/* OAIT Design System 2.1.0 · reference/css/card.css
   Cards and icon tiles (unit c-containers).

   Components
   - Card (.oa-card): outlined (the default), filled, elevated, tonal (four pastels), dashed placeholder,
     floating form card; header, title, body, meta, footer, and raised actions; the clickable card.
   - Icon tile (.oa-tile): five sizes, four pastel hues, five status tones, square or round.

   Implements canonical §10.10, §2.5, §2.11, §5.2, §5.3, §6.1, §6.2, §7.2, §8.2 and D-CSN-01, D-CSN-02,
   D-CSN-03, D-CSN-04, D-CSN-05, D-CSN-06, D-ARC-09, D-ARC-14, D-ARC-15, D-ARC-16, D-ARC-23, D-ARC-25,
   D-ARC-26, D-COL-17, D-SEM-10, D-SEM-15, D-BCP-33.

   Tokens read: --color-card-outlined-container, --color-card-elevated-container,
   --color-surface-container-low, --color-surface-container-high, --color-outline-variant,
   --color-outline, --color-on-surface, --color-on-surface-variant, --color-pastel-peach,
   --color-pastel-lavender, --color-pastel-mint, --color-pastel-sand and their --color-on-pastel-*,
   --color-success-container, --color-warning-container, --color-info-container,
   --color-error-container and their --color-on-*-container; --radius-card, --radius-sheet,
   --radius-box, --radius-12px, --radius-24px, --radius-full; --shadow-elevation-1,
   --shadow-elevation-3; --space-card, --space-card-medium, --space-stack, --space-stack-tight,
   --space-stack-loose, --space-2, --space-4, --space-5, --space-10; --container-form;
   --size-tile-sm, -md, -lg, -xl, -2xl; --size-icon-md, -lg, -xl, -2xl, -3xl; --z-raised, --z-behind;
   --opacity-state-pressed; --duration-short-3; --ease-standard; --text-title-md, --text-body-lg,
   --text-body-md with their --line-height, --letter-spacing, and --font-weight companions.
   Context property read: --oa-state (the state-layer opacity; documentation pages force it inline).
   Component-local properties: --oa-card-gap, --oa-tile-size, --oa-tile-icon.

   Classes: .oa-card (+ --outlined, --filled, --elevated, --tonal, --peach, --lavender, --mint, --sand,
   --dashed, --floating; __header, __heading, __title, __body, __meta, __footer, __actions),
   .oa-tile (+ --sm, --md (the default), --lg, --xl, --2xl; --round; --peach, --lavender, --mint, --sand,
   --success, --warning, --info, --error; the neutral tone is the default).

   Relies on link.css for .oa-title-link--stretched: its ::after covers the card (the card is the
   positioned box) and carries the focus ring with --radius-card. Relies on base.css for .oa-icon.
   Breakpoint is literal: sm 40rem (640px). */


/* ---------------------------------------------------------------------------------------------
   1. Card. One 24px shape for every variant. The outlined card is the default: card-outlined-
   container (white, the page color in dark) with a 1px outline-variant hairline. Padding 20px,
   24px from 640px; blocks 16px apart, a title and its body 8px apart (D-CSN-01, D-CSN-02, D-CSN-03,
   D-ARC-09, D-ARC-25). Every variant keeps a 1px border, transparent when no line shows, so forced
   colors draw its edge (D-SEM-10). The card is the positioned, isolated box of its state layer and
   of a stretched title link.
   --------------------------------------------------------------------------------------------- */

.oa-card {
  --oa-card-gap: var(--space-stack);
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: var(--oa-card-gap);
  box-sizing: border-box;
  min-inline-size: 0;
  margin: 0;
  padding: var(--space-card);
  border: 1px solid var(--color-outline-variant);
  border-radius: var(--radius-card);
  background-color: var(--color-card-outlined-container);
  color: var(--color-on-surface);
  transition:
    box-shadow var(--duration-short-3) var(--ease-standard),
    border-color var(--duration-short-3) var(--ease-standard);
}

/* The state layer: under the content (z-index -1 inside the isolated card), over the 1px edge as
   well (the border box), so pressed shows no lighter rim. A card shows only the pressed layer;
   hover is the elevation-3 shadow and the outline edge (canonical §7.2). */
.oa-card::before {
  content: "";
  position: absolute;
  inset: -1px; /* over the 1px edge as well */
  z-index: var(--z-behind);
  border-radius: inherit;
  background-color: currentColor;
  opacity: var(--oa-state, 0);
  pointer-events: none;
  transition: opacity var(--duration-short-3) var(--ease-standard);
}

@media (min-width: 40rem) {
  .oa-card {
    padding: var(--space-card-medium);
  }
}


/* Variants (D-CSN-01, D-CSN-06, D-ARC-09, D-ARC-15, D-COL-17). */

.oa-card--outlined {
  border-color: var(--color-outline-variant);
  background-color: var(--color-card-outlined-container);
}

/* Grouping inside a white surface, quiet tile grids. Never on a filled panel. */
.oa-card--filled {
  border-color: transparent;
  background-color: var(--color-surface-container-low);
}

/* The one focal card of a view. */
.oa-card--elevated {
  border-color: transparent;
  background-color: var(--color-card-elevated-container);
  box-shadow: var(--shadow-elevation-1);
}

/* Action and category tiles on a pastel; --tonal alone is peach, the first hue of the cycle
   peach → lavender → mint → sand. Text on it is the pastel's on-color (canonical §2.11). */
.oa-card--tonal,
.oa-card--peach {
  border-color: transparent;
  background-color: var(--color-pastel-peach);
  color: var(--color-on-pastel-peach);
}

.oa-card--lavender {
  border-color: transparent;
  background-color: var(--color-pastel-lavender);
  color: var(--color-on-pastel-lavender);
}

.oa-card--mint {
  border-color: transparent;
  background-color: var(--color-pastel-mint);
  color: var(--color-on-pastel-mint);
}

.oa-card--sand {
  border-color: transparent;
  background-color: var(--color-pastel-sand);
  color: var(--color-on-pastel-sand);
}

/* Something that is not there yet: coming soon, nothing found. The words carry the meaning; the
   dashes are a second cue (D-CSN-06). */
.oa-card--dashed {
  border-style: dashed;
  border-color: var(--color-outline-variant);
  background-color: transparent;
}

/* Floating form card (sign-in, register, contact): the sheet radius on the elevated container with
   elevation-1, 460px at most, padded 40px 20px and 40px from 640px, blocks 24px apart (D-ARC-15, C-8). */
.oa-card--floating {
  --oa-card-gap: var(--space-stack-loose);
  inline-size: 100%;
  max-inline-size: var(--container-form);
  padding: var(--space-10) var(--space-5);
  border-color: transparent;
  border-radius: var(--radius-sheet);
  background-color: var(--color-card-elevated-container);
  box-shadow: var(--shadow-elevation-1);
}

@media (min-width: 40rem) {
  .oa-card--floating {
    padding: var(--space-10);
  }
}


/* ---------------------------------------------------------------------------------------------
   2. Clickable card. One link, the title (.oa-title-link--stretched), whose ::after covers the
   card. While a mouse hovers that link the card takes elevation-3 and the outline edge over
   short-3; while it is pressed the 12% layer of the content color shows at once. The card never
   moves, lifts, or scales; the ring is the link's, drawn on its ::after with the card's corners
   (D-CSN-04, D-ARC-16, D-SEM-15). Controls other than the title sit in .oa-card__actions, above
   the link.
   --------------------------------------------------------------------------------------------- */

@media (hover: hover) {
  .oa-card:has(.oa-title-link--stretched:hover) {
    border-color: var(--color-outline);
    box-shadow: var(--shadow-elevation-3);
  }
}

.oa-card:has(.oa-title-link--stretched:active) {
  --oa-state: var(--opacity-state-pressed);
}

.oa-card:has(.oa-title-link--stretched:active)::before {
  transition-duration: 0ms; /* lint-ok: a press shows at once; only hover and release fade (canonical §2.7, §7.2) */
}


/* ---------------------------------------------------------------------------------------------
   3. Parts. Title title-md in the card's text color; body body-lg and meta body-md in
   on-surface-variant. A title (or a header) and the body or meta right after it sit 8px apart;
   every other block keeps the card's gap. The footer follows a hairline and stays at the bottom of
   a card stretched by its grid row (D-CSN-03, D-ARC-20, D-ARC-25).
   --------------------------------------------------------------------------------------------- */

/* A row: an avatar or tile, the heading, the raised actions at the inline end. */
.oa-card__header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  min-inline-size: 0;
}

/* The text group of a header: the title and its meta, 8px apart. */
.oa-card__heading {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: var(--space-stack-tight);
  min-inline-size: 0;
}

.oa-card__title {
  margin: 0;
  font-size: var(--text-title-md);
  line-height: var(--text-title-md--line-height);
  letter-spacing: var(--text-title-md--letter-spacing);
  font-weight: var(--text-title-md--font-weight);
  overflow-wrap: break-word;
  text-wrap: balance;
}

.oa-card__body {
  margin: 0;
  color: var(--color-on-surface-variant);
  font-size: var(--text-body-lg);
  line-height: var(--text-body-lg--line-height);
  letter-spacing: var(--text-body-lg--letter-spacing);
  font-weight: var(--text-body-lg--font-weight);
  text-wrap: pretty;
}

.oa-card__meta {
  margin: 0;
  color: var(--color-on-surface-variant);
  font-size: var(--text-body-md);
  line-height: var(--text-body-md--line-height);
  letter-spacing: var(--text-body-md--letter-spacing);
  font-weight: var(--text-body-md--font-weight);
  overflow-wrap: anywhere;
}

/* Title (or header) then body or meta, as children of the card: 8px, whatever the card's gap.
   Inside .oa-card__heading the heading's own 8px gap applies. */
.oa-card > :is(.oa-card__title, .oa-card__header) + :is(.oa-card__body, .oa-card__meta) {
  margin-block-start: calc(var(--space-stack-tight) - var(--oa-card-gap));
}

.oa-card__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  margin-block-start: auto;
  padding-block-start: var(--space-stack);
  border-block-start: 1px solid var(--color-outline-variant);
  color: var(--color-on-surface-variant);
  font-size: var(--text-body-md);
  line-height: var(--text-body-md--line-height);
  letter-spacing: var(--text-body-md--letter-spacing);
  font-weight: var(--text-body-md--font-weight);
}

/* Controls on a card (save, more, a button row): above a stretched title link (z-raised). */
.oa-card__actions {
  position: relative;
  z-index: var(--z-raised);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.oa-card__header > .oa-card__actions {
  flex-wrap: nowrap;
  margin-inline-start: auto;
}


/* ---------------------------------------------------------------------------------------------
   4. Icon tile. A square (or a disc with --round) about a third rounded: 40px at 12px, 48 and 56px
   at 16px (box), 64 and 80px at 24px. Each holds an icon about half its size: 20, 24, 28, 32, and
   40px; icons inside tonal tiles take FILL 1 (.oa-icon--filled). Neutral by default; pastel hues for
   decoration (feature cards cycle peach → lavender → mint → sand); status tones for activity discs,
   always beside words (canonical §4.7, §5.3, §8.2; D-CSN-05, D-ARC-23, D-COL-17). Tiles are
   decorative: aria-hidden, the words beside them carry the meaning.
   --------------------------------------------------------------------------------------------- */

.oa-tile {
  --oa-tile-size: var(--size-tile-md);
  --oa-tile-icon: var(--size-icon-lg);
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  inline-size: var(--oa-tile-size);
  block-size: var(--oa-tile-size);
  border-radius: var(--radius-box);
  background-color: var(--color-surface-container-high);
  color: var(--color-on-surface-variant);
}

.oa-tile > .oa-icon {
  font-size: var(--oa-tile-icon);
}

/* md is the default; --md states it. */
.oa-tile--md {
  --oa-tile-size: var(--size-tile-md);
  --oa-tile-icon: var(--size-icon-lg);
}

.oa-tile--sm {
  --oa-tile-size: var(--size-tile-sm);
  --oa-tile-icon: var(--size-icon-md);
  border-radius: var(--radius-12px);
}

.oa-tile--lg {
  --oa-tile-size: var(--size-tile-lg);
  --oa-tile-icon: var(--size-icon-xl);
}

.oa-tile--xl {
  --oa-tile-size: var(--size-tile-xl);
  --oa-tile-icon: var(--size-icon-2xl);
  border-radius: var(--radius-24px);
}

.oa-tile--2xl {
  --oa-tile-size: var(--size-tile-2xl);
  --oa-tile-icon: var(--size-icon-3xl);
  border-radius: var(--radius-24px);
}

.oa-tile--round {
  border-radius: var(--radius-full);
}

/* Pastel hues (decoration). */
.oa-tile--peach {
  background-color: var(--color-pastel-peach);
  color: var(--color-on-pastel-peach);
}

.oa-tile--lavender {
  background-color: var(--color-pastel-lavender);
  color: var(--color-on-pastel-lavender);
}

.oa-tile--mint {
  background-color: var(--color-pastel-mint);
  color: var(--color-on-pastel-mint);
}

.oa-tile--sand {
  background-color: var(--color-pastel-sand);
  color: var(--color-on-pastel-sand);
}

/* Status tones (activity discs in list rows, beside the words that say what happened). */
.oa-tile--success {
  background-color: var(--color-success-container);
  color: var(--color-on-success-container);
}

.oa-tile--warning {
  background-color: var(--color-warning-container);
  color: var(--color-on-warning-container);
}

.oa-tile--info {
  background-color: var(--color-info-container);
  color: var(--color-on-info-container);
}

.oa-tile--error {
  background-color: var(--color-error-container);
  color: var(--color-on-error-container);
}
