/* ==========================================================================
   base.css — reset, element defaults, shared primitives
   Uses tokens.css only. No section-specific rules here.
   ========================================================================== */

/* --- Reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

/* --- Hero eyebrow face -----------------------------------------------------
   Was an OCR-B test face carried only by the hero eyebrow and hero dates, which
   left those two lines set in a family nothing else on the page used. Aligned
   to --font-mono with the rest of the eyebrow/label register. The @font-face and
   assets/fonts/OCR-B.ttf are kept out of the cascade rather than deleted, so the
   comparison can be reopened by restoring this class. */
.hero__eyebrow--ocrb { font-family: var(--font-mono); }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem; /* clears the sticky header on anchor jumps */
}

body {
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--font-sans);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden; /* page never scrolls sideways; wide blocks scroll internally */
}

img, picture, video, svg { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
ul, ol { padding: 0; list-style: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Typography ---------------------------------------------------------- */
h1, h2, h3, h4 {
  color: var(--c-ink);
  font-weight: 600;
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-tight);
  text-wrap: balance;
}
h1 { font-size: var(--t-h1); line-height: var(--lh-tight); }
/* H2 shares the proposition statement's voice. Instrument Serif ships a single
   weight, so weight is pinned to 400 (600 would trigger faux-bold) and size is
   raised a step to match Inter's visual mass. */
h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: var(--t-h2);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
h3 { font-size: var(--t-h3); letter-spacing: -0.01em; }

p { text-wrap: pretty; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--c-accent); }

strong { font-weight: 600; }

.lead {
  font-size: var(--t-lead);
  line-height: 1.5;
  color: var(--c-ink-muted);
  max-width: var(--w-prose);
}
.small  { font-size: var(--t-small); }
.muted  { color: var(--c-ink-muted); }
.faint  { color: var(--c-ink-faint); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  font-weight: 400; /* matches .proposition__mark */
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--c-accent);
}
/* Hero eyebrow and dates keep the original treatment: weight 500, no prefix. */
.hero__eyebrow, .hero__dates { font-weight: 500; }

/* --- Focus / a11y -------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: var(--s-3);
  left: var(--s-3);
  z-index: calc(var(--z-modal) + 1);
  padding: var(--s-2) var(--s-4);
  background: var(--c-ink);
  color: var(--c-ink-inverse);
  border-radius: var(--r-sm);
  transform: translateY(-200%);
  transition: transform var(--dur) var(--ease);
}
.skip-link:focus { transform: translateY(0); color: var(--c-ink-inverse); }

/* --- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 0.8rem 1.4rem;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-size: var(--t-small);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; pointer-events: none; }

.btn--primary {
  background: var(--c-accent);
  color: var(--c-accent-ink);
}
.btn--primary:hover { background: var(--c-accent-hover); color: var(--c-accent-ink); }

.btn--secondary {
  background: transparent;
  border-color: var(--c-border-strong);
  color: var(--c-ink);
}
.btn--secondary:hover { border-color: var(--c-ink); color: var(--c-ink); background: var(--c-bg-hover); }

.btn--ghost { padding-inline: var(--s-2); color: var(--c-ink-muted); }
.btn--ghost:hover { color: var(--c-ink); }

.btn--lg { padding: 1rem 1.9rem; font-size: var(--t-body); }
.btn--block { width: 100%; }

/* --- Cards / surfaces ---------------------------------------------------- */
/* On dark the card reads as a lift off the ground, not a raised plane: the
   --c-surface step does most of the work and the hairline finishes the edge.
   Shadow is deliberately absent — it adds nothing over a near-black ground. */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
}

/* Media card: the photograph runs full-bleed to the card edge, so the padding
   moves off .card and onto .card__body. Used by the programme grid. */
.card--media {
  padding: 0;
  overflow: hidden;
}
.card--media > .card__body { padding: var(--s-5); }

.card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--c-bg-deep);
  border-bottom: 1px solid var(--c-border);

  /* The three dials the LED treatment reads. Raising --led-gap or dropping
     --led-pitch makes it coarser and harder; both directions are one edit. */
  --led-pitch:  4px;    /* centre-to-centre of the LEDs */
  --led-gap:    0.14;   /* darkness of the lattice between them — 0 removes it */
  --led-rgb:    0.06;   /* strength of the subpixel stripe */
}

/* Black and white by design, not by accident: the four programme photographs
   come from four different cameras and lighting situations, and colour would
   make the row read as a scrapbook. The contrast lift is mild — the lattice
   below already eats light, and stacking a hard grade under it is what made
   the first pass look crunchy rather than screen-like. */
.card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.08) brightness(1.04);
}

/* LED-wall treatment, in two passes over the grayscale plate.
   ::before is the RGB subpixel stripe — the thing that makes a photographed
   screen look like a screen. ::after is the physical gap between the LEDs.

   The lattice is a CONTINUOUS ramp, dark to clear to dark across each period,
   with no flat run and no hard stop anywhere in it. That is not a stylistic
   choice — it is what stops the lines rendering at uneven weights.

   A stop at a fractional pixel (0.5px, 1.5px) has to be resolved against the
   device pixel grid, and at the fractional display scaling Windows ships by
   default (125%, 150%) that rounding goes a different way from one line to the
   next. The eye reads the result as random thick lines and a faint moire that
   crawls as the page scrolls. A gradient whose value changes smoothly across
   the whole period has no edge to round, so the worst an unlucky alignment
   costs is a shade of darkness rather than a visibly doubled line. */
.card__media::before,
.card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Same rule as the lattice, for the same reason: the stripe eases R -> G -> B
   -> R across one pitch and closes on the colour it opened with, so the period
   is continuous. Hard 1px colour stops were the worst offender of the two —
   a 1px period cannot survive fractional scaling at all, and what it produced
   was not a subpixel stripe but coloured noise. */
.card__media::before {
  background-image: repeating-linear-gradient(
    90deg,
    rgb(255 96 96 / var(--led-rgb)) 0,
    rgb(96 255 96 / var(--led-rgb)) calc(var(--led-pitch) / 3),
    rgb(96 96 255 / var(--led-rgb)) calc(var(--led-pitch) * 2 / 3),
    rgb(255 96 96 / var(--led-rgb)) var(--led-pitch)
  );
  mix-blend-mode: screen;
}

.card__media::after {
  background-image:
    repeating-linear-gradient(90deg,
      rgb(0 0 0 / var(--led-gap)) 0,
      transparent calc(var(--led-pitch) / 2),
      rgb(0 0 0 / var(--led-gap)) var(--led-pitch)),
    repeating-linear-gradient(0deg,
      rgb(0 0 0 / var(--led-gap)) 0,
      transparent calc(var(--led-pitch) / 2),
      rgb(0 0 0 / var(--led-gap)) var(--led-pitch));
}

/* Below roughly 2x DPR the lattice is subpixel anyway and mostly costs paint
   time, so it softens further rather than being drawn at full strength. */
@media (max-width: 30rem) {
  .card__media { --led-gap: 0.10; }
}

/* The lattice works by taking light out of the photograph, so it lowers the
   image's effective contrast. Anyone who has asked for more gets less of it. */
@media (prefers-contrast: more) {
  .card__media { --led-gap: 0.07; --led-rgb: 0.03; }
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--c-border);
  border-radius: var(--r-pill);
  background: var(--c-bg-subtle);
  font-size: var(--t-caption);
  font-weight: 500;
  color: var(--c-ink-muted);
}

/* Structural, so --c-divider (2.14:1) not --c-border (1.58:1): a decorative
   card outline and a rule that separates content are not the same job once
   there is no light ground to carry the line. */
hr, .rule {
  border: 0;
  border-top: 1px solid var(--c-divider);
  margin: 0;
}

/* --- Forms --------------------------------------------------------------- */
.field { display: grid; gap: var(--s-2); }

.field > label {
  font-size: var(--t-small);
  font-weight: 600;
}

.field .hint { font-size: var(--t-caption); color: var(--c-ink-faint); }

.input, .select, .textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  background: var(--c-bg);
  border: 1px solid var(--c-border-strong); /* 3.15:1 against the card it sits in */
  border-radius: var(--r-md);
  font-size: var(--t-small);
  color: var(--c-ink);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--c-ink-faint); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-soft);
}
.textarea { min-height: 7rem; resize: vertical; }

.field[data-invalid="true"] .input,
.field[data-invalid="true"] .select,
.field[data-invalid="true"] .textarea { border-color: var(--c-error); }

.field .error { font-size: var(--t-caption); color: var(--c-error); }

.checkbox {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  font-size: var(--t-small);
  color: var(--c-ink-muted);
  cursor: pointer;
}
.checkbox input { margin-top: 0.2em; accent-color: var(--c-accent); }

.required { color: var(--c-accent); }
