/* Planning Passport design system: tokens.
   One file, three layers. Components use only the role and scale tokens, never a raw colour, so a palette
   is a single block that swaps roles. Documented in DESIGN.md, "The design system".

   1. Faces          self-hosted, so they pass the CSP (font-src 'self').
   2. Roles          what a colour is for: paper, ink, the highlighter, civic colours, states.
   3. Scales         type, space, radius, shadow, control size and motion.
   4. Palettes       html[data-palette="..."] blocks that override roles only. The default is "highlighter". */

/* ---------- 1. Faces ---------- */
@font-face {
  font-family: 'Mona Sans';
  src: url('/assets/fonts/MonaSans-Variable.woff2') format('woff2');
  font-weight: 200 900;
  font-stretch: 75% 125%;
  font-style: normal;
  font-display: swap;
}
/* A local Arial resized to Mona Sans's measurements at weight 450, so text doesn't jump when the real face
   arrives. Measured with fontTools from MonaSans-Variable.woff2 and macOS Arial, 2 November 2026. */
@font-face {
  font-family: 'Mona Sans Fallback';
  src: local('Arial'), local('ArialMT'), local('Helvetica');
  size-adjust: 108.3%;
  ascent-override: 100.7%;
  descent-override: 29.6%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('/assets/fonts/SourceSerif4-Variable.woff2') format('woff2');
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('/assets/fonts/SourceSerif4-Italic-Variable.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/assets/fonts/GeistMono-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  /* ---------- 2. Roles: the "highlighter" palette ---------- */
  color-scheme: light;
  --pp-paper: #ffffff; /* page */
  --pp-paper-2: #f4f5f7; /* tinted band, quiet fills */
  --pp-surface: #ffffff; /* cards and documents */
  --pp-ink: #0e1116; /* text, primary buttons */
  --pp-ink-hover: #262b33;
  --pp-ink-2: #4a505c; /* secondary text: 7.6:1 on paper-2 */
  --pp-ink-3: #575e6b; /* captions and labels: 5.9:1 on paper-2 */
  --pp-on-ink: #ffffff; /* text on ink */
  --pp-line: #e3e6eb; /* dividers, decorative only */
  --pp-line-strong: #858b97; /* field outlines and control borders: 3.4:1 on white (WCAG 1.4.11) */
  --pp-hl: #ffe14d; /* the highlighter: marks quoted or key words, and the register band. Nothing else */
  --pp-on-hl: #0e1116; /* text on the highlighter */
  --pp-on-hl-2: #3a3410; /* secondary text on the highlighter: 9.6:1 */
  --pp-civic-1: #13504a; /* national documents (NPF4) */
  --pp-civic-2: #1f2c55; /* local documents (Glasgow's plan) */
  --pp-on-civic: #ffffff;
  --pp-night: #0b0d12; /* the one dark band */
  --pp-on-night: #ffffff;
  --pp-on-night-2: #9ba3b4;
  --pp-ok: #136c43;
  --pp-ok-wash: #e4f4ea;
  --pp-warn: #8a5200;
  --pp-warn-ink: #5e3a00;
  --pp-warn-wash: #fcf0da;
  --pp-neu: #3f4653;
  --pp-neu-wash: #eceef2;
  --pp-err: #9b1c14;
  --pp-err-wash: #fcebe9;
  --pp-shadow-rgb: 14, 17, 22; /* shadows are tinted by the ink */
  --pp-tint-rgb:
    14, 17, 22; /* the ink as numbers, for hover and pressed fills that suit any paper */
  --pp-shadow-hl-rgb: 80, 60, 0; /* shadows on the highlighter band */

  /* ---------- 3. Scales ---------- */
  /* Faces by job. Serif is only for words quoted from a source or an answer. */
  --pp-font-ui: 'Mona Sans', 'Mona Sans Fallback', 'Helvetica Neue', Arial, sans-serif;
  --pp-font-source: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --pp-font-data: 'Geist Mono', ui-monospace, Menlo, monospace;

  /* Type: five display steps, tracking tightening as size grows (Mona Sans at wide widths takes it). */
  --pp-display-1: clamp(2.75rem, 7vw, 6rem); /* 96: the page headline, once */
  --pp-display-2: clamp(2.5rem, 5.6vw, 5rem); /* 80: statement bands */
  --pp-display-3: clamp(2.125rem, 4.4vw, 3.5rem); /* 56: section headings */
  --pp-display-4: clamp(1.75rem, 3vw, 2.5rem); /* 40: sub-sections, story steps */
  --pp-display-5: clamp(1.375rem, 2vw, 1.75rem); /* 28: card titles */
  --pp-track-1: -0.04em;
  --pp-track-2: -0.035em;
  --pp-track-3: -0.03em;
  --pp-track-4: -0.025em;
  --pp-track-5: -0.015em;
  --pp-wide: 110%; /* display width */
  --pp-lead-display: 1.02;
  --pp-lead-title: 1.1;
  --pp-text-lg: clamp(1.0625rem, 1.5vw, 1.3125rem); /* 17 to 21: ledes */
  --pp-text: 1.125rem; /* 18: body */
  --pp-text-sm: 0.9375rem; /* 15: UI */
  --pp-text-xs: 0.8125rem; /* 13: captions */
  --pp-lead-body: 1.55;

  /* Space: a 4px grid. Sections and the heading-to-content gap have their own tokens. */
  --pp-space-1: 4px;
  --pp-space-2: 8px;
  --pp-space-3: 12px;
  --pp-space-4: 16px;
  --pp-space-5: 24px;
  --pp-space-6: 32px;
  --pp-space-7: 40px;
  --pp-space-8: 48px;
  --pp-space-9: 64px;
  --pp-space-10: 96px;
  --pp-section: clamp(64px, 11vw, 144px);
  --pp-stack: 64px; /* heading block to its content */
  --pp-gutter: clamp(20px, 4vw, 40px);
  --pp-column: 1200px;

  /* Radius: five steps. Documents drawn on the page keep paper corners. */
  --pp-r-sm: 6px; /* tags, small marks */
  --pp-r-md: 12px; /* fields, inner panels */
  --pp-r-lg: 20px; /* cards, bubbles, forms */
  --pp-r-xl: 28px; /* feature panels */
  --pp-r-pill: 999px; /* buttons, chips */
  --pp-r-doc: 4px; /* a page */

  /* Depth: three levels, all tinted by the ink. */
  --pp-shadow-1:
    0 1px 2px rgba(var(--pp-shadow-rgb), 0.05), 0 8px 24px -10px rgba(var(--pp-shadow-rgb), 0.16);
  --pp-shadow-2:
    0 0 0 1px rgba(var(--pp-shadow-rgb), 0.06), 0 18px 36px -18px rgba(var(--pp-shadow-rgb), 0.12),
    0 30px 45px -30px rgba(var(--pp-shadow-rgb), 0.2);
  --pp-shadow-3:
    0 1px 2px rgba(var(--pp-shadow-rgb), 0.06), 0 12px 32px -8px rgba(var(--pp-shadow-rgb), 0.18),
    0 40px 80px -24px rgba(var(--pp-shadow-rgb), 0.22);
  --pp-shadow-on-hl: 0 30px 60px -30px rgba(var(--pp-shadow-hl-rgb), 0.45);

  /* Controls: two heights, then a table row and a navigation item. Compact density shrinks all four. */
  --pp-control: 52px;
  --pp-control-sm: 44px;
  --pp-row: 52px;
  --pp-nav-item: 44px;

  /* Fills for hover and pressed, drawn from the ink so they suit any palette. */
  --pp-fill-hover: rgba(var(--pp-tint-rgb), 0.05);
  --pp-fill-press: rgba(var(--pp-tint-rgb), 0.09);

  /* Motion. CSS transitions use these; home.js mirrors the GSAP values by name. */
  --pp-ease-out: cubic-bezier(0.16, 1, 0.3, 1); /* reveals: expo.out */
  --pp-ease-pen: cubic-bezier(0.45, 0, 0.55, 1); /* the highlighter: power2.inOut, no jolt */
  --pp-fast: 150ms; /* hover and state changes */
  --pp-hl-band: 100% 78%; /* the highlighter's size: the full word, the lower 78% */
  --pp-hl-at: 0 88%; /* and where it sits */
  --pp-slow: 220ms; /* page transitions and the menu */
}

/* ---------- Density ---------- */

/* Compact: working screens, where people scan tables all day (the console). Public screens keep the
   default, 16px text and 44px controls at least. Set with <html data-density="compact">. */
html[data-density='compact'] {
  --pp-text: 0.875rem; /* 14: interface */
  --pp-text-sm: 0.8125rem; /* 13: dense controls, secondary */
  --pp-text-xs: 0.75rem; /* 12: captions, table headers, tags */
  --pp-lead-body: 1.45;
  --pp-control: 36px;
  --pp-control-sm: 28px;
  --pp-row: 40px;
  --pp-nav-item: 32px;
}

/* ---------- 4. Palettes: experiments. Each overrides roles only. ---------- */

/* Clyde: deep river navy for ink and the civic pair, on cool paper. */
html[data-palette='clyde'] {
  --pp-paper-2: #eef2f6;
  --pp-ink: #0b1f3a;
  --pp-ink-hover: #18315a;
  --pp-ink-2: #3c4b61;
  --pp-ink-3: #4b5a70;
  --pp-line: #dde4ec;
  --pp-line-strong: #7d8aa0;
  --pp-civic-1: #0f5b66;
  --pp-civic-2: #0b1f3a;
  --pp-night: #0b1f3a;
  --pp-on-night-2: #a9b8cc;
  --pp-shadow-rgb: 11, 31, 58;
  --pp-tint-rgb: 11, 31, 58;
}

/* Sandstone: Glasgow's red sandstone and slate roofs as the civic pair, on stone grey. */
html[data-palette='sandstone'] {
  --pp-paper-2: #f1f0ee;
  --pp-ink: #1c1a19;
  --pp-ink-hover: #34302e;
  --pp-ink-2: #4c4743;
  --pp-ink-3: #5c5651;
  --pp-line: #e5e2de;
  --pp-line-strong: #8c8580;
  --pp-civic-1: #9c3b26;
  --pp-civic-2: #34404a;
  --pp-night: #2a1712;
  --pp-on-night-2: #c9b3aa;
  --pp-shadow-rgb: 42, 23, 18;
  --pp-tint-rgb: 28, 26, 25;
}

/* Green pen: the same system with a fluorescent green highlighter. */
html[data-palette='green-pen'] {
  --pp-hl: #c4f24a;
  --pp-on-hl-2: #263306;
  --pp-civic-1: #1d4d2f;
  --pp-civic-2: #22304d;
  --pp-shadow-hl-rgb: 40, 70, 0;
}

/* Night: the dark version, for a future dark mode. The highlighter keeps dark text. */
html[data-palette='night'] {
  color-scheme: dark;
  --pp-paper: #0e1116;
  --pp-paper-2: #161a21;
  --pp-surface: #1b2029;
  --pp-ink: #f2f3f5;
  --pp-ink-hover: #ffffff;
  --pp-ink-2: #b4bac5;
  --pp-ink-3: #9aa1ad;
  --pp-on-ink: #0e1116;
  --pp-line: #2a303b;
  --pp-line-strong: #6f7684;
  --pp-civic-1: #1d6b63;
  --pp-civic-2: #33467f;
  --pp-night: #000000;
  --pp-ok: #6fd3a0;
  --pp-ok-wash: #12301f;
  --pp-warn: #f2c27a;
  --pp-warn-ink: #f6d7a6;
  --pp-warn-wash: #2e2310;
  --pp-neu: #c3c9d3;
  --pp-neu-wash: #262c36;
  --pp-err: #ff8a80;
  --pp-err-wash: #3a1614;
  --pp-shadow-rgb: 0, 0, 0;
  --pp-tint-rgb: 242, 243, 245;
}
