/* ============================================================================
   AI COE Playbook — design tokens (T012)
   src/web/tokens.css

   The single source for colour, spacing and type under src/web/. No other file
   under src/web/ defines a colour, a step in a scale, or a font face: a page links
   this file and consumes the custom properties below, and nothing else.

   Why it lives in src/web/ and not brand/: the deploy root is src/web/ (Cloudflare
   Pages, `wrangler pages deploy site`), there is no build step, and no page may
   reference a resource outside the deploy root — a tokens file under brand/
   would not exist on the host. P003 §3.2 named `brand/tokens.css` before that
   constraint was checked; corrected 2026-11-12 in the same commit as this file.

   PALETTE. Midnight navy #0B193C (the field), electric indigo #4338CA and
   #2E27B8 (structure on light surfaces), warm amber (the single accent), white
   #FFFFFF, paper #F7F7F5.

   ONE AMBER — Alex's call, relayed by Ava 2026-11-12: #FBBF24 is the accent and
   #F59E0B is retired. Collapsed here and in the header mark that reads these
   tokens. The SVG sources under brand/marks/ still carry #F59E0B — that is a
   separate change to the mark build, not this file.

   THE THREE MEASURED RULES (source: brand/marks/README.md §"Why the structure is
   white and not indigo"). Every ratio quoted here was recomputed from the hexes
   on 2026-11-12 by the contrast probe written for this run, not copied from the
   README:

     1. ON NAVY, STRUCTURE IS WHITE. Indigo measures 1.72:1 (#2E27B8) and
        2.18:1 (#4338CA) against the navy field; at those ratios a 2px line
        dissolves at favicon size, which is exactly what the first draft of the
        mark candidates did. White on navy is 17.23:1.
     2. INDIGO IS THE LIGHT-SURFACE STRUCTURE COLOUR. #4338CA is 7.90:1 on
        white and 7.37:1 on paper.
     3. AMBER IS USED ONCE, ON NAVY, AS THE ACTIVE ELEMENT. #FBBF24 is 10.32:1
        on navy and 1.56:1 on paper — the retired #F59E0B was 2.00:1 there, so
        the current amber is worse on light and the rule is stricter, not
        looser. On this site the one amber is the active unit of the mark, on
        the mark's own navy field.

   THE TYPE PAIRING — the rest of T012, decided 2026-11-12. Two self-hosted faces,
   declared by the @font-face blocks below and by nothing else. The files, their
   licences, their hashes and the one axis decision are in src/web/fonts/README.md.

     DISPLAY, the field-note voice: Fraunces — a serif with a live optical-size
       axis, so one token draws a 38px title in the display cut and a 20px
       section heading in the text cut. It sets the publication's name and every
       heading: the places the voice is a title. Shipped with SOFT and WONK
       pinned to 0 and removed from the file — the upstream build defaults WONK
       to 1, and its wonky alternates (a slanted e, a hooked y, a curved t) were
       rendered, looked at, and read as a novelty face at masthead size rather
       than as an enterprise governance guide.
     TEXT, running copy and UI: Inter — everything that is not a heading,
       including form controls, which do not inherit a font from the page and so
       have to be given one.
     MONO: no file, a system stack, on purpose. src/web/issue.html (T017) is the
       first page that sets code: an inline command and a file path in running
       copy, at --text-code. It sets them in this stack and ships no third
       webfont, because choosing a typeface is Alex's call and not a design
       round's (T017 section 2; ai-docs/design/brief.md section 3). T012's
       earlier note, that the first code-bearing commit adds a mono face, is
       deferred for that reason. When a face is chosen, it lands here with its
       licence, and no page changes.

   The site sets two weights, both tokens below, and both stated explicitly in
   every `font` shorthand: 400 for copy and inputs, 600 for headings and the
   submit button. A shorthand that omits the weight resets it to 400, so the
   display face is never left to whatever the user agent wanted to do.

   Both faces are the `latin` subset, with the subset's unicode-range declared
   below — it covers U+0000–00FF and, in U+2000–206F, the site's curly quotes and
   em dashes. No italic file for either face: the site sets no italic text, and a
   browser-synthesised oblique is a T014 problem if the template ever needs one.
   ============================================================================ */

/* --- the two faces: self-hosted from src/web/fonts/, same origin, no CDN ------ */

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 100 900;          /* variable: the wght axis, 100–900 */
  font-display: swap;
  src: url("fonts/fraunces-latin-opsz-wght.woff2") format("woff2-variations");
  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-weight: 100 900;          /* variable: the wght axis, 100–900 */
  font-display: swap;
  src: url("fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  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;
}

:root {
  /* --- palette: the only six colours in the system ------------------------- */
  --navy: #0B193C;
  --indigo: #4338CA;        /* structure on light surfaces */
  --indigo-deep: #2E27B8;
  --amber: #FBBF24;         /* the single accent; #F59E0B retired 2026-11-12 */
  --white: #FFFFFF;
  --paper: #F7F7F5;

  /* --- derived: documented mixes of navy and paper, NOT palette colours ---- */
  --ink-muted: #525C74;     /* navy 70% + paper 30% — 6.23:1 on paper, 6.68:1 on white */
  --rule-strong: #818898;   /* navy 50% + paper 50%: 3.55:1 on white, 3.31:1 on paper. A form control's
                               edge, which WCAG 1.4.11 holds to 3:1; --rule is decoration and measures 1.36:1 */
  --rule: #D4D6D9;          /* navy 15% + paper 85% — a hairline, decoration not text */

  /* --- roles: what a page is allowed to say --------------------------------- */
  --field: var(--navy);            /* the navy field: the mark's ground, never a light surface */
  --surface: var(--paper);         /* the page */
  --surface-raised: var(--white);  /* cards and inputs */
  --ink: var(--navy);
  --ink-quiet: var(--ink-muted);
  --structure: var(--indigo);      /* rules, links, borders on light surfaces — rule 2 */
  --structure-on-field: var(--white); /* structure on navy is white — rule 1 */
  --accent: var(--amber);          /* on --field only, once — rule 3 */
  --border: var(--rule);
  --border-control: var(--rule-strong); /* the edge of an input: a boundary a reader has to find */
  --focus: var(--indigo);

  /* --- spacing: a 4px base, 4 to 96 ----------------------------------------- */
  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  /* --- type scale: 17px base, ~1.15–1.2 per step, one display step ---------- */
  --text-sm: 0.875rem;      /* 14px — notes, footer */
  --text-base: 1.0625rem;   /* 17px — body */
  --text-lg: 1.25rem;       /* 20px — section headings, the site name */
  --text-xl: 1.5rem;        /* 24px — standfirst */
  --text-2xl: 1.875rem;     /* 30px — long-read headings */
  --text-3xl: 2.375rem;     /* 38px — the issue's own title */
  --text-code: 0.9375rem;   /* 15px: mono inside 17px copy; a system mono at the
                               body size reads a step larger than Inter (T017) */

  --leading-tight: 1.15;
  --leading-heading: 1.25;
  --leading-body: 1.55;

  /* --- type faces: the pairing, each with the stack it falls back to -------- */
  /* The fallbacks are not decoration: they are what a reader sees while a woff2
     is in flight (font-display: swap) and what a `file://` render shows when the
     font files are missing. Each stack starts with the real face, so a machine
     that already has Fraunces or Inter gets the intended voice. */
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino,
    "Book Antiqua", Georgia, "Times New Roman", serif;
  --font-text: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  /* --- type weights: the two the site sets --------------------------------- */
  --weight-regular: 400;    /* copy, inputs, notes */
  --weight-semibold: 600;   /* headings, in the display face; the submit button */

  --measure: 40rem;         /* 640px box — 592px of text inside the two 24px
                               gutters, 64–72 characters to a full line at 17px,
                               mean 68, counted on the rendered page
                               (ai-docs/evidence/T012-type-render.txt) */

  /* --- shape and targets ---------------------------------------------------- */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-pill: 999px;
  --hairline: 1px;
  --stroke: 3px;            /* the pull-quote's and the figures block's rule (T017) */
  --tap: 44px;              /* the smallest tap target allowed */

  /* --- component sizes ------------------------------------------------------ */
  --mark-inline: 44px;      /* the header mark, mobile: one tap target across */
  --mark-inline-lg: 56px;   /* the header mark, from 40em */
}
