/* ═══════════════════════════════════════════════════════════════
   THE CS CONSTRUCT: shared styles for every page
   ═══════════════════════════════════════════════════════════════ */

/* ── FONTS ─────────────────────────────────────────────────────
   One place controls the site's type.
   To switch headings to Courier Prime: add &family=Courier+Prime:wght@400;700
   to this URL, then change --font-head below.                      */
@import url('https://fonts.googleapis.com/css2?family=Archivo:wdth,wght@62..125,400..900&display=swap');

:root {
  /* Colours */
  --black: #000000;   /* true black background */
  --ink:   #ececec;   /* main text */
  --dim:   #a3a3a3;   /* secondary text */
  --faint: #2a2a2a;   /* rules and borders */
  --green: #008f11;       /* darker Matrix green */
  --green-rgb: 0, 143, 17; /* the same green as r, g, b: used by the rain on every page */

  /* Type */
  --font-body: 'Archivo', system-ui, sans-serif;
  --font-head: 'Archivo', system-ui, sans-serif;
  --head-stretch: 78%;   /* condensed headings (use 100% for Courier Prime) */
  --head-weight: 800;    /* (use 700 for Courier Prime) */
}

/* ── BASE ──────────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { background: var(--black); scroll-behavior: smooth; }

body {
  background: var(--black);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: inherit; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

/* Hidden from view, still read by screen readers and search engines */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ── BACKGROUND RAIN (drawn by rain.js) ────────────────────── */
#bg-rain {
  position: fixed;
  inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}
main, footer { position: relative; z-index: 1; }

/* ── LAYOUT HELPERS ────────────────────────────────────────── */
.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 3rem);
}

/* ── HEADINGS ──────────────────────────────────────────────── */
h1, h2 {
  font-family: var(--font-head);
  font-stretch: var(--head-stretch);
  font-weight: var(--head-weight);
  color: var(--green);
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); line-height: 1; }
h2 { font-size: clamp(2rem, 4.2vw, 3.4rem); line-height: 1.02; max-width: 14em; }
h3 {
  font-family: var(--font-head);
  font-stretch: calc(var(--head-stretch) + 7%);
  font-weight: 700;
  line-height: 1.15;
}

.lede {
  color: var(--dim);
  font-size: 1.1rem;
  max-width: 36em;
  margin-top: 1.1rem;
}

/* Underlined text link with a green rule */
.text-link {
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid var(--green);
  padding-bottom: 1px;
}
.text-link:hover { color: var(--green); }

/* ── NAV ───────────────────────────────────────────────────── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1.1rem clamp(1rem, 4vw, 3rem);
  background: var(--black);
  border-bottom: 1px solid var(--faint);
  transition: background 0.3s, border-color 0.3s;
}
/* The homepage nav starts transparent over the poster */
nav.over-poster { background: transparent; border-bottom-color: transparent; }

.brand {
  font-family: var(--font-head);
  font-weight: 700;
  font-stretch: calc(var(--head-stretch) + 7%);
  font-size: 1.05rem;
  text-decoration: none;
  margin-right: auto;
  letter-spacing: 0.01em;
}

.nav-links { display: flex; gap: 1.8rem; list-style: none; }
.nav-links a, .sound-btn {
  font-size: 0.95rem;
  color: var(--dim);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-links a:hover, .sound-btn:hover { color: var(--ink); }
/* Page you are on */
.nav-links a[aria-current="page"] {
  color: var(--ink);
  border-bottom: 2px solid var(--green);
  padding-bottom: 2px;
}

.sound-btn {
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
}
.sound-btn.on { color: var(--green); }

.nav-burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-burger span { display: block; width: 22px; height: 2px; background: var(--ink); }

.nav-mobile {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--black);
  z-index: 490;
  flex-direction: column;
  justify-content: center;
  gap: 1.6rem;
  padding: 0 2rem;
}
.nav-mobile.open { display: flex; }
.nav-mobile a {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 700;
  font-stretch: 80%;
  text-decoration: none;
}
.nav-mobile a[aria-current="page"] { color: var(--green); }

/* ── INNER PAGE HEADER ─────────────────────────────────────── */
.page-head { padding-top: 9rem; padding-bottom: 3.5rem; }
.crumb { font-size: 0.92rem; color: var(--dim); margin-bottom: 1.2rem; }
.crumb a { text-decoration: none; }
.crumb a:hover { color: var(--green); }

/* ── SLIDE FIGURES ─────────────────────────────────────────── */
figure.slide img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px;
  background: #fff;
}
figure.slide figcaption {
  margin-top: 0.8rem;
  font-size: 0.92rem;
  color: var(--dim);
}
figure.slide figcaption b { color: var(--green); font-weight: 600; }

/* ── FOOTER ────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--faint);
  background: var(--black);
  padding: 2.2rem clamp(1rem, 4vw, 3rem);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: space-between;
  color: var(--dim);
  font-size: 0.92rem;
}
footer ul { display: flex; gap: 1.6rem; list-style: none; }
footer a { text-decoration: none; }
footer a:hover { color: var(--ink); }

/* ── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 760px) {
  .nav-links { display: none; }
  .nav-burger { display: flex; }
  nav { gap: 1.2rem; }
  .page-head { padding-top: 7rem; padding-bottom: 2.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
