/* ==========================================================================
   Shared sizes for every theme (docs/features/themes.md).
   Colours, surfaces, shadows, fonts and corner sizes live in the theme files in public/themes/ (one file per look,
   listed in public/themes/registry.js; the contract is public/themes/tokens.js). This file holds what every look
   shares: type sizes, spacing, motion, layout sizes, density, and the old v3 names kept as aliases.
   Pages use only tokens; tests/no-hard-coded-colours.test.mjs fails on a colour written into a page.
   ========================================================================== */

:root {
  /* type: six sizes, nothing else (UI-OVERHAUL §3.2) */
  --t-display: 24px;
  --t-title: 18px;
  --t-lede: 15px;
  --t-body: 14px;
  --t-small: 13px;
  --t-meta: 12px;

  /* spacing: 4 px base */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 28px;
  --s-8: 40px;
  --s-9: 56px;

  /* radius */
  --r-pill: 999px;

  /* motion: calm; nothing loops except the AI's working dot */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --dur-fast: 120ms;
  --dur-pop: 160ms;
  --dur-slide: 220ms;

  --sidebar-width: 224px;
  --sidebar-collapsed: 64px;
  --topbar-height: 52px;
  --control-height: 30px;
  --control-pad-x: 12px;
  --table-row-height: 44px;
  --content-max: 1240px;
}

/* ── The rest of the look contract (public/themes/tokens.js CONTRACT_TOKENS) ─────────────────────────
   Defaults that leave every look as it is; a look's tokens.css sets only the ones it changes. */
:root {
  /* shape */
  --edge-width: 1px;
  --edge-style: solid;
  --card-pad: var(--s-4);
  --rule: var(--edge-width) var(--edge-style) var(--border);
  /* type */
  --font-display: var(--font);
  --answer-size: var(--t-display);
  --answer-weight: var(--title-weight);
  --label-case: none;
  --label-tracking: 0;
  --num-font: var(--font);
  /* depth */
  --card-blur: 0px;
  --card-glow: none;
  --page-art: none;
  /* space */
  --density: 1;
  --measure: 72ch;
  /* motion */
  --motion: 1;
  --settle: var(--ease);
  /* state marks */
  --mark-ok: dot;
  --mark-warn: dot;
  --mark-bad: dot;
  --mark-ai: dot;
  /* sound */
  --sound-tap: none;
}
/* "Reduce motion": the computer's setting, the person's toggle (data-motion="off") or a still look (data-motion="none"). */
[data-motion="off"],
[data-motion="none"] {
  --motion: 0;
}
@media (prefers-reduced-motion: reduce) {
  :root {
    --motion: 0;
  }
}

/* ── Density ─────────────────────────────────────────────────────────── */
[data-density="comfortable"] {
  --density: 1.15;
  --control-height: 34px;
  --control-pad-x: 14px;
  --table-row-height: 52px;
  --t-body: 15px;
  --t-small: 14px;
}

/* ── Reduced motion ──────────────────────────────────────────────────── */
/* The person's toggle and a still look (data-motion) do what the computer's setting does. */
[data-motion="off"] *,
[data-motion="off"] *::before,
[data-motion="off"] *::after,
[data-motion="none"] *,
[data-motion="none"] *::before,
[data-motion="none"] *::after {
  transition-duration: 0.01ms !important;
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

/* ── v3 names, kept as aliases while pages move to the v4 components (UI-OVERHAUL phase 8
   deletes them). They resolve against the theme on <html>, so they follow light and dark.
   New code must not use them. ── */
:root {
  --canvas: var(--bg);
  --canvas-2: var(--bg-sunken);
  --surface-solid: var(--surface);
  --surface-raised: var(--raised);
  --surface-hover: var(--hover);
  --surface-sunken: var(--bg-sunken);
  --border-subtle: var(--border);
  --text-strong: var(--text);
  --text-muted: var(--text-2);
  --text-faint: var(--text-3);
  --text-on-accent: var(--on-accent);
  --text-on-bad: var(--on-bad);
  --text-on-ok: var(--on-ok);
  --accent-strong: var(--accent);
  --accent-fg: var(--accent-text);
  --selected-row: var(--accent-soft);
  /* "observation" used violet; violet now means the AI only, so observations read as info. */
  --obs: var(--info);
  --obs-soft: var(--info-soft);
  /* No glows or backdrop in v4: these resolve to nothing. Glass follows the look's --card-blur (0, none, unless a look sets it). */
  --accent-glow: transparent;
  --ok-glow: transparent;
  --bad-glow: transparent;
  --warn-glow: transparent;
  --glass-blur: var(--card-blur, 0px);
  --glass-edge: none;
  --glass-highlight: 0 0 0 0 transparent;
  --aurora-1: transparent;
  --aurora-2: transparent;
  --aurora-3: transparent;
  --grid-dot: transparent;
  --elev-1: 0 0 0 0 transparent;
  --elev-2: var(--shadow-1);
  --elev-3: var(--shadow-2);
  --font-sans: var(--font);
  --font-mono: var(--mono);
  --fs-xxs: var(--t-meta);
  --fs-xs: var(--t-meta);
  --fs-sm: var(--t-small);
  --fs-md: var(--t-body);
  --fs-lg: var(--t-lede);
  --fs-xl: var(--t-title);
  --fs-xxl: var(--t-display);
  --fs-hero: 32px;
  --sp-1: var(--s-1);
  --sp-2: var(--s-2);
  --sp-3: var(--s-3);
  --sp-4: var(--s-4);
  --sp-5: var(--s-6);
  --sp-6: var(--s-7);
  --sp-7: var(--s-8);
  --radius-control: var(--r-ctl);
  --radius-ctrl: var(--r-ctl);
  --radius-input: var(--r-ctl);
  --radius-card: var(--r-card);
  --radius-surface: var(--r-card);
  --radius-pill: var(--r-pill);
  --ease-out: var(--ease);
  --ease-spring: var(--ease);
  --motion-fast: var(--dur-fast) var(--ease);
  --motion-med: var(--dur-pop) var(--ease);
  --motion-slow: var(--dur-slide) var(--ease);
  --badge-fs: var(--t-meta);
  --bg-raised: var(--surface);
  --bg-hover: var(--hover);
  --text-dim: var(--text-2);
  --panel: var(--raised);
}
