/* SelfLaw design tokens. Source of truth: the SelfLaw design canvas (2026-11-24).
   Token names follow docs/spec/design-system-handoff-spec.md section 2.
   Values differ from that spec in two places, on purpose: fonts and radii.
   See design-system/HANDOFF.md for the full list of differences. */

@layer tokens, base, components, utilities;

@layer tokens {
  /* Self-hosted fonts in web/fonts/ (SIL OFL 1.1, licences alongside).
     Latin subset only: Basic Latin plus Latin-1, which covers Spanish. */
  @font-face { font-family: "Red Hat Display"; src: url("../fonts/RedHatDisplay-VF.woff2") format("woff2"); font-weight: 300 900; font-display: swap; }
  @font-face { font-family: "Red Hat Text"; src: url("../fonts/RedHatText-VF.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
  @font-face { font-family: "Red Hat Mono"; src: url("../fonts/RedHatMono-VF.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
  @font-face { font-family: "Tinos"; src: url("../fonts/Tinos-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
  @font-face { font-family: "Tinos"; src: url("../fonts/Tinos-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

  :root {
    color-scheme: light;

    /* Color: Archival Daylight (default) */
    --bg-canvas: #FAF8F4;
    --bg-surface: #FFFFFF;
    --bg-subtle: #F2EFE9;
    --bg-court-paper: #FFFFFF;
    --ink-court-paper: #111111;
    --border-hairline: #E4DFD7;
    --border-strong: #C5BEB3;
    --border-ink: #181715;
    --text-primary: #181715;
    --text-secondary: #494540;
    --text-muted: #6B665F;
    --text-on-accent: #FFFFFF;
    --text-on-accent-soft: #DCEBE3;
    --accent-primary: #1B4332;
    --accent-primary-hover: #143326;
    --accent-ink-navy: #1D3557;
    --highlight-navy-bg: #E8EEF6;
    --status-verified-bg: #ECF5F0;
    --status-verified-fg: #164A33;
    --status-attention-bg: #FDF4E3;
    --status-attention-fg: #7C4D06;
    --status-urgent-bg: #FDECEC;
    --status-urgent-fg: #8E1B1B;
    --focus-ring-color: #1D3557;
    --meter-track: #E4DFD7;

    /* Case identity spines */
    --spine-teal: #0F5C6E;
    --spine-ochre: #9A5B13;
    --spine-plum: #5E376D;
    --spine-terracotta: #9E3B24;
    --spine-forest: #23533A;
    --spine-slate: #334E68;

    /* Type */
    --font-display: "Red Hat Display", system-ui, sans-serif;
    --font-sans: "Red Hat Text", system-ui, sans-serif;
    --font-mono: "Red Hat Mono", ui-monospace, monospace;
    --font-court-doc: "Tinos", "Liberation Serif", "Times New Roman", serif;
    --text-scale: 1;
    --text-xs: calc(0.8125rem * var(--text-scale));
    --text-sm: calc(0.9375rem * var(--text-scale));
    --text-base: calc(1.0625rem * var(--text-scale));
    --text-lg: calc(1.25rem * var(--text-scale));
    --text-xl: calc(1.5rem * var(--text-scale));
    --text-podium: 1.833rem;
    --text-podium-lead: 2.25rem;
    --text-numeral: 2.5rem;
    --text-numeral-lg: 3.375rem;
    --text-hero: clamp(3.75rem, 10.5vw, 9.25rem);
    --text-section: clamp(2.125rem, 4.6vw, 4rem);
    --tracking-display: -0.03em;
    --tracking-hero: -0.055em;
    --tracking-mono-caps: 0.04em;
    --weight-display: 800;
    --weight-hero: 900;

    /* Space (4px base) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-8: 48px;
    --space-10: 64px;

    /* Shape. The canvas uses near-square corners and ink rules, not soft cards. */
    --radius-sm: 2px;
    --radius-md: 2px;
    --radius-lg: 2px;
    --rule-hairline: 1px solid var(--border-hairline);
    --rule-ink: 1.5px solid var(--border-ink);
    --rule-pleading: 3px double var(--border-strong);
    --shadow-sheet: 0 1px 2px rgba(24, 23, 21, 0.05), 0 8px 24px rgba(24, 23, 21, 0.07);

    /* Touch */
    --tap-min: 44px;
    --tap-comfortable: 54px;
    --page-max: 1280px;
    --page-gutter: clamp(20px, 4vw, 48px);
  }

  /* Warm Night Ink. Court day runs in this theme by default. */
  [data-theme="night"] {
    color-scheme: dark;
    --bg-canvas: #161514;
    --bg-surface: #201E1C;
    --bg-subtle: #2A2724;
    --border-hairline: #35322E;
    --border-strong: #524D47;
    --border-ink: #F3EFE8;
    --text-primary: #F3EFE8;
    --text-secondary: #C2BCB2;
    --text-muted: #968F84;
    --text-on-accent: #161514;
    --text-on-accent-soft: #161514;
    --accent-primary: #52B788;
    --accent-primary-hover: #74C69D;
    --accent-ink-navy: #7CA5D8;
    --highlight-navy-bg: #1F2A3A;
    --status-verified-bg: #192E24;
    --status-verified-fg: #7AD0A6;
    --status-attention-bg: #302410;
    --status-attention-fg: #F3C677;
    --status-urgent-bg: #331616;
    --status-urgent-fg: #F79494;
    --focus-ring-color: #7CA5D8;
    --meter-track: #35322E;
    --shadow-sheet: none;
  }

  /* High contrast. Derived, not yet drawn on the canvas: check before shipping. */
  [data-theme="contrast"] {
    --bg-canvas: #FFFFFF;
    --bg-subtle: #FFFFFF;
    --border-hairline: #000000;
    --border-strong: #000000;
    --border-ink: #000000;
    --text-primary: #000000;
    --text-secondary: #000000;
    --text-muted: #000000;
    --accent-primary: #0B2E20;
    --accent-primary-hover: #000000;
    --accent-ink-navy: #0B2545;
    --meter-track: #BDBDBD;
  }

  /* Senior / easy-read: 1.2x on every text token. */
  [data-text="large"] { --text-scale: 1.2; }
}
