/* Corpus design system v2 (15-11-2026) · tokens.
   The only place where visual decisions are defined. Born on the public home (site/landing/ds,
   docs/landing-design-system.md) and extended with the denser scales the product needs.

   Rules
   - Space: 4 px grid. --space-N = N × 0.25rem (only --space-hair, 2 px, is off the grid).
   - Type by role. Fixed sizes for product UI (--text-2xs … --text-4xl); fluid sizes for public pages
     (--text-lead, --text-h3, --text-h2, --text-display-*), from 390 to 1440 px wide.
   - One family for all text (Instrument Sans). DM Serif Display only for display headings and the
     wordmark. DM Mono only for codes, identifiers and anonymised data.
   - Three weights: 400, 500, 600.
   - Breakpoints: 500 px (compact), 720 px (mobile), 900 px (tablet), 1240 px (wide app chrome).
     `min-width: 721px` is the complement of the mobile band. They cannot be custom properties. */

:root {
  color-scheme: light;

  /* ── Colour: surfaces ── */
  --color-bg: #faf9f6;
  --color-surface: #ffffff;
  --color-surface-muted: #ebe9e3;
  --color-surface-subtle: #fcfbf9;
  --color-surface-inverse: #09090b;

  /* ── Colour: text ── */
  --color-text: #09090b;
  --color-text-soft: #52525b;
  --color-text-muted: #71717a;
  --color-text-faint: #a1a1a1;
  --color-text-inverse: #ffffff;

  /* ── Colour: lines ── */
  --color-border: #e8e8e6;
  --color-border-strong: rgba(9, 9, 11, 0.16);
  --color-border-subtle: rgba(9, 9, 11, 0.06);

  /* ── Colour: brand ── */
  --color-accent: #1a1a4a;
  --color-accent-hover: #2c2c5e;
  --color-accent-strong: #3d3d7a;
  --color-accent-muted: rgba(26, 26, 74, 0.08);

  /* ── Colour: on the accent or on the dark surface ── */
  --color-on-accent: #ffffff;
  --color-on-accent-soft: rgba(255, 255, 255, 0.86);
  --color-on-accent-muted: rgba(255, 255, 255, 0.66);
  --color-on-accent-faint: rgba(255, 255, 255, 0.45);
  --color-on-accent-line: rgba(255, 255, 255, 0.14);
  --color-on-accent-fill: rgba(255, 255, 255, 0.14);

  /* ── Colour: states ── */
  --color-success: #175a3c;
  --color-success-muted: rgba(31, 139, 85, 0.1);
  --color-warning: #8a6d1f;
  --color-warning-muted: rgba(138, 109, 31, 0.12);
  --color-danger: #842f2f;
  --color-danger-hover: #6f2727;
  --color-danger-muted: rgba(132, 47, 47, 0.08);
  --color-info: #2d5a8a;
  --color-info-muted: #e4edf7;
  --color-caution: #ea7a2c;
  --color-overlay: rgba(9, 9, 11, 0.36);
  --color-focus-ring: rgba(26, 26, 74, 0.18);

  /* ── Colour: illustration signals ── */
  --color-signal-good: #2e9e6a;
  --color-signal-bad: #d9534f;
  --color-file-docx: #2b5797;
  --color-file-pdf: #b3261e;
  --color-device: #17172f;
  --color-brand-claude: #d97757;

  /* ── Type: families ── */
  --font-sans: "Instrument Sans", "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: "DM Serif Display", Georgia, serif;
  --font-mono: "DM Mono", ui-monospace, "Courier New", monospace;

  /* ── Type: weights ── */
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;

  /* ── Type: fixed sizes (product UI) ── */
  --text-2xs: 0.625rem;   /* 10 · file extensions, tiny badges */
  --text-xs: 0.75rem;     /* 12 · chips, captions, table heads */
  --text-sm: 0.8125rem;   /* 13 · secondary data, tabs, menus */
  --text-ui: 0.875rem;    /* 14 · product body text and controls */
  --text-md: 0.9375rem;   /* 15 · lists and card text on public pages, simulated UIs */
  --text-base: 1rem;      /* 16 · reading text */
  --text-lg: 1.125rem;    /* 18 · small titles, questions */
  --text-xl: 1.25rem;     /* 20 · panel titles */
  --text-2xl: 1.5rem;     /* 24 · page titles in the product */
  --text-3xl: 1.75rem;    /* 28 · large titles in the product */
  --text-4xl: 2.25rem;    /* 36 · display titles in the product */

  /* ── Type: fluid sizes (public pages, 390 → 1440 px) ── */
  --text-lead: clamp(1.0625rem, 0.9196rem + 0.5714vw, 1.25rem);    /* 17 → 20 */
  --text-h3: clamp(1.375rem, 1.2821rem + 0.381vw, 1.625rem);       /* 22 → 26 */
  --text-h2: clamp(1.75rem, 1.5179rem + 0.9524vw, 2.375rem);       /* 28 → 38 */
  --text-display-2: clamp(2.625rem, 1.9286rem + 2.8571vw, 4.5rem); /* 42 → 72 · serif */
  --text-display-1: clamp(3.25rem, 2.4143rem + 3.4286vw, 5.5rem);  /* 52 → 88 · serif */

  /* ── Type: figures ── */
  --num-sm: 1.5rem;                                               /* 24 */
  --num-md: clamp(1.5rem, 1.2214rem + 1.1429vw, 2.25rem);         /* 24 → 36 */
  --num-lg: clamp(2.75rem, 2.2857rem + 1.9048vw, 4rem);           /* 44 → 64 */
  --num-xl: clamp(3.5rem, 2.7571rem + 3.0476vw, 5.5rem);          /* 56 → 88 */

  /* ── Type: line height ── */
  --leading-none: 1;
  --leading-display: 1.04;
  --leading-heading: 1.15;
  --leading-snug: 1.3;
  --leading-ui: 1.45;
  --leading-body: 1.6;
  --leading-loose: 1.8;

  /* ── Type: letter spacing ── */
  --tracking-display: -0.015em;
  --tracking-heading: -0.03em;
  --tracking-title: -0.02em;
  --tracking-num: -0.045em;
  --tracking-caps: 0.08em;

  /* ── Space: 4 px grid ── */
  --space-0: 0;
  --space-hair: 0.125rem; /*   2 */
  --space-1: 0.25rem;     /*   4 */
  --space-2: 0.5rem;      /*   8 */
  --space-3: 0.75rem;     /*  12 */
  --space-4: 1rem;        /*  16 */
  --space-5: 1.25rem;     /*  20 */
  --space-6: 1.5rem;      /*  24 */
  --space-8: 2rem;        /*  32 */
  --space-10: 2.5rem;     /*  40 */
  --space-12: 3rem;       /*  48 */
  --space-14: 3.5rem;     /*  56 */
  --space-16: 4rem;       /*  64 */
  --space-20: 5rem;       /*  80 */
  --space-24: 6rem;       /*  96 */
  --space-28: 7rem;       /* 112 */
  --space-32: 8rem;       /* 128 */

  /* ── Space: page rhythm (fluid, public pages) ── */
  --section-y: clamp(5rem, 3.8333rem + 4.7619vw, 8rem);
  --gap-group: clamp(4rem, 3.0714rem + 3.8095vw, 6rem);
  --gap-head: clamp(2rem, 1.5357rem + 1.9048vw, 3rem);
  --pad-card: clamp(1.5rem, 1.0357rem + 1.9048vw, 2.5rem);
  --pad-cell: clamp(1rem, 0.7679rem + 0.9524vw, 1.5rem);

  /* ── Layout ── */
  --container: 74rem;
  --container-reading: 42.5rem;
  --container-timeline: 48.75rem;
  --container-page: 80rem;
  --container-wide: 90rem;
  --gutter: 1.5rem;
  --measure: 40rem;
  --measure-narrow: 46rem;
  --nav-h: 4.25rem;

  /* ── Shape ── */
  --radius-xs: 0.25rem;    /*  4 */
  --radius-sm: 0.5rem;     /*  8 */
  --radius-md: 0.75rem;    /* 12 */
  --radius-lg: 1rem;       /* 16 */
  --radius-xl: 1.25rem;    /* 20 · frames, cards and bands */
  --radius-2xl: 1.5rem;    /* 24 · dialogs and large panels */
  --radius-device: 2.5rem;
  --radius-full: 999px;

  /* ── Elevation ── */
  --shadow-xs: 0 1px 3px rgba(9, 9, 11, 0.05);
  --shadow-sm: 0 4px 20px rgba(26, 26, 74, 0.1);
  --shadow-md: 0 18px 50px rgba(9, 9, 11, 0.06);
  --shadow-lg: 0 22px 70px rgba(26, 26, 74, 0.08);
  --shadow-dialog: 0 24px 60px rgba(9, 9, 11, 0.22);
  --shadow-on-dark: 0 24px 60px rgba(0, 0, 0, 0.35);
  --shadow-device: 0 30px 60px rgba(26, 26, 74, 0.18);

  /* ── Controls ── */
  --control-xs: 2rem;     /* 32 · compact product controls */
  --control-sm: 2.25rem;  /* 36 */
  --control-md: 2.5rem;   /* 40 · default */
  --control-lg: 2.75rem;  /* 44 · touch targets, large product buttons */
  --control-xl: 3.25rem;  /* 52 · public calls to action */

  /* ── Motion ── */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-standard: ease;
  --dur-fast: 150ms;
  --dur: 300ms;
  --dur-enter: 1s;

  /* ── Illustrations: on mobile they all shrink by the same ratio ── */
  --mock-scale: 1;

  /* ── Layers ── */
  --z-sticky: 10;
  --z-nav: 20;
  --z-dropdown: 40;
  --z-popover: 60;
  --z-dialog: 70;
  --z-confirmation: 75;
  --z-onboarding: 80;
  --z-grain: 9999;

  /* ── Focus ── */
  --focus-outline: 2px solid var(--color-accent);
  --focus-ring: 0 0 0 4px var(--color-focus-ring);
}

@media (max-width: 720px) {
  :root {
    --gutter: 1.25rem;
    --nav-h: 3.5rem;
    --mock-scale: 0.9;
  }
}

/* Staff pages (body.is-staff, set by site/app-v2.js): the faint grey of labels, table heads and notes,
   and the warning text, pass 4.5:1 on white and on the muted surfaces (finding 40). */
body.is-staff {
  --color-text-faint: #707070;
  --color-warning: #7a5f17;
}
