/*
 * Design tokens, docs/design.md §2. Components use these, never literal values.
 * Dark values follow the OS unless data-theme on <html> says otherwise.
 */
:root {
  /* 2.1 Colors */
  --bg: #ffffff;
  --fg: #141414;
  --muted: #6b6b6b;
  --line: #d8d8d8;
  --surface: #f0f0fa;
  --nav: #0d1138;
  --nav-fg: #c0c8e8;
  --nav-dim: #7a84b8;
  --nav-line: rgba(255, 255, 255, .18);
  --nav-hover: rgba(255, 255, 255, .05);
  --nav-active: rgba(40, 230, 210, .12);
  --nav-active-compact: rgba(40, 230, 210, .18);
  --accent: #28e6d2;
  --on-accent: #0d1138;
  --blue: #0563c1;
  --blue-tint: #e3edf8;
  --lime: #e1e628;
  --on-lime: #0d1138;
  --lime-tint: #f3f6c8;
  --on-lime-tint: #4b5000;
  --red: #b3261e;
  --red-tint: #f8e4e2;
  --grey-tint: #eeeeee;
  --green: #1f8a4c;
  --chart: #2a6fd4;
  --chart-grid: #e6e6ee;
  --white: #ffffff;

  /* 2.2 Typography */
  --f-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --f-body: "Inter", ui-sans-serif, system-ui, sans-serif;
  --f-mono: ui-monospace, "SF Mono", Menlo, monospace;

  /* 2.3 Radii, borders, shadows, motion */
  --radius: 4px;
  --radius-sm: 3px;
  --radius-lg: 10px;
  --radius-rail: 14px;
  --radius-pill: 999px;
  --border: 1px solid var(--line);
  --shadow-tooltip: 0 4px 16px rgba(10, 10, 10, .08);
  --shadow-popover: 0 16px 40px rgba(10, 10, 10, .12);
  /* Motion (#2376): one set of durations and easings, never over 250ms. Under
     prefers-reduced-motion every duration is 0ms (below). */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(0, 0, .2, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --duration-fast: 120ms;
  --duration: 180ms;
  --duration-swap: 220ms;
  /* A Turbo frame that is still loading dims only after this, so a fast load never flickers. */
  --delay-busy: 150ms;
  /* The run indicators (runs.css), the only motion that loops: it shows that work goes on. */
  --duration-run-spin: 1s;
  --duration-run-shimmer: 1.4s;
  --duration-run-pulse: 1.6s;
  --duration-run-pop: 500ms;

  /* 2.4 Spacing (4px grid) */
  --page-max: 1160px;
  --page-pad: 36px 28px 72px;
  --page-header-gap: 28px;
  --panel-gap: 22px;
  --gap-2col: 22px;
  --gap-3col: 18px;
  --gap-tiles: 16px;
  --panel-head-pad: 18px 20px 12px;
  --panel-body-pad: 16px 20px;
  --cell-pad: 12px 16px;
  /* The height of a one-line field and of the button beside it in a choice row (components.css). */
  --control-height: 44px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0e22;
    --fg: #eceefa;
    --muted: #9aa2cc;
    --line: #2a3060;
    --surface: #161a3a;
    --nav: #060818;
    --nav-line: rgba(255, 255, 255, .12);
    --blue: #6ea8f2;
    --blue-tint: #16264a;
    --lime-tint: #2f3212;
    --on-lime-tint: #e1e628;
    --red: #f08a80;
    --red-tint: #3a1a1a;
    --grey-tint: #22264a;
    --green: #5cc98a;
    --chart: #6ea8f2;
    --chart-grid: #262b55;
  }
}

:root[data-theme="dark"] {
  --bg: #0b0e22;
  --fg: #eceefa;
  --muted: #9aa2cc;
  --line: #2a3060;
  --surface: #161a3a;
  --nav: #060818;
  --nav-line: rgba(255, 255, 255, .12);
  --blue: #6ea8f2;
  --blue-tint: #16264a;
  --lime-tint: #2f3212;
  --on-lime-tint: #e1e628;
  --red: #f08a80;
  --red-tint: #3a1a1a;
  --grey-tint: #22264a;
  --green: #5cc98a;
  --chart: #6ea8f2;
  --chart-grid: #262b55;
}

/* Reduced motion: every duration token is 0ms, and a catch-all stops any other motion (a
   browser's own, a view transition). Delays stay, so a notice still leaves after its time. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-fast: 0ms;
    --duration: 0ms;
    --duration-swap: 0ms;
    --duration-run-spin: 0ms;
    --duration-run-shimmer: 0ms;
    --duration-run-pulse: 0ms;
    --duration-run-pop: 0ms;
  }

  *,
  *::before,
  *::after,
  ::backdrop {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }

  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}
