/* Thinking in Context, the visual identity.
   ==========================================================================

   Every color, face and size in the site is declared here and nowhere else.
   The values are taken from Endurant's Hyperion identity (the neutral ladder,
   one green, three faces), reduced to what a reading surface needs. See
   IDENTITY.md for the reasoning. */

/* ── faces ─────────────────────────────────────────────────────────────────
   Latin subset only (U+0000-00FF), which covers English and Portuguese. All
   three families are SIL Open Font License. */

@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('/assets/fonts/newsreader-normal-200-800-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Newsreader';
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url('/assets/fonts/newsreader-italic-200-800-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Libre Franklin';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/libre-franklin-normal-100-900-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Libre Franklin';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/libre-franklin-italic-100-900-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-mono-normal-400-latin.woff2') format('woff2');
}

/* ── reading ───────────────────────────────────────────────────────────────
   With no `data-theme` on the root, the page follows the system. theme.js
   sets `data-theme` before first paint when the reader has chosen one. Every
   role below resolves through `light-dark()`, so this is the only switch. */

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

:root {
  /* ── primitives ──────────────────────────────────────────────────────────
     The neutral has chroma exactly zero at every rung. The green is the only
     hue, and it marks a link or the focus ring and nothing else. */
  --neutral-000: #ffffff;
  --neutral-025: #fafafa;
  --neutral-050: #f4f4f4;
  --neutral-100: #e9e9e9;
  --neutral-200: #d7d7d7;
  --neutral-300: #bababa;
  --neutral-400: #8c8c8c;
  --neutral-500: #707070;
  --neutral-600: #5b5b5b;
  --neutral-700: #414141;
  --neutral-800: #2c2c2c;
  --neutral-900: #1e1e1e;
  --neutral-925: #141414;
  --neutral-950: #0a0a0a;

  --green-200: #58b47d;
  --green-600: #4f6e59;

  /* ── roles: light-dark(light reading, dark reading) ────────────────────── */
  --ground: light-dark(var(--neutral-050), var(--neutral-900));
  --surface: light-dark(var(--neutral-000), var(--neutral-800));
  --surface-sunken: light-dark(var(--neutral-100), var(--neutral-925));
  --text: light-dark(var(--neutral-900), var(--neutral-025));
  --text-muted: light-dark(var(--neutral-600), var(--neutral-300));
  --rule: light-dark(var(--neutral-200), var(--neutral-700));
  --link: light-dark(var(--green-600), var(--green-200));
  --focus: light-dark(var(--green-600), var(--green-200));

  /* ── faces, one job each ───────────────────────────────────────────────── */
  --font-display: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-text: 'Libre Franklin', -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* ── scale: size / line-height / tracking travel together ──────────────── */
  --display-xl: 4rem;      --display-xl-lh: 0.96;  --display-xl-ls: -0.022em;
  --display-lg: 3rem;      --display-lg-lh: 1.02;  --display-lg-ls: -0.02em;
  --display-md: 2.25rem;   --display-md-lh: 1.08;  --display-md-ls: -0.016em;
  --heading-md: 1.375rem;  --heading-md-lh: 1.26;  --heading-md-ls: -0.01em;
  --body-lg: 1.125rem;     --body-lg-lh: 1.62;
  --body-md: 1rem;         --body-md-lh: 1.6;
  --caption: 0.8125rem;    --caption-lh: 1.48;
  --label: 0.75rem;        --label-lh: 1.3;        --label-ls: 0.01em;

  /* ── space: 4px base ───────────────────────────────────────────────────── */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;

  --measure: 66ch;

  /* ── motion ────────────────────────────────────────────────────────────── */
  --dur-fast: 120ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: 0ms;
  }
}
