/* identity.css — fonts and color tokens for "the drafting table" (concept A,
   2026-10-22). Loaded by EVERY route now, straight after kit/base.css; the
   look itself lives in drafting.css, loaded last.

   HOW THIS WORKS WITHOUT RIPPING OUT kit/base.css (pinned by hash): that
   file reads every color and font through custom properties on :root
   (--paper, --ink, --accent, --sans, --mono, ...). This file redeclares
   them, so every kit rule repaints with the same markup and classes.

   SCREEN ONLY. Every token below sits inside `@media screen`. On paper the
   kit's own tokens stand exactly as they do on main, so the printable
   sheet (which sets its labels in var(--mono)) prints the same bytes. The
   one exception is `/`, whose prose printout used this file's tokens before
   the redesign; the print block at the bottom restores them there, value for
   value, so `/` prints the same bytes as before too.

   Self-hosted OFL families, Latin subsets, each with its OFL.txt beside it
   (tests/structure.js checks both): Kalam for hand-lettered headings and
   labels on screen, Atkinson Hyperlegible for everything that is read or
   operated. Barlow Semi Condensed and B612 Mono are only `/`'s print faces
   (headings and readouts), kept so that printout does not change.
   Kalam (bold only) is `optional` and preloaded by every page: if it is not
   there in time the first paint keeps the fallback and nothing reflows later. With no font-src directive the CSP
   falls back to default-src 'self', which covers these files. */

@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/atkinson-hyperlegible/400.woff2") format("woff2");
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/atkinson-hyperlegible/700.woff2") format("woff2");
}
@font-face {
  font-family: "Kalam";
  font-style: normal;
  font-weight: 700;
  font-display: optional;
  src: url("fonts/kalam/700.woff2") format("woff2");
}

@font-face {
  font-family: "Barlow Semi Condensed";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/barlow-semi-condensed/600.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow Semi Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/barlow-semi-condensed/700.woff2") format("woff2");
}
@font-face {
  font-family: "B612 Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/b612-mono/400.woff2") format("woff2");
}
@font-face {
  font-family: "B612 Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/b612-mono/700.woff2") format("woff2");
}

@media screen {
  :root {
    /* Drafting vellum on a walnut table, drawn in navy drafting ink. */
    --paper: #F3EEDF;         /* vellum */
    --panel: #FFFDF6;         /* a fresh sheet */
    --ink: #1C2A3F;           /* drafting ink */
    --ink-soft: #46516A;
    --line: #DDD3BA;
    --line-strong: #8C7C56;   /* pencil-box tan, 3.9:1 on --panel for control edges */
    --accent: #1F4F8F;        /* blueprint blue, this site's interactive color */
    --accent-soft: #E3EAF5;
    --focus: #0f62fe;         /* the house focus-ring blue: a safety color, not a brand one */
    --pass: #197a3d;
    --pass-soft: #e2f2e7;
    --fail: #b3261e;
    --fail-soft: #fbe9e7;
    --warn: #8a5300;
    --readout-bg: #1A1611;    /* ebony scale */
    --readout-ink: #F6EBD3;
    --readout-dim: #CDB78A;

    --brass: #B5832A;
    --brass-hi: #E9C46A;
    --boxwood: #E8CF9A;
    --walnut: #3B2616;
    --walnut-hi: #5A3B22;
    --cream: #F6EAD2;
    --pencil-red: #B3261E;
    --grid-ink: rgba(31, 79, 143, .09);
    --grid-ink-major: rgba(31, 79, 143, .17);

    --sans: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto,
            "Helvetica Neue", Arial, sans-serif;
    /* Readouts keep a tabular, upright face: Atkinson with tabular figures
       (drafting.css turns them on) rather than a third family. */
    --mono: "Atkinson Hyperlegible", ui-monospace, "SF Mono", "Cascadia Code",
            Menlo, Consolas, monospace;
    --hand: "Kalam", "Atkinson Hyperlegible", "Segoe Print", "Bradley Hand", cursive;
    /* bench.css reads --tick for the blade numerals and the wordmark. */
    --tick: "Atkinson Hyperlegible", "Arial Narrow", system-ui, sans-serif;
  }

  ::selection { background: #FFE39A; color: #1C2A3F; }
}

@media screen and (prefers-color-scheme: dark) {
  :root {
    /* Dark mode is the blueprint: cyanotype blue, white linework. */
    --paper: #0E2A4C;
    --panel: #12345C;
    --ink: #EEF4FB;
    --ink-soft: #BCD0E6;
    --line: #2C5584;
    --line-strong: #7E9FC6;
    --accent: #A9D0FF;
    --accent-soft: #1B4373;
    --focus: #FFD166;         /* the blue ring vanishes on blueprint; amber reads 9:1 */
    --pass: #7BE3A2;
    --pass-soft: #12402A;
    --fail: #FF9F96;
    --fail-soft: #43201E;
    --warn: #F2B864;
    --readout-bg: #08182C;
    --readout-ink: #F6EBD3;
    --readout-dim: #C9B48A;

    --boxwood: #E2C48C;
    --walnut: #22160D;
    --walnut-hi: #3B2616;
    --grid-ink: rgba(220, 236, 255, .07);
    --grid-ink-major: rgba(220, 236, 255, .15);
    color-scheme: dark;
  }
  ::selection { background: #5a4a12; color: #F7F8F4; }
}

/* `/` only (it is the one page with a #bench): paper gets back exactly what
   this file gave it before the redesign, the tokens, the two print faces and
   the heading rule, light and dark. `:where()` keeps each selector at the
   specificity it had then (`:root` for the tokens, the bare element for h1-h3), so the cascade on paper is unchanged. Every other
   route prints on kit tokens, as it always has. tests/pages-live.js checks
   the faces; the PR's print-diff proof compares the PDFs. */
@media print {
  :root:where(:has(#bench)) {
    --paper: #F7F8F4;
    --panel: #ffffff;
    --ink: #16191B;
    --ink-soft: #4B5553;
    --line: #D6DBD5;
    --line-strong: #8CC2AE;
    --accent: #1E5B4F;
    --accent-soft: #E7F1EC;
    --focus: #0f62fe;
    --pass: #197a3d;
    --pass-soft: #e2f2e7;
    --fail: #c0231b;
    --fail-soft: #fbe9e7;
    --warn: #9a5b00;
    --readout-bg: #16191B;
    --readout-ink: #F7F8F4;
    --readout-dim: #9db3ab;

    --sans: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto,
            "Helvetica Neue", Arial, sans-serif;
    --mono: "B612 Mono", ui-monospace, "SF Mono", "Cascadia Code", "Segoe UI Mono",
            Menlo, Consolas, monospace;
    --tick: "Barlow Semi Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  }
  :where(:root:has(#bench)) h1,
  :where(:root:has(#bench)) h2,
  :where(:root:has(#bench)) h3,
  :where(:root:has(#bench)) .brand b {
    font-family: var(--tick);
  }
  :where(:root:has(#bench)) h1 { font-weight: 700; }
  :where(:root:has(#bench)) h2,
  :where(:root:has(#bench)) h3 { font-weight: 700; }
}

@media print and (prefers-color-scheme: dark) {
  :root:where(:has(#bench)) {
    --paper: #111416;
    --panel: #171b1d;
    --ink: #E6EAE7;
    --ink-soft: #A2ADA9;
    --line: #283130;
    --line-strong: #37433f;
    --accent: #8CC2AE;
    --accent-soft: #1b2a26;
    --pass: #5fd68a;
    --pass-soft: #163123;
    --fail: #ff8d85;
    --fail-soft: #371a17;
    --readout-bg: #0B0D0E;
    --readout-ink: #F7F8F4;
    --readout-dim: #7c8f88;
    color-scheme: dark;
  }
}
