/* Reference tier (MD3 "ref"): the only file, with typography.css, that holds raw values (colours,
   lengths, durations, curves, shadows, opacities). Nothing outside src/styles/tokens/ reads these
   names: system roles (sys.css) and component tokens (comp.css) point at them, and pages use the
   roles. Theme-independent: light, dark and high contrast are chosen in sys.css.
   Guard: src/styles/hardcoded.test.ts (raw values outside this tier only go down).

   Colours are HSL channel triplets ("H S% L%", optional "/ alpha") so a role can be used as
   hsl(var(--role)) or hsl(var(--role) / 0.5). Names are family-lightness: --ref-coral-51 is the
   coral at 50.8% lightness. Her mockup samples are recorded in DESIGN.md (Colour roles). */
:root {
  /* Colour palette */
  --ref-amber-66: 31 70% 66%;
  --ref-amber-43: 31 66% 43%;
  --ref-apricot-96: 35 83% 95.5%;
  --ref-apricot-95: 32 93% 94.5%;
  --ref-apricot-87: 33 94% 86.5%;
  --ref-apricot-28: 33 30% 28%;
  --ref-apricot-15: 32 22% 15%;
  --ref-blue-70: 209 50% 70%;
  --ref-blue-40: 209 43% 40%;
  --ref-blush-90: 4 61% 90%;
  --ref-blush-28: 4 26% 28%;
  --ref-brick-72: 8 72% 72%;
  --ref-brick-68: 8 78% 68%;
  --ref-brick-48: 8 72% 48%;
  --ref-brick-46: 8 75% 46%;
  --ref-brick-37: 8 75% 37%;
  --ref-clay-73: 10 44% 73%;
  --ref-clay-45: 10 30% 45%;
  --ref-cocoa-15: 12 16% 15%;
  --ref-cocoa-12: 14 14% 12%;
  --ref-coral-96: 8 79% 96.3%;
  --ref-coral-75: 8 65% 75%;
  --ref-coral-62: 8 66% 62%;
  --ref-coral-57: 8 66% 56.7%;
  --ref-coral-51: 7 65% 50.8%;
  --ref-coral-46: 7 65% 45.5%;
  --ref-coral-44: 7 55% 44%;
  --ref-cream-98: 26 78% 98.2%;
  --ref-cream-96: 28 90% 95.9%;
  --ref-grey-95: 0 0% 95%;
  --ref-grey-65: 0 0% 65%;
  --ref-grey-38: 160 2% 37.5%;
  --ref-grey-20: 0 0% 20%;
  --ref-grey-16: 0 0% 16%;
  --ref-grey-11: 0 0% 11%;
  --ref-grey-7: 0 0% 7%;
  --ref-lavender-90: 270 20% 90%;
  --ref-lavender-80: 270 30% 80%;
  --ref-lavender-35: 270 20% 35%;
  --ref-lavender-20: 270 30% 20%;
  --ref-lilac-95: 250 16% 94.5%;
  --ref-lilac-15: 250 12% 15%;
  --ref-linen-99: 30 20% 99%;
  --ref-linen-98: 30 25% 98%;
  --ref-linen-97: 30 20% 97%;
  --ref-linen-94: 30 15% 94%;
  --ref-linen-93: 30 20% 93%;
  --ref-linen-90: 30 15% 90%;
  --ref-linen-88: 30 15% 88%;
  --ref-mint-96: 86 30% 95.5%;
  --ref-moss-64: 100 22% 64%;
  --ref-moss-40: 100 18% 40%;
  --ref-moss-13: 130 8% 13%;
  --ref-navy-9: 209 53% 9.2%;
  --ref-olive-96: 76 71% 95.9%;
  --ref-olive-93: 71 30% 92.7%;
  --ref-olive-77: 78 20% 77.1%;
  --ref-olive-40: 79 14% 40%;
  --ref-olive-28: 78 14% 28%;
  --ref-paper-90: 30 38% 90%;
  --ref-peach-94: 22 82% 93.5%;
  --ref-peach-84: 13 85% 84.3%;
  --ref-peach-28: 13 30% 28%;
  --ref-red-50: 0 70% 50%;
  --ref-red-48: 0 84% 48%;
  --ref-rose-96: 0 73% 95.7%;
  --ref-rose-90: 350 30% 90%;
  --ref-rose-85: 350 50% 85%;
  --ref-rose-30: 350 30% 30%;
  --ref-rose-25: 350 40% 25%;
  --ref-rose-15: 350 14% 15%;
  --ref-saffron-95: 38 80% 95%;
  --ref-saffron-58: 38 85% 58%;
  --ref-saffron-55: 38 80% 55%;
  --ref-saffron-25: 38 70% 25%;
  --ref-saffron-15: 38 80% 15%;
  --ref-sage-90: 145 20% 90%;
  --ref-sage-85: 145 20% 85%;
  --ref-sage-72: 145 25% 72%;
  --ref-sage-66: 140 16% 66%;
  --ref-sage-35: 145 20% 35%;
  --ref-sage-25: 145 30% 25%;
  --ref-sage-20: 145 30% 20%;
  --ref-sage-18: 145 15% 18%;
  --ref-sand-96: 27 47% 96.3%;
  --ref-sand-82: 28 24% 82%;
  --ref-sky-97: 206 89% 96.5%;
  --ref-sky-95: 201 50% 94.5%;
  --ref-sky-77: 199 64% 77.1%;
  --ref-sky-28: 199 30% 28%;
  --ref-sky-15: 205 22% 15%;
  --ref-slate-42: 206 6% 42%;
  --ref-stone-94: 30 14% 94%;
  --ref-stone-72: 28 8% 72%;
  --ref-stone-24: 20 8% 24%;
  --ref-stone-13: 20 8% 13%;
  --ref-stone-9: 20 9% 9%;
  --ref-stone-9-a70: 20 9% 9% / 0.7;
  --ref-stone-9-a90: 20 9% 9% / 0.9;
  --ref-umber-34: 20 14% 34%;
  --ref-umber-30: 20 15% 30%;
  --ref-umber-10: 20 25% 10%;
  --ref-umber-8: 20 24% 8%;
  --ref-white: 0 0% 100%;
  --ref-white-a0: 0 0% 100% / 0;
  --ref-white-a4: 0 0% 100% / 0.04;
  --ref-white-a40: 0 0% 100% / 0.4;
  --ref-white-a70: 0 0% 100% / 0.7;
  --ref-white-a90: 0 0% 100% / 0.9;
  --ref-black: 0 0% 0%;
  /* Error ramp (MD3 error roles; not drawn in her mockups, tuned for AA). */
  --ref-red-96: 0 80% 96%;
  --ref-red-80: 0 85% 80%;
  --ref-red-30: 0 72% 30%;
  --ref-red-20: 0 60% 20%;
  --ref-red-15: 0 45% 15%;

  /* Stable viewport used by the app content area and its loading state. */
  --ref-size-viewport: 100svh;

  /* Spacing: 4 px steps (--ref-space-N = N x 0.25rem). */
  --ref-space-0: 0;
  --ref-space-1: 0.25rem;
  --ref-space-2: 0.5rem;
  --ref-space-3: 0.75rem;
  --ref-space-4: 1rem;
  --ref-space-5: 1.25rem;
  --ref-space-6: 1.5rem;
  --ref-space-7: 1.75rem;
  --ref-space-8: 2rem;
  --ref-space-9: 2.25rem;
  --ref-space-10: 2.5rem;
  --ref-space-11: 2.75rem;
  --ref-space-12: 3rem;
  --ref-space-14: 3.5rem;
  --ref-space-16: 4rem;

  /* Corner radii (px-equivalent names). */
  --ref-radius-0: 0;
  --ref-radius-4: 0.25rem;
  --ref-radius-8: 0.5rem;
  --ref-radius-12: 0.75rem;
  --ref-radius-16: 1rem;
  --ref-radius-24: 1.5rem;
  --ref-radius-32: 2rem;
  --ref-radius-64: 4rem;
  --ref-radius-full: 9999px;

  /* Sizes: page frame, hero copy measure, Material 3 window-class edges, touch targets. */
  --ref-size-page: 80rem;
  --ref-size-measure-hero: 28rem;
  /* Copy share of a panoramic painted hero, measured on the approved community mockup. */
  --ref-size-hero-copy-share: 46%;
  --ref-size-window-medium: 37.5rem;
  --ref-size-window-expanded: 52.5rem;
  --ref-size-window-large: 75rem;
  --ref-size-window-xlarge: 100rem;
  --ref-size-target-24: 1.5rem;
  --ref-size-target-44: 2.75rem;
  --ref-size-target-48: 3rem;
  --ref-size-hairline: 1px;
  --ref-size-rule: 0.125rem;
  --ref-size-focus-ring: 0.125rem;
  --ref-size-focus-ring-strong: 0.1875rem;

  /* Motion (Material 3 durations and easing curves). */
  --ref-duration-0: 0ms;
  --ref-duration-50: 50ms;
  --ref-duration-100: 100ms;
  --ref-duration-150: 150ms;
  --ref-duration-200: 200ms;
  --ref-duration-250: 250ms;
  --ref-duration-300: 300ms;
  --ref-duration-350: 350ms;
  --ref-duration-400: 400ms;
  --ref-duration-450: 450ms;
  --ref-duration-500: 500ms;
  --ref-duration-550: 550ms;
  --ref-duration-600: 600ms;
  --ref-easing-linear: cubic-bezier(0, 0, 1, 1);
  --ref-easing-standard: cubic-bezier(0.2, 0, 0, 1);
  --ref-easing-standard-decelerate: cubic-bezier(0, 0, 0, 1);
  --ref-easing-standard-accelerate: cubic-bezier(0.3, 0, 1, 1);
  --ref-easing-emphasized-decelerate: cubic-bezier(0.05, 0.7, 0.1, 1);
  --ref-easing-emphasized-accelerate: cubic-bezier(0.3, 0, 0.8, 0.15);
  --ref-distance-lift: 0.125rem;

  /* Opacities (Material 3 state layers and disabled content). */
  --ref-opacity-8: 0.08;
  --ref-opacity-10: 0.1;
  --ref-opacity-12: 0.12;
  --ref-opacity-16: 0.16;
  --ref-opacity-38: 0.38;

  /* Elevation shadows (Material 3 levels 1 to 5: key + ambient light). The site is flat by
     design; these exist for menus, dialogs and sheets. */
  --ref-shadow-none: none;
  --ref-shadow-1: 0 1px 2px 0 hsl(0 0% 0% / 0.3), 0 1px 3px 1px hsl(0 0% 0% / 0.15);
  --ref-shadow-2: 0 1px 2px 0 hsl(0 0% 0% / 0.3), 0 2px 6px 2px hsl(0 0% 0% / 0.15);
  --ref-shadow-3: 0 1px 3px 0 hsl(0 0% 0% / 0.3), 0 4px 8px 3px hsl(0 0% 0% / 0.15);
  --ref-shadow-4: 0 2px 3px 0 hsl(0 0% 0% / 0.3), 0 6px 10px 4px hsl(0 0% 0% / 0.15);
  --ref-shadow-5: 0 4px 4px 0 hsl(0 0% 0% / 0.3), 0 8px 12px 6px hsl(0 0% 0% / 0.15);
}

/* Sampled from the approved wellness-v1 publication mockup. */
:root {
  --ref-publication-paper: 30.00 66.67% 97.65%;
  --ref-publication-peach: 24.00 80.65% 93.92%;
  --ref-publication-olive: 83.08 13.40% 38.04%;
  --ref-publication-sage: 53.33 23.08% 92.35%;
  --ref-publication-rose: 12.00 90.91% 95.69%;
  --ref-publication-sky: 205.00 50.00% 95.29%;
  --ref-publication-apricot: 30.00 92.31% 94.90%;
  --ref-publication-card-peach: 13.85 100.00% 94.90%;
}

/* System tier (MD3 "sys"): roles. Every value here is a var() pointing at the reference tier
   (ref.css) or at another role; no raw values. Pages, Tailwind and component tokens use these
   names. Theme sets: light (:root), dark (.dark, set by next-themes on <html>), high contrast
   (prefers-contrast: more, both themes). DESIGN.md "Token tiers" has the full map.

   Colour roles are HSL channel triplets: hsl(var(--sys-color-primary)). */
:root {
  --sys-size-panoramic-hero-copy-max: var(--ref-size-hero-copy-share);
  color-scheme: light;

  /* Material 3 colour roles (light). Her coral fill is the primary (white text 4.5:1); her small
     coral text is on-primary-container (4.5:1 on the ground and every tint); her olive band is the
     secondary; her blue glyph and sky tint are the tertiary pair. */
  --sys-color-primary: var(--ref-coral-51);
  --sys-color-on-primary: var(--ref-white);
  --sys-color-primary-container: var(--ref-coral-96);
  --sys-color-on-primary-container: var(--ref-coral-46);
  --sys-color-secondary: var(--ref-olive-40);
  --sys-color-on-secondary: var(--ref-olive-96);
  --sys-color-secondary-container: var(--ref-mint-96);
  --sys-color-on-secondary-container: var(--ref-navy-9);
  --sys-color-tertiary: var(--ref-blue-40);
  --sys-color-on-tertiary: var(--ref-white);
  --sys-color-tertiary-container: var(--ref-sky-97);
  --sys-color-on-tertiary-container: var(--ref-navy-9);
  --sys-color-error: var(--ref-red-48);
  --sys-color-on-error: var(--ref-white);
  --sys-color-error-container: var(--ref-red-96);
  --sys-color-on-error-container: var(--ref-red-30);
  --sys-color-surface: var(--ref-cream-98);
  --sys-color-surface-dim: var(--ref-linen-94);
  --sys-color-surface-bright: var(--ref-white);
  --sys-color-surface-container-lowest: var(--ref-white);
  --sys-color-surface-container-low: var(--ref-sand-96);
  --sys-color-surface-container: var(--ref-cream-96);
  --sys-color-surface-container-high: var(--ref-linen-94);
  --sys-color-surface-container-highest: var(--ref-linen-93);
  --sys-color-on-surface: var(--ref-navy-9);
  --sys-color-on-surface-variant: var(--ref-slate-42);
  --sys-color-outline: var(--ref-slate-42);
  --sys-color-outline-variant: var(--ref-sand-82);
  --sys-color-inverse-surface: var(--ref-navy-9);
  --sys-color-inverse-on-surface: var(--ref-cream-98);
  --sys-color-inverse-primary: var(--ref-coral-75);
  --sys-color-scrim: var(--ref-black);
  --sys-color-shadow: var(--ref-black);

  /* Editorial roles: today's --ed-* names. The core ones are aliases of the MD3 roles above;
     the rest are her brand extension colours (MD3 "custom colours": tints, glyphs, stage cards)
     and point at the palette directly. */
  --ed-ivory: var(--sys-color-surface);
  --ed-ink: var(--sys-color-on-surface);
  --ed-muted: var(--sys-color-on-surface-variant);
  --ed-line: var(--sys-color-outline-variant);
  --ed-coral-fill: var(--sys-color-primary);
  --ed-on-accent: var(--sys-color-on-primary);
  --ed-terracotta-text: var(--sys-color-on-primary-container);
  --ed-blush: var(--sys-color-primary-container);
  --ed-sage: var(--sys-color-secondary);
  --ed-on-sage: var(--sys-color-on-secondary);
  --ed-mint: var(--sys-color-secondary-container);
  --ed-sky: var(--sys-color-tertiary-container);
  --ed-glyph-sky: var(--sys-color-tertiary);
  --ed-surface: var(--sys-color-surface-bright);
  --ed-terracotta: var(--ed-coral-fill);
  --ed-wash: var(--ref-cream-96);
  --ed-sand: var(--ref-sand-96);
  --ed-coral: var(--ref-coral-57);
  --ed-apricot: var(--ref-apricot-96);
  --ed-lilac: var(--ref-lilac-95);
  --ed-glyph-apricot: var(--ref-amber-43);
  --ed-glyph-sage: var(--ref-moss-40);
  --ed-stage-sage: var(--ref-olive-93);
  --ed-stage-peach: var(--ref-peach-94);
  --ed-stage-rose: var(--ref-rose-96);
  --ed-stage-sky: var(--ref-sky-95);
  --ed-stage-apricot: var(--ref-apricot-95);
  --ed-stage-sage-accent: var(--ref-olive-77);
  --ed-stage-peach-accent: var(--ref-peach-84);
  --ed-stage-rose-accent: var(--ref-blush-90);
  --ed-stage-sky-accent: var(--ref-sky-77);
  --ed-stage-apricot-accent: var(--ref-apricot-87);
  --ed-art-ground: var(--ref-white-a0);
  --ed-chip: var(--ref-white-a70);
  --ed-chip-strong: var(--ref-white-a90);
  --ed-stage-panel: var(--ref-white-a40);
  --ed-chip-line: var(--ref-clay-73);
  --ed-muted-home: var(--ref-grey-38);

  /* App roles (shadcn/ui, used across the non-editorial pages; unchanged values). */
  --background: var(--ref-linen-98);
  --foreground: var(--ref-umber-10);
  --card: var(--ref-linen-99);
  --card-foreground: var(--ref-umber-10);
  --popover: var(--ref-linen-99);
  --popover-foreground: var(--ref-umber-10);
  --primary: var(--ref-brick-46);
  --primary-foreground: var(--ref-white);
  --primary-tint: var(--ref-brick-68);
  --primary-text: var(--ref-brick-37);
  --secondary: var(--ref-sage-90);
  --secondary-foreground: var(--ref-sage-25);
  --muted: var(--ref-linen-94);
  --muted-foreground: var(--ref-umber-34);
  --accent: var(--ref-saffron-55);
  --accent-foreground: var(--ref-saffron-15);
  --destructive: var(--ref-red-48);
  --destructive-foreground: var(--ref-white);
  --border: var(--ref-linen-90);
  --input: var(--ref-linen-88);
  --ring: var(--ref-brick-46);
  --sage: var(--ref-sage-72);
  --sage-foreground: var(--ref-sage-20);
  --saffron: var(--ref-saffron-58);
  --saffron-foreground: var(--ref-saffron-15);
  --lavender: var(--ref-lavender-80);
  --lavender-foreground: var(--ref-lavender-20);
  --blush: var(--ref-rose-85);
  --blush-foreground: var(--ref-rose-25);

  /* Shape (Material 3 corner scale). extra-large is her 24 px card corner (MD3 default 28). */
  --sys-shape-corner-none: var(--ref-radius-0);
  --sys-shape-corner-extra-small: var(--ref-radius-4);
  --sys-shape-corner-small: var(--ref-radius-8);
  --sys-shape-corner-medium: var(--ref-radius-12);
  --sys-shape-corner-large: var(--ref-radius-16);
  --sys-shape-corner-extra-large: var(--ref-radius-24);
  --sys-shape-corner-extra-large-increased: var(--ref-radius-32);
  --sys-shape-corner-extra-extra-large: var(--ref-radius-64);
  --sys-shape-corner-full: var(--ref-radius-full);
  --radius: var(--sys-shape-corner-medium);

  /* Elevation (Material 3 levels 0 to 5). */
  --sys-elevation-level0: var(--ref-shadow-none);
  --sys-elevation-level1: var(--ref-shadow-1);
  --sys-elevation-level2: var(--ref-shadow-2);
  --sys-elevation-level3: var(--ref-shadow-3);
  --sys-elevation-level4: var(--ref-shadow-4);
  --sys-elevation-level5: var(--ref-shadow-5);

  /* Motion (Material 3). Zeroed under prefers-reduced-motion below, so every user of these
     tokens stops moving without its own media query. */
  --sys-motion-duration-short1: var(--ref-duration-50);
  --sys-motion-duration-short2: var(--ref-duration-100);
  --sys-motion-duration-short3: var(--ref-duration-150);
  --sys-motion-duration-short4: var(--ref-duration-200);
  --sys-motion-duration-medium1: var(--ref-duration-250);
  --sys-motion-duration-medium2: var(--ref-duration-300);
  --sys-motion-duration-medium3: var(--ref-duration-350);
  --sys-motion-duration-medium4: var(--ref-duration-400);
  --sys-motion-duration-long1: var(--ref-duration-450);
  --sys-motion-duration-long2: var(--ref-duration-500);
  --sys-motion-duration-long3: var(--ref-duration-550);
  --sys-motion-duration-long4: var(--ref-duration-600);
  --sys-motion-easing-linear: var(--ref-easing-linear);
  --sys-motion-easing-standard: var(--ref-easing-standard);
  --sys-motion-easing-standard-decelerate: var(--ref-easing-standard-decelerate);
  --sys-motion-easing-standard-accelerate: var(--ref-easing-standard-accelerate);
  --sys-motion-easing-emphasized: var(--ref-easing-standard);
  --sys-motion-easing-emphasized-decelerate: var(--ref-easing-emphasized-decelerate);
  --sys-motion-easing-emphasized-accelerate: var(--ref-easing-emphasized-accelerate);
  --sys-motion-distance-lift: var(--ref-distance-lift);
  --motion-fast: var(--sys-motion-duration-short3);
  --motion-lift: var(--sys-motion-distance-lift);

  /* State layers (Material 3 opacities over the content colour). */
  --sys-state-hover-opacity: var(--ref-opacity-8);
  --sys-state-focus-opacity: var(--ref-opacity-10);
  --sys-state-pressed-opacity: var(--ref-opacity-10);
  --sys-state-dragged-opacity: var(--ref-opacity-16);
  --sys-state-disabled-content-opacity: var(--ref-opacity-38);
  --sys-state-disabled-container-opacity: var(--ref-opacity-12);

  /* Sizes. Touch target: 24 px on fine pointers (WCAG 2.5.8), 44 px on coarse ones (Apple HIG;
     MD3 asks 48, kept as --sys-size-target-touch-md3). Layout and window-class edges. */
  /* Header is space-14 high; short routes and their loader reserve the same content area. */
  --sys-size-app-content-min: calc(var(--ref-size-viewport) - var(--ref-space-14));
  --sys-size-target: var(--ref-size-target-24);
  --sys-size-target-touch: var(--ref-size-target-44);
  --sys-size-target-touch-md3: var(--ref-size-target-48);
  --sys-size-hairline: var(--ref-size-hairline);
  --sys-size-rule: var(--ref-size-rule);
  --sys-size-focus-ring: var(--ref-size-focus-ring);
  --layout-page: var(--ref-size-page);
  --layout-measure-hero: var(--ref-size-measure-hero);
  --window-medium: var(--ref-size-window-medium);
  --window-expanded: var(--ref-size-window-expanded);
  --window-large: var(--ref-size-window-large);
  --window-xlarge: var(--ref-size-window-xlarge);
}

/* High contrast, light (prefers-contrast: more): secondary text and outlines become ink, coral
   text and fills one step darker (7:1 class), the decorative coral reads as text coral. */
@media (prefers-contrast: more) {
  :root:not(.dark) {
    --sys-color-primary: var(--ref-brick-37);
    --sys-color-on-primary-container: var(--ref-brick-37);
    --sys-color-on-surface-variant: var(--ref-navy-9);
    --sys-color-outline: var(--ref-navy-9);
    --sys-color-outline-variant: var(--ref-slate-42);
    --ed-coral: var(--sys-color-on-primary-container);
    --ed-muted-home: var(--sys-color-on-surface-variant);
    --ed-glyph-apricot: var(--ref-saffron-25);
    --ed-glyph-sage: var(--ref-olive-28);
    --ed-chip-line: var(--sys-color-outline);
    --sys-size-focus-ring: var(--ref-size-focus-ring-strong);
  }
}

.dark {
  color-scheme: dark;

  --sys-color-primary: var(--ref-coral-44);
  --sys-color-on-primary: var(--ref-white);
  --sys-color-primary-container: var(--ref-cocoa-15);
  --sys-color-on-primary-container: var(--ref-coral-75);
  --sys-color-secondary: var(--ref-sage-66);
  --sys-color-on-secondary: var(--ref-umber-8);
  --sys-color-secondary-container: var(--ref-moss-13);
  --sys-color-on-secondary-container: var(--ref-stone-94);
  --sys-color-tertiary: var(--ref-blue-70);
  --sys-color-on-tertiary: var(--ref-navy-9);
  --sys-color-tertiary-container: var(--ref-sky-15);
  --sys-color-on-tertiary-container: var(--ref-stone-94);
  --sys-color-error: var(--ref-red-80);
  --sys-color-on-error: var(--ref-red-20);
  --sys-color-error-container: var(--ref-red-15);
  --sys-color-on-error-container: var(--ref-red-80);
  --sys-color-surface: var(--ref-stone-9);
  --sys-color-surface-dim: var(--ref-grey-7);
  --sys-color-surface-bright: var(--ref-stone-13);
  --sys-color-surface-container-lowest: var(--ref-grey-7);
  --sys-color-surface-container-low: var(--ref-cocoa-12);
  --sys-color-surface-container: var(--ref-stone-13);
  --sys-color-surface-container-high: var(--ref-grey-16);
  --sys-color-surface-container-highest: var(--ref-grey-20);
  --sys-color-on-surface: var(--ref-stone-94);
  --sys-color-on-surface-variant: var(--ref-stone-72);
  --sys-color-outline: var(--ref-stone-72);
  --sys-color-outline-variant: var(--ref-stone-24);
  --sys-color-inverse-surface: var(--ref-stone-94);
  --sys-color-inverse-on-surface: var(--ref-stone-9);
  --sys-color-inverse-primary: var(--ref-coral-46);

  --ed-wash: var(--ref-cocoa-12);
  --ed-sand: var(--ref-stone-13);
  --ed-coral: var(--ref-coral-62);
  --ed-apricot: var(--ref-apricot-15);
  --ed-lilac: var(--ref-lilac-15);
  --ed-glyph-apricot: var(--ref-amber-66);
  --ed-glyph-sage: var(--ref-moss-64);
  --ed-stage-sage: var(--ref-moss-13);
  --ed-stage-peach: var(--ref-cocoa-15);
  --ed-stage-rose: var(--ref-rose-15);
  --ed-stage-sky: var(--ref-sky-15);
  --ed-stage-apricot: var(--ref-apricot-15);
  --ed-stage-sage-accent: var(--ref-olive-28);
  --ed-stage-peach-accent: var(--ref-peach-28);
  --ed-stage-rose-accent: var(--ref-blush-28);
  --ed-stage-sky-accent: var(--ref-sky-28);
  --ed-stage-apricot-accent: var(--ref-apricot-28);
  --ed-art-ground: var(--ref-paper-90);
  --ed-chip: var(--ref-stone-9-a70);
  --ed-chip-strong: var(--ref-stone-9-a90);
  --ed-stage-panel: var(--ref-white-a4);
  --ed-chip-line: var(--ref-clay-45);

  --background: var(--ref-grey-7);
  --foreground: var(--ref-grey-95);
  --card: var(--ref-grey-11);
  --card-foreground: var(--ref-grey-95);
  --popover: var(--ref-grey-11);
  --popover-foreground: var(--ref-grey-95);
  --primary: var(--ref-brick-48);
  --primary-foreground: var(--ref-white);
  --primary-tint: var(--ref-brick-68);
  --primary-text: var(--ref-brick-72);
  --secondary: var(--ref-sage-18);
  --secondary-foreground: var(--ref-sage-85);
  --muted: var(--ref-grey-16);
  --muted-foreground: var(--ref-grey-65);
  --accent: var(--ref-saffron-25);
  --accent-foreground: var(--ref-saffron-95);
  --destructive: var(--ref-red-50);
  --destructive-foreground: var(--ref-white);
  --border: var(--ref-grey-20);
  --input: var(--ref-grey-20);
  --ring: var(--ref-brick-48);
  --sage: var(--ref-sage-35);
  --sage-foreground: var(--ref-sage-90);
  --saffron: var(--ref-saffron-25);
  --saffron-foreground: var(--ref-saffron-95);
  --lavender: var(--ref-lavender-35);
  --lavender-foreground: var(--ref-lavender-90);
  --blush: var(--ref-rose-30);
  --blush-foreground: var(--ref-rose-90);
}

@media (prefers-contrast: more) {
  .dark {
    --sys-color-primary: var(--ref-brick-37);
    --sys-color-on-primary-container: var(--ref-peach-84);
    --sys-color-on-surface-variant: var(--ref-stone-94);
    --sys-color-outline: var(--ref-stone-94);
    --sys-color-outline-variant: var(--ref-stone-72);
    --ed-coral: var(--sys-color-on-primary-container);
    --ed-chip-line: var(--sys-color-outline);
    --sys-size-focus-ring: var(--ref-size-focus-ring-strong);
  }
}

/* Coarse pointers (touch): 44 px targets (Apple HIG). */
@media (pointer: coarse) {
  :root {
    --sys-size-target: var(--sys-size-target-touch);
  }
}

/* Reduced motion: every duration and the hover lift go to zero through the tokens. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --sys-motion-duration-short1: var(--ref-duration-0);
    --sys-motion-duration-short2: var(--ref-duration-0);
    --sys-motion-duration-short3: var(--ref-duration-0);
    --sys-motion-duration-short4: var(--ref-duration-0);
    --sys-motion-duration-medium1: var(--ref-duration-0);
    --sys-motion-duration-medium2: var(--ref-duration-0);
    --sys-motion-duration-medium3: var(--ref-duration-0);
    --sys-motion-duration-medium4: var(--ref-duration-0);
    --sys-motion-duration-long1: var(--ref-duration-0);
    --sys-motion-duration-long2: var(--ref-duration-0);
    --sys-motion-duration-long3: var(--ref-duration-0);
    --sys-motion-duration-long4: var(--ref-duration-0);
    --sys-motion-distance-lift: var(--ref-space-0);
  }
}

/* Publication mockup palette: opt-in until each founder page is compared.
   Dark mode retains the existing accessible theme roles. */
:root:not(.dark) .wellness-publication {
  --ed-ivory: var(--ref-publication-paper);
  --ed-stage-peach: var(--ref-publication-peach);
  --ed-sage: var(--ref-publication-olive);
  --ed-stage-sage: var(--ref-publication-sage);
  --ed-stage-rose: var(--ref-publication-rose);
  --ed-stage-sky: var(--ref-publication-sky);
  --ed-stage-apricot: var(--ref-publication-apricot);
}
:root:not(.dark) .wellness-door.bg-ed-stage-peach {
  --ed-stage-peach: var(--ref-publication-card-peach);
}

/* Typography tokens: the ONE file for fonts. It holds the @font-face rules, the font-family
   tokens (--ref-font-*) and the Material 3 type-role scale (--sys-typescale-*). Raw values are
   allowed here (font names, rem sizes, weights, tracking), as in ref.css.

   Swap the display face (DESIGN.md, "Typography tokens: how to swap a font"):
   1. put the new woff2 in public/fonts/ and add its @font-face below (latin unicode-range);
   2. set --ref-font-display-face to its family name;
   3. adjust the weights (and tracking) of the display/headline/title roles below, then check
      /dev/design-language (font lab) and the viewport matrix.
   The logo is an image asset, not a font token. */

/* Self-hosted variable fonts (was a Google Fonts @import: HTML -> CSS -> Google CSS -> woff2,
   two extra round trips to another origin, with no preload). Inter and Inter Tight by The Inter
   Project Authors (rsms/inter, rsms/inter-tight), SIL Open Font License 1.1 -- licence texts in
   public/fonts/OFL-*.txt. Files: the latin and latin-ext "wght" subsets from
   @fontsource-variable/inter and @fontsource-variable/inter-tight 5.3.0, renamed. One variable
   file per subset covers every weight the app uses; the family names stay 'Inter' and
   'Inter Tight' so no style changes. index.html preloads the two latin files. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/fonts/inter-latin-wght.woff2') format('woff2');
  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: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/fonts/inter-latin-ext-wght.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Inter Tight';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/fonts/inter-tight-latin-wght.woff2') format('woff2');
  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: 'Inter Tight';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/fonts/inter-tight-latin-ext-wght.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* Editorial faces (.home-editorial / .ed-page). Newsreader by the Newsreader Project Authors
   (productiontype/Newsreader) and Caveat by Impallari Type, both SIL OFL 1.1 -- licence text in
   public/fonts/OFL-Newsreader.txt. Latin subsets (same unicode-range as Inter above) of the
   variable fonts from google/fonts: wght trimmed to 400-700, opsz axis (6-72) kept so small card
   titles get the text cut and the hero gets the display cut automatically. */
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url('/fonts/newsreader-latin-wght.woff2') format('woff2');
  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: 'Newsreader';
  font-style: italic;
  font-display: swap;
  font-weight: 400 700;
  src: url('/fonts/newsreader-italic-latin-wght.woff2') format('woff2');
  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: 'Caveat';
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url('/fonts/caveat-latin-wght.woff2') format('woff2');
  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;
}

/* Metric-matched local fallbacks, used until the woff2 above arrives (font-display: swap),
   so the swap barely moves text (CLS). These are exactly what next/font generates for these
   families: calculateSizeAdjustValues() in next@15.5.26 dist/server/font-utils.js
   (sizeAdjust = (xWidthAvg/unitsPerEm) / (Arial xWidthAvg/unitsPerEm); each override =
   metric / (unitsPerEm * sizeAdjust)) over the capsize metrics next ships in
   dist/server/capsize-font-metrics.json (same as @capsizecss/metrics 4.3.0):
   Inter ascent 1984, descent -494, lineGap 0, UPM 2048, xWidthAvg 978; Inter Tight same
   vertical metrics, xWidthAvg 880; Arial xWidthAvg 913. Helvetica stands in where Arial is
   absent (close enough in width; better than an unadjusted system-ui). */
@font-face {
  font-family: 'Inter Fallback';
  src: local('Arial'), local('ArialMT'), local('Helvetica');
  size-adjust: 107.12%;
  ascent-override: 90.44%;
  descent-override: 22.52%;
  line-gap-override: 0%;
}
/* Newsreader fallbacks over Times New Roman (Liberation Serif has identical advances). Sizes come
   from summed advance widths of headline strings at wght 500 against the serif (fonttools):
   Newsreader is 107.5 percent (opsz 16) / 105 (opsz 30) / 110.8 (opsz 58) as wide as Times, the
   italic 101.7 / 98.2 / 103.3. 'Newsreader Fallback' (107 / 101) serves card titles and h2;
   'Newsreader Display Fallback' (108 / 103; 110 fits 1280 best but runs 7 percent wide at 390) is for the h1. Ascent 73.5 and descent 26.5
   percent of the em (hhea 1470/530 of 2000) divided by the size-adjust. */
@font-face {
  font-family: 'Newsreader Fallback';
  font-style: normal;
  src: local('Times New Roman'), local('TimesNewRomanPSMT'), local('Liberation Serif'), local('Times');
  size-adjust: 107%;
  ascent-override: 68.69%;
  descent-override: 24.77%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Newsreader Fallback';
  font-style: italic;
  src: local('Times New Roman Italic'), local('TimesNewRomanPS-ItalicMT'), local('Liberation Serif Italic'), local('Times Italic');
  size-adjust: 101%;
  ascent-override: 72.77%;
  descent-override: 26.24%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Newsreader Display Fallback';
  font-style: normal;
  src: local('Times New Roman'), local('TimesNewRomanPSMT'), local('Liberation Serif'), local('Times');
  size-adjust: 108%;
  ascent-override: 68.06%;
  descent-override: 24.54%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Newsreader Display Fallback';
  font-style: italic;
  src: local('Times New Roman Italic'), local('TimesNewRomanPS-ItalicMT'), local('Liberation Serif Italic'), local('Times Italic');
  size-adjust: 103%;
  ascent-override: 71.36%;
  descent-override: 25.73%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Inter Tight Fallback';
  src: local('Arial'), local('ArialMT'), local('Helvetica');
  size-adjust: 96.39%;
  ascent-override: 100.51%;
  descent-override: 25.03%;
  line-gap-override: 0%;
}

:root {
  /* Typefaces (MD3 ref.typeface). The face tokens are what the font lab (dev only) and a swap
     change; the stacks add metric-matched fallbacks (tuned for these faces; a new face keeps
     them until it gets its own, which only affects the swap moment, not the final render). */
  --ref-font-display-face: 'Newsreader';
  --ref-font-body-face: 'Inter';
  --ref-font-script-face: 'Caveat';
  --ref-font-display: var(--ref-font-display-face), 'Newsreader Fallback', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  /* The h1 cut: same face, the fallback sized for display lines. */
  --ref-font-display-hero: var(--ref-font-display-face), 'Newsreader Display Fallback', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --ref-font-body: var(--ref-font-body-face), 'Inter Fallback', system-ui, -apple-system, sans-serif;
  /* App-wide headings outside the editorial pages (font-serif utility, h1-h3). */
  --ref-font-heading: 'Inter Tight', 'Inter Tight Fallback', 'Inter', system-ui, -apple-system, sans-serif;
  --ref-font-script: var(--ref-font-script-face), 'Segoe Script', 'Bradley Hand', cursive;

  /* Font roles (sys): what CSS and Tailwind use. */
  --sys-font-display: var(--ref-font-display);
  --sys-font-display-hero: var(--ref-font-display-hero);
  --sys-font-body: var(--ref-font-body);
  --sys-font-heading: var(--ref-font-heading);
  --sys-font-script: var(--ref-font-script);
  --sys-font-script-weight: var(--ref-weight-medium);

  /* Weights. Display and headline weights live here so a swap tunes them in one place. */
  --ref-weight-regular: 400;
  --ref-weight-medium: 500;
  --ref-weight-semibold: 600;
  --ref-weight-bold: 700;
  /* The display face's two working weights (her headlines are 500, the Getting Pregnant and Tools
     heroes 600). A new face usually needs these two tuned, nothing else. */
  --ref-weight-display: var(--ref-weight-medium);
  --ref-weight-display-emphasized: var(--ref-weight-semibold);

  /* Material 3 type roles (editorial scale, measured on her mockups; docs/design/mockup-fidelity.md).
     Sizes are rem (browser text size and Dynamic Type scale them), fluid between the compact and
     large window classes: clamp(min at 390, slope, max at 1280). Line heights are unitless. */
  /* display-large: the hub hero H1 (36 px at 390 to 58 px at 1280). */
  --sys-typescale-display-large-font: var(--sys-font-display-hero);
  --sys-typescale-display-large-size: clamp(2.25rem, 1.648rem + 2.472vw, 3.625rem);
  --sys-typescale-display-large-line-height: 1.1;
  --sys-typescale-display-large-weight: var(--ref-weight-display);
  --sys-typescale-display-large-tracking: -0.01em;
  /* display-medium: the homepage hero H1 (36 to 49 px). */
  --sys-typescale-display-medium-font: var(--sys-font-display-hero);
  --sys-typescale-display-medium-size: clamp(2.25rem, 1.75rem + 2vw, 3.0625rem);
  --sys-typescale-display-medium-line-height: 1;
  --sys-typescale-display-medium-weight: var(--ref-weight-display);
  --sys-typescale-display-medium-tracking: -0.01em;
  /* display-small: compact display lines (28 to 36 px). */
  --sys-typescale-display-small-font: var(--sys-font-display-hero);
  --sys-typescale-display-small-size: clamp(1.75rem, 1.531rem + 0.899vw, 2.25rem);
  --sys-typescale-display-small-line-height: 1.1;
  --sys-typescale-display-small-weight: var(--ref-weight-display);
  --sys-typescale-display-small-tracking: -0.01em;
  /* headline-large: homepage, Getting Pregnant and Tools section H2 (24 to 33 px). */
  --sys-typescale-headline-large-font: var(--sys-font-display);
  --sys-typescale-headline-large-size: clamp(1.5rem, 1.254rem + 1.011vw, 2.0625rem);
  --sys-typescale-headline-large-line-height: 1.15;
  --sys-typescale-headline-large-weight: var(--ref-weight-display);
  --sys-typescale-headline-large-tracking: -0.005em;
  /* headline-medium: hub section H2 (24 to 30 px). */
  --sys-typescale-headline-medium-font: var(--sys-font-display);
  --sys-typescale-headline-medium-size: clamp(1.5rem, 1.336rem + 0.674vw, 1.875rem);
  --sys-typescale-headline-medium-line-height: 1.15;
  --sys-typescale-headline-medium-weight: var(--ref-weight-display);
  --sys-typescale-headline-medium-tracking: -0.005em;
  /* headline-small: band and panel titles (20 to 24 px). */
  --sys-typescale-headline-small-font: var(--sys-font-display);
  --sys-typescale-headline-small-size: clamp(1.25rem, 1.14rem + 0.45vw, 1.5rem);
  --sys-typescale-headline-small-line-height: 1.1;
  --sys-typescale-headline-small-weight: var(--ref-weight-display);
  --sys-typescale-headline-small-tracking: -0.005em;
  /* title-large: door titles (19 px). */
  --sys-typescale-title-large-font: var(--sys-font-display);
  --sys-typescale-title-large-size: 1.1875rem;
  --sys-typescale-title-large-line-height: 1.2;
  --sys-typescale-title-large-weight: var(--ref-weight-display-emphasized);
  --sys-typescale-title-large-tracking: -0.01em;
  /* title-medium: card titles (16 px). */
  --sys-typescale-title-medium-font: var(--sys-font-display);
  --sys-typescale-title-medium-size: 1rem;
  --sys-typescale-title-medium-line-height: 1.2;
  --sys-typescale-title-medium-weight: var(--ref-weight-display);
  --sys-typescale-title-medium-tracking: -0.01em;
  /* title-small: small card titles (15 px). */
  --sys-typescale-title-small-font: var(--sys-font-display);
  --sys-typescale-title-small-size: 0.9375rem;
  --sys-typescale-title-small-line-height: 1.2;
  --sys-typescale-title-small-weight: var(--ref-weight-display);
  --sys-typescale-title-small-tracking: -0.01em;
  /* body-large: hero intros (17 px). */
  --sys-typescale-body-large-font: var(--sys-font-body);
  --sys-typescale-body-large-size: 1.0625rem;
  --sys-typescale-body-large-line-height: 1.4;
  --sys-typescale-body-large-weight: var(--ref-weight-regular);
  --sys-typescale-body-large-tracking: 0;
  /* body-medium: running text (16 px; the 1rem floor for body copy on phones). */
  --sys-typescale-body-medium-font: var(--sys-font-body);
  --sys-typescale-body-medium-size: 1rem;
  --sys-typescale-body-medium-line-height: 1.5;
  --sys-typescale-body-medium-weight: var(--ref-weight-regular);
  --sys-typescale-body-medium-tracking: 0;
  /* body-small: blurbs and secondary lines (15 px). */
  --sys-typescale-body-small-font: var(--sys-font-body);
  --sys-typescale-body-small-size: 0.9375rem;
  --sys-typescale-body-small-line-height: 1.4;
  --sys-typescale-body-small-weight: var(--ref-weight-regular);
  --sys-typescale-body-small-tracking: 0;
  /* label-large: buttons and nav (14 px). */
  --sys-typescale-label-large-font: var(--sys-font-body);
  --sys-typescale-label-large-size: 0.875rem;
  --sys-typescale-label-large-line-height: 1.43;
  --sys-typescale-label-large-weight: var(--ref-weight-medium);
  --sys-typescale-label-large-tracking: 0.006em;
  /* label-medium: card blurbs and chips (13 px). */
  --sys-typescale-label-medium-font: var(--sys-font-body);
  --sys-typescale-label-medium-size: 0.8125rem;
  --sys-typescale-label-medium-line-height: 1.5;
  --sys-typescale-label-medium-weight: var(--ref-weight-regular);
  --sys-typescale-label-medium-tracking: 0;
  /* label-small: eyebrows and photo tags (12 px, the floor for any text). */
  --sys-typescale-label-small-font: var(--sys-font-body);
  --sys-typescale-label-small-size: 0.75rem;
  --sys-typescale-label-small-line-height: 1.33;
  --sys-typescale-label-small-weight: var(--ref-weight-semibold);
  --sys-typescale-label-small-tracking: 0.08em;

  /* Hero titles fit their copy column (a query container, .ed-hero-copy). The size is at most
     the one at which the column holds the longer clause on one line: HubHero passes each clause's
     length in characters (--hero-title-lead-chars, --hero-title-accent-chars; the accent scaled by
     the hero's --hero-title-accent-scale) and Newsreader averages 0.46 em per character. Short
     titles count as 9 em (her longest hero line, "From first hopes to", is 8.6 em). The floor is
     1.75rem (rem, so browser text size still scales it); below it the clause wraps, balanced.
     A new display face: re-measure --ref-font-display-char-width. */
  --ref-font-display-char-width: 0.46;
  --sys-typescale-display-fit-min: 1.75rem;

  /* Emphasized display (MD3 emphasized type): the heavier hero H1 on Getting Pregnant and Tools. */
  --sys-typescale-emphasized-weight: var(--ref-weight-display-emphasized);
}

/* The fit is declared on every h1 (not only :root) because a custom property resolves its var()s
   where it is declared: here it reads the title's own clause lengths and its hero's accent scale.
   cqi resolves where the token is used, against the h1's query container. */
:root,
h1 {
  --sys-typescale-display-fit: calc(100cqi / max(9, var(--hero-title-lead-chars, 0) * var(--ref-font-display-char-width), var(--hero-title-accent-chars, 0) * var(--ref-font-display-char-width) * var(--hero-title-accent-scale, 1)));
}

/* Rhythm (system tier for space; DESIGN.md, Rhythm recipe; mockup gaps measured at 1280 in
   docs/design/mockup-fidelity.md). --space-N (N x 4 px) is the spacing scale from ref.css; every
   semantic token below is one of them or a clamp() between two of them. One wrapper, .ed-stack
   (index.css), applies page-top and section; the footer's own margin is page-bottom, so pages add
   no bottom padding of their own. Guard: src/styles/rhythm.test.ts. */
:root {
  --space-1: var(--ref-space-1);
  --space-2: var(--ref-space-2);
  --space-3: var(--ref-space-3);
  --space-4: var(--ref-space-4);
  --space-5: var(--ref-space-5);
  --space-6: var(--ref-space-6);
  --space-7: var(--ref-space-7);
  --space-8: var(--ref-space-8);
  --space-9: var(--ref-space-9);
  --space-10: var(--ref-space-10);
  --space-11: var(--ref-space-11);
  --space-12: var(--ref-space-12);
  --space-16: var(--ref-space-16);
  --space-gutter: var(--space-4);
  /* Hero (or header) to the first section: 16 px everywhere (mockups 4 to 12; 16 is the floor
     between any two blocks). */
  --space-page-top: var(--space-4);
  /* Between sections: 24 px up to 1280 (mockups 15 to 25 px box to box), growing to 32 px at
     1920. */
  --space-section: clamp(var(--space-6), 1.25vw + var(--space-2), var(--space-8));
  /* A section that continues the one above it (her homepage bottom row under Popular topics). */
  --space-section-tight: var(--space-4);
  /* Heading block (h2 and sub) to its content (mockups 6 to 14 px of ink, 12 px box). */
  --space-heading: var(--space-3);
  /* Between cards in a row (mockups 11 to 18 px). */
  --space-card-gap: var(--space-4);
  /* Inside a tinted band or panel, top and bottom (mockups 12 to 16 px box). */
  --space-band-pad: var(--space-4);
  /* Last section to the footer: 40 px on phones to 48 px from 1280 (mockups 23 to 45 px to the
     image edge, which has no footer). */
  --space-page-bottom: clamp(var(--space-10), 0.95vw + var(--space-9), var(--space-12));
  --space-card: var(--space-5);
}

/* Gutter widens from 640px and then grows with the viewport to the mockups' 44 px at 1280
   (3.4 to 3.7 percent of the width on all five screens; docs/design/mockup-fidelity.md, Global
   frame). Header, page and footer share it, so their edges stay aligned. */
@media (min-width: 40em) {
  :root {
    --space-gutter: clamp(var(--space-6), 3.5vw, var(--space-11));
  }
}

/* Component tier (MD3 "comp"): per-component tokens, each pointing at a system role (sys.css,
   rhythm.css, typography.css). Tune one component here without touching the roles. No raw
   values. */
:root {
  /* Cards and doors: radius (rounded-card), padding (p-card), gap (gap-card-gap), hover lift
     (-translate-y-lift); read through the Tailwind utilities in tailwind.config.ts. */
  --comp-card-radius: var(--sys-shape-corner-extra-large);
  --comp-card-padding: var(--space-card);
  --comp-card-gap: var(--space-card-gap);
  --comp-card-hover-lift: var(--sys-motion-distance-lift);
  /* Hero (HubHero and the five page heroes); the copy measure is max-w-hero-copy. */
  --comp-hero-radius: var(--sys-shape-corner-extra-large-increased);
  --comp-hero-bleed-radius: var(--sys-shape-corner-extra-extra-large);
  --comp-hero-copy-measure: var(--layout-measure-hero);
  --comp-community-hero-copy-max: var(--sys-size-panoramic-hero-copy-max);
  /* The hero title's largest size; pages with her own hero scale override it on their hero. */
  --comp-hero-title-max: var(--sys-typescale-display-large-size);
  /* Template pages (content, topic, article, tool, listing, form; src/components/templates): the
     page title is a compact display line, not a hub hero (`.ed-page-title`, index.css). */
  --comp-page-title-max: var(--sys-typescale-display-small-size);
  /* Buttons and other controls: the smallest hit area (.tap-target). */
  --comp-button-min-size: var(--sys-size-target);
  /* Header navigation. */
  --comp-nav-min-size: var(--sys-size-target);
  --comp-nav-indicator-height: var(--sys-size-rule);
  --comp-nav-indicator-inset: var(--space-3);
  --comp-nav-indicator-offset: var(--space-1);
  /* Tinted bands (olive Tools band, Find-my-week band, the week explorer): py-band-pad. */
  --comp-band-padding-block: var(--space-band-pad);
  /* Icon link rows (the tools bands' round icons and labels): the narrowest a column may get. */
  --comp-icon-row-min: calc(var(--space-16) + var(--space-2));
  /* Focus ring (every interactive element). */
  --comp-focus-ring-width: var(--sys-size-focus-ring);
  --comp-focus-ring-color: var(--sys-color-on-primary-container);

  /* Aliases kept for existing utilities (rounded-card, rounded-hero, md:rounded-l-hero-bleed). */
  --radius-card: var(--comp-card-radius);
  --radius-hero: var(--comp-hero-radius);
  --radius-hero-bleed: var(--comp-hero-bleed-radius);
}

/* Static reference pages share the publication's token tiers and self-hosted fonts. */
:root {
  --rose: hsl(var(--ed-terracotta-text));
  --ink: hsl(var(--ed-ink));
  --muted: hsl(var(--ed-muted));
  --bg: hsl(var(--ed-ivory));
  --card: hsl(var(--ed-surface));
  --blush: hsl(var(--ed-blush));
  --sage: hsl(var(--ed-sage));
}
body { font-family: var(--sys-font-body); font-size: var(--sys-typescale-body-medium-size); background: var(--bg); color: var(--ink); }
.wrap { max-width: 68ch; padding: var(--space-section) var(--space-gutter) var(--space-page-bottom); overflow-wrap: anywhere; }
h1, h2, h3, details.details-block > summary { font-family: var(--sys-font-display); font-weight: var(--sys-typescale-headline-medium-weight); }
h1 { font-size: var(--sys-typescale-display-small-size); line-height: var(--sys-typescale-display-small-line-height); text-wrap: balance; margin: var(--space-4) 0; }
h2 { font-size: var(--sys-typescale-headline-small-size); line-height: var(--sys-typescale-headline-small-line-height); margin-bottom: var(--space-4); }
h3 { font-size: var(--sys-typescale-title-large-size); }
p, li { line-height: var(--sys-typescale-body-medium-line-height); }
main > section { margin-block: var(--space-section); }
.lede { font-size: var(--sys-typescale-body-large-size); }
.card { padding: var(--space-card); border-radius: var(--comp-card-radius); margin-block: var(--space-section); box-shadow: none; }
.card:not(.in-short) { background: var(--card); }
.in-short, .cta { background: var(--blush); }
a { color: var(--rose); text-underline-offset: var(--space-1); }
a:focus-visible, summary:focus-visible { outline: var(--comp-focus-ring-width) solid hsl(var(--comp-focus-ring-color)); outline-offset: var(--space-1); }
.crumbs, .source, .disclaimer, .checked, .attrib { font-size: var(--sys-typescale-label-large-size); color: var(--muted); }
.tag { background: hsl(var(--ed-mint)); font-size: var(--sys-typescale-label-medium-size); padding: var(--space-1) var(--space-3); }
.site-header { background: var(--bg); border-color: hsl(var(--ed-line)); font-family: var(--sys-font-body); }
.site-header .bar { max-width: var(--layout-page); padding: var(--space-3) var(--space-gutter); gap: var(--space-4); }
.site-header nav a { font-size: var(--sys-typescale-label-large-size); min-height: var(--sys-size-target-touch); display: inline-flex; align-items: center; }
.site-footer { max-width: var(--layout-page); padding: var(--space-section) var(--space-gutter); border-color: hsl(var(--ed-line)); font-size: var(--sys-typescale-label-large-size); }
.site-footer a { display: inline-block; padding-block: var(--space-2); }
.reference-intro { background: hsl(var(--ed-wash)); padding: var(--space-5) var(--space-gutter); }
.reference-intro > div { max-width: var(--layout-page); margin-inline: auto; display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-3); align-items: center; }
.reference-intro p { margin: 0; color: var(--muted); font-size: var(--sys-typescale-label-large-size); }
.reference-intro strong { display: block; color: var(--ink); font-family: var(--sys-font-display); font-size: var(--sys-typescale-title-large-size); font-weight: var(--sys-typescale-headline-medium-weight); }
.reference-intro a { font-size: var(--sys-typescale-label-large-size); }
table { display: block; overflow-x: auto; max-width: 100%; }
table.nutri td, table.names td, table.skus td, table.skus th, table.threshold-table td, table.threshold-table th { border-color: hsl(var(--ed-line)); padding: var(--space-3) var(--space-2); }
.growth-table-scroll, .reference-table-scroll { max-width: 100%; overflow-x: auto; }
.growth-table-scroll:focus-visible, .reference-table-scroll:focus-visible { outline: var(--comp-focus-ring-width) solid hsl(var(--comp-focus-ring-color)); outline-offset: var(--space-1); }
table.growth-table { display: table; min-width: 100%; max-width: none; overflow: visible; }
table.growth-table th, table.growth-table td { white-space: nowrap; overflow-wrap: normal; word-break: normal; }
table.test-threshold-table { display: table; min-width: 40rem; max-width: none; overflow: visible; }
table.test-threshold-table th, table.test-threshold-table td { overflow-wrap: normal; word-break: normal; }
table.test-threshold-table td:nth-child(2) { white-space: nowrap; }
.related { padding-top: 0; }
.related ul { padding-left: var(--space-5); }
.related li { margin-block: var(--space-3); }

/* Reference blueprint: a compact illustrated title, readable body and source navigation. */
.reference-heading, .reference-layout { max-width: var(--layout-page); margin-inline: auto; padding-inline: var(--space-gutter); }
.reference-heading { display: grid; gap: var(--space-6); align-items: center; padding-block: var(--space-6); background: hsl(var(--ed-wash)); border-radius: var(--comp-card-radius); }
.reference-heading h1 { font-size: var(--sys-typescale-display-small-size); }
.reference-heading > div { min-width: 0; overflow-wrap: anywhere; }
.reference-eyebrow { color: var(--rose); text-transform: uppercase; font-size: var(--sys-typescale-label-large-size); letter-spacing: var(--sys-typescale-label-large-tracking); }
.reference-heading picture { display: block; overflow: hidden; border-radius: var(--comp-card-radius); }
.reference-heading img { display: block; width: 100%; height: auto; }
.reference-layout { display: block; }
.reference-layout .wrap { min-width: 0; width: 100%; max-width: calc(33em + 2 * var(--space-card)); padding-inline: 0; padding-top: var(--space-4); }
.reference-contents, .reference-explore { min-width: 0; margin-block: var(--space-4); padding: var(--space-card); background: hsl(var(--ed-stage-peach)); border-radius: var(--comp-card-radius); }
.reference-contents ul { display: grid; gap: var(--space-2) var(--space-6); list-style: none; padding: 0; }
.reference-contents a, .reference-explore a { display: inline-flex; align-items: center; min-height: var(--sys-size-target-touch); }
.reference-layout details > summary { min-height: var(--sys-size-target-touch); padding-block: var(--space-2); }
.reference-explore nav { display: flex; flex-wrap: wrap; gap: var(--space-4); }
.reference-layout .wrap > section, .reference-layout .card { margin-block: var(--space-4); }
.reference-layout .card ul, .reference-layout .card ol { padding-inline-start: var(--space-5); }
@media (min-width: 64em) {
  .reference-heading { grid-template-columns: 2fr 1fr; }
  .reference-contents ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media print {
  .reference-contents, .reference-explore, .reference-heading picture { display: none; }
  .reference-layout { display: block; }
}

/* Keep urgent instructions ahead of decorative art on small screens. */
@media (max-width: 63.99em) { .reference-urgent picture { display: none; } }
