/* ---- tokens.css ---- */
/* ==========================================================================
   tokens.css: every colour, size, space, radius and duration lives here.
   Direction: DESIGN.md (a pharmacy-aisle shelf label). After any colour change run
   `python3 tools/contrast.py`; the build runs it too and fails on a pair below WCAG 2.2 AA.
   Phase 2 and 3 builders: add tokens in your own CSS file under a :root block in
   @layer tokens, never edit this file (HANDOFF.md).
   ========================================================================== */

@layer reset, tokens, base, layout, components, utilities;

@layer tokens {
  :root {
    color-scheme: light dark;

    /* ---- Surfaces --------------------------------------------------------- light | dark */
    --paper:   light-dark(oklch(0.975 0.005 250), oklch(0.20 0.025 260));  /* page */
    --surface: light-dark(oklch(1 0 0),           oklch(0.25 0.028 260));  /* fields, raised panels */
    --band:    light-dark(oklch(0.952 0.009 250), oklch(0.23 0.026 260));  /* alternate sections */
    --line:    light-dark(oklch(0.87 0.014 250),  oklch(0.37 0.03 260));   /* hairlines, decorative */
    --label:   light-dark(oklch(0.955 0.06 95),   oklch(0.31 0.045 90));   /* the shelf-edge label */

    /* ---- Text ------------------------------------------------------------------ */
    --ink:     light-dark(oklch(0.25 0.035 260),  oklch(0.94 0.01 250));
    --muted:   light-dark(oklch(0.43 0.03 260),   oklch(0.80 0.02 250));

    /* ---- The one accent: familiar link blue. Text and fill split so both pass -- */
    --accent:      light-dark(oklch(0.47 0.17 262), oklch(0.80 0.10 255));
    --accent-fill: light-dark(oklch(0.47 0.17 262), oklch(0.80 0.10 255));
    --on-accent:   light-dark(oklch(0.99 0.003 250), oklch(0.20 0.025 260));
    --accent-hover: oklch(from var(--accent-fill) calc(l - 0.06) c h);
    --accent-tint:  color-mix(in oklch, var(--accent) 10%, var(--paper));

    /* ---- Answers: always shown with a word, never colour alone ---------------- */
    --yes:  light-dark(oklch(0.45 0.11 150), oklch(0.82 0.12 150));
    --hard: light-dark(oklch(0.47 0.10 65),  oklch(0.84 0.11 80));
    --no:   light-dark(oklch(0.50 0.18 27),  oklch(0.80 0.10 27));

    /* ---- UI states ------------------------------------------------------------- */
    --field-line: light-dark(oklch(0.55 0.025 260), oklch(0.64 0.025 250));
    --focus:      light-dark(oklch(0.42 0.17 262),  oklch(0.84 0.07 250));
    --danger:     light-dark(oklch(0.50 0.18 27),   oklch(0.80 0.10 27));
    --success:    light-dark(oklch(0.45 0.11 150),  oklch(0.82 0.12 150));

    --tbc-bg:  light-dark(oklch(0.95 0.06 95),  oklch(0.32 0.05 95));
    --tbc-ink: light-dark(oklch(0.30 0.05 80),  oklch(0.94 0.03 95));

    /* ---- Type: Atkinson Hyperlegible Next. Body 20 -> 22px, floor 18px --------- */
    --font-body: "Atkinson Hyperlegible Next", "Atkinson Fallback", system-ui, sans-serif;
    --font-display: var(--font-body);

    --step--1: 1.125rem;                                          /* 18px floor */
    --step-0: clamp(1.25rem, 1.201rem + 0.2174vw, 1.375rem);      /* 20 -> 22 */
    --step-1: clamp(1.45rem, 1.37rem + 0.36vw, 1.65rem);          /* 23 -> 26 */
    --step-2: clamp(1.7rem, 1.57rem + 0.58vw, 2.05rem);           /* 27 -> 33 */
    --step-3: clamp(2rem, 1.8rem + 0.87vw, 2.5rem);               /* 32 -> 40 */
    --step-4: clamp(2.35rem, 2.05rem + 1.3vw, 3.1rem);            /* 38 -> 50 */
    --step-5: clamp(2.8rem, 2.4rem + 1.77vw, 3.9rem);             /* 45 -> 62 */

    --weight-body: 450;
    --weight-strong: 700;
    --weight-heading: 720;
    --leading-body: 1.55;
    --leading-heading: 1.15;
    --leading-display: 1.05;
    --measure: 40rem;

    /* ---- Space ----------------------------------------------------------------- */
    --space-3xs: clamp(0.25rem, 0.2255rem + 0.1087vw, 0.3125rem);
    --space-2xs: clamp(0.5rem, 0.4511rem + 0.2174vw, 0.625rem);
    --space-xs: clamp(0.75rem, 0.6766rem + 0.3261vw, 0.9375rem);
    --space-s: clamp(1rem, 0.9022rem + 0.4348vw, 1.25rem);
    --space-m: clamp(1.5rem, 1.353rem + 0.6522vw, 1.875rem);
    --space-l: clamp(2rem, 1.804rem + 0.8696vw, 2.5rem);
    --space-xl: clamp(3rem, 2.707rem + 1.304vw, 3.75rem);
    --space-2xl: clamp(4rem, 3.609rem + 1.739vw, 5rem);
    --space-3xl: clamp(6rem, 5.413rem + 2.609vw, 7.5rem);

    --gutter: var(--space-s);
    --content-max: 68rem;

    /* ---- Shape: squared plates, never capsules ---------------------------------- */
    --radius-s: 0.25rem;
    --radius-m: 0.625rem;
    --border: 1px;
    --focus-width: 3px;
    --tap: 3.5rem;           /* 56px buttons; 48px is the floor */

    --duration-fast: 120ms;
    --duration-base: 200ms;
    --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  }
}

/* ---- fonts.css ---- */
/* ==========================================================================
   fonts.css: self-hosted WOFF2 (CSP stays font-src 'self').

   Atkinson Hyperlegible Next, variable weight 200 to 800, Latin subset, SIL OFL 1.1
   (assets/fonts/OFL.txt), from @fontsource-variable/atkinson-hyperlegible-next 5.3.0.
   Chosen because it was drawn for low-vision readers by the Braille Institute: the
   letter and digit shapes stay distinct, which matters when people read barcodes.

   The fallback is Arial, lightly scaled. No metric overrides were computed (no fontTools
   in this repo); the swap moves text slightly. Files under /assets/fonts/ are immutable
   for a year: a changed font must get a new filename.
   ========================================================================== */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/assets/fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Atkinson Fallback";
  src: local("Arial"), local("ArialMT"), local("Liberation Sans"), local("Helvetica");
  size-adjust: 104%;
}

/* ---- base.css ---- */
/* ==========================================================================
   base.css: a modern reset, element defaults, focus rings and motion rules.
   Element selectors only (plus a few utilities). Components live in components.css.
   ========================================================================== */

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }

  * { margin: 0; }

  html {
    /* No px root size: the user's chosen default text size must still apply. */
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
    hanging-punctuation: first last;
    scroll-padding-block-start: var(--space-l);
  }

  body { min-block-size: 100svh; }

  img, picture, svg, video, canvas { display: block; max-inline-size: 100%; block-size: auto; }

  input, button, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }

  button { cursor: pointer; }

  p, li, h1, h2, h3, h4, dd { overflow-wrap: break-word; }

  ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

  textarea:not([rows]) { min-block-size: 8em; }

  [hidden] { display: none !important; }
}

@layer base {
  body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: var(--step-0);
    font-weight: var(--weight-body);
    line-height: var(--leading-body);
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
  }

  h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: var(--weight-heading);
    line-height: var(--leading-heading);
    text-wrap: balance;
  }

  h1 { font-size: var(--step-4); line-height: var(--leading-display); letter-spacing: -0.01em; }
  h2 { font-size: var(--step-3); }
  h3 { font-size: var(--step-1); }
  h4 { font-size: var(--step-0); }

  p, li, dd { text-wrap: pretty; }

  strong, b { font-weight: var(--weight-strong); }

  small { font-size: var(--step--1); font-weight: 500; }

  a {
    color: var(--accent);
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.18em;
  }

  a:hover { text-decoration-thickness: 0.14em; }

  hr { border: 0; border-block-start: var(--border) solid var(--line); }

  address { font-style: normal; }

  ::selection { background: var(--accent-tint); color: var(--ink); }

  /* Focus: always visible for keyboard users, never removed without a replacement.
     The ring sits outside the element so it shows on every surface and on the
     primary button, whose fill is a different colour. */
  :focus-visible {
    outline: var(--focus-width) solid var(--focus);
    outline-offset: 2px;
    border-radius: var(--radius-s);
  }

  /* Programmatic focus targets (main, error summary) do not need a ring. */
  [tabindex="-1"]:focus:not(:focus-visible) { outline: none; }

  /* Cross-document view transitions: a quiet fade between pages where supported.
     Not Baseline (no Firefox); harmless where missing. */
  @media (prefers-reduced-motion: no-preference) {
    @view-transition { navigation: auto; }
  }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
  }

  @media (forced-colors: active) {
    :focus-visible { outline-color: Highlight; }
  }
}

@layer utilities {
  /* Visible to screen readers, hidden on screen. */
  .visually-hidden:not(:focus, :active) {
    clip-path: inset(50%);
    block-size: 1px;
    inline-size: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
  }

  /* [TBC: ...] markers in previews. build.py wraps body-text markers in .tbc. */
  .tbc {
    background: var(--tbc-bg);
    color: var(--tbc-ink);
    outline: 1px dashed currentColor;
    outline-offset: 1px;
    border-radius: var(--radius-s);
    padding-inline: 0.15em;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
  }
  /* Tight display leading clips the marker's background; loosen it only while a marker is there. */
  :is(h1, h2, h3):has(.tbc) { line-height: 1.3; }
}

/* ---- layout.css ---- */
/* ==========================================================================
   layout.css: layout primitives (Every Layout's names). They respond to the space
   they have, so most media queries are unnecessary and components work in a narrow
   column and a wide one alike. The parent owns spacing with `gap`; children carry
   no outer margins. Logical properties throughout.

   Rule from experience: keep vertical section spacing (.region) and the centred
   container (.wrapper) on different elements, and override only padding-inline on
   the container. A `padding` shorthand on the container in a media query wipes the
   section spacing on phones.
   ========================================================================== */

@layer layout {
  /* Centred column with the page gutter. */
  .wrapper {
    inline-size: 100%;
    max-inline-size: var(--content-max);
    margin-inline: auto;
    padding-inline: var(--gutter);
  }

  .wrapper.narrow { max-inline-size: calc(var(--measure) + 2 * var(--gutter)); }

  /* Vertical rhythm between page sections. */
  .region { padding-block: var(--region-space, var(--space-2xl)); }
  .region.tight { --region-space: var(--space-xl); }
  .region.band { background: var(--band); }

  /* Stack: vertical flow with one gap. Set --gap to change it. */
  .stack {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: var(--gap, var(--space-s));
  }
  .stack.gap-xs { --gap: var(--space-xs); }
  .stack.gap-m  { --gap: var(--space-m); }
  .stack.gap-l  { --gap: var(--space-l); }
  .stack.gap-xl { --gap: var(--space-xl); }

  /* Cluster: a wrapping row of buttons, links or meta. */
  .cluster {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--gap, var(--space-s));
  }

  /* Sidebar: a fixed-ish side next to a fluid main; stacks when main would get
     narrower than --main-min. The side is the first child unless .sidebar.end. */
  .sidebar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap, var(--space-xl));
  }
  .sidebar > * { min-inline-size: 0; }
  .sidebar > :first-child { flex-basis: var(--side-width, 18rem); flex-grow: 1; }
  .sidebar > :last-child { flex-basis: 0; flex-grow: 999; min-inline-size: var(--main-min, 55%); }
  .sidebar.end > :first-child { flex-basis: 0; flex-grow: 999; min-inline-size: var(--main-min, 55%); }
  .sidebar.end > :last-child { flex-basis: var(--side-width, 18rem); flex-grow: 1; min-inline-size: 0; }

  /* Switcher: items side by side above --threshold, all stacked below it, never 2+1.
     Keep it to four children or fewer. */
  .switcher {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap, var(--space-l));
  }
  .switcher > * {
    flex-grow: 1;
    flex-basis: calc((var(--threshold, 40rem) - 100%) * 999);
    min-inline-size: 0;
  }

  /* Grid: as many columns as fit, each at least --min wide. min(100%, ...) stops a
     single column overflowing a 320px phone. auto-fill keeps a lone card card-sized. */
  .grid {
    display: grid;
    gap: var(--gap, var(--space-m));
    grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--min, 17rem)), 1fr));
  }
  .grid > * { min-inline-size: 0; }

  /* Prose: readable measure for running text. */
  .prose { max-inline-size: var(--measure); }
  .prose > * + * { margin-block-start: var(--space-s); }
  .prose > * + :is(h2, h3) { margin-block-start: var(--space-l); }
  .prose ul, .prose ol { padding-inline-start: 1.25em; }
  .prose li + li { margin-block-start: var(--space-2xs); }
}

/* ---- components.css ---- */
/* ==========================================================================
   components.css: phase 1 components. Direction in DESIGN.md.
   Rules: no shadows, no black borders, no side stripes, no capsules. Surfaces separate by a
   pale hairline (--line), a tint or space. Focus rings come from base.css.
   Shared pieces later phases may reuse: .button, .button.secondary, .field, .input, .hint,
   .field-error, .error-summary, .panel, .shelf-label, .verdict, .rows, .check, .flash, .muted.
   ========================================================================== */

@layer components {
  /* ---- Skip link ------------------------------------------------------------- */
  .skip-link {
    position: absolute; inset-inline-start: var(--space-s); inset-block-start: var(--space-s);
    z-index: 10; padding: var(--space-2xs) var(--space-s);
    background: var(--accent-fill); color: var(--on-accent); font-weight: var(--weight-strong);
    border-radius: var(--radius-m); transform: translateY(-200%);
  }
  .skip-link:focus { transform: none; }

  /* ---- Header ------------------------------------------------------------------ */
  .site-header { background: var(--surface); border-block-end: var(--border) solid var(--line); }
  .header-row {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: var(--space-3xs) var(--space-m); padding-block: var(--space-2xs);
  }
  .brand {
    display: inline-flex; align-items: center; min-block-size: 3rem;
    color: var(--ink); font-size: var(--step-1); font-weight: 800; letter-spacing: -0.01em; text-decoration: none;
  }
  .brand:hover { text-decoration: underline; }
  .nav-list { display: flex; flex-wrap: wrap; gap: 0 var(--space-2xs); }
  .nav-list a {
    display: inline-flex; align-items: center; min-block-size: 3rem; padding-inline: var(--space-2xs);
    color: var(--ink); font-weight: 600; text-decoration: none; border-radius: var(--radius-s);
  }
  .nav-list a:hover { text-decoration: underline; }
  .nav-list a[aria-current="page"] {
    color: var(--accent); text-decoration: underline; text-decoration-thickness: 0.14em; text-underline-offset: 0.3em;
  }

  /* ---- Breadcrumbs ------------------------------------------------------------- */
  .crumbs { display: flex; flex-wrap: wrap; gap: var(--space-3xs) var(--space-2xs); font-size: var(--step--1); }
  .crumbs li + li::before { content: "/"; color: var(--muted); margin-inline-end: var(--space-2xs); }
  .crumbs a { display: inline-block; padding-block: 0.6rem; }
  .crumbs [aria-current="page"] { color: var(--muted); }

  /* ---- Text -------------------------------------------------------------------- */
  .lede { font-size: var(--step-1); line-height: 1.4; max-inline-size: 34ch; }
  .muted { color: var(--muted); }
  .h3 { font-size: var(--step-1); }
  .hero h1 { font-size: var(--step-5); line-height: var(--leading-display); letter-spacing: -0.02em; }
  .digits { font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }

  /* ---- Buttons: squared plates --------------------------------------------------- */
  .button {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
    min-block-size: var(--tap); padding: 0.5rem 1.4rem;
    background: var(--accent-fill); color: var(--on-accent);
    border: 2px solid var(--accent-fill); border-radius: var(--radius-m);
    font-weight: var(--weight-strong); line-height: 1.2; text-align: center; text-decoration: none;
    transition: background-color var(--duration-fast) var(--ease-out);
  }
  .button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
  .button.secondary { background: var(--surface); color: var(--ink); border-color: var(--field-line); }
  .button.secondary:hover { background: var(--band); }

  /* ---- Forms ------------------------------------------------------------------- */
  .field { display: grid; gap: var(--space-2xs); border: 0; padding: 0; min-inline-size: 0; }
  .field > label, .field > legend { font-weight: var(--weight-strong); padding: 0; }
  .field legend + * { margin-block-start: var(--space-2xs); }
  .optional { font-weight: var(--weight-body); color: var(--muted); }
  .hint { color: var(--muted); font-size: var(--step--1); }
  .input {
    inline-size: 100%; min-block-size: var(--tap); padding: 0.5rem 0.85rem;
    background: var(--surface); color: var(--ink);
    border: 2px solid var(--field-line); border-radius: var(--radius-s);
  }
  .input:hover { border-color: var(--accent); }
  .input.digits { font-size: var(--step-1); }
  .input[aria-invalid="true"] { border-color: var(--danger); }
  select.input { appearance: auto; }
  .field-error { color: var(--danger); font-weight: var(--weight-strong); }
  .check {
    display: flex; align-items: flex-start; gap: 0.75rem; min-block-size: 3rem; padding-block: 0.6rem; cursor: pointer;
  }
  .check input { inline-size: 1.5rem; block-size: 1.5rem; margin-block-start: 0.15em; flex: none; accent-color: var(--accent); }
  .error-summary {
    display: grid; gap: var(--space-2xs); padding: var(--space-m);
    background: color-mix(in oklch, var(--danger) 8%, var(--surface));
    border: 2px solid var(--danger); border-radius: var(--radius-m);
  }
  .error-summary h2 { font-size: var(--step-1); }
  .error-summary ul { padding-inline-start: 1.1em; }
  .error-summary a { color: var(--danger); font-weight: var(--weight-strong); }

  /* ---- Lookup ------------------------------------------------------------------ */
  .lookup-row { display: flex; flex-wrap: wrap; gap: var(--space-2xs); }
  .lookup-row .input { flex: 1 1 14rem; inline-size: auto; }
  .lookup-row .button { flex: 1 0 auto; }
  @media (min-width: 30rem) { .lookup-row .button { flex: 0 0 auto; } }
  .or-scan a { font-weight: 600; }

  .explain { display: grid; gap: var(--space-m); }
  .explain dt { font-weight: var(--weight-strong); font-size: var(--step-1); }
  .explain dd { margin: 0; }

  /* ---- The shelf-edge label (the one bold element) -------------------------------- */
  .shelf-label {
    display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2xs); padding: var(--space-m) var(--space-m) var(--space-s);
    background: var(--label); color: var(--ink);
    border: var(--border) solid color-mix(in oklch, var(--ink) 14%, var(--label));
    border-radius: var(--radius-m);
  }
  .shelf-label h1 { font-size: var(--step-3); line-height: var(--leading-heading); overflow-wrap: anywhere; }
  .label-brand { font-weight: var(--weight-strong); }
  .label-brand a { color: var(--accent); }
  .verdict { font-size: var(--step-4); font-weight: 800; line-height: var(--leading-display); letter-spacing: -0.015em; text-wrap: balance; }
  .verdict-yes { color: var(--yes); }
  .verdict-hard { color: var(--hard); }
  .verdict-no { color: var(--no); }
  .verdict-none, .verdict-few { font-size: var(--step-2); color: var(--ink); }
  .label-counts { font-size: var(--step-1); }
  .label-code {
    margin-block-start: var(--space-2xs); padding-block-start: var(--space-2xs);
    border-block-start: var(--border) dashed color-mix(in oklch, var(--ink) 30%, var(--label));
    color: var(--muted); font-variant-numeric: tabular-nums;
  }

  /* ---- Panels ------------------------------------------------------------------ */
  .panel {
    display: grid; gap: var(--space-s); padding: var(--space-m);
    background: var(--surface); border: var(--border) solid var(--line); border-radius: var(--radius-m);
  }
  .panel h2 { font-size: var(--step-2); }
  .panel.certified h2::before { content: "\2713\00a0"; color: var(--yes); }
  .panel.note { background: var(--band); }
  .thanks:focus { outline: none; }
  .thanks:focus-visible { outline: var(--focus-width) solid var(--focus); }
  .flash { font-weight: var(--weight-strong); }
  .source-note { color: var(--muted); font-size: var(--step--1); }

  /* ---- "Could you open it?" ------------------------------------------------------- */
  .answer-buttons { display: grid; gap: var(--space-xs); }
  @media (min-width: 52rem) { .answer-buttons { grid-template-columns: repeat(3, 1fr); } }
  .answer {
    min-block-size: 4.5rem; padding: 0.75rem 1rem;
    background: var(--surface); border: 2px solid currentColor; border-radius: var(--radius-m);
    font-size: var(--step-1); font-weight: 800; line-height: 1.2; text-align: start;
    transition: background-color var(--duration-fast) var(--ease-out);
  }
  .answer-yes { color: var(--yes); }
  .answer-hard { color: var(--hard); }
  .answer-no { color: var(--no); }
  .answer:hover { background: color-mix(in oklch, currentColor 9%, var(--surface)); }
  .answer-word-yes { color: var(--yes); }
  .answer-word-hard { color: var(--hard); }
  .answer-word-no { color: var(--no); }

  details.more summary {
    display: inline-flex; align-items: center; min-block-size: 3rem; cursor: pointer;
    color: var(--accent); font-weight: var(--weight-strong); text-decoration: underline; text-underline-offset: 0.18em;
  }
  details.more[open] summary { margin-block-end: var(--space-s); }

  /* ---- Lists of products and brands --------------------------------------------- */
  .rows > li { padding-block: var(--space-xs); border-block-end: var(--border) solid var(--line); }
  .rows > li:first-child { border-block-start: var(--border) solid var(--line); }
  .rows a { font-weight: var(--weight-strong); font-size: var(--step-1); }
  .result { font-weight: var(--weight-strong); }
  .result-yes { color: var(--yes); }
  .result-hard { color: var(--hard); }
  .result-no { color: var(--no); }
  .result-none, .result-few { color: var(--muted); }
  .cert-word { color: var(--yes); font-weight: var(--weight-strong); white-space: nowrap; }
  .cert-word::before { content: "\2713\00a0"; }

  /* ---- Scan ------------------------------------------------------------------------ */
  .scan-video {
    inline-size: 100%; aspect-ratio: 4 / 3; object-fit: cover;
    background: var(--band); border: 2px solid var(--field-line); border-radius: var(--radius-m);
  }
  .scan-status { font-weight: var(--weight-strong); min-block-size: 1.5em; }

  /* ---- Footer ------------------------------------------------------------------- */
  .site-footer {
    margin-block-start: var(--space-2xl); padding-block: var(--space-l);
    background: var(--band); border-block-start: var(--border) solid var(--line);
  }
  .footer-grid { display: grid; gap: var(--space-m); }
  @media (min-width: 52rem) { .footer-grid { grid-template-columns: 3fr 2fr; } }
  .footer-say { max-inline-size: 46ch; }
  .footer-links { display: grid; gap: 0; }
  .footer-links a { display: inline-flex; align-items: center; min-block-size: 3rem; }
}

/* ---- packlab.css ---- */
/* packlab.css: phase 2 (Pack Lab) styles. Owned by the phase 2 builder.
   Rules go in @layer components and use the tokens in tokens.css. No shadows, no black borders. */
@layer components {
  .plain-list, .steps { padding-inline-start: 1.25em; display: grid; gap: var(--space-2xs); }
  .plain-list { list-style: disc; }
  .steps { list-style: decimal; }
  .steps li { padding-inline-start: 0.25em; }
  .label-like { font-weight: var(--weight-strong); }
  textarea.input { min-block-size: 6rem; resize: vertical; line-height: var(--leading-body); }

  .force-mid { font-size: var(--step-1); }
  .force-figure { font-size: var(--step-3); font-weight: 800; line-height: var(--leading-display); }

  .plain-table { inline-size: 100%; border-collapse: collapse; }
  .plain-table th, .plain-table td {
    text-align: start; vertical-align: top; padding: var(--space-xs) var(--space-2xs);
    border-block-end: var(--border) solid var(--line);
  }
  .plain-table th { font-weight: var(--weight-strong); }

  /* The card diagram: colours come from tokens, so light and dark both work. */
  .diagram { display: grid; gap: var(--space-m); margin: 0; }
  .card-diagram { inline-size: 100%; max-inline-size: 22rem; block-size: auto; margin-inline: auto; display: block; }
  .d-card { fill: var(--surface); stroke: var(--field-line); stroke-width: 2; }
  .d-blister { fill: var(--accent-tint); stroke: var(--accent); stroke-width: 2; }
  .d-strip { stroke: var(--accent); stroke-width: 3; stroke-dasharray: 8 6; }
  .d-bridge { stroke: var(--hard); stroke-width: 3; }
  .d-window { fill: var(--band); stroke: var(--field-line); stroke-width: 2; stroke-dasharray: 4 3; }
  .d-tab { fill: var(--accent-fill); }
  .d-stop { fill: none; stroke: var(--danger); stroke-width: 2; stroke-dasharray: 12 10; }
  .d-hole { fill: var(--band); stroke: var(--field-line); stroke-width: 2; }
  .d-tag { fill: none; stroke: var(--yes); stroke-width: 2; stroke-dasharray: 6 4; }
  .d-code rect { fill: var(--muted); }
  .d-badge circle { fill: var(--accent-fill); }
  .d-badge text { fill: var(--on-accent); font: 700 17px var(--font-body); }
  .legend { padding-inline-start: 1.5em; list-style: decimal; display: grid; gap: var(--space-2xs); }
  .legend li::marker { font-weight: var(--weight-strong); }
}

/* ---- trials.css ---- */
/* trials.css: phase 3 (retailer trial tracker). Same rules as components.css: no shadows, no
   black borders, hairlines from --line, colours only from tokens.css. Every chart colour comes
   with a word or a shape (solid line and dots vs dashed line and squares). */

@layer components {
  .region.band-soft { background: var(--band); }

  /* Form groups: a hairline above each group instead of boxes. */
  .tr-form > .tr-group, .tr-week > .tr-group {
    border: 0; margin: 0; padding: var(--space-s) 0 0; min-inline-size: 0;
    border-block-start: var(--border) solid var(--line);
  }
  .tr-group > legend { padding: 0; float: left; inline-size: 100%; margin-block-end: var(--space-xs); }
  .tr-group > legend + * { clear: both; }
  .tr-group legend h2 { font-size: var(--step-2); }
  .tr-group legend h3 { font-size: var(--step-1); }
  .tr-choices { display: grid; gap: 0; }
  .tr-pair { display: grid; gap: var(--space-s); align-items: end; }
  @media (min-width: 36rem) { .tr-pair { grid-template-columns: 1fr 1fr; } }
  .field.digits .input { font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }

  /* Intro steps: a real sequence, so numbered. */
  .tr-steps { counter-reset: step; display: grid; gap: var(--space-m); }
  .tr-steps > li {
    counter-increment: step; display: grid; grid-template-columns: 2.75rem 1fr; gap: 0 var(--space-s);
  }
  .tr-steps > li::before {
    content: counter(step); grid-row: span 2; display: grid; place-items: center;
    inline-size: 2.75rem; block-size: 2.75rem; border-radius: var(--radius-m);
    background: var(--label); color: var(--ink); font-weight: 800; font-size: var(--step-1);
  }

  /* The links page: the warning sits on the shelf label, the page's one bold element. */
  .tr-warning-head { font-size: var(--step-2); font-weight: 800; line-height: var(--leading-heading); }
  .tr-link { font-size: var(--step--1); font-variant-numeric: tabular-nums; }
  .tr-copied { font-weight: var(--weight-strong); color: var(--success); }

  .tr-flash { gap: var(--space-xs); }
  .tr-flash [role="status"] p { font-weight: var(--weight-strong); }
  .tr-flash:focus { outline: none; }
  .tr-flash:focus-visible { outline: var(--focus-width) solid var(--focus); }

  /* Results */
  .tr-verdict .verdict { font-size: var(--step-3); }
  .tr-weeks-note { color: var(--muted); }
  .tr-facts { display: grid; gap: var(--space-xs); }
  .tr-facts > div { display: grid; gap: 0 var(--space-s); padding-block-end: var(--space-xs); border-block-end: var(--border) solid var(--line); }
  @media (min-width: 36rem) { .tr-facts > div { grid-template-columns: 8rem 1fr; } }
  .tr-facts dt { font-weight: var(--weight-strong); }
  .tr-facts dd { margin: 0; }

  .tr-table-wrap { overflow-x: auto; max-inline-size: 100%; }
  .tr-table { border-collapse: collapse; inline-size: 100%; font-variant-numeric: tabular-nums; }
  .tr-table caption { text-align: start; font-weight: var(--weight-strong); padding-block-end: var(--space-2xs); }
  .tr-table th, .tr-table td { padding: 0.55rem 0.6rem; text-align: end; vertical-align: top; border-block-end: var(--border) solid var(--line); }
  .tr-table th:first-child, .tr-table thead th:first-child { text-align: start; }
  .tr-table thead th { font-size: var(--step--1); color: var(--muted); font-weight: var(--weight-strong); }
  .tr-table td a { display: inline-block; padding-block: 0.4rem; }

  /* Charts (inline SVG, colours by class so dark mode follows the tokens) */
  .tr-figure { margin: 0; display: grid; gap: var(--space-2xs); }
  .tr-svg { inline-size: 100%; block-size: auto; max-inline-size: 30rem; overflow: visible; }
  .tr-svg text { fill: var(--ink); font-size: 18px; font-family: var(--font-body); }
  .tr-svg .tr-small { fill: var(--muted); }
  .tr-axis, .tr-grid { stroke: var(--line); stroke-width: 1.5; }
  .tr-zero { stroke: var(--field-line); stroke-width: 2; }
  .tr-margin { stroke: var(--no); stroke-width: 2.5; stroke-dasharray: 6 4; }
  .tr-zone { fill: color-mix(in oklch, var(--no) 14%, transparent); }
  .tr-range { stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
  .tr-point { fill: var(--accent); stroke: var(--paper); stroke-width: 2; }
  .tr-change { stroke: var(--field-line); stroke-width: 2; stroke-dasharray: 3 4; }
  .tr-line-test { fill: none; stroke: var(--accent); stroke-width: 3; }
  .tr-line-control { fill: none; stroke: var(--hard); stroke-width: 3; stroke-dasharray: 8 6; }
  .tr-mark-test { fill: var(--accent); }
  .tr-mark-control { fill: var(--hard); }
  .tr-legend { display: grid; gap: var(--space-3xs); }
  .tr-legend li { display: flex; align-items: center; gap: var(--space-2xs); }
  .tr-key { flex: none; inline-size: 2.5rem; block-size: 0; border-block-start: 3px solid var(--accent); }
  .tr-key-control { border-block-start: 3px dashed var(--hard); }
}
