/* Design tokens — ritchot.me
 * Contrast verified programmatically:
 * ink/ground 15.49 (light) 14.68 (dark) · ink-soft 6.98/7.19 · signal 5.66/9.06
 * · vermilion 4.69/5.02 (≥3 accent floor) · ai 5.62/7.31 · code palette ≥4.68 on surface.
 * Two grounds: light "washi" paper and dark "sumi" ink.
 *
 * Mode resolution (D23, manual toggle): dark applies via
 * prefers-color-scheme when no explicit choice, or via
 * :root[data-theme="dark"] when chosen; data-theme="light" forces light.
 * /theme.js sets the attribute from one localStorage key before first
 * paint. THE TWO DARK BLOCKS BELOW MUST STAY IDENTICAL — one covers
 * system-dark, the other the forced override.
 */

:root {
  color-scheme: light dark;

  /* ground and ink scale — washi (light) */
  --ground: #f7f4ef;
  --surface: #eeeae1;
  --ink: #1e1c19;
  --ink-soft: #57534b;
  --ink-faint: #7d786e; /* decorative only (divider, hairline art) */
  --line: #d9d3c7;

  /* accents */
  --vermilion: #c73b27; /* focus states, ≤1 rare accent per viewport */
  --signal: #0c6b76;    /* links */
  --ai: #2f5fb3;        /* 藍 indigo: hero, nav current-page dot, ScholaVal mark */
  --murasaki: #b23879;  /* hero pigment only — never UI */

  /* code palette (on --surface; all pairs ≥4.5:1) */
  --code-keyword: #8d3423;
  --code-string: #3d6647;
  --code-constant: #0c6b76;
  --code-name: #8a4d15;
  --code-comment: #6d6759;

  /* typography */
  --font-serif: 'Source Serif 4', 'Source Serif 4 Fallback', Georgia, serif;
  --font-mono: 'IBM Plex Mono', 'IBM Plex Mono Fallback', ui-monospace, Menlo, monospace;
  --text-base: 19px;

  /* modular scale ≈ 1.25 (rem against 19px root) */
  --text--1: 0.8rem;
  --text-0: 1rem;
  --text-1: 1.25rem;
  --text-2: 1.5625rem;
  --text-3: 1.9531rem;

  --leading-body: 1.65;
  --leading-tight: 1.3;
  --measure: 42rem; /* justified prose measure */

  /* motion */
  --fade-duration: 160ms;
}

:root[data-theme='light'] {
  color-scheme: light;
}

/* dark tokens, system path — MUST MATCH the forced block below */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;

    /* ground and ink scale — sumi (dark) */
    --ground: #101014;
    --surface: #17171d;
    --ink: #e6e2d9;
    --ink-soft: #a49f93;
    --ink-faint: #767268;
    --line: #2c2c34;

    --vermilion: #e05543;
    --signal: #4cc3d0;
    --ai: #78a0f0;
    --murasaki: #e061a6;

    --code-keyword: #e57a68;
    --code-string: #86b28d;
    --code-constant: #4cc3d0;
    --code-name: #d9a15e;
    --code-comment: #8b8578;
  }
}

/* dark tokens, forced path — MUST MATCH the system block above */
:root[data-theme='dark'] {
  color-scheme: dark;

  /* ground and ink scale — sumi (dark) */
  --ground: #101014;
  --surface: #17171d;
  --ink: #e6e2d9;
  --ink-soft: #a49f93;
  --ink-faint: #767268;
  --line: #2c2c34;

  --vermilion: #e05543;
  --signal: #4cc3d0;
  --ai: #78a0f0;
  --murasaki: #e061a6;

  --code-keyword: #e57a68;
  --code-string: #86b28d;
  --code-constant: #4cc3d0;
  --code-name: #d9a15e;
  --code-comment: #8b8578;
}
