:root {
  color-scheme: dark;
  --bg: #0a0908;
  --ink: #efe8da;
  --muted: #a79f90;
  --line: rgba(239, 232, 218, 0.16);
  --amber: #e0a94a;
  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(1rem, 4vw, 3.5rem);
  --nav-h: 3.25rem;
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 1.5rem); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 100%/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }

:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 2px; }

/* Nav: a translucent layer the page scrolls under */
.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
  padding: 0 var(--gutter);
  background: rgba(10, 9, 8, 0.62);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
}
.nav-mark { font-family: var(--serif); font-size: 1.0625rem; letter-spacing: -0.005em; text-decoration: none; }
.nav nav { display: flex; gap: 1.5rem; }
.nav nav a {
  padding: 0.5rem 0;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.005em;
  text-decoration: none;
  color: var(--muted);
  transition: color 120ms ease-out;
}
.nav nav a:hover { color: var(--ink); }
.nav nav a:active { color: var(--amber); }

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 4rem);
  min-height: 100svh;
  padding: calc(var(--nav-h) + 1.5rem) var(--gutter) 2rem;
}
h1 {
  margin: 0;
  font: 400 clamp(3rem, 6vw, 5.75rem)/1 var(--serif);
  letter-spacing: -0.03em;
}
.say { margin: 0.75rem 0 0; color: var(--muted); font-size: 1.0625rem; }
.lede {
  max-width: 34ch;
  margin: 1.75rem 0 0;
  font: 400 clamp(1.15rem, 1.6vw, 1.4rem)/1.36 var(--serif);
  letter-spacing: -0.01em;
}
.readout {
  display: grid;
  gap: 0.15rem;
  margin: clamp(2rem, 5vh, 3.5rem) 0 0;
  padding-left: 0.875rem;
  border-left: 2px solid var(--amber);
  font-size: 0.9375rem;
}
.readout-label { color: var(--amber); font-weight: 600; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }
.readout-episode { font-weight: 500; font-variant-numeric: tabular-nums; }
.readout-note { color: var(--muted); }

.record-wrap { display: grid; justify-items: center; gap: 0.75rem; min-width: 0; }
.record {
  display: block;
  width: min(100%, calc(100svh - var(--nav-h) - 6.5rem));
  height: auto;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  border-radius: 50%;
  transition: transform 100ms ease-out;
}
.record.is-held { cursor: grabbing; transform: scale(0.985); }
.record:focus-visible { outline-offset: -2px; }
.ring, .spindle { fill: var(--ink); fill-rule: evenodd; }
.tick { stroke: var(--muted); stroke-opacity: 0.6; stroke-width: 3; stroke-linecap: round; }
.tick.is-active { stroke: var(--amber); stroke-opacity: 1; stroke-width: 5; }
.hint { margin: 0; color: var(--muted); font-size: 0.875rem; text-align: center; }

@media (prefers-reduced-motion: no-preference) {
  .js .ring { animation: ring-in 800ms ease-out both; animation-delay: calc(var(--i) * 45ms); }
  @keyframes ring-in { from { opacity: 0; } }
}

/* Definition */
.definition {
  padding: clamp(4.5rem, 12vh, 9rem) var(--gutter);
  border-top: 1px solid var(--line);
}
.entry { max-width: 46rem; margin-inline: auto; }
.headword {
  margin: 0;
  font: 400 clamp(2.5rem, 6.4vw, 5rem)/1.05 var(--serif);
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}
.entry-say { margin: 0.75rem 0 0; color: var(--muted); font-size: 1.0625rem; }
.entry-say em { margin-left: 0.5rem; font-family: var(--serif); color: var(--ink); }
.senses {
  margin: 2.5rem 0 0;
  padding-left: 1.75rem;
  font: 400 clamp(1.25rem, 2.2vw, 1.625rem)/1.36 var(--serif);
  letter-spacing: -0.005em;
}
.senses li + li { margin-top: 1.25rem; }
.senses li::marker { color: var(--amber); font-family: var(--sans); font-size: 0.8em; font-weight: 600; }
.notes { margin: 3rem 0 0; }
.notes > div {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 0.25rem 1.5rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--line);
}
.notes dt { grid-row: span 3; color: var(--muted); font-size: 0.875rem; font-weight: 500; }
.notes dd { grid-column: 2; margin: 0; }
.notes dd + dd { margin-top: 0.625rem; }
.notes b { font-weight: 600; }
.notes i { font-family: var(--serif); }

/* The show */
.show {
  padding: clamp(4.5rem, 12vh, 9rem) var(--gutter) clamp(4rem, 10vh, 7rem);
  border-top: 1px solid var(--line);
}
.show h2 {
  max-width: 18ch;
  margin: 0;
  font: 400 clamp(2.25rem, 5.4vw, 4.75rem)/1.04 var(--serif);
  letter-spacing: -0.025em;
}
.show-lede { max-width: 40rem; margin: 2rem 0 0; font-size: clamp(1.0625rem, 1.5vw, 1.25rem); line-height: 1.5; color: var(--muted); }
.format {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: clamp(3rem, 8vh, 5rem) 0 0;
  padding: 0;
  list-style: none;
  border-block: 1px solid var(--line);
}
.format li { display: grid; gap: 0.2rem; padding: 1.5rem 1.5rem 1.625rem 0; }
.format li + li { padding-left: 1.5rem; border-left: 1px solid var(--line); }
.format span { color: var(--muted); font-size: 0.9375rem; }
.format strong { font: 400 clamp(1.4rem, 2.5vw, 2.125rem)/1.15 var(--serif); letter-spacing: -0.015em; }
.next { margin: 2rem 0 0; color: var(--muted); }
.next span { margin-right: 0.625rem; color: var(--amber); font-weight: 600; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }

/* Footer */
.foot {
  display: grid;
  gap: 0.375rem;
  padding: 2rem var(--gutter) 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8125rem;
  text-align: center;
}
.foot p { margin: 0; }
.foot a { text-underline-offset: 2px; }
.foot a:hover { color: var(--ink); }

/* Sections arrive once, only when scripting can bring them in */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(1rem); transition: opacity 700ms ease-out, transform 700ms cubic-bezier(0.2, 0.8, 0.2, 1); }
  .js .reveal.is-in { opacity: 1; transform: none; }
}

@media (max-width: 820px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    min-height: 0;
    gap: 2rem;
  }
  h1 { font-size: clamp(2.75rem, 13.5vw, 5rem); }
  .lede { max-width: 30ch; margin-top: 1.25rem; }
  .readout { margin-top: 1.5rem; }
  /* Gutters either side of the record stay free for scrolling past it */
  .record { width: min(84%, 30rem); }
  .notes > div { grid-template-columns: minmax(0, 1fr); }
  .notes dt { grid-row: auto; }
  .notes dd { grid-column: 1; }
  .format { grid-template-columns: minmax(0, 1fr); }
  .format li, .format li + li { padding: 1.125rem 0; border-left: 0; }
  .format li + li { border-top: 1px solid var(--line); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .record { transition: none; }
  .record.is-held { transform: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .nav { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; border-bottom: 1px solid var(--line); }
}

@media (prefers-contrast: more) {
  :root { --muted: #d8d1c3; --line: rgba(239, 232, 218, 0.5); }
  .nav { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; border-bottom: 1px solid var(--ink); }
}
