/* Design tokens - the WARRANT direction (/DESIGN.md is binding).

   The product's differentiator is that testing happens inside a SIGNED AUTHORIZATION ENVELOPE,
   so the identity is an authorization instrument: stamped, dated, countersigned, exact. Graphite
   ink ground, bone text, one seal-brass accent for authority. Deliberately NOT the near-black
   plus acid-green terminal this replaced, not cream + serif + terracotta, not broadsheet.

   This is the ONLY file in which a colour literal may appear, and only as a --token: definition
   value. Enforced by apps/core/theme_audit.py + apps/core/tests/test_theme_guardrails.py. */

/* Dark tokens on :root (default) AND [data-theme="dark"] so a nested dark subtree (e.g. the
   styleguide) renders dark even when the page theme is light. */
:root,
[data-theme="dark"] {
  /* --- Surface + ink --- */
  --bg: #101319;             /* app canvas (graphite ink)        */
  --surface: #171B23;        /* panels, cards, table bodies      */
  --surface-raised: #1F242E; /* hover, control fill, raised rows */
  --border: #2A3140;         /* hairlines, dividers, table rules */
  --border-strong: #3C4557;  /* panel edges, focused control     */
  --text: #E8E6E1;           /* primary text (bone)              */
  --text-muted: #9BA3B0;     /* captions, secondary, timestamps  */

  /* --- Authority accent: seal brass. Affordance ONLY, never a status. --- */
  --accent: #C9973F;
  --accent-hover: #DCA94E;
  --accent-ink: #14161B;     /* text on a filled accent surface */

  /* --- Semantic state. --danger is never chrome: a page at rest shows no red. --- */
  --danger: #C1453E;
  --warn: #C98A2E;
  --ok: #4F8A72;

  /* --- Severity ramp: DATA ONLY (fills, spines, chart series), never chrome.
         Identical in both themes so a severity never changes meaning with the theme. --- */
  --sev-info: #5B6B85;
  --sev-low: #3E8E7E;
  --sev-medium: #C8922E;
  --sev-high: #D8663C;
  --sev-crit: #C2415A;

  /* --- Semantic TEXT colours (AA >= 4.5:1 on the app backgrounds, per theme).
         The raw ramp above does not clear AA as small text on the ground, so message text
         uses these instead. --- */
  --text-danger: #F09A93;
  --text-success: #6FBFA3;

  /* --- Typography --- */
  --font-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --font-ui: "Public Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  /* Modular type scale (DESIGN.md section 3) */
  --fs-0: 0.6875rem;  /* 11px  micro labels, table headers */
  --fs-1: 0.8125rem;  /* 13px  caption, dense cell, data   */
  --fs-2: 0.9375rem;  /* 15px  body                        */
  --fs-3: 1.0625rem;  /* 17px  lead body                   */
  --fs-4: 1.3125rem;  /* 21px  heading                     */
  --fs-5: 1.625rem;   /* 26px  section display             */
  --fs-6: 2.125rem;   /* 34px  page display                */
  --fs-7: 2.75rem;    /* 44px  cover display (reports)     */

  --lh-body: 1.55;
  --lh-heading: 1.25;
  --lh-display: 1.15;
  --lh-mono: 1.45;
  --track-display: -0.02em;
  --track-heading: -0.01em;
  --track-label: 0.06em;   /* micro labels + table headers only */

  /* --- Spacing (8px base) --- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;

  /* --- Shape: exactly three radii --- */
  --radius-control: 3px;
  --radius-card: 5px;
  --radius-pill: 999px;
  --spine-width: 3px;

  /* --- Functional surfaces (theme-independent) --- */
  --on-severity: #FFFFFF;  /* text/icon on a filled severity or danger control */
  --scan-surface: #FFFFFF; /* QR/scan plate - must stay white for scanners     */
  --scrim: rgba(8, 10, 14, 0.66);

  /* --- Elevation: borders + surface steps first; shadow is layered and low-opacity --- */
  --shadow-1: 0 1px 1px rgba(0, 0, 0, 0.20), 0 2px 4px rgba(0, 0, 0, 0.16);
  --shadow-2: 0 2px 4px rgba(0, 0, 0, 0.22), 0 8px 16px rgba(0, 0, 0, 0.18);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.04);

  /* --- Shell metrics --- */
  --topbar-h: 52px;
  --rail-w: 240px;
  --rail-w-collapsed: 64px;
  --measure: 72ch;

  /* --- Motion --- */
  --motion-fast: 100ms;
  --motion-base: 160ms;
  --motion-slow: 280ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.3, 1);
  --ease-in-out: cubic-bezier(0.5, 0, 0.2, 1);

  color-scheme: dark;
}

[data-theme="light"] {
  /* Daylight instrument: warm paper ground, ink text, a darker brass that clears AA as text. */
  --bg: #F4F2ED;
  --surface: #FFFFFF;
  --surface-raised: #EAE7E0;
  --border: #D4CFC4;
  --border-strong: #B3AC9D;
  --text: #1A1D23;
  --text-muted: #5A6070;

  --accent: #8A6220;
  --accent-hover: #6E4D18;
  --accent-ink: #FFFFFF;

  --danger: #A3322C;
  --warn: #8A5D14;
  --ok: #2F6151;

  /* Severity ramp holds across both themes (see the dark block). */
  --sev-info: #5B6B85;
  --sev-low: #3E8E7E;
  --sev-medium: #C8922E;
  --sev-high: #D8663C;
  --sev-crit: #C2415A;

  --text-danger: #9B2B26;
  --text-success: #23594A;

  --scrim: rgba(26, 29, 35, 0.42);

  --shadow-1: 0 1px 1px rgba(26, 29, 35, 0.06), 0 2px 4px rgba(26, 29, 35, 0.08);
  --shadow-2: 0 2px 4px rgba(26, 29, 35, 0.10), 0 8px 16px rgba(26, 29, 35, 0.10);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.60);

  color-scheme: light;
}
