/* Food Robot Index: design tokens for design A, "Data journalism" (serif headlines, square corners, thin rules).
   Palette: "Slate and teal" is always the default. "Night desk" is chosen with the header toggle: [data-theme="dark"] on <html> (block at the end of this file).
   Decided 17 Nov 2026 (see process/design-tokens.md). Extracted from css/style.css on 17 Nov 2026. This file holds values only and no selectors except :root.
   Rules for using these tokens are in process/design-tokens.md. Load this file before css/style.css.

   Breakpoints (custom properties cannot be used inside @media, so they are notes, not variables):
     --bp-narrow: 800px   single-column scoreboard, smaller h1 and map (max-width: 800px)
     --bp-phone:  520px   15px root font size, 14px gutter, stacked header (max-width: 520px)
*/
:root {
  /* ---- Color: surfaces and ink ---- */
  --bg: #f2f5f7;               /* page, header background */
  --fg: #12181e;               /* body text, rules, borders, focus ring */
  --muted: #394450;            /* secondary text (contrast 9.7:1 on --bg) */
  --line: #c3ccd4;             /* hairlines between rows and cards */
  --card-bg: #fcfdfe;          /* cards, table, inputs */
  --row-hover: #e6ecf0;        /* table row hover */
  --header-bg: var(--bg);
  --banner-bg: #cfe9ec;        /* "Seed data" banner */
  --banner-fg: #06353b;
  --banner-border: #7ab5bb;
  --link: #0a6670;
  --link-visited: #3d4f8a;
  --focus: var(--fg);          /* focus ring color */
  --on-ink: var(--bg);         /* text on --fg backgrounds (skip link) */
  --white: #ffffff;            /* hollow chip marker, pin ring, hatch lines */

  /* ---- Color: status (text color + chip background). Always pair with the status word. ---- */
  --live: #0a5a40;
  --live-bg: #d5ebe0;
  --piloting: #8f5a00;
  --piloting-bg: #f5e3c3;
  --announced: #2347a8;
  --announced-bg: #dbe4f7;
  --removed: #9b1239;
  --removed-bg: #f7d6df;
  --unconfirmed: #5a6570;
  --unconfirmed-bg: #e3e8ec;

  /* ---- Color: brand (logo B inline in the header; favicon, social image and manifest are built from these by process/build-brand.py) ---- */
  --brand-mark: #0a6670;       /* logo square */
  --brand-bars: #f2f5f7;       /* the two bars inside the square */
  --on-status: #ffffff;        /* text on a solid status fill (numbers inside chart bars) */

  /* ---- Color: map ---- */
  --pin-live: #0a5a40;         /* pins match the chip colors; the chip palette is already tuned for colorblind separation */
  --pin-piloting: #8f5a00;
  --pin-announced: #2347a8;
  --pin-removed: #9b1239;
  --pin-unconfirmed: #5a6570;
  --map-bg: #e3e9ed;           /* shown when tiles fail */
  --map-grid: rgba(80, 80, 80, 0.06);
  --map-note-bg: rgba(252, 253, 254, 0.95);
  --map-tile-filter: none;      /* dark mode darkens the OpenStreetMap tiles only, never markers or legend */
  --pin-ring: var(--white);
  --pin-shadow: 0 0 0 1px rgba(18, 24, 30, 0.45), 0 1px 4px rgba(0, 0, 0, 0.3);

  /* ---- Type: families ---- */
  --font: "Source Sans 3", "Segoe UI", Helvetica, Arial, sans-serif;     /* body, UI, numbers labels */
  --serif: "Libre Baskerville", Georgia, "Times New Roman", serif;       /* headlines, big numbers */
  --mono: "Source Sans 3", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --mono-code: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;  /* inline <code> */

  /* ---- Type: size scale (rem; root is 16px, 15px under 520px) ---- */
  --fs-chip: 0.72rem;          /* status chips */
  --fs-label: 0.75rem;         /* small caps labels under big numbers */
  --fs-note: 0.78rem;          /* map fallback note */
  --fs-th: 0.82rem;            /* table headers (serif italic) */
  --fs-sm: 0.85rem;            /* nav, banner, meta lines */
  --fs-meta: 0.88rem;          /* footnotes, legend, counts */
  --fs-small: 0.9rem;          /* footer, definition lists, prose tables */
  --fs-table: 0.95rem;         /* table body, h3 */
  --fs-base: 1rem;
  --fs-lede: 1.15rem;
  --fs-h2: 1.25rem;
  --fs-wordmark: 1.45rem;
  --fs-score: 2rem;            /* big numbers in scoreboard cards */
  --fs-h1: 2.4rem;
  --fs-h1-narrow: 1.85rem;     /* under 800px */
  --fs-h1-phone: 1.55rem;      /* under 520px */
  --fs-wordmark-narrow: 1.2rem;
  --fs-lede-phone: 1.05rem;
  --fs-root: 16px;
  --fs-root-phone: 15px;

  /* ---- Type: weight, leading, tracking ---- */
  --fw-regular: 400;
  --fw-semibold: 600;
  --fw-bold: 700;
  --lh-body: 1.5;
  --lh-tight: 1.15;
  --lh-chip: 1.3;
  --lh-score: 1.1;
  --tracking-caps: 0.08em;     /* uppercase labels, nav, banner */
  --tracking-chip: 0.05em;
  --tracking-wordmark: -0.02em;

  /* ---- Spacing (rem unless noted) ---- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-9: 2.25rem;          /* between sections */
  --space-12: 3rem;
  --gutter: 20px;              /* page side padding */
  --gutter-phone: 14px;
  --max: 1120px;               /* content width */
  --prose-max: 46rem;
  --lede-max: 40rem;

  /* ---- Borders, radii, shadows ---- */
  --bw-hairline: 1px;
  --bw-heavy: 3px;            /* header and footer rules */
  --border-ink: 1px solid var(--fg);
  --border-line: 1px solid var(--line);
  --rule-heavy: 3px solid var(--fg);
  --radius: 0;                 /* design A has square corners */
  --radius-round: 50%;
  --shadow: none;

  /* ---- Sizes and layers ---- */
  --map-h: 440px;
  --map-h-narrow: 300px;
  --map-h-phone: 260px;
  --pin-size: 16px;
  --pin-hit: 24px;             /* minimum touch/click target (WCAG 2.2 AA 2.5.8) */
  --control-h: 2.4rem;
  --z-skip: 20;
  --z-map-note: 500;
}

/* ---- Explorer layout (headline strip, timeline, split map and list, drawer) ---- */
:root {
  --max-wide: 1240px;          /* explorer pages: map + list side by side */
  --map-h-explorer: 540px;
  --drawer-w: 27rem;
  --z-drawer: 600;
  --z-sticky: 550;
  --fs-stat: 2.6rem;           /* headline numbers */
  --fs-stat-phone: 2rem;
  --bar-h: 0.9rem;             /* scoreboard bar height */
  --tl-thumb: 22px;            /* timeline slider thumb width */
}

/* ---- Night desk: dark mode, chosen by the reader with the header toggle (js/theme.js sets data-theme="dark" on <html>, saved in localStorage; the inline script in <head> applies it before first paint). The OS setting is ignored: light is always the default. Same token names, new values. Contrast: process/check-contrast.py. ---- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101316;
  --fg: #eee9df;
  --muted: #c3bdb1;
  --line: #3a4148;
  --card-bg: #181c20;
  --row-hover: #21262b;
  --banner-bg: #3b2f0b;
  --banner-fg: #f6dd8a;
  --banner-border: #7a6420;
  --link: #7fd0d6;
  --link-visited: #b9a6e8;
  --white: #f4f1ea;
  --live: #52f27d;
  --live-bg: #1b3b28;
  --piloting: #e99431;
  --piloting-bg: #372a1a;
  --announced: #5199cf;
  --announced-bg: #1b2b37;
  --removed: #f45e7c;
  --removed-bg: #392028;
  --unconfirmed: #ccc9c9;
  --unconfirmed-bg: #313336;
  --pin-live: #52f27d;
  --pin-piloting: #e99431;
  --pin-announced: #5199cf;
  --pin-removed: #f45e7c;
  --pin-unconfirmed: #b5b2b2;
  --map-bg: #1d2227;
  --map-note-bg: rgba(24, 28, 32, 0.95);
  --map-tile-filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.88);
  --pin-shadow: 0 0 0 1px rgba(0, 0, 0, 0.7), 0 1px 4px rgba(0, 0, 0, 0.6);
  --brand-mark: #eee9df;
  --brand-bars: #101316;
  --on-status: #101316;
}
