/* ---------------------------------------------------------------
   /listen — synced listen-and-read player

   Follows the design language in style.css: paper ground, hairline
   rules, Zen Old Mincho for display type, filled panel only for a
   distinct surface (here, the player).

   The transcript deliberately uses plain inline spans separated by
   real whitespace text nodes so popup-dictionary extensions can scan
   across word boundaries — do not lay words out with flex/grid, and
   do not disable text selection.
   --------------------------------------------------------------- */

.listen {
  max-width: var(--max-width-wide);
}

.listen-intro {
  margin-bottom: calc(var(--space) * 2.5);
}

.listen-intro h1 {
  font-size: clamp(2rem, 4vw, 2.6rem);
  color: var(--indigo);
  margin: 0 0 0.4em;
}

.listen-intro p {
  max-width: 56ch;
  margin: 0;
}

/* --- Player (sticks to the top while you read) --------------------- */

.player {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper-deep);
  border-radius: var(--radius);
  padding: calc(var(--space) * 1.25) calc(var(--space) * 1.5);
  margin-bottom: calc(var(--space) * 2.5);
}

.player-pick {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.85em;
}

.player-pick .label {
  flex: 0 0 auto;
}

#episode-select {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.45rem 0.6rem;
}

.player-title {
  font-size: 1.35rem;
  color: var(--indigo);
  margin: 0 0 0.15em;
}

.player-meta {
  margin: 0 0 1em;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: var(--space);
  flex-wrap: wrap;
}

.player-play {
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 1px solid var(--indigo);
  background: var(--indigo);
  color: var(--paper-raised);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-play:hover:not(:disabled) {
  background: var(--indigo-deep);
}

.player-play:disabled {
  opacity: 0.4;
  cursor: default;
}

.player-time {
  flex: 0 0 auto;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.player-seek {
  flex: 1 1 160px;
  min-width: 120px;
  accent-color: var(--indigo);
  cursor: pointer;
}

.player-volume {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.player-volume-icon {
  font-size: 0.8rem;
  opacity: 0.6;
  line-height: 1;
}

#player-volume {
  width: 78px;
  accent-color: var(--indigo);
  cursor: pointer;
}

.player-rates {
  flex: 0 0 auto;
  display: flex;
  gap: 0.35rem;
}

.player-rates button {
  font-family: var(--font-body);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.3rem 0.55rem;
  cursor: pointer;
}

.player-rates button:hover {
  color: var(--indigo);
  border-color: var(--indigo);
}

.player-rates button.is-on {
  color: var(--paper-raised);
  background: var(--indigo);
  border-color: var(--indigo);
}

/* --- Transcript ---------------------------------------------------- */

.transcript-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.6em;
  margin-bottom: calc(var(--space) * 1.75);
}

.transcript-hint {
  margin: 0;
}

/* Floats above the text so it is reachable wherever you have scrolled to. */
.transcript-follow {
  position: fixed;
  left: 50%;
  bottom: calc(var(--space) * 1.75);
  transform: translateX(-50%);
  z-index: 30;
  font-family: var(--font-body);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--paper-raised);
  background: var(--indigo);
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.25rem;
  cursor: pointer;
  box-shadow: 0 4px 14px -6px rgba(31, 52, 62, 0.5);
}

.transcript-follow:hover {
  background: var(--indigo-deep);
}

.transcript {
  max-width: 60ch;
  font-size: 1.15rem;
  line-height: 2;
}

.line {
  margin: 0 0 1.1em;
  color: var(--ink-soft);
  transition: color 0.25s ease;
}

.line.is-current {
  color: var(--ink);
}

.w {
  cursor: pointer;
  border-radius: 2px;
  padding: 0.05em 0.04em;
  transition: background 0.12s ease;
}

.w:hover {
  background: rgba(44, 71, 83, 0.1);
}

.w.is-active {
  background: rgba(169, 96, 60, 0.2);
  color: var(--ink);
}

.transcript-status {
  color: var(--ink-soft);
  font-style: italic;
}

/* --- Small screens ------------------------------------------------- */

@media (max-width: 700px) {
  .player {
    padding: var(--space);
  }

  .player-title {
    font-size: 1.15rem;
  }

  .player-controls {
    gap: 0.6rem;
  }

  .player-seek {
    flex-basis: 100%;
    order: 5;
  }

  /* Phones have hardware volume, and iOS ignores audio.volume outright,
     so the fader is desktop-only. */
  .player-volume {
    display: none;
  }

  .transcript {
    font-size: 1.05rem;
    line-height: 1.95;
  }
}
