@layer tokens {
/*
  Design tokens, derived from product/design-direction.md. Light and dark are expressed with
  light-dark() so one declaration carries both; the explicit toggle sets color-scheme on <html>.
*/

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../fonts/BricolageGrotesque.woff2") format("woff2");
  font-weight: 300 800;
  font-stretch: 75% 100%;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("../fonts/AtkinsonHyperlegibleNext.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("../fonts/AtkinsonHyperlegibleNext-Italic.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/IBMPlexMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/IBMPlexMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  /* Palette. Hex equivalents in the design direction; oklch here so tints are one step away. */
  --c-slate: light-dark(oklch(26% 0.03 230), oklch(93% 0.008 200));
  --c-sky: light-dark(oklch(95.5% 0.005 200), oklch(22% 0.03 230));
  --c-pine: light-dark(oklch(43% 0.08 165), oklch(68% 0.1 165));
  --c-lantern: oklch(76% 0.15 75);
  /* Lantern as text. The same amber, deep enough to read on the ground in daylight (4.5:1); in the dark it is the lantern itself. */
  --c-lantern-ink: light-dark(oklch(45% 0.12 75), oklch(76% 0.15 75));
  --c-contour: light-dark(oklch(85% 0.012 190), oklch(38% 0.02 220));
  --c-ember: light-dark(oklch(50% 0.19 28), oklch(68% 0.17 28));
  --c-paper: light-dark(oklch(100% 0 0), oklch(26% 0.03 230));
  /* The roofline: the header, the footer and the closing band are wet slate in both themes. */
  --c-roof: oklch(24% 0.03 230);
  --c-on-roof: oklch(94% 0.008 200);
  --c-on-roof-muted: oklch(76% 0.014 200);
  --c-on-roof-link: oklch(82% 0.09 165);
  --c-on-roof-line: oklch(36% 0.025 225);
  /* The night: the hero ground, deeper than the roofline so the glow has somewhere to sit. One value in both themes. */
  --c-night: oklch(20% 0.03 230);
  /* The lines of a still life on the night surface; in daylight the picture takes the muted ink instead. */
  --c-on-night-line: oklch(52% 0.02 220);
  --c-glow: oklch(80% 0.16 75 / 0.35);

  /* Derived */
  --c-ink: var(--c-slate);
  --c-ink-muted: color-mix(in oklab, var(--c-slate) 70%, var(--c-sky));
  --c-ground: var(--c-sky);
  --c-pine-hover: color-mix(in oklab, var(--c-pine) 85%, var(--c-slate));
  --c-pine-tint: color-mix(in oklab, var(--c-pine) 12%, var(--c-paper));
  --c-lantern-tint: color-mix(in oklab, var(--c-lantern) 18%, var(--c-paper));
  --c-ember-tint: color-mix(in oklab, var(--c-ember) 12%, var(--c-paper));
  --c-focus: var(--c-lantern);

  /* Type */
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible Next", system-ui, Arial, sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, Consolas, monospace;

  --text-s: 0.875rem;
  --text-m: 1rem;
  --text-l: 1.25rem;
  --text-xl: clamp(1.4rem, 1.1rem + 1.2vw, 1.75rem);
  --text-2xl: clamp(1.9rem, 1.4rem + 2vw, 2.4rem);
  --text-display: clamp(3.5rem, 2rem + 10vw, 7rem);

  --leading-tight: 1.1;
  --leading-body: 1.55;

  /* Space, on a 4px base */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --gutter: clamp(1rem, 4vw, 2rem);

  /* Shape */
  --radius-s: 0.375rem;
  --radius-m: 0.75rem;
  --border: 2px solid var(--c-contour);
  --focus-ring: 3px solid var(--c-focus);

  /* Layout */
  --measure: 62ch;
  /* The column grows with the window instead of stopping dead at the mockup's 78rem: on a 2000px
     monitor a fixed 1248px column leaves 376px of empty ground down each side, which reads as a
     page built for a laptop. Running prose is held to --measure wherever it appears, so widening
     this widens the grids, the board and the hero rather than the sentences. */
  --page-max: clamp(78rem, 90vw, 110rem);
  --header-height: 4rem;

  /* Motion */
  --duration-quick: 150ms;
  --duration-reveal: 900ms;
  --duration-glow: 600ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* The map library's control icons are black SVGs; in the dark they are inverted to read. */
  --map-icon-filter: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --map-icon-filter: invert(0.85);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --map-icon-filter: invert(0.85);
}

/* The animatable Days Ready number. Registered so the figure can count up in CSS alone. */
@property --days {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}
}
