/* ==========================================================================
   tokens.css — fonts, palette, type scale, spacing.
   Change a value here and it changes everywhere. No magic numbers in site.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Fonts. Self-hosted, latin subset, no external requests.
   See /assets/fonts/README.txt for provenance and OFL.txt for the licence.
   -------------------------------------------------------------------------- */

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/archivo-variable-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Literata";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/assets/fonts/literata-variable-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Spline Sans Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/spline-sans-mono-400-latin.woff2") format("woff2");
}

:root {
  /* ------------------------------------------------------------------------
     2. Palette. Six values, all drawn from land at the end of a working day.
     Contrast ratios noted against the surface each colour is used on.
     ------------------------------------------------------------------------ */

  --haze: #e7eae3;        /* page ground — cool pale mineral                  */
  --haze-deep: #dde1d8;   /* inset panels on the light ground                 */
  --indigo: #1c2b4a;      /* field at dusk — dark bands, and text on haze     */
  --indigo-lift: #26375c; /* hover state for dark surfaces                    */
  --chicory: #4a4fa8;     /* chicory / alfalfa bloom — links      5.8:1 haze  */
  --chicory-lift: #383d92;/* link hover                           8.0:1 haze  */
  --straw: #d2b877;       /* cut stubble — accent on dark only    7.1:1 ind.  */
  --shadow: #4e5a50;      /* secondary text                       6.0:1 haze  */
  --sage: #8c9585;        /* rules and dividers ONLY — 2.6:1, never text      */
  --sage-dim: #3c4e70;    /* the same job, on the dark bands                  */
  --mist: #c3cbd6;        /* secondary text on dark               8.5:1 ind.  */

  /* ------------------------------------------------------------------------
     3. Roles. Everything in site.css reads these, never the raw palette,
     so `.band--dark` can repaint a whole section by overriding six values.
     ------------------------------------------------------------------------ */

  --surface: var(--haze);
  --surface-inset: var(--haze-deep);
  --text: var(--indigo);
  --text-muted: var(--shadow);
  --rule: var(--sage);
  --accent: var(--chicory);
  --link: var(--chicory);
  --link-hover: var(--chicory-lift);
  --focus-ring: var(--chicory);
  --mark-rule: var(--sage);
  --mark-fill: var(--chicory);
  /* The big margin numeral. It is aria-hidden and the visible title repeats
     what it says, so WCAG's decoration exemption would cover it — but it is
     set to clear the 3:1 large-text threshold anyway rather than rely on that
     argument. 3.43:1 on --haze, 3.14:1 on --haze-deep. */
  --numeral: #767f70;

  /* ------------------------------------------------------------------------
     4. Type
     ------------------------------------------------------------------------ */

  --font-display: "Archivo", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Literata", Georgia, "Times New Roman", serif;
  --font-mono: "Spline Sans Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --size-h1: clamp(2.25rem, 1.5rem + 3.6vw, 4rem);
  --size-h2: clamp(1.75rem, 1.3rem + 2.1vw, 2.75rem);
  --size-h3: clamp(1.35rem, 1.15rem + 0.9vw, 1.75rem);
  --size-lead: clamp(1.15rem, 1.05rem + 0.5vw, 1.375rem);
  --size-body: clamp(1.0625rem, 1.03rem + 0.16vw, 1.125rem);
  --size-small: 0.9375rem;
  --size-label: 0.75rem;

  --leading-tight: 1.05;
  --leading-head: 1.15;
  --leading-lead: 1.55;
  --leading-body: 1.7;

  --track-h1: -0.025em;
  --track-h2: -0.02em;
  --track-h3: -0.015em;
  --track-label: 0.12em;

  --measure: 62ch;
  --measure-tight: 46ch;

  /* ------------------------------------------------------------------------
     5. Space, shape, motion
     ------------------------------------------------------------------------ */

  --gutter: clamp(1.25rem, 4vw, 3rem);
  --shell-max: 76rem;

  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 2.5rem;
  --sp-8: 3rem;

  --band-pad: clamp(3.5rem, 8vw, 7.5rem);
  --stack-gap: clamp(2.5rem, 5vw, 4rem);
  --grid-gap: clamp(1.5rem, 4vw, 4.5rem);

  --radius: 4px;
  --radius-sm: 3px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --speed: 160ms;
}

/* --------------------------------------------------------------------------
   6. The dark bands. Same roles, repainted. Every contrast pairing below
   clears WCAG AA: haze on indigo 11.2:1, mist on indigo 8.5:1,
   straw on indigo 7.1:1.
   -------------------------------------------------------------------------- */

.band--dark {
  --surface: var(--indigo);
  --surface-inset: var(--indigo-lift);
  --text: var(--haze);
  --text-muted: var(--mist);
  --rule: var(--sage-dim);
  --accent: var(--straw);
  --link: var(--straw);
  --link-hover: #e6d09a;
  --focus-ring: var(--straw);
  --mark-rule: var(--straw);
  --mark-fill: var(--straw);
  --numeral: #66799f;   /* 3.11:1 on --indigo */

  /* The plat field. Pre-blended against --indigo rather than layered with
     opacity, because straw at low alpha over indigo goes a muddy olive — and
     because one shared layer opacity cannot make the section lines read
     heavier than the fine grid. Grid is structural (blue), the filled cells
     are the accent (gold). */
  --plat-fine: #2f3a51;
  --plat-section: #47526d;
  --plat-cell: #b7a370;
}

/* A third ground, so the page is not just a light/dark binary. */
.band--tint {
  --surface: var(--haze-deep);
  background: var(--surface);
}
