/* Design tokens. One file, no build step, no external requests.
   Dark is the default; light follows the OS setting or an explicit data-theme. */

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

  --text-xs: 0.75rem;    /* 12 */
  --text-sm: 0.8125rem;  /* 13 */
  --text-md: 0.9375rem;  /* 15  body */
  --text-lg: 1.0625rem;  /* 17 */
  --text-xl: 1.375rem;   /* 22 */
  --text-2xl: 1.75rem;   /* 28 */
  --text-3xl: clamp(2rem, 1.2rem + 3.2vw, 3.25rem);

  --leading-tight: 1.15;
  --leading-snug: 1.35;
  --leading-body: 1.6;
  --tracking-label: 0.08em;

  /* ---- space (4px base) ---- */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;

  /* ---- shape ---- */
  --r-1: 2px;   /* tags, byte cells */
  --r-2: 4px;   /* buttons, inputs */
  --r-3: 6px;   /* cards, tables */
  --line: 1px;

  /* ---- layout ---- */
  --w-text: 68ch;
  --w-page: 1120px;
  --header-h: 56px;

  /* ---- motion ---- */
  --t-fast: 120ms;
  --t-base: 200ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);

  /* ---- colour: dark (default) ---- */
  color-scheme: dark;
  --bg: #0c0e11;
  --bg-raised: #12151a;
  --bg-sunken: #08090b;
  --bg-hover: #181c22;
  --border: #262b33;
  --border-strong: #3a414c;

  --fg: #e9e7e0;
  --fg-dim: #a0a6b0;
  --fg-faint: #6d7480;       /* decoration only, never body text */

  --accent: #c6f24e;          /* "valid": a check that passed */
  --accent-fg: #c6f24e;       /* accent used as text */
  --accent-ink: #12180a;      /* text on an accent fill */
  --accent-soft: #c6f24e1f;
  --accent-line: #c6f24e66;

  --fail: #ff7a6b;
  --fail-soft: #ff7a6b1c;
  --fail-line: #ff7a6b59;
  --warn: #f0b849;
  --warn-soft: #f0b8491a;
  --warn-line: #f0b84959;
  --info: #8ab4ff;
  --info-soft: #8ab4ff1a;
  --info-line: #8ab4ff4d;

  --shadow-pop: 0 16px 48px #000000b3, 0 0 0 1px var(--border-strong);
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

/* light values, applied by OS preference unless the page is pinned dark */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f5f4ef;
    --bg-raised: #fdfcf9;
    --bg-sunken: #eceae3;
    --bg-hover: #e9e7df;
    --border: #d6d3c9;
    --border-strong: #a9a69b;
    --fg: #16181c;
    --fg-dim: #535a66;
    --fg-faint: #858b95;
    --accent: #b4e02a;
    --accent-fg: #456200;
    --accent-ink: #12180a;
    --accent-soft: #6b960024;
    --accent-line: #5a7f0080;
    --fail: #b3261e;
    --fail-soft: #b3261e14;
    --fail-line: #b3261e59;
    --warn: #8a5a00;
    --warn-soft: #c9870024;
    --warn-line: #8a5a0066;
    --info: #1f55b5;
    --info-soft: #1f55b514;
    --info-line: #1f55b54d;
    --shadow-pop: 0 16px 40px #16181c2e, 0 0 0 1px var(--border-strong);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f4ef;
  --bg-raised: #fdfcf9;
  --bg-sunken: #eceae3;
  --bg-hover: #e9e7df;
  --border: #d6d3c9;
  --border-strong: #a9a69b;
  --fg: #16181c;
  --fg-dim: #535a66;
  --fg-faint: #858b95;
  --accent: #b4e02a;
  --accent-fg: #456200;
  --accent-ink: #12180a;
  --accent-soft: #6b960024;
  --accent-line: #5a7f0080;
  --fail: #b3261e;
  --fail-soft: #b3261e14;
  --fail-line: #b3261e59;
  --warn: #8a5a00;
  --warn-soft: #c9870024;
  --warn-line: #8a5a0066;
  --info: #1f55b5;
  --info-soft: #1f55b514;
  --info-line: #1f55b54d;
  --shadow-pop: 0 16px 40px #16181c2e, 0 0 0 1px var(--border-strong);
}

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