/* =====================================================================
   Coo Intelligence Agency — shared site tokens (CANONICAL, applied in D3)
   ---------------------------------------------------------------------
   THE one token set for the public pages. This file is the source:

     website/src/styles/tokens.css            (this file — edit HERE)
       -> imported by website/src/styles/global.css (every Astro page,
          and so the carved /support + /delete-account Worker pages)
       -> copied BYTE-FOR-BYTE to docs/marketing/landing/public/tokens.css
          (the hand-written Worker pages: / and /deck link it)
     website/public/fonts/*.woff2
       -> copied to docs/marketing/landing/public/fonts/

   Never edit a copy. After editing this file or a font, run
       python3 tools/sync_site_tokens.py
   `tools/sync_site_tokens.py --check` (make guards + CI) reds on any drift.
   `tools/check_css_token_drift.py` holds the tier-1 hexes to
   docs/brand/design-tokens.json.

   Values: docs/brand/design-tokens.json + DESIGN.md, plus the
   PAPER-SURFACE tier (owner Q5 = manila sheets) and the self-hosted deck
   type system (owner Q6 = Libre Baskerville / Special Elite / Public
   Sans). Font URLs are root-absolute (/fonts/…) so the SAME bytes work on
   the Astro site and on the Worker. Contrast table:
   docs/design/site-redesign-2026-11/README.md §2 and the D3 PR body.

   Three tiers:  1 reference (raw values)  →  2 semantic (by surface + role)
                 →  3 component (one block per pattern).
   Component CSS must reference tier 2/3 only — never a tier-1 hex.
   ===================================================================== */

/* ---------- Fonts: self-hosted, latin subset, swap -------------------
   ~216 KB for all eight faces. The two Public Sans italics are the
   uswds/public-sans v2.001 release WOFF2s as shipped (not subset; no
   fonttools here) — ~35 KB each, fetched only when italic is used.
   A page preloads at most ONE (the face its hero sets). No Google
   Fonts request: no visitor IP leaves the site.  */
@font-face { font-family: "Libre Baskerville"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/libre-baskerville-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Libre Baskerville"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("/fonts/libre-baskerville-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Libre Baskerville"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/fonts/libre-baskerville-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Special Elite"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/special-elite-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/public-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/fonts/public-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("/fonts/public-sans-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-style: italic; font-weight: 600; font-display: swap;
  src: url("/fonts/public-sans-latin-600-italic.woff2") format("woff2"); }

:root {
  /* ================= TIER 1 — reference =================== */
  /* the drawer (dark) */
  --ref-drawer-900: #0d0b08;   /* = redact */
  --ref-drawer-800: #14110c;   /* = bg */
  --ref-drawer-700: #1d1813;   /* = panel */
  --ref-drawer-600: #2e2820;   /* = Unity SurfaceAlt */
  --ref-drawer-500: #3a332a;   /* = rule */
  /* the documents (manila) */
  --ref-manila-100: #efe9da;   /* = Unity CardAlt — a fresher sheet */
  --ref-manila-200: #e9e2d0;   /* = paper */
  --ref-manila-300: #d8cbb0;   /* = Unity CardEdge */
  --ref-manila-400: #b9af97;   /* = Unity InkLine — rules drawn on paper */
  --ref-folder:     #ecd69a;   /* = Unity FolderManila — the folder TAB, never a text bg for long copy */
  /* inks */
  --ref-ink-900: #1a1712;      /* = ink */
  --ref-ink-600: #5c5242;      /* = Unity InkDim */
  --ref-muted:   #9a917f;      /* = muted (dark surfaces only) */
  /* brass / gold */
  --ref-gold-400: #c8a24a;     /* = accent — THE brand accent */
  --ref-gold-ink: #66501f;     /* = Unity BrassInk — gold's hue, darkened to read on manila */
  --ref-gold-on:  #18130a;     /* = accent_text */
  /* stamp red */
  --ref-red-500: #b6402f;      /* = danger — large text, borders, fills */
  --ref-red-300: #e0705a;      /* = danger_text — normal-size red on dark */
  --ref-red-700: #9c3320;      /* stamp-on-paper — normal-size red on manila */
  /* paper wear */
  --ref-coffee: #6b4a2b;       /* = Unity CoffeeRing */
  --ref-steel:  #6d7277;       /* = Unity ClipSteelDark */

  /* ================= TIER 2 — semantic ==================== */
  /* -- dark surface (the drawer: page, nav, hero, footer) -- */
  --color-page:            var(--ref-drawer-800);
  --color-surface:         var(--ref-drawer-700);
  --color-surface-raised:  var(--ref-drawer-600);
  --color-text:            var(--ref-manila-200);
  --color-text-muted:      var(--ref-muted);
  --color-rule:            var(--ref-drawer-500);
  --color-accent:          var(--ref-gold-400);
  --color-on-accent:       var(--ref-gold-on);
  --color-alert-text:      var(--ref-red-300);
  --color-focus:           var(--ref-gold-400);

  /* -- paper surface (every RECORD: dossier card, /d sheet, home demo) -- */
  --paper:                 var(--ref-manila-200);
  --paper-fresh:           var(--ref-manila-100);
  --paper-edge:            var(--ref-manila-300);
  --paper-rule:            var(--ref-manila-400);
  --paper-ink:             var(--ref-ink-900);
  --paper-ink-soft:        var(--ref-ink-600);   /* never --color-text-muted on paper (R3) */
  --paper-brass:           var(--ref-gold-ink);  /* gold-role text on paper (R6) */
  --paper-stamp:           var(--ref-red-700);   /* small red on paper */
  --paper-stamp-large:     var(--ref-red-500);   /* borders and rules only (non-text, 3:1); never stamp text */
  --redact:                var(--ref-drawer-900); /* belongs on paper (R4): 15.2:1 */

  /* -- type families: one role each -- */
  --font-record: "Libre Baskerville", Georgia, "Times New Roman", serif;     /* the sincere voice: Section A, headings, species */
  --font-bureau: "Special Elite", "Courier New", Courier, monospace;         /* the Bureau typewriter: stamps, file labels, codes. ≥ 0.8rem, never body */
  --font-body:   "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; /* UI + running copy */

  /* -- type scale: 1.25 (major third) on a 1rem body; display steps are fluid -- */
  --text-label:   0.8rem;    /* Special Elite floor (DESIGN.md label floor is 0.72; the typewriter needs more) */
  --text-small:   0.875rem;
  --text-body:    1rem;
  --text-lead:    1.125rem;
  --text-h3:      1.25rem;
  --text-h2:      clamp(1.5rem, 1.2rem + 1.2vw, 1.95rem);
  --text-h1:      clamp(2rem, 1.4rem + 2.6vw, 3.05rem);
  --text-display: clamp(2.4rem, 1.3rem + 5vw, 4.75rem);
  --leading-tight: 1.12;
  --leading-body:  1.6;     /* sans */
  --leading-serif: 1.72;    /* serif body runs a little looser */
  --tracking-bureau: 0.06em; /* Special Elite is already wide; no all-caps tracking games */
  --measure: 66ch;

  /* -- space: 4px grid (DESIGN.md §5) -- */
  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem;
  --space-6: 1.5rem;  --space-8: 2rem;   --space-12: 3rem;   --space-16: 4rem; --space-24: 6rem;
  --gutter: 16px;                          /* phone side gutter */
  --container: 1120px;                     /* page frame (the deck's width) */
  --container-text: 860px;                 /* reading frame (the old site width) */

  /* -- radius: 2 / 3 / 5 (DESIGN.md) — paper is barely rounded, never pills -- */
  --radius-sm: 2px; --radius-md: 3px; --radius-lg: 5px;

  /* -- texture (CSS only — no images, no blur filters; ~700 cards on /field-guide) -- */
  --texture-paper:
    radial-gradient(120% 90% at 12% 8%, rgba(255,255,255,.35), transparent 55%),
    radial-gradient(90% 70% at 88% 96%, rgba(107,74,43,.10), transparent 60%);
  --shadow-sheet:   0 1px 0 rgba(0,0,0,.35), 0 14px 30px -12px rgba(0,0,0,.65);
  --shadow-vignette: inset 0 0 28px rgba(90,70,40,.13);
  --lamp: radial-gradient(70% 60% at 18% 0%, rgba(200,162,74,.13), transparent 70%);

  /* -- motion -- */
  --ease-out: cubic-bezier(.2,.7,.2,1);
  --dur-reveal: 180ms;   /* the redaction reveal — the signature motion */
  --dur-stamp:  320ms;   /* the one stamp "thunk" per page */
  --dur-fast:   150ms;

  /* ================= TIER 3 — component =================== */
  --sheet-bg:          var(--paper);
  --sheet-ink:         var(--paper-ink);
  --sheet-border:      var(--paper-edge);
  --sheet-radius:      var(--radius-md);
  --sheet-pad:         clamp(1.25rem, 3vw, 2.5rem);
  --stamp-ink:         var(--paper-stamp);         /* stamp TEXT: #9c3320, 5.59:1 on paper, AA at any size */
  --stamp-border:      3px double var(--paper-stamp-large);
  --redact-bar:        var(--redact);
  --redact-reveal-underline: var(--paper-brass);
  --cta-bg:            var(--color-accent);
  --cta-ink:           var(--color-on-accent);
  --cta-radius:        var(--radius-md);
  --focus-ring:        2px solid var(--color-focus);
  --label-font:        var(--font-bureau);
  --label-size:        var(--text-label);
  --clip-steel:        var(--ref-steel);          /* paperclip wire (decoration) */
  --coffee-ring:       rgba(107,74,43,.16);       /* --ref-coffee at 16%: the ring on every 3rd card */
  --tape:              rgba(236,214,154,.78);     /* --ref-folder at 78%: tape over a pasted-in print */
  --redact-edge:       var(--ref-muted);          /* 1px edge so a bar left on the DARK page still reads (R4, 6.0:1) */
}

/* Reduced motion: the reveal and the stamp land in their settled state. */
@media (prefers-reduced-motion: reduce) {
  :root { --dur-reveal: 0ms; --dur-stamp: 0ms; --dur-fast: 0ms; }
}

/* High-contrast preference: drop texture, harden edges. */
@media (prefers-contrast: more) {
  :root {
    --texture-paper: none;
    --shadow-vignette: none;
    --paper-ink-soft: var(--ref-ink-900);
    --color-text-muted: var(--ref-manila-200);
  }
}
