/* ==========================================================================
   DESIGN TOKENS — the single source of truth for the Cikgu.cc UI.

   Loaded first, before style.css. Every older token set (`--g-*` in
   glass-theme.css, `--primary`/`--ink` in style.css, `--lp-*`, `--a-*` in
   admin.css) is now an alias of these, so one change here moves the whole app.

   Rules of use:
     - Radius: only --r-sm / --r-md / --r-lg / --r-pill.
     - Border: 1px solid var(--c-border) (or --c-border-strong for controls).
     - Shadow: only --sh-1 / --sh-2 / --sh-3, focus with --ring.
     - Surfaces are flat. No gradients or backdrop blur on cards.

   Official OUM document output (.doc-preview-*, .doc-tpl2-*, print) does not
   read these tokens and must not start to.
   ========================================================================== */

:root,
body[data-glass-mode='light'] {
  /* Colour roles */
  --c-bg: #f5f7fa;
  --c-surface: #ffffff;
  --c-surface-2: #f8fafc;      /* inset: wells, table heads, quiet fills */
  --c-surface-3: #eef2f7;      /* hover on quiet fills, segmented track */
  --c-border: #e3e8ef;
  --c-border-strong: #cfd7e2;
  --c-ink: #0f2742;            /* headings + body */
  --c-ink-2: #3f5672;          /* secondary copy */
  --c-ink-3: #5f738c;          /* hints, meta (4.6:1 on white) */
  --c-accent: #0b3c68;         /* OUM navy */
  --c-accent-hover: #0a3359;
  --c-accent-ink: #ffffff;
  --c-accent-soft: #e8f0f8;    /* selected / active fill */
  --c-accent-text: #0b4f86;    /* links, active labels */
  --c-success: #15803d;
  --c-success-soft: #e9f7ef;
  --c-warn: #b45309;
  --c-warn-soft: #fdf4e3;
  --c-danger: #be123c;
  --c-danger-soft: #fdecef;
  --c-placeholder: #8796a8;
  --c-scrim: rgba(15, 23, 42, 0.42);

  /* Shadows — one scale, navy-tinted, soft */
  --sh-1: 0 1px 2px rgba(15, 39, 66, 0.04), 0 1px 3px rgba(15, 39, 66, 0.04);
  --sh-2: 0 4px 12px rgba(15, 39, 66, 0.08), 0 1px 3px rgba(15, 39, 66, 0.05);
  --sh-3: 0 20px 48px rgba(15, 39, 66, 0.16), 0 4px 12px rgba(15, 39, 66, 0.06);
  --ring: 0 0 0 3px rgba(11, 79, 134, 0.22);
}

body[data-glass-mode='dark'] {
  --c-bg: #0b0f15;
  --c-surface: #121821;
  --c-surface-2: #0f141c;
  --c-surface-3: #1a2230;
  --c-border: #232c3a;
  --c-border-strong: #313c4d;
  --c-ink: #eef3f9;
  --c-ink-2: #b9c5d4;
  --c-ink-3: #8f9db0;
  --c-accent: #e6eef8;
  --c-accent-hover: #ffffff;
  --c-accent-ink: #0b0f15;
  --c-accent-soft: rgba(79, 216, 228, 0.12);
  --c-accent-text: #7fdde8;
  --c-success: #4ade80;
  --c-success-soft: rgba(34, 197, 94, 0.14);
  --c-warn: #fbbf24;
  --c-warn-soft: rgba(245, 158, 11, 0.14);
  --c-danger: #fb7185;
  --c-danger-soft: rgba(244, 63, 94, 0.14);
  --c-placeholder: #6b7a8f;
  --c-scrim: rgba(0, 0, 0, 0.6);

  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.3);
  --sh-2: 0 6px 16px rgba(0, 0, 0, 0.4);
  --sh-3: 0 24px 56px rgba(0, 0, 0, 0.55);
  --ring: 0 0 0 3px rgba(127, 221, 232, 0.3);
}

:root {
  /* Radius */
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;

  /* Spacing (4px scale) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 48px;

  /* Type */
  --f-ui: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --f-display: 'Instrument Serif', Georgia, serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --t-xs: 12px;
  --t-sm: 13px;
  --t-md: 14px;
  --t-lg: 16px;
  --t-xl: 20px;
  --t-2xl: 24px;
  --t-3xl: 32px;

  /* Controls */
  --h-control: 40px;
  --h-control-sm: 32px;
}

@media (pointer: coarse) {
  :root { --h-control: 44px; --h-control-sm: 36px; }
}
