/* Her Hour — structure, typography, controls.
   Era-varying values live in eras.css and are driven by js/scroll.js. */

:root {
  --sans: 'Archivo', ui-sans-serif, system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --serif: 'Bodoni Moda', Didot, 'Bodoni MT', 'Times New Roman', serif;

  --player-h: 7rem;   /* two rows on phones: meta + a full-width thumb-sized scrubber */
  --gutter: clamp(1.25rem, 6vw, 5rem);
  --measure: 62ch;

  --hairline: 1px;
}
@media (min-width: 720px) { :root { --player-h: 4rem; } }

*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: auto; }
[hidden] { display: none !important; }
/* height:auto is load-bearing: the covers carry width/height="1200" attributes, and
   without it that 1200px height wins over aspect-ratio and stretches every cover. */
img { max-width: 100%; height: auto; display: block; }

body {
  font-family: var(--sans);
  font-variation-settings: 'wdth' var(--wdth, 100), 'wght' 400;
  font-size: clamp(1rem, 0.96rem + 0.25vw, 1.1875rem);
  line-height: 1.62;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

/* Browser surfaces get the palette too. */
::selection { background: var(--track-accent); color: var(--bg); }
:focus-visible { outline: 2px solid var(--track-accent); outline-offset: 4px; border-radius: 1px; }
html { scrollbar-color: var(--track-accent) transparent; }
em { font-style: italic; }

/* ---------- Layout skeleton (constant across all eras) ---------- */

main { display: block; }

section {
  min-height: 100vh;
  min-height: 100svh;          /* svh: a collapsing phone URL bar must not reflow */
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  align-content: safe center;  /* never clip the top of tall copy on a short phone */
  width: 100%;
  max-width: 76rem;
  margin-inline: auto;
  padding: clamp(5rem, 12vh, 9rem) var(--gutter) calc(clamp(5rem, 12vh, 9rem) + var(--player-h));
  gap: clamp(1.5rem, 3vh, 2.25rem);
  position: relative;
  /* clip, not hidden: contains the artwork glow's bleed without making the section
     a scroll container. Without this the glow adds ~60px of phantom page width. */
  overflow-x: clip;
}

.chapter {
  max-width: 70rem;
  gap: clamp(2rem, 5vh, 3.25rem);
}
@media (min-width: 900px) {
  .chapter {
    grid-template-columns: minmax(0, 1fr) minmax(0, 27rem);
    align-items: center;
    gap: clamp(3rem, 6vw, 5.5rem);
  }
}

.chapter figure { position: relative; }
.chapter figure img { width: 100%; aspect-ratio: 1; object-fit: cover; }

.chapter-text { display: grid; gap: 1rem; align-content: start; }

/* ---------- Typography ---------- */

h1 {
  font-family: var(--serif);
  font-variation-settings: 'opsz' 96, 'wght' 500;
  font-size: clamp(3.5rem, 14vw, 9rem);
  line-height: 0.88;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

h2 {
  font-family: var(--sans);
  font-variation-settings: 'wdth' var(--wdth, 100), 'wght' 600;
  font-size: clamp(2.15rem, 7vw, 4.25rem);
  line-height: 1.02;
  letter-spacing: -0.022em;
  text-wrap: balance;
  margin-top: 0.15em;
}

/* Catalog metadata: number and year. The sequence is the story here, so it stays. */
.kicker {
  font-family: var(--sans);
  font-variation-settings: 'wdth' var(--wdth-tight, 88), 'wght' 600;
  text-transform: uppercase;
  letter-spacing: calc(var(--tracking, 0.18) * 1em);
  font-size: 0.7rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--accent-ink);
}

.artist {
  font-size: 0.9375rem;
  line-height: 1.45;
  letter-spacing: 0.005em;
  opacity: 0.82;
  max-width: 38ch;
}

.beat {
  font-size: 1.0625rem;
  line-height: 1.65;
  max-width: var(--measure);
  text-wrap: pretty;
  opacity: 0.9;
}
@media (min-width: 900px) { .beat { font-size: 1.09375rem; } }

/* ---------- Hero ---------- */

/* 48rem so the sleeve rule lands about where "Her Hour" ends, rather than floating
   out past every other right edge in the block. */
/* hero and premise carry less than a full screen; 88svh stops them yawning. */
#hero, #premise { min-height: 88svh; }
#hero { gap: clamp(1.25rem, 2.5vh, 1.75rem); max-width: 48rem; }

/* Back-cover tracklist: printed type on the sleeve, not buttons. Each row is a
   .chapter-play, so player.js binds it at init with no wiring changes. */
.tracklist { list-style: none; padding: 0; margin-top: clamp(1rem, 3vh, 2rem);
  border-top: var(--hairline) solid var(--rule); }
.tracklist .tl {
  display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto;
  align-items: baseline; column-gap: 0.9rem;
  width: 100%; min-height: 2.5rem; padding: 0.45rem 0;
  margin: 0; border: 0; border-radius: 0; border-bottom: var(--hairline) solid var(--rule);
  background: none; text-align: left; text-transform: none; letter-spacing: 0;
  font-size: 0.8125rem; color: inherit;
}
.tracklist .tl::before { display: none; }         /* no play triangle in a printed list */
.tracklist .tl:hover { background: none; color: var(--accent-ink); }
.tracklist .tl:hover .tl-t { text-decoration: underline; text-underline-offset: 3px; }
.tl-n { font-variant-numeric: tabular-nums; opacity: 0.55; font-size: 0.6875rem; }
.tl-t { font-variation-settings: 'wdth' var(--wdth-tight, 88), 'wght' 600; }
.tl-a { grid-column: 2; font-size: 0.75rem; opacity: 0.6; }
.tl-time { grid-row: 1; grid-column: 3; font-variant-numeric: tabular-nums;
  font-size: 0.6875rem; opacity: 0.6; }
@media (min-width: 640px) {
  .tracklist .tl { grid-template-columns: 1.6rem minmax(0, 1fr) minmax(0, 14rem) auto; }
  .tl-a { grid-column: 3; grid-row: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tl-time { grid-column: 4; }
}

/* Jacket printing: quiet marks in the corners, like a real sleeve. */
.jacket-mark {
  position: absolute; font-size: 0.5625rem; text-transform: uppercase;
  letter-spacing: 0.22em; opacity: 0.4; font-variant-numeric: tabular-nums;
  font-variation-settings: 'wdth' var(--wdth-tight, 88), 'wght' 500;
}
.jm-stereo { top: clamp(1.5rem, 4vh, 3rem); right: var(--gutter); }
.jm-cat { bottom: calc(var(--player-h) + clamp(1.5rem, 4vh, 3rem)); right: var(--gutter); }

.credits {
  font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.2em;
  font-variation-settings: 'wdth' var(--wdth-tight, 88), 'wght' 500;
  opacity: 0.6; max-width: none;
  padding-top: 1.1rem; border-top: var(--hairline) solid var(--rule);
}
#hero .kicker { font-size: 0.72rem; }

.dedication {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.15rem, 3.2vw, 1.6rem);
  line-height: 1.35;
  letter-spacing: -0.01em;
  opacity: 0.88;
  max-width: 34ch;
}

/* The on-air intro, set as liner notes. */
.onair {
  font-size: 0.9375rem;
  line-height: 1.72;
  max-width: 58ch;
  text-wrap: pretty;
  opacity: 0.78;
  padding-top: clamp(1.25rem, 3vh, 2rem);
  margin-top: clamp(0.5rem, 2vh, 1.25rem);
  border-top: var(--hairline) solid var(--rule);
}
@media (min-width: 900px) { .onair { font-size: 0.96875rem; } }

#premise { max-width: 46rem; }
#premise p {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 4.5vw, 2.6rem);
  line-height: 1.28;
  letter-spacing: -0.018em;
  text-wrap: balance;
}

/* ---------- Closing ---------- */

#closing { max-width: 48rem; }
.big {
  font-family: var(--serif);
  font-size: clamp(1.85rem, 6vw, 3.4rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.outro-credit {
  font-size: 0.8125rem;
  line-height: 1.6;
  letter-spacing: 0.01em;
  opacity: 0.6;
  max-width: 46ch;
  padding-top: 1.25rem;
  border-top: var(--hairline) solid var(--rule);
}
.personal-note:empty { display: none; }

/* ---------- Play controls ---------- */

.chapter-play {
  font: inherit;
  font-family: var(--sans);
  font-variation-settings: 'wdth' var(--wdth-tight, 88), 'wght' 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-variant-numeric: tabular-nums;

  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  justify-self: start;
  min-height: 2.75rem;
  padding: 0.7rem 1.4rem;
  margin-top: 0.5rem;

  color: var(--accent-ink);
  background: transparent;
  border: var(--hairline) solid var(--rule-accent);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.25s ease, border-color 0.25s ease, background-color 0.25s ease;
}
.chapter-play::before {
  content: '';
  width: 0.6em;
  height: 0.72em;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  flex: none;
}
.chapter-play:hover {
  color: var(--bg);
  background: var(--track-accent);
  border-color: var(--track-accent);
}

#hero-play {
  font-size: 0.8125rem;
  padding: 1rem 2rem;
  min-height: 3.25rem;
  margin-top: clamp(0.75rem, 2vh, 1.5rem);
}

/* ---------- Persistent player ---------- */

#player {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 20;
  display: block;
}

.player-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    'art  meta  toggle'
    'seek seek  time';
  align-items: center;
  column-gap: 0.875rem;
  row-gap: 0.25rem;
  padding: 0.6rem var(--gutter) calc(0.6rem + env(safe-area-inset-bottom, 0px));

  background: var(--player-bg);
  color: var(--player-ink);
  border-top: var(--hairline) solid var(--player-rule);
}
@media (min-width: 720px) {
  .player-inner {
    grid-template-columns: auto minmax(7rem, 15rem) auto minmax(0, 1fr) auto;
    grid-template-areas: 'art meta toggle seek time';
    column-gap: 1rem;
    padding-block: 0.5rem;
  }
}

#p-art { grid-area: art; width: 2.5rem; height: 2.5rem; object-fit: cover; }
.p-meta { grid-area: meta; display: flex; flex-direction: column; min-width: 0; gap: 0.1rem; }
.p-meta strong {
  font-size: 0.8125rem;
  font-variation-settings: 'wdth' var(--wdth-tight, 88), 'wght' 600;
  line-height: 1.25;
  letter-spacing: 0.005em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.p-meta span {
  font-size: 0.6875rem;
  line-height: 1.25;
  letter-spacing: 0.04em;
  opacity: 0.66;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Transport: the glyph player.js writes is hidden; the shape is drawn.
   player.js also sets aria-label, which is what switches play <-> pause. */
#p-toggle {
  grid-area: toggle;
  font-size: 0;
  width: 2.75rem; height: 2.75rem;
  display: grid; place-items: center;
  background: none; border: 0; padding: 0;
  color: inherit; cursor: pointer;
}
#p-toggle::before {
  content: '';
  width: 0.875rem; height: 1rem;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  transition: opacity 0.2s ease;
}
#p-toggle[aria-label='Pause']::before {
  clip-path: none;
  background: linear-gradient(90deg, currentColor 0 34%, transparent 34% 66%, currentColor 66% 100%);
}
#p-toggle:hover::before { opacity: 0.7; }

#p-time {
  grid-area: time;
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  opacity: 0.66;
  justify-self: end;
}

#p-seek {
  grid-area: seek;
  appearance: none; -webkit-appearance: none;
  width: 100%;
  height: 2.75rem;              /* thumb-sized hit area; the visible track is 3px */
  background: transparent;
  cursor: pointer;
}
#p-seek::-webkit-slider-runnable-track {
  height: 3px;
  background: var(--player-rule);
}
#p-seek::-moz-range-track { height: 3px; background: var(--player-rule); }
#p-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 0.875rem; height: 0.875rem;
  margin-top: calc((3px - 0.875rem) / 2);
  border-radius: 50%;
  border: 0;
  background: var(--player-ink);
}
#p-seek::-moz-range-thumb {
  width: 0.875rem; height: 0.875rem;
  border-radius: 50%; border: 0;
  background: var(--player-ink);
}
