/* Card variants. One source for the site and for tells.blowhorn.ai, which
   <link>s the unminified copy at /assets/brand/cards.css. Structure (padding,
   radius, grid gaps) stays on .card in site.css; these classes only set the
   look. Pick the variant by what the content is, and never give two
   neighbours in a row or a column the same variant (DESIGN.md, "Cards").

   Every colour is a brand token with a fallback, so the file also works where
   a token is missing. Each variant sets the --card-* properties; the shared
   rules below read them. No variant draws a stripe on one edge. Every variant
   keeps the same box (a 1px border, or none): a thicker edge is drawn inside
   it, so the content box, and where a label wraps, never depends on the
   variant. --card-chip is the fill of a card link's round arrow chip
   (site.css); it defaults to --surface-tint, and a variant whose own fill is
   that tint sets it to something that stands off the card. */

/* A .card or docs card with no variant class gets the field look, so nothing
   ships unstyled. On the site every card is dealt a variant (card-deal.html,
   docs-content.html); this is the safety net, not a style to choose. Every
   variant below overrides these: zero specificity, so a.docs-card never outranks
   a variant class. */
:where(.card, a.docs-card) {
  --card-bg: var(--surface-tint, #DDF4F1);
  --card-ink: var(--ink, #1E2117);
  --card-muted: var(--ink-muted, #5B6A70);
  --card-border-color: transparent;
}

/* Shared look. Each property reads the --card-* set by the variant. The site
   header is the same recipe with its own variables (see "Glass" below). */
.card,
a.docs-card,
.card-paper,
.card-dispatch,
.card-stamp,
.card-field,
.card-plain,
.card-glass,
.glass,
.site-header {
  background: var(--card-bg);
  color: var(--card-ink);
  border: var(--card-border-width, 1px) var(--card-border-style, solid) var(--card-border-color, transparent);
  box-shadow: var(--card-shadow, none);
  -webkit-backdrop-filter: var(--card-blur, none);
  backdrop-filter: var(--card-blur, none);
}
/* Text inside a card, at zero specificity: a default, never an override. A
   component that colours its own text (a badge, a status pill) keeps it, and
   Paper and Dispatch reach those rules through the tokens they set below. */
:where(.card, a.docs-card, .card-paper, .card-dispatch, .card-stamp, .card-field, .card-plain, .card-glass) :where(h2, h3, h4, .h2, .h3, .h4) {
  color: var(--card-ink);
}
:where(.card, a.docs-card, .card-paper, .card-dispatch, .card-stamp, .card-field, .card-plain, .card-glass) :where(p, ul, li) {
  color: var(--card-muted);
}
:where(.card, a.docs-card, .card-paper, .card-dispatch, .card-stamp, .card-field, .card-plain, .card-glass) :where(code) {
  color: var(--card-ink);
  background: color-mix(in srgb, var(--card-ink) 10%, transparent);
}

/* 1. Paper: "Field order". Cream paper, near-black ink and a 1.5px outline, with
   no shadow (a hard offset is banned: DESIGN.md, Cards rule 1). Keeps its colours in dark mode, like the paper speech
   bubble. For Major's voice, testimonials and the one featured item in a section. */
.card-paper {
  --card-bg: var(--cream, #FFF6E0);
  --card-ink: var(--near-black, #1E2117);
  --card-muted: var(--charcoal, #3C494F);
  --card-border-width: 1.5px;
  --card-border-color: var(--near-black, #1E2117);
  --card-shadow: none;
  --card-hover-border: var(--near-black, #1E2117);
  --card-hover-shadow: none;
}

/* 2. Dispatch: a terminal teletype. Near-black fill in both themes, light ink, a
   dashed teal border that goes solid on hover, and a mono label with a drawn ">"
   prompt. For developer notes, API and JSON facts, commands. */
.card-dispatch {
  --card-bg: var(--near-black, #1E2117);
  --card-ink: var(--cream, #FFF6E0);
  --card-muted: var(--mint, #A6EBDF);
  --card-border-width: 1px;
  --card-border-style: dashed;
  --card-border-color: var(--teal-shade, #008F80);
  --card-hover-border: var(--teal-shade, #008F80);
  --card-hover-shadow: none;
}
.card-dispatch .label {
  font-family: var(--font-mono, var(--mono, ui-monospace, monospace));
  color: var(--teal-bright, #00D3A9);
}
.card-dispatch .label::before {
  content: ">" / "";
  margin-right: 0.5em;
}

/* Paper and Dispatch keep their colours in both themes, so each also sets the
   page's theme tokens for its own subtree: a component rule that reads --ink,
   --ink-muted, --link, --line, --surface or a --glass-* token inside one of
   them (text, a code chip, a secondary button, a form field) gets the card's palette,
   not the page's, and stays legible (paper is the light palette, dispatch the
   dark one). The focus ring changes only inside the card: the card's own ring
   is drawn on the page, so it keeps the page's colour. */
.card-paper {
  --ink: var(--near-black, #1E2117);
  --ink-muted: var(--charcoal, #3C494F);
  --ink-wordmark: var(--charcoal, #3C494F);
  --link: var(--teal-deep, #00756A);
  --link-hover: var(--near-black, #1E2117);
  --line: #D5DEDD;
  --surface-tint: #DDF4F1;
  --surface: #FFFFFF;
  --surface-raised: #F4F7F6;
  --glass-fill: rgba(255, 255, 255, 0.58);
  --glass-fill-strong: rgba(255, 255, 255, 0.72);
  --glass-fill-solid: #FBFDFC;
  --glass-field: rgba(255, 255, 255, 0.78);
  --glass-sheen: rgba(255, 255, 255, 0.55);
  --glass-specular: rgba(255, 255, 255, 0.95);
  --glass-rim: rgba(255, 255, 255, 0.65);
  --glass-edge: rgba(30, 33, 23, 0.08);
}
.card-paper * { --focus-ring: var(--teal-deep, #00756A); }
.card-dispatch {
  --ink: var(--cream, #FFF6E0);
  --ink-muted: var(--mint, #A6EBDF);
  --ink-wordmark: var(--cream, #FFF6E0);
  --link: var(--teal-bright, #00D3A9);
  --link-hover: var(--mint, #A6EBDF);
  --line: #3C494F;
  --surface-tint: #173A34;
  --surface: #1E2117;
  --surface-raised: #2A2E25;
  --glass-fill: rgba(42, 46, 37, 0.52);
  --glass-fill-strong: rgba(30, 33, 23, 0.68);
  --glass-fill-solid: #262A21;
  --glass-field: rgba(30, 33, 23, 0.60);
  --glass-sheen: rgba(255, 255, 255, 0.06);
  --glass-specular: rgba(255, 255, 255, 0.14);
  --glass-rim: rgba(255, 255, 255, 0.08);
  --glass-edge: rgba(0, 0, 0, 0.35);
}
.card-dispatch * { --focus-ring: var(--teal-bright, #00D3A9); }

/* 3. Stamp: no fill, a 2px ink edge, a small radius, and a label boxed in mono
   caps like a rubber stamp. For facts, stats, guarantees, proof, compliance.
   The edge is the 1px border plus a 1px inset ring, so the box matches the
   other variants. */
.card-stamp {
  --card-bg: transparent;
  --card-ink: var(--ink, #1E2117);
  --card-muted: var(--ink-muted, #5B6A70);
  --card-border-width: 1px;
  --card-border-color: var(--ink, #1E2117);
  --card-shadow: inset 0 0 0 1px var(--ink, #1E2117);
  --card-hover-border: var(--ink, #1E2117);
  --card-hover-shadow: var(--card-shadow);
  border-radius: var(--radius-sm, 6px);
}
.card-stamp .label {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  padding: 2px 8px;
  border: 1px solid var(--ink, #1E2117);
  border-radius: 2px;
  color: var(--ink, #1E2117);
}

/* 4. Field: a flat tint, no border, no shadow, no gradient. The common case, for
   feature and explanation grids. The hover border is the only edge it draws.
   The fill is the tint a link's arrow chip uses, so the chip takes --surface. */
.card-field {
  --card-bg: var(--surface-tint, #DDF4F1);
  --card-chip: var(--surface, #FFFFFF);
  --card-ink: var(--ink, #1E2117);
  --card-muted: var(--ink-muted, #5B6A70);
  --card-border-color: transparent;
  --card-hover-border: var(--line-strong, #7A878C);
  --card-hover-shadow: none;
}

/* 5. Plain: no fill, one even 1px hairline on all sides. For secondary lists and
   link lists. The hairline is --line-strong: --line is under the 3:1 contrast WCAG
   asks of a UI boundary. */
.card-plain {
  --card-bg: transparent;
  --card-ink: var(--ink, #1E2117);
  --card-muted: var(--ink-muted, #5B6A70);
  --card-border-color: var(--line-strong, #7A878C);
  --card-hover-border: var(--ink, #1E2117);
  --card-hover-shadow: none;
}

/* 6. Glass: the liquid glass recipe, one definition for every glass surface.
   Reserved for one floating surface over content (a menu, a hero panel, the
   cookie notice, the header): the .glass panel class and the .card-glass variant
   share it, and it is never a card in a grid. The site header is the same recipe
   with a stronger fill, a tighter blur and no outer edge. */
.card-glass,
.glass {
  --card-bg:
    linear-gradient(180deg, var(--glass-sheen, rgba(255, 255, 255, 0.55)), transparent 46%),
    var(--glass-fill, rgba(255, 255, 255, 0.58));
  --card-ink: var(--ink, #1E2117);
  --card-muted: var(--ink-muted, #5B6A70);
  --card-border-color: transparent;
  --card-shadow:
    inset 0 1px 0 0 var(--glass-specular, rgba(255, 255, 255, 0.95)),
    inset 0 0 0 1px var(--glass-rim, rgba(255, 255, 255, 0.65)),
    0 0 0 1px var(--glass-edge, rgba(30, 33, 23, 0.08)),
    var(--glass-shadow, 0 12px 32px -12px rgba(30, 33, 23, 0.18));
  --card-blur: blur(var(--glass-blur, 20px)) saturate(var(--glass-saturate, 170%));
  --card-hover-border: var(--glass-specular, rgba(255, 255, 255, 0.95));
  --card-hover-shadow: var(--card-shadow);
}
.site-header {
  --card-bg: var(--glass-fill-strong, rgba(255, 255, 255, 0.72));
  --card-border-width: 0px;
  --card-blur: blur(24px) saturate(180%);
  --card-shadow:
    inset 0 -1px 0 0 var(--glass-edge, rgba(30, 33, 23, 0.08)),
    0 1px 0 0 var(--glass-rim, rgba(255, 255, 255, 0.65)),
    0 8px 24px -18px rgba(30, 33, 23, 0.35);
}
/* Glass drops its blur where the page asks for less transparency or more contrast. */
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .card-glass,
  .glass,
  .site-header { --card-blur: none; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card-glass,
  .glass,
  .site-header { --card-blur: none; }
}

/* Whole-card links, any variant: a 2px lift and a stronger border, no glow. The
   selector is every anchor that carries a variant class (a.card-link, a.mm-card,
   a.resource-type-card, a.agent-tile, a.docs-card, ...), so the lift never depends
   on which component the card lives in. The lift and transition are off under
   reduced motion. */
a:is(.card-paper, .card-dispatch, .card-stamp, .card-field, .card-plain, .card-glass),
a.docs-card {
  text-decoration: none;
}
a:is(.card-paper, .card-dispatch, .card-stamp, .card-field, .card-plain, .card-glass, .docs-card):is(:hover, :focus-visible) {
  transform: translateY(-2px);
  border-color: var(--card-hover-border, var(--card-border-color, transparent));
  box-shadow: var(--card-hover-shadow, none);
}
a.card-dispatch:is(:hover, :focus-visible) {
  border-style: solid;
}
@media (prefers-reduced-motion: no-preference) {
  a:is(.card-paper, .card-dispatch, .card-stamp, .card-field, .card-plain, .card-glass, .docs-card) {
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  }
}
@media (prefers-reduced-motion: reduce) {
  a:is(.card-paper, .card-dispatch, .card-stamp, .card-field, .card-plain, .card-glass, .docs-card):is(:hover, :focus-visible) {
    transform: none;
  }
}

/* More contrast: no translucency, every edge a solid ink line. */
@media (prefers-contrast: more) {
  .card-field,
  .card-plain,
  .card-glass,
  .glass {
    --card-bg: var(--surface, #FFFFFF);
    --card-border-color: var(--ink, #1E2117);
    --card-blur: none;
  }
  .card-field { --card-chip: var(--surface-tint, #DDF4F1); }
  .card-glass,
  .glass { --card-shadow: 0 0 0 1px var(--ink, #1E2117); }
}

/* Forced colours: fills and shadows are dropped, so every edge is a system colour
   that stays visible. */
@media (forced-colors: active) {
  .card,
  a.docs-card,
  .card-paper,
  .card-dispatch,
  .card-stamp,
  .card-field,
  .card-plain,
  .card-glass,
  .glass,
  .site-header {
    background: Canvas;
    color: CanvasText;
    border-color: CanvasText;
    box-shadow: none;
  }
  .card-stamp { border-width: 2px; }
  .card-dispatch .label,
  .card-stamp .label { color: CanvasText; }
}

/* Print: a white box with a hairline, no shadow and no translucency. */
@media print {
  .glass,
  .card,
  a.docs-card,
  .card-paper,
  .card-dispatch,
  .card-stamp,
  .card-field,
  .card-plain,
  .card-glass {
    background: #FFFFFF;
    color: #000000;
    border: 1px solid #000000;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
