/* ===== OMNISYNX DEFENCE — design tokens =====
 *
 * One source of truth for colour, type and spacing. Components style
 * themselves through these variables and never through a raw hex value, which
 * is what lets `theme-light.css` re-skin the whole console by redefining this
 * block and nothing else.
 *
 * Typefaces are system faces. The console runs under a CSP that permits no
 * external font host, and a silent fallback to Times is worse than choosing
 * the stack deliberately: Segoe UI Variable Display carries the wordmark,
 * Segoe UI the body, Cascadia Mono every figure that has to line up.
 */
:root {
  /* type */
  --disp: "Segoe UI Variable Display", "Segoe UI Semibold", system-ui, sans-serif;
  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Mono", "Consolas", ui-monospace, monospace;

  --fs-micro: 9.5px;
  --fs-tiny: 10.5px;
  --fs-small: 12px;
  --fs-body: 13px;
  --fs-lead: 15px;
  --fs-h3: 17px;
  --fs-h2: 21px;
  --fs-h1: 27px;

  /* spacing — a 4px grid, so gaps compose predictably */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 22px;
  --s6: 30px;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;

  --rail: 76px;
  --topbar: 62px;
  --panel-w: 400px;

  /* semantic status — independent of the accent, so "healthy" never reads as
   * "selected" and a warning never borrows the brand colour */
  --ok: #54e6a4;
  --warn: #ffb648;
  --bad: #ff5d6c;
  --busy: #38e1ff;
  --idle: #8aa0c4;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- dark: the operational default ---------- */
:root,
:root[data-theme="dark"] {
  --bg: #060a11;
  --bg-grad-a: rgba(56, 225, 255, 0.1);
  --bg-grad-b: rgba(155, 140, 255, 0.09);
  --surface: rgba(16, 24, 38, 0.72);
  --surface-2: rgba(22, 32, 50, 0.6);
  --surface-solid: #101826;
  --raised: rgba(30, 42, 64, 0.7);

  --stroke: rgba(120, 160, 220, 0.14);
  --stroke-2: rgba(120, 160, 220, 0.3);

  --ink: #e7eefc;
  --ink-2: #8aa0c4;
  --ink-3: #5b6f92;

  --accent: #38e1ff;
  --accent-2: #12b6da;
  --accent-ink: #04202a;
  --accent-wash: rgba(56, 225, 255, 0.09);

  --grid: rgba(120, 160, 220, 0.05);
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.55);
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
  --map-filter: none;
}

/* ---------- light: same console, daylight operations room ---------- */
:root[data-theme="light"] {
  --bg: #eef2f8;
  --bg-grad-a: rgba(18, 150, 190, 0.12);
  --bg-grad-b: rgba(120, 108, 220, 0.08);
  --surface: rgba(255, 255, 255, 0.86);
  --surface-2: rgba(243, 247, 253, 0.9);
  --surface-solid: #ffffff;
  --raised: #ffffff;

  --stroke: rgba(28, 55, 95, 0.14);
  --stroke-2: rgba(28, 55, 95, 0.28);

  --ink: #101c2e;
  --ink-2: #45608a;
  --ink-3: #7189ac;

  --accent: #0b8fb5;
  --accent-2: #076e8c;
  --accent-ink: #ffffff;
  --accent-wash: rgba(11, 143, 181, 0.1);

  --ok: #1a9c62;
  --warn: #b56d00;
  --bad: #d3283a;
  --busy: #0b8fb5;
  --idle: #7189ac;

  --grid: rgba(28, 55, 95, 0.05);
  --shadow: 0 10px 30px rgba(20, 40, 70, 0.14);
  --focus: 0 0 0 2px #fff, 0 0 0 4px var(--accent);
  --map-filter: none;
}

/* Theme "system" writes no attribute, so the OS preference has to be handled
 * on its own. Guarded against [data-theme="light"] so an explicit light choice
 * still wins on a dark desktop. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #eef2f8;
    --bg-grad-a: rgba(18, 150, 190, 0.12);
    --bg-grad-b: rgba(120, 108, 220, 0.08);
    --surface: rgba(255, 255, 255, 0.86);
    --surface-2: rgba(243, 247, 253, 0.9);
    --surface-solid: #ffffff;
    --raised: #ffffff;
    --stroke: rgba(28, 55, 95, 0.14);
    --stroke-2: rgba(28, 55, 95, 0.28);
    --ink: #101c2e;
    --ink-2: #45608a;
    --ink-3: #7189ac;
    --accent: #0b8fb5;
    --accent-2: #076e8c;
    --accent-ink: #ffffff;
    --accent-wash: rgba(11, 143, 181, 0.1);
    --ok: #1a9c62;
    --warn: #b56d00;
    --bad: #d3283a;
    --busy: #0b8fb5;
    --idle: #7189ac;
    --grid: rgba(28, 55, 95, 0.05);
    --shadow: 0 10px 30px rgba(20, 40, 70, 0.14);
    --focus: 0 0 0 2px #fff, 0 0 0 4px var(--accent);
  }
}
