/*
 * Design tokens: the only file that may contain raw colour values or pixel font sizes
 * (tests/unit/test_dashboard_design.py enforces this).
 *
 * Colour carries meaning only. Neutral surface and text ramps, one accent (links and the
 * focus ring), and five semantic colours: pass, fail, warn, price up, price down. Status is
 * never colour alone: components pair the colour with a text label and a CSS-drawn shape.
 *
 * Themes: `:root` is the light theme; the prefers-color-scheme block switches to dark unless the
 * user picked light; `[data-theme="dark"]` / `[data-theme="light"]` (set by theme-init.js from the
 * remembered choice) always win. The dark values appear twice on purpose (media block and the
 * explicit selector); the design test checks the two copies are identical.
 *
 * Contrast (WCAG AA): every text and semantic colour is at least 4.5:1 on bg, surface and sunken;
 * --c-border (control borders) and the focus ring are at least 3:1. --c-rule is a decorative
 * hairline between table rows and is exempt.
 *
 * Breakpoint (media queries cannot read custom properties): narrow layout below 48rem; the
 * layout is built to work from 360px wide.
 */

:root {
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;

  /* Type scale. Roles: caption/label xs, table body sm, body base, section heading lg, page title xl. */
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-lg: 1.125rem;
  --text-xl: 1.5rem;
  --text-code: 0.9em; /* inline code and ids, relative to the surrounding text */
  --leading-tight: 1.25;
  --leading-base: 1.5;
  --tracking-label: 0.08em;

  /* Spacing scale. */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;

  --radius-1: 0.125rem;
  --radius-2: 0.25rem;
  --border-width: 1px;
  --focus-width: 2px;
  --focus-offset: 2px;
  --duration: 120ms;
  --content-max: 76rem;
  --rail-width: 11rem;
  --table-tall: 26rem;

  /* Light theme. */
  --c-bg: #f3f2ec;
  --c-surface: #fbfaf6;
  --c-sunken: #e8e6dd;
  --c-text: #1a1916;
  --c-muted: #58554c;
  --c-border: #7d7a6f;
  --c-rule: #d3d0c4;
  --c-accent: #3730c4;
  --c-pass: #16692f;
  --c-fail: #b3261e;
  --c-warn: #80560a;
  --c-up: #0a6785;
  --c-down: #a3175a;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --c-bg: #121211;
    --c-surface: #1b1a18;
    --c-sunken: #0c0c0b;
    --c-text: #ebeae4;
    --c-muted: #a19e94;
    --c-border: #7a776d;
    --c-rule: #2d2c28;
    --c-accent: #a5a6ff;
    --c-pass: #5fd38d;
    --c-fail: #ff8077;
    --c-warn: #e6b94a;
    --c-up: #52cdea;
    --c-down: #ff90c2;
    color-scheme: dark;
  }
}

[data-theme="dark"] {
  --c-bg: #121211;
  --c-surface: #1b1a18;
  --c-sunken: #0c0c0b;
  --c-text: #ebeae4;
  --c-muted: #a19e94;
  --c-border: #7a776d;
  --c-rule: #2d2c28;
  --c-accent: #a5a6ff;
  --c-pass: #5fd38d;
  --c-fail: #ff8077;
  --c-warn: #e6b94a;
  --c-up: #52cdea;
  --c-down: #ff90c2;
  color-scheme: dark;
}

[data-theme="light"] {
  --c-bg: #f3f2ec;
  --c-surface: #fbfaf6;
  --c-sunken: #e8e6dd;
  --c-text: #1a1916;
  --c-muted: #58554c;
  --c-border: #7d7a6f;
  --c-rule: #d3d0c4;
  --c-accent: #3730c4;
  --c-pass: #16692f;
  --c-fail: #b3261e;
  --c-warn: #80560a;
  --c-up: #0a6785;
  --c-down: #a3175a;
  color-scheme: light;
}
