/* ==========================================================================
   Design tokens
   Identity: technical-drawing clarity. Ink lines on datasheet paper, one
   signal color (OM3 fiber aqua) reserved for "the thing you're looking at".
   Status colors carry meaning only; they are never decorative.
   Light is the default; dark is applied with :root[data-theme="dark"].
   ========================================================================== */

@font-face {
  font-family: "Red Hat Display";
  src: url("../assets/fonts/red-hat-display-var-latin.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
}
@font-face {
  font-family: "Red Hat Text";
  src: url("../assets/fonts/red-hat-text-var-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Red Hat Mono";
  src: url("../assets/fonts/red-hat-mono-var-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

:root {
  color-scheme: light;

  /* ---- Type families: one family, three jobs ---- */
  --font-display: "Red Hat Display", ui-sans-serif, system-ui, sans-serif;
  --font-text: "Red Hat Text", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Red Hat Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  /* ---- Type scale (modular, ratio ~1.25 from 16px) ---- */
  --text-2xs: 0.6875rem; /* 11  bit ruler, axis ticks */
  --text-xs: 0.75rem;    /* 12  metadata */
  --text-sm: 0.875rem;   /* 14  secondary, tables */
  --text-md: 1rem;       /* 16  body */
  --text-lg: 1.25rem;    /* 20  lead, panel titles */
  --text-xl: 1.5625rem;  /* 25  section headings */
  --text-2xl: 1.953rem;  /* 31  page headings */
  --text-3xl: 2.441rem;  /* 39  metric values */
  --text-hero: clamp(2.6rem, 1.2rem + 5.4vw, 5.6rem);

  --leading-tight: 1.08;
  --leading-snug: 1.3;
  --leading-body: 1.55;

  /* ---- Spacing (4px base) ---- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  --measure: 62ch;
  --container: 74rem;
  --gutter: clamp(1rem, 0.4rem + 2.4vw, 2.5rem);
  --rail-width: 13.5rem;
  --topbar-height: 3.5rem;

  /* ---- Radius: crisp, varies by hierarchy ---- */
  --radius-xs: 2px;   /* ticks, tiny chips */
  --radius-sm: 4px;   /* inputs, buttons */
  --radius-md: 6px;   /* panels */
  --radius-lg: 10px;  /* overlays */
  --radius-full: 999px;

  /* ---- Lines ---- */
  --line: 1px;
  --line-strong: 1.5px;

  /* ---- Motion ---- */
  --duration-fast: 110ms;
  --duration-base: 180ms;
  --duration-slow: 420ms;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  /* ---- Layers ---- */
  --z-sticky: 40;
  --z-nav: 50;
  --z-popover: 60;
  --z-tooltip: 70;
  --z-modal: 80;

  /* ---- Palette: light ---- */
  --c-paper: #f1f3f2;        /* page */
  --c-paper-2: #e7ebe9;      /* hover, sunken */
  --c-sheet: #ffffff;        /* panels */
  --c-sheet-2: #f7f8f8;      /* table heads, wells */
  --c-rule: #d6dbd9;         /* hairlines */
  --c-rule-2: #b9c0bd;       /* stronger dividers, input borders */
  --c-ink: #1b2330;          /* text, drawing lines, primary actions */
  --c-ink-2: #4b5664;        /* secondary text */
  --c-ink-3: #78838f;        /* tertiary text, captions */
  --c-ink-hover: #2c3746;
  --c-on-ink: #ffffff;

  --c-signal: #0a8c99;       /* selection, replay, focus */
  --c-signal-strong: #07737e;
  --c-signal-wash: #dbf0f1;

  --c-ok: #2f8a3e;
  --c-ok-wash: #e2f1e4;
  --c-warn: #a87400;
  --c-warn-wash: #fbf0d4;
  --c-bad: #c9372b;
  --c-bad-wash: #fae3e0;
  --c-info: #3563d3;
  --c-info-wash: #e4ebfb;
  --c-mute: #737d88;
  --c-mute-wash: #e9ecee;

  /* Categorical palette for protocols (charts, map, replay lanes). Fixed order. */
  --c-cat-1: #0a8c99;
  --c-cat-2: #4b5bbf;
  --c-cat-3: #d17b22;
  --c-cat-4: #9a4f94;
  --c-cat-5: #6f8a24;
  --c-cat-6: #b5566f;
  --c-cat-7: #8a7a55;
  --c-cat-8: #6e7b8a;

  --focus: 0 0 0 2px var(--c-sheet), 0 0 0 4px var(--c-signal);
  --shadow-overlay: 0 1px 2px rgb(27 35 48 / 0.08), 0 12px 32px rgb(27 35 48 / 0.16);
  --overlay: rgb(27 35 48 / 0.42);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --c-paper: #131922;
  --c-paper-2: #1b2330;
  --c-sheet: #18202b;
  --c-sheet-2: #1d2632;
  --c-rule: #2a3442;
  --c-rule-2: #3a4657;
  --c-ink: #e4e9ee;
  --c-ink-2: #a9b3bf;
  --c-ink-3: #7d8896;
  --c-ink-hover: #ffffff;
  --c-on-ink: #131922;

  --c-signal: #33c3cf;
  --c-signal-strong: #5fd4dd;
  --c-signal-wash: rgb(51 195 207 / 0.14);

  --c-ok: #5cc06c;
  --c-ok-wash: rgb(92 192 108 / 0.14);
  --c-warn: #e2ad3b;
  --c-warn-wash: rgb(226 173 59 / 0.14);
  --c-bad: #f0695d;
  --c-bad-wash: rgb(240 105 93 / 0.15);
  --c-info: #6f95f2;
  --c-info-wash: rgb(111 149 242 / 0.15);
  --c-mute: #8c97a4;
  --c-mute-wash: rgb(140 151 164 / 0.14);

  --c-cat-1: #33c3cf;
  --c-cat-2: #8794f0;
  --c-cat-3: #ec9d4a;
  --c-cat-4: #cf86c8;
  --c-cat-5: #a3c157;
  --c-cat-6: #e48aa1;
  --c-cat-7: #c2b088;
  --c-cat-8: #98a5b4;

  --shadow-overlay: 0 1px 2px rgb(0 0 0 / 0.4), 0 16px 40px rgb(0 0 0 / 0.5);
  --overlay: rgb(5 8 12 / 0.6);
}

@media (prefers-reduced-motion: reduce) {
  :root { --duration-fast: 0ms; --duration-base: 0ms; --duration-slow: 0ms; }
}
