/*
 * Every interface colour, as a variable named for its role (TD-SET-2).
 *
 * Two kinds: neutral variables (surfaces, text, lines, and the few roles whose
 * contrast depends on the surface under them) are the only thing a theme
 * block redefines; accents are declared once on :root. `test/theme.test.js`
 * checks that split.
 *
 * Which theme applies: `data-theme` on the root element for an explicit
 * choice; absent for "Device", so the media query decides and follows the
 * device live (src/lib/theme.js). The media block is guarded so an explicit
 * Light on a dark device stays light.
 *
 * The one computed colour is a source's hue, set per element as `--h` from
 * src/lib/explain.js `sourceHue`; the expressions using it are here.
 *
 * Values from the approved prototype (tools/design/prototype/styles.css).
 */

:root {
  /* Accents: the same in both themes. */
  --accent: #1f8f7d;
  --warn: #c0603f;

  /* Neutral, light. */
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #f6f4ef;
  --ink: #1c1b19;
  --ink-2: #57544e;
  --ink-3: #8b877f;
  --line: #e4e0d6;
  --card-edge: #dedad0;
  --shadow: 0 1px 2px rgb(40 30 10 / 0.06), 0 4px 16px rgb(40 30 10 / 0.05);
  --scrim: rgb(20 18 14 / 0.32);
  --bar: rgb(246 244 239 / 0.88);
  --toast-bg: #23221f;
  --toast-ink: #f3f1ec;
  --accent-text: #0f7b6c;
  --accent-soft: #dcefeb;
  --warn-text: #b4543a;
  --pill-bg: #0f7b6c;
  --pill-ink: #ffffff;
  --tint-l: 96%;
  --mono-l: 42%;
  --image-wait: #ebe7de;
  color-scheme: light;

  --radius: 16px;
  --col: 640px;
  --bar-h: 52px;
  --serif: ui-serif, 'New York', 'Iowan Old Style', Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Inter, system-ui, sans-serif;

  /* Per-source colours, from `--h` on the element. */
  --source-mono: hsl(var(--h, 200) 48% var(--mono-l));
  --source-tint: hsl(var(--h, 200) 40% var(--tint-l));
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #121211;
    --surface: #1c1c1a;
    --surface-2: #252523;
    --ink: #ece9e2;
    --ink-2: #aaa59b;
    --ink-3: #75716a;
    --line: #2b2a27;
    --card-edge: #3a3935;
    --shadow: none;
    --scrim: rgb(0 0 0 / 0.5);
    --bar: rgb(18 18 17 / 0.85);
    --toast-bg: #ece9e2;
    --toast-ink: #1c1c1a;
    --accent-text: #45b8a5;
    --accent-soft: #1d3632;
    --warn-text: #e08a6a;
    --pill-bg: #45b8a5;
    --pill-ink: #0d1f1c;
    --tint-l: 14%;
    --mono-l: 38%;
    --image-wait: #232321;
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --bg: #121211;
  --surface: #1c1c1a;
  --surface-2: #252523;
  --ink: #ece9e2;
  --ink-2: #aaa59b;
  --ink-3: #75716a;
  --line: #2b2a27;
  --card-edge: #3a3935;
  --shadow: none;
  --scrim: rgb(0 0 0 / 0.5);
  --bar: rgb(18 18 17 / 0.85);
  --toast-bg: #ece9e2;
  --toast-ink: #1c1c1a;
  --accent-text: #45b8a5;
  --accent-soft: #1d3632;
  --warn-text: #e08a6a;
  --pill-bg: #45b8a5;
  --pill-ink: #0d1f1c;
  --tint-l: 14%;
  --mono-l: 38%;
  --image-wait: #232321;
  color-scheme: dark;
}

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