/* Tokens. The palette is the Spov app's, copied by hand from spov-gh
   web/src/styles/global.css with the same names and values: update it
   here when the app's changes. Three drawing colours are added from the
   CLI launcher's palette (spov-gh internal/cli/launchview.go).
   @decision(DL-004) */
:root {
  color-scheme: light;
  --paper: #ebeae6;
  --raised: #f6f5f2;
  --sunk: #e1e0db;
  --rule: #d4d3cd;
  --rule-2: #bebcb4;
  --ink: #23211d;
  --soft: #59564e;
  --faint: #67635a;
  --olive: #5f7343;
  --olive-b: #4c5d35;
  --rust: #9a4724;
  --gold: #96741f;
  --gold-t: #765b15;
  --stone: #68645b;
  --on-accent: #f6f5f2;
  /* Drawing only, never text or state: the launcher's warm bird (darkened
     to hold 3:1 on paper), its pale cool flock and its earth ground. */
  --bird: #8f6a3a;
  --flock: #6b8299;
  --earth: #6b5a45;
  /* The OpenCode TUI sketch: a diff's removed and added lines, tinted
     from the panel with the page's own rust and olive. */
  --tui-del: color-mix(in srgb, var(--rust) 16%, var(--raised));
  --tui-add: color-mix(in srgb, var(--olive) 20%, var(--raised));

  --sans: "Atkinson Hyperlegible Next", system-ui, sans-serif;
  /* A glyph missing from Atkinson Mono falls through to Spov Cells, never
     to a system font with a different advance. */
  --mono: "Atkinson Hyperlegible Mono", "Spov Cells", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* The cell. Atkinson Mono advances 0.632 em, and a row of 1.3 em is
     the face's own content box, so box-drawing lines join and a cell is
     about 1:2, like a terminal's. Columns below are counted in cells. */
  --cell-fs: 16px;
  --cw: calc(var(--cell-fs) * 0.632);
  --rh: calc(var(--cell-fs) * 1.3);
  --cols: 112;
  --gutter: 32px;

  /* Below the hero: a reading size, and two smaller steps for notes and
     controls. */
  --t-sm: 0.8125rem;   /* 13, controls */
  --t-md: 0.875rem;    /* 14, captions and marginal notes */
  --t-read: 1.0625rem; /* 17, running text */
  /* The margin column and the reading column. The margin is counted in
     cells, so the reading column starts on the hero's grid, 28 cells in. */
  --margin-w: calc(24 * var(--cw));
  --margin-gap: calc(4 * var(--cw));
  --measure: 36rem;
  --section: 9rem;
}

/* The dark values, applied by the OS preference unless light is pinned,
   and by an explicit data-theme="dark". */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #16181a;
    --raised: #1d2023;
    --sunk: #121416;
    --rule: #2b3034;
    --rule-2: #3a4146;
    --ink: #e4e2dc;
    --soft: #a29c90;
    --faint: #8f887a;
    --olive: #9db577;
    --olive-b: #b2c78f;
    --rust: #d98a5e;
    --gold: #d4ac5a;
    --gold-t: #d4ac5a;
    --stone: #938d81;
    --on-accent: #16181a;
    --bird: #ecd071;
    --flock: #6b8299;
    --earth: #8a7a5f;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #16181a;
  --raised: #1d2023;
  --sunk: #121416;
  --rule: #2b3034;
  --rule-2: #3a4146;
  --ink: #e4e2dc;
  --soft: #a29c90;
  --faint: #8f887a;
  --olive: #9db577;
  --olive-b: #b2c78f;
  --rust: #d98a5e;
  --gold: #d4ac5a;
  --gold-t: #d4ac5a;
  --stone: #938d81;
  --on-accent: #16181a;
  --bird: #ecd071;
  --flock: #6b8299;
  --earth: #8a7a5f;
}

/* Below 960 px the margin column folds away; sections close up and the
   reading size steps down to 16 px.
   @decision(DL-004) */
@media (max-width: 959px) {
  :root {
    --section: 5.5rem;
    --t-read: 1rem;
  }
}
/* Narrow: the cell shrinks so the 39-column curlew fills the column
   exactly, and everything counted in cells shrinks with it. The hero
   script refines it from the real column width. */
@media (max-width: 639px) {
  :root {
    --gutter: 16px;
    --cell-fs: min(16px, calc((100vw - 32px) / 24.7));
  }
}
