/* =============================================================================
   tokens.css — THE SINGLE SOURCE OF TRUTH FOR EVERY VISUAL VALUE ON THIS SITE
   Generated from the recipe in references/design-system.md.

   HARD RULE, CI-ENFORCED
   This file is the ONLY legal home for raw values. The Layer 2 token-lint fails
   the PR if any other stylesheet, component, or inline style contains:
     - a raw hex / rgb() / hsl() / oklch() color literal
     - a px font-size
     - a spacing value that is not a var(--space-*) reference
   Everywhere else, values are referenced as var(--token-name). No exceptions,
   no "just this once".

   HOW TO FILL THIS FILE
   Run the derivation helper from references/design-system.md:
       node derive-tokens.mjs <primaryHex> <secondaryHex>
   Paste its :root output over the COLOR PRIMITIVES + SEMANTIC ROLES sections
   below. Filled by the build script.

   Sections marked FIXED are not brand-derived. Do not edit them per project —
   they are the same on every site so that a component built once behaves the
   same everywhere. Changing a FIXED value is a design-system change and needs
   its own note in SITE_STATE.md.
   ========================================================================== */

:root {
  /* ==========================================================================
     1. COLOR PRIMITIVES — DERIVED
     11-step ramps. Step 50 is near-white, 950 is near-black. Exactly one step
     per ramp is the true brand hex (the "anchor"); every other step is derived
     by holding hue and chroma-ratio while stepping OKLCH lightness.
     Never hand-tune a step. Re-run the helper instead.
     ====================================================================== */

  /* --- Primary brand ramp. Anchor step is recorded in DISCOVERY.md. ------- */
  --color-primary-50:  #fff3ec;   /* tint 5 — page washes, hover fills on white */
  --color-primary-100: #ffe3d5;  /* tint 4 — badge/alert backgrounds */
  --color-primary-200: #ffcdb2;  /* tint 3 — dividers on tinted surfaces */
  --color-primary-300: #f9ab82;  /* tint 2 — disabled brand fills */
  --color-primary-400: #e1844f;  /* tint 1 — brand text on DARK surfaces */
  --color-primary-500: #c6621f;  /* mid — large decorative surfaces */
  --color-primary-600: #b45309;  /* shade 1 — default action fill */
  --color-primary-700: #914000;  /* shade 2 — action hover, brand text on light */
  --color-primary-800: #723100;  /* shade 3 — action active/pressed */
  --color-primary-900: #5a2500;  /* shade 4 — dark section backgrounds */
  --color-primary-950: #381400;  /* shade 5 — deepest, footer/hero backdrops */

  /* --- Secondary brand ramp. Accent only. Never the primary CTA color. ---- */
  --color-secondary-50:  #f7f5f4;
  --color-secondary-100: #ece9e7;
  --color-secondary-200: #ddd8d5;
  --color-secondary-300: #c5bfbb;
  --color-secondary-400: #a69e99;
  --color-secondary-500: #88807b;
  --color-secondary-600: #766e69;
  --color-secondary-700: #605955;
  --color-secondary-800: #4b4542;
  --color-secondary-900: #3a3633;
  --color-secondary-950: #1c1917;

  /* --- Neutral ramp, 10 steps. Hue is borrowed from the PRIMARY at very low
         chroma (0.003–0.0085) so greys read as part of the palette instead of
         as a separate grey system pasted in. --------------------------------- */
  --color-neutral-50:  #fcf9f8;   /* page background (light theme) */
  --color-neutral-100: #f6f3f1;  /* subtle zebra / inset fills */
  --color-neutral-200: #e9e5e3;  /* decorative hairline borders */
  --color-neutral-300: #d7d1cf;  /* disabled surfaces */
  --color-neutral-400: #b6b0ad;  /* disabled text (non-essential only) */
  --color-neutral-500: #918b88;  /* input borders — must clear 3:1 */
  --color-neutral-600: #6d6865;  /* muted body text — must clear 4.5:1 */
  --color-neutral-700: #4b4744;  /* secondary headings */
  --color-neutral-800: #2e2b29;  /* dark surfaces */
  --color-neutral-900: #141211;  /* primary body text */

  --color-white: #ffffff;                /* FIXED */
  --color-black: #000000;                /* FIXED — decorative only, never body text bg */

  /* --- Semantic. Hue rotated into the conventional band (success ~148,
         warning ~85, error ~27, info ~245 in OKLCH degrees), then chroma and
         lightness matched to the brand ramp so they harmonize. ------------- */
  --color-success-50:  #e4f8e6;   /* success message background */
  --color-success-100: #c8edcc;  /* success border */
  --color-success-500: #35994c;  /* success icon / large mark */
  --color-success-600: #20863c;  /* success fill */
  --color-success-700: #086929;  /* success TEXT — 4.5:1 verified */

  --color-warning-50:  #fcf1da;
  --color-warning-100: #f3dfb6;
  --color-warning-500: #a47b00;
  --color-warning-600: #8e6a00;
  --color-warning-700: #6e5200;  /* warning TEXT — 4.5:1 verified */

  --color-error-50:  #ffedeb;
  --color-error-100: #ffd6d1;
  --color-error-500: #ca5a50;
  --color-error-600: #b44840;
  --color-error-700: #90332d;      /* error TEXT — 4.5:1 verified */

  --color-info-50:  #e7f4ff;
  --color-info-100: #c8e5ff;
  --color-info-500: #1788d2;
  --color-info-600: #0075ba;
  --color-info-700: #005b91;        /* info TEXT — 4.5:1 verified */

  /* ==========================================================================
     2. SEMANTIC ROLES — DERIVED
     Components reference THESE, not the primitives above. A component that
     reads --color-primary-600 directly cannot be re-themed; one that reads
     --color-action-bg can. Primitives are the palette; roles are the API.
     ====================================================================== */
  --color-bg:             #ffffff;            /* usually --color-neutral-50 */
  --color-bg-subtle:      #fafaf9;     /* usually --color-neutral-100 */
  --color-surface:        #ffffff;       /* cards — usually #ffffff */
  --color-surface-raised: #ffffff;/* modals/popovers */
  --color-surface-inverse:#1c1917;/* dark bands — primary-950 or neutral-900 */

  --color-border:         var(--color-neutral-200);        /* decorative hairlines, no contrast floor */
  --color-border-strong:  var(--color-neutral-500); /* input outlines — 3:1 verified vs bg AND surface */

  --color-text:           #57534e;          /* body — 4.5:1 verified */
  --color-heading:        #1c1917;  /* approved secondary */
  --color-text-muted:     #78716c;    /* captions — 4.5:1 verified */
  --color-text-inverse:   #ffffff;  /* text on --color-surface-inverse */
  --color-text-brand:     var(--color-primary-600);    /* the LIGHTEST brand step clearing 4.5:1 */

  --color-link:           var(--color-primary-600);          /* = --color-text-brand */
  --color-link-hover:     var(--color-primary-700);    /* one step darker */
  --color-link-visited:   var(--color-secondary-700);  /* secondary ramp, 4.5:1 verified */

  --color-action-bg:      var(--color-primary-600);     /* primary button fill */
  --color-action-fg:      #ffffff;     /* label on it — 4.5:1 verified */
  --color-action-bg-hover:var(--color-primary-700);
  --color-action-bg-active:var(--color-primary-800);
  --color-action-bg-disabled:var(--color-neutral-200);

  --color-focus-ring:     #b6540c;    /* 3:1 verified vs bg AND surface */

  /* ==========================================================================
     3. TYPOGRAPHY
     Font families are per-project. Everything else is FIXED.
     Fonts are ALWAYS self-hosted WOFF2. No Google Fonts CDN, ever — the
     consent test treats a font-CDN request as a failure.
     ====================================================================== */
  --font-heading: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;  /* e.g. "Fraunces", Georgia, serif */
  --font-body:    "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;     /* e.g. "Inter", system-ui, sans-serif */
  --font-mono:    ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; /* FIXED */

  /* FIXED fluid scale. Linear interpolation between 360px and 1280px viewports.
     Body NEVER drops below 16px — the min of --font-size-base is exactly 1rem. */
  --font-size-2xs:  clamp(0.75rem, 0.7378rem + 0.0543vw, 0.7813rem);  /* 12 -> 12.5px */
  --font-size-xs:   clamp(0.875rem, 0.8505rem + 0.1087vw, 0.9375rem); /* 14 -> 15px */
  --font-size-sm:   clamp(0.9375rem, 0.913rem + 0.1087vw, 1rem);      /* 15 -> 16px */
  --font-size-base: clamp(1rem, 0.9511rem + 0.2174vw, 1.125rem);      /* 16 -> 18px */
  --font-size-lg:   clamp(1.1875rem, 1.1019rem + 0.3804vw, 1.4063rem);/* 19 -> 22.5px */
  --font-size-xl:   clamp(1.4375rem, 1.3152rem + 0.5435vw, 1.75rem);  /* 23 -> 28px  h4 */
  --font-size-2xl:  clamp(1.6875rem, 1.4918rem + 0.8696vw, 2.1875rem);/* 27 -> 35px  h3 */
  --font-size-3xl:  clamp(2.0625rem, 1.7935rem + 1.1957vw, 2.75rem);  /* 33 -> 44px  h2 */
  --font-size-4xl:  clamp(2.4375rem, 2.0462rem + 1.7391vw, 3.4375rem);/* 39 -> 55px  h1 */
  --font-size-5xl:  clamp(2.9375rem, 2.3995rem + 2.3913vw, 4.3125rem);/* 47 -> 69px  hero */

  --font-weight-regular:  400;  /* FIXED */
  --font-weight-medium:   500;
  --font-weight-semibold: 600;
  --font-weight-bold:     700;

  --line-height-tight:   1.15;  /* FIXED — display/hero only */
  --line-height-heading: 1.25;
  --line-height-snug:    1.4;   /* UI labels, table cells */
  --line-height-body:    1.6;   /* prose — inside the required 1.5–1.7 band */
  --line-height-loose:   1.75;  /* long-form articles */

  --letter-spacing-tight:  -0.02em;  /* FIXED — display sizes only */
  --letter-spacing-normal: 0;
  --letter-spacing-wide:   0.04em;   /* eyebrow/overline text */

  --measure-prose: 68ch;   /* FIXED — inside the required 65–75ch band */
  --measure-narrow: 45ch;  /* pull quotes, form column */

  /* ==========================================================================
     4. SPACING — FIXED. 4px base, 8px rhythm above 24px.
     Every margin, padding and gap on the site is one of these.
     ====================================================================== */
  --space-0:   0;
  --space-1:   0.25rem;  /* 4px  */
  --space-2:   0.5rem;   /* 8px  */
  --space-3:   0.75rem;  /* 12px */
  --space-4:   1rem;     /* 16px */
  --space-5:   1.25rem;  /* 20px */
  --space-6:   1.5rem;   /* 24px */
  --space-8:   2rem;     /* 32px */
  --space-10:  2.5rem;   /* 40px */
  --space-12:  3rem;     /* 48px */
  --space-16:  4rem;     /* 64px */
  --space-20:  5rem;     /* 80px */
  --space-24:  6rem;     /* 96px */
  --space-32:  8rem;     /* 128px */

  /* Fluid composition spacing */
  --space-section-y:     clamp(3rem, 1.8261rem + 5.2174vw, 6rem);      /* 48 -> 96px */
  --space-gutter:        clamp(1rem, 0.6087rem + 1.7391vw, 2rem);      /* 16 -> 32px */
  --space-container-pad: clamp(1.25rem, 0.7609rem + 2.1739vw, 2.5rem); /* 20 -> 40px */

  --container-max: 75rem;      /* 1200px — FIXED */
  --container-prose: 45rem;    /* 720px  — article column */
  --tap-target-min: 2.75rem;   /* 44px   — WCAG 2.2 AA target size floor */

  /* ==========================================================================
     5. RADII — FIXED. Pick ONE personality in Phase 1 by choosing which of the
     three families the components use; do not mix sharp and pill on one site.
     ====================================================================== */
  --radius-none: 0;
  --radius-xs:   0.125rem;  /* 2px  */
  --radius-sm:   0.25rem;   /* 4px  — inputs, small chips */
  --radius-md:   0.5rem;    /* 8px  — buttons, default */
  --radius-lg:   0.75rem;   /* 12px — cards */
  --radius-xl:   1rem;      /* 16px — modals, feature panels */
  --radius-2xl:  1.5rem;    /* 24px — hero media */
  --radius-full: 9999px;    /* pills, avatars */

  /* ==========================================================================
     6. SHADOWS — DERIVED (tint only)
     Layered, and tinted with the NEUTRAL hue rather than pure black. Pure
     black shadows read as dirty grey smudges over a hued palette; a shadow
     carrying the palette's own hue reads as depth.
     20, 18, 17 = the r,g,b triplet of --color-neutral-900, e.g. "18, 19, 20".
     ====================================================================== */
  --shadow-color: 20, 18, 17;
  --shadow-xs: 0 1px 2px 0 rgba(var(--shadow-color), 0.05);
  --shadow-sm: 0 1px 2px 0 rgba(var(--shadow-color), 0.06),
               0 1px 3px 0 rgba(var(--shadow-color), 0.10);
  --shadow-md: 0 2px 4px -1px rgba(var(--shadow-color), 0.06),
               0 4px 8px -2px rgba(var(--shadow-color), 0.10);
  --shadow-lg: 0 4px 6px -2px rgba(var(--shadow-color), 0.05),
               0 12px 20px -4px rgba(var(--shadow-color), 0.12);
  --shadow-xl: 0 8px 12px -4px rgba(var(--shadow-color), 0.06),
               0 24px 40px -8px rgba(var(--shadow-color), 0.16);
  --shadow-inner: inset 0 1px 2px 0 rgba(var(--shadow-color), 0.08);

  /* ==========================================================================
     7. BREAKPOINTS — FIXED
     Custom properties cannot be used inside @media in current browsers, so
     these exist as DOCUMENTATION and for JS that needs the same numbers.
     Media queries below must use the literal px values. This is the one
     sanctioned exception to "no raw values"; the token-lint allowlists
     @media preludes.
     ====================================================================== */
  --bp-sm:  30rem;   /* 480px  */
  --bp-md:  48rem;   /* 768px  — tablet */
  --bp-lg:  64rem;   /* 1024px — small laptop */
  --bp-xl:  80rem;   /* 1280px — desktop, top of the fluid ramp */
  --bp-2xl: 96rem;   /* 1536px */

  /* ==========================================================================
     8. Z-INDEX — FIXED. Nothing on the site uses a z-index outside this list.
     ====================================================================== */
  --z-below:    -1;
  --z-base:      0;
  --z-raised:    10;   /* cards on hover, sticky table headers */
  --z-dropdown:  100;
  --z-sticky:    200;  /* sticky navbar */
  --z-overlay:   300;  /* scrim behind modal/drawer */
  --z-modal:     400;
  --z-popover:   500;  /* tooltips, menus above modals */
  --z-toast:     600;
  --z-consent:   900;  /* consent banner sits above app chrome */
  --z-skiplink:  1000; /* skip-to-content must beat everything */
}

/* ============================================================================
   10. GLOBAL APPLICATION
   The only place tokens are applied to bare elements. Everything else lives in
   a component stylesheet and references tokens.
   ========================================================================= */

html {
  color-scheme: light; /* add " dark" only if dark mode was chosen in Phase 1 */
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-body);
  letter-spacing: var(--letter-spacing-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1 { font-size: var(--font-size-4xl); letter-spacing: var(--letter-spacing-tight); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }

p, li { text-wrap: pretty; }

/* Prose measure. Never justified — ragged right beats rivers of whitespace. */
.prose { max-width: var(--measure-prose); text-align: left; }
.prose > * + * { margin-block-start: var(--space-6); }

a { color: var(--color-link); text-underline-offset: 0.15em; }
a:hover { color: var(--color-link-hover); }
a:visited { color: var(--color-link-visited); }

/* One focus style, site-wide. Never `outline: none` without a replacement. */
:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection {
  background-color: var(--color-primary-200);
  color: var(--color-neutral-900);
}
