/* The QOR design tokens (T-116 §1.1, extended by T-119 §1.1) — the ONE :root
   custom-property layer the shell + every UI component consume. Loaded BEFORE
   shell.css everywhere shell.css loads (the /app head AND the welcome head), and
   part of the T-112 shell contract (SW precache + shell-version hash) so a
   tokens-only edit rolls the cache name.

   INK ON WHITE (decision #87, founder ruling 2026-08-30) replaces the warm-light
   register of T-116: white ground, black ink that is also the action colour —
   actions are typographic, an underlined word or a black button — one colour,
   saperavi, for "here" and for consequence. The dark palette is Pirosmani's
   oilcloth, member-chosen: it follows the device (prefers-color-scheme) and a
   `data-theme` stamp on <html> overrides it either way (the switch in Your
   rhythm is house-phase work). The token NAMES stay (--paper, --amber, --pine…)
   so shell.css needs no rename; their meanings are re-stated below. Type: one
   face for everything (decision 9, ruled with #87) — FiraGO, self-hosted
   (T-259): it sets Latin and Georgian as one family, so a mixed line never
   changes voice mid-sentence. The budget is ~20 KB per Latin style and
   ~6.5 KB per Georgian style actually used (unicode-range: a Latin-only page
   never fetches a Georgian file), content-hashed names cached `immutable` and
   held by the SW in its own `qor-fonts` cache, so a tokens edit never
   re-downloads a font. qor.domain never sees a token. */

/* ── FiraGO (T-259; SIL OFL 1.1, /fonts/FiraGO-OFL.txt) — five styles × two
   scripts. The ranges are the subsetter's (fonts/README.md); `bb fonts`
   regenerates the files and prints this block. swap: text paints at once in
   the fallback and settles into FiraGO, never invisible while it loads. ──── */
@font-face { font-family: "FiraGO"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/FiraGO-Regular-latin.de17312661.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "FiraGO"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/FiraGO-Regular-georgian.fc9506ef72.woff2") format("woff2");
  unicode-range: U+10A0-10FF, U+1C90-1CBF, U+2D00-2D2F; }
@font-face { font-family: "FiraGO"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("/fonts/FiraGO-Medium-latin.058e92ecd4.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "FiraGO"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("/fonts/FiraGO-Medium-georgian.6ea0f8a2a3.woff2") format("woff2");
  unicode-range: U+10A0-10FF, U+1C90-1CBF, U+2D00-2D2F; }
@font-face { font-family: "FiraGO"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/fonts/FiraGO-SemiBold-latin.2075a72c76.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "FiraGO"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/fonts/FiraGO-SemiBold-georgian.79618517a8.woff2") format("woff2");
  unicode-range: U+10A0-10FF, U+1C90-1CBF, U+2D00-2D2F; }
@font-face { font-family: "FiraGO"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/fonts/FiraGO-Bold-latin.8dd3d44f9e.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "FiraGO"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/fonts/FiraGO-Bold-georgian.14c9c196c7.woff2") format("woff2");
  unicode-range: U+10A0-10FF, U+1C90-1CBF, U+2D00-2D2F; }
@font-face { font-family: "FiraGO"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("/fonts/FiraGO-Italic-latin.c48e9719b4.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "FiraGO"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("/fonts/FiraGO-Italic-georgian.07a7fb24d8.woff2") format("woff2");
  unicode-range: U+10A0-10FF, U+1C90-1CBF, U+2D00-2D2F; }

:root {
  color-scheme: light dark;

  /* ── ink on white — the light palette (decision #87) ────────────────────── */
  --paper: #FFFFFF;   /* the page ground */
  --ink:   #141414;   /* body text — and the action colour (18.4:1) */
  --muted: #666666;   /* secondary text, calm refusals (5.7:1) */
  --line:  #D9D9D9;   /* hairlines, card + field borders */
  --amber: #141414;   /* THE ACTION — links (underlined), primary buttons (black). Name kept for shell.css. */
  --pine:  #141414;   /* affirmation/success — plain ink; nothing shouts */
  --here:  #7A1F3A;   /* saperavi — the ring/dot that says here (10.1:1) */
  --conseq:#7A1F3A;   /* saperavi — the two acts that end something */
  --accent: var(--amber);

  /* ── derived values (T-119 §1.1, re-pointed) ────────────────────────────── */
  --paper-raised: #FFFFFF;                 /* cards, inputs, toasts — same as the ground; the line does the work */
  --wash:         #F1F1F1;                 /* working-surface fill, hover fill, selected pill */
  --line-strong:  #BFBFBF;                 /* emphasized rules: quote rail, working borders  */
  --amber-deep:   #000000;                 /* hover state of actions/links                   */
  --ring:         rgba(20, 20, 20, 0.22);  /* the one focus ring (ink at 22%)                */
  --scrim:        rgba(20, 20, 20, 0.35);  /* the modal veil                                 */
  --shadow-soft:  0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.06);
  --ease:         120ms ease-out;          /* color/border/background only, ever             */

  /* ── spacing scale (§1.1: 4/8/12/16/24/32/48) ───────────────────────────── */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;

  /* ── type scale (T-119: the editorial register — confident, not shouty) ─── */
  --text-sm:   0.9rem;
  --text-base: 1rem;
  --text-lg:   1.15rem;
  --step-1:    1.2rem;    /* h3 */
  --step-2:    1.45rem;   /* h2, the wordmark */
  --step-3:    1.9rem;    /* h1, the publication title */
  --leading:   1.5;
  --leading-tight: 1.2;

  /* the reading voice: serif bodies on reading surfaces (T-119 §1.1) */
  --text-reading:    1.05rem;
  --leading-reading: 1.65;

  /* the overline: the meta voice (T-119 §1 move 2) — dates, states, labels */
  --overline-size: 0.72rem;
  --overline-ls:   0.08em;

  /* ── radius ─────────────────────────────────────────────────────────────── */
  --radius:    6px;
  --radius-sm: 4px;

  /* ── font stacks — one face for everything (decision 9, 2026-08-30) ──────
     FiraGO leads (T-259, the @font-face block above); the system stack behind
     it is the swap-period fallback and the face for any codepoint outside the
     two subsets. --font-serif keeps its name (28 uses) and resolves to the same
     stack. The reader's inline sheet (publications.clj) lifts the @font-face
     block above verbatim at load (decision #99) — this file stays the one
     place the hashed font files are named. */
  --font-system: "FiraGO", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Georgian", sans-serif;
  --font-serif:  var(--font-system);

  /* ── Georgian is set as a Georgian sets it (T-259 §4): one step up the type
     scale (base 1rem → the 1.05rem reading step, reading 1.05rem → the 1.15rem
     -lg step) and 1.65 leading throughout — Mkhedruli's tall ascenders and
     descenders crowd at 1.5. Applied by the ONE :lang(ka) rule below; <html
     lang> is the negotiated locale on every head. */
  --text-base-ka:    1.05rem;
  --text-reading-ka: 1.15rem;
  --leading-ka:      1.65;

  /* ── layout constants ───────────────────────────────────────────────────── */
  --measure: 40rem;   /* the single-column reading measure */
  --tap:     44px;    /* the minimum tap target (T-112 §1.4) */
}

/* the Georgian re-point (T-259 §4) — the only :lang rule; no override elsewhere */
:root:lang(ka) {
  --text-base:       var(--text-base-ka);
  --text-reading:    var(--text-reading-ka);
  --leading:         var(--leading-ka);
  --leading-reading: var(--leading-ka);
}

/* ── oilcloth — the dark palette (decision #87): Pirosmani's ground, his whites,
   his ochre for the one action, thinned blue for here, dark cherry lifted for
   consequence. Follows the device; data-theme on <html> wins either way. ── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #161413; --ink: #EDE6D6; --muted: #A89F91; --line: #3B3632;
    --amber: #D9A441; --pine: #EDE6D6; --here: #9FB8C8; --conseq: #D8626B;
    --paper-raised: #1F1C1A; --wash: #2A2623; --line-strong: #4A443F;
    --amber-deep: #E8B85A; --ring: rgba(217, 164, 65, 0.3); --scrim: rgba(0, 0, 0, 0.55);
    --shadow-soft: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
  }
}
:root[data-theme="dark"] {
  --paper: #161413; --ink: #EDE6D6; --muted: #A89F91; --line: #3B3632;
  --amber: #D9A441; --pine: #EDE6D6; --here: #9FB8C8; --conseq: #D8626B;
  --paper-raised: #1F1C1A; --wash: #2A2623; --line-strong: #4A443F;
  --amber-deep: #E8B85A; --ring: rgba(217, 164, 65, 0.3); --scrim: rgba(0, 0, 0, 0.55);
  --shadow-soft: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
}
