/* Design tokens: the only place colours, type and spacing are defined
   (context/brand-guide.md). Dark is the default; light overrides below. */
:root {
  --red: #d90202;
  --maroon: #390707;
  --brand-deep: #4f0000;
  --bg: #121212;
  --surface: #1a1a1a;
  --surface-2: #292929;
  --line: #3d3d3d;
  --text: #f2f2f2;
  --text-muted: #9a9a9a;
  --link: #bbc2fc;
  --text-dim: #9a9a9a;
  --on-red: #ffffff;
  --on-maroon: #ffffff;
  --glow: rgb(217 2 2 / 0.85);
  --line-active: rgb(57 7 7 / 0.55);
  --scrim: rgb(0 0 0 / 0.55);
  /* Areas are told apart by tone, space and shadow, not by rules (spec 2026-10-21-shell-redesign). */
  --hover: rgb(255 255 255 / 0.07);
  --shadow: 0 10px 30px rgb(0 0 0 / 0.45), 0 1px 3px rgb(0 0 0 / 0.35);
  --shadow-up: 0 -8px 24px rgb(0 0 0 / 0.35);
  --hero-glow: rgb(79 0 0 / 0.45);   /* behind the home page's opening lines */
  /* Glass: the player, menus, the word card, dialogs and the chapter sheet float over the page,
     which shows through blurred. Opaque enough that text on it passes contrast over the page
     (tests/contrast-test.php: "glass over ..."). */
  --glass: rgb(38 38 38 / 0.78);
  --glass-edge: rgb(255 255 255 / 0.1);
  --glass-shine: inset 0 1px 0 rgb(255 255 255 / 0.06);
  --glass-blur: blur(24px) saturate(1.6);
  /* Red as text and as the focus ring: --red itself is under 4.5:1 for small text on the dark
     current-line tint and under 3:1 on --surface-2 (tests/contrast-test.php). */
  --red-text: #ff4d4d;
  --focus: #ff4d4d;   /* focus rings */
  /* The share-a-line picture (js/share.js) is always dark, like the Open Graph pictures:
     these are not redefined for the light theme. */
  --share-bg: #121212;
  --share-text: #f2f2f2;
  --share-muted: #9a9a9a;

  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* Chinese prose and interface text (summaries, commentary, glosses, notes, term intros, pages):
     the reader's own system fonts, so the Kai web font stays the size of the book's characters. */
  --font-zh-prose: "Songti SC", "STSong", "Noto Serif CJK SC", "Noto Serif SC", "Source Han Serif SC", "Source Han Serif CN", "Microsoft YaHei", serif;
  /* Latin in Source Serif; Chinese in running text falls through to the prose fonts. */
  --font-text: "DDJ Serif", Georgia, "Times New Roman", var(--font-zh-prose);
  /* The classical text only (chapter lines, word and term characters, chapter titles: ddj_kai_text()
     in src/assets.php lists it, and the subset holds just that). The DDJ Kai subset is simplified-only:
     traditional characters (phase 4 §3) fall through to the system Kai fonts, the traditional ones
     (Kaiti TC, BiauKai, DFKai-SB) included. */
  --font-zh: "DDJ Kai", "KaiTi", "STKaiti", "Kaiti SC", "Kaiti TC", "BiauKai", "DFKai-SB", serif;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: 2rem;
  --zh-size: 1.6rem;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.5rem;
  --radius: 12px;
  --sheet-radius: 18px;
  --measure: 38rem;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #faf8f5;
  --surface: #ffffff;
  --surface-2: #f0ece6;
  --line: #ddd6cc;
  --text: #1a1a1a;
  --text-muted: #5f5a54;
  --link: #8a0101;
  --text-dim: #6b655e;
  --glow: rgb(217 2 2 / 0.45);
  --line-active: rgb(217 2 2 / 0.08);
  --red-text: #b80000;
  --focus: var(--red);
  --hover: rgb(0 0 0 / 0.05);
  --shadow: 0 10px 30px rgb(60 40 20 / 0.14), 0 1px 3px rgb(60 40 20 / 0.12);
  --shadow-up: 0 -8px 24px rgb(60 40 20 / 0.10);
  --hero-glow: rgb(217 2 2 / 0.07);
  --glass: rgb(255 255 255 / 0.72);
  --glass-edge: rgb(60 40 20 / 0.1);
  --glass-shine: inset 0 1px 0 rgb(255 255 255 / 0.8);
  color-scheme: light;
}
