/* Matches the cover art (brand/looking-for-alfred-cover-3000.jpg): ink ground, a lamp glow upper right,
   a stacked Fraunces title, Plex Mono small text and a row of build dots ending in a build that never ran. */

@font-face {
  font-family: "Fraunces";
  src: url("/assets/fonts/fraunces-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-regular-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-medium-latin.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  /* Dark is the primary scheme: it is the cover. */
  --ink: #10151C;
  --ink-glow: #202C3C;
  --paper: #F0E7D6;
  --muted: #8A96A5;
  --pass: #4D8FDC;
  --unstable: #E0A63A;
  --fail: #D4553A;
  --rule: color-mix(in srgb, var(--muted) 30%, transparent);

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --gutter: clamp(1.25rem, 8vw, 6rem);
  --dot: clamp(1.1rem, 3.2vw, 1.4rem);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --ink: #F4EEE3;
    --ink-glow: #E6DCC8;
    --paper: #10151C;
    --muted: #525B68;
    --pass: #2F6FBF;
    --unstable: #B7801A;
    --fail: #B8442B;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  display: flex;
  flex-direction: column;
  color: var(--paper);
  /* The lamp: subtle, fixed to the viewport so it stays upper right while scrolling. */
  background:
    radial-gradient(ellipse 95% 85% at 82% 8%, var(--ink-glow), transparent 78%) fixed,
    var(--ink);
  font-family: var(--font-mono);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main,
footer {
  width: 100%;
  max-width: calc(64rem + 2 * var(--gutter));
  padding-inline: var(--gutter);
}

main {
  flex: 1;
  padding-block: clamp(3rem, 10vh, 8rem) clamp(2.5rem, 7vh, 5rem);
}

p { margin: 0; }

.kicker {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: clamp(1rem, 3vw, 2rem) 0 0;
  font-family: var(--font-display);
  /* "Looking" is about 3.62em wide in Fraunces Black: 23vw fills the 84vw measure without crossing the gutter. */
  font-size: clamp(4.5rem, 23vw, 15rem);
  font-weight: 900;
  /* The display cut at every size, as on the cover. Optical sizing alone gives opsz 90 on a phone. */
  font-variation-settings: "opsz" 144;
  line-height: 0.86;
  letter-spacing: -0.005em;
}

/* One word per line; spans rather than <br> keep the accessible name "Looking for Alfred". */
h1 span { display: block; }

.lede {
  max-width: 40ch;
  margin-top: clamp(1.75rem, 5vw, 3rem);
  color: var(--muted);
  font-size: clamp(1rem, 2.4vw, 1.1rem);
}

/* Episode tracker, rendered by build.py. Each planned episode is a mark in the cover's build-status style: a dashed
   ring (a build that hasn't run) until it is released, then a solid "passing" dot. The ring's size, stroke and dash
   pattern are SVG attributes, so a stale or missing stylesheet still shows small rings; here they take the colour. */
.episodes {
  margin-top: clamp(2rem, 5vw, 2.75rem);
}

.episodes-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tracker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem calc(var(--dot) * 0.55);
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
}

.tracker li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}

.tracker .dot,
.tracker .ring {
  flex: none;
  width: var(--dot);
  height: var(--dot);
}

.tracker .dot {
  border-radius: 50%;
  background: var(--pass);
}

.tracker .ring { color: var(--muted); }

.tracker .num {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1;
}

.tracker .released .num { color: var(--paper); }

.status {
  margin-top: 1.1rem;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.status .count {
  color: var(--muted);
  font-weight: 400;
}

footer {
  padding-block: 0 2rem;
  color: var(--muted);
  font-size: 0.8rem;
}

footer p {
  max-width: 60ch;
  padding-top: 0.25rem;
}

footer p:first-child {
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}

/* Episode pages (templates/episode.html, written by build.py). Same ground and type as the home page, with a
   smaller title so a long one wraps cleanly. */
a {
  color: inherit;
  text-decoration-color: var(--muted);
  text-underline-offset: 0.2em;
}

a:hover { text-decoration-color: currentColor; }

.episode h1 {
  max-width: 14ch;
  font-size: clamp(3rem, 11vw, 7.5rem);
  line-height: 0.92;
  text-wrap: balance;
  overflow-wrap: break-word;
}

.facts {
  display: grid;
  gap: 1rem;
  max-width: 44rem;
  margin: clamp(1.75rem, 5vw, 3rem) 0 0;
}

.facts dt {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.facts dd {
  margin: 0.2rem 0 0;
  font-size: clamp(1rem, 2.4vw, 1.1rem);
}

.episode .status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: clamp(1.75rem, 5vw, 2.5rem);
}

.episode .status .ring,
.episode .status .dot {
  flex: none;
  width: 1.1rem;
  height: 1.1rem;
}

.episode .status .ring { color: var(--muted); }

.episode .status .dot {
  border-radius: 50%;
  background: var(--pass);
}

.player {
  display: block;
  width: 100%;
  max-width: 40rem;
  margin-top: 1.25rem;
}

.transcript {
  margin-top: 0.75rem;
  font-size: 0.85rem;
}

.notes {
  max-width: 60ch;
  margin-top: clamp(1.75rem, 5vw, 2.5rem);
  font-size: 0.95rem;
}

.notes p + p { margin-top: 1em; }

.preview-note {
  display: inline-block;
  margin-bottom: 2rem;
  padding: 0.4rem 0.75rem;
  border: 1px dashed var(--unstable);
  font-size: 0.8rem;
}
