/* reader.css — the follow-along player on /book/{album}/{chapter}
 *
 * Hand-written, and deliberately NOT part of book.css: that file is generated
 * by book/scripts/restyle_fragment.py and says so at the top, so anything added
 * to it is lost on the next build.
 *
 * ── Tokens ─────────────────────────────────────────────────────────────────
 * This site has three competing token vocabularies and two of them are loaded
 * by nobody. The one that is actually live here is the BOOK's own, declared on
 * .lpp-book in the generated book.css (--ink, --sunk, --hair, --muted,
 * --accent, --mono, --sans, --panel) and re-pointed for the Classic Sticker
 * theme under [data-theme="white_blue_red"] .lpp-book — so this file follows
 * the site's theme toggle for free.
 *
 * 🔴 An undefined custom property drops the WHOLE declaration, silently: no
 * error, no warning, the element just renders unstyled. Every var() below
 * therefore carries a literal fallback, and every one of these rules is scoped
 * under .lpp-book so the tokens are guaranteed to be in scope.
 *
 * ── Depth ──────────────────────────────────────────────────────────────────
 * Dark mode gets its depth from an elevated SURFACE, never from a shadow.
 * There is no box-shadow anywhere in this file, on purpose.
 */

/* ── the player block ───────────────────────────────────────────────────── */

.lpp-book .lppsync {
  margin: 1.4rem 0 1rem;
  padding: 1rem 1.1rem 1.1rem;
  background: var(--sunk, #1A1A24);
  border: 1px solid var(--hair, rgba(255, 255, 255, .12));
  border-radius: 6px;
}

.lpp-book .lppsync-head {
  margin: 0 0 .6rem;
  font-family: var(--mono, ui-monospace, "SF Mono", Menlo, monospace);
  font-size: .66rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted, rgba(255, 255, 255, .55));
}

/* The native control is the progressive-enhancement base: it is what a reader
   with JS off gets, so it must be usable on its own at 320px. */
.lpp-book .lppsync-audio {
  display: block;
  width: 100%;
  min-height: 2.75rem;
}

.lpp-book .lppsync-dl {
  color: var(--accent-ink, #35E0A1);
}

/* ── the follow-along toggle (created by hw-book-reader.js) ─────────────── */

.lpp-book .lppsync-controls:empty {
  display: none;
}

.lpp-book .lppsync-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem .8rem;
  margin-top: .9rem;
}

.lpp-book .lppsync-toggle {
  /* 44px at a 16px root — the touch-target floor, not a design choice. */
  min-height: 2.75rem;
  /* 16px: anything smaller and iOS zooms the page on focus. */
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1rem;
  font-family: var(--sans, "Helvetica Neue", Helvetica, Arial, sans-serif);
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink, #FFFFFF);
  background: var(--panel, #111118);
  border: 1px solid var(--hair, rgba(255, 255, 255, .12));
  border-radius: 5px;
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease;
}

/* The dot is the state, carried by colour AND by the button's own text +
   aria-pressed — never by colour alone. */
.lpp-book .lppsync-toggle::before {
  content: "";
  width: .6rem;
  height: .6rem;
  border-radius: 50%;
  flex: none;
  background: var(--muted, rgba(255, 255, 255, .55));
}

.lpp-book .lppsync-toggle:hover:not(:disabled) {
  background: var(--sunk, #1A1A24);
  border-color: var(--muted, rgba(255, 255, 255, .55));
}

.lpp-book .lppsync-toggle:active:not(:disabled) {
  border-color: var(--accent, #35E0A1);
}

.lpp-book .lppsync-toggle[aria-pressed="true"] {
  border-color: var(--accent, #35E0A1);
  color: var(--accent-ink, #35E0A1);
}

.lpp-book .lppsync-toggle[aria-pressed="true"]::before {
  background: var(--accent, #35E0A1);
}

.lpp-book .lppsync-toggle:focus-visible {
  outline: 2px solid var(--accent, #35E0A1);
  outline-offset: 2px;
}

/* Reachable, readable, and obviously inert. A listen-tier track lands here:
   the reason lives in .lppsync-note beside it, never in the disabled state
   alone. */
.lpp-book .lppsync-toggle:disabled {
  cursor: not-allowed;
  opacity: .55;
  color: var(--muted, rgba(255, 255, 255, .55));
  border-style: dashed;
}

.lpp-book .lppsync-note {
  margin: 0;
  flex: 1 1 14rem;
  min-width: 0;
  font-family: var(--sans, "Helvetica Neue", Helvetica, Arial, sans-serif);
  font-size: .82rem;
  line-height: 1.45;
  color: var(--muted, rgba(255, 255, 255, .55));
}

/* The section currently playing, announced politely. It changes ~10 times a
   track, not once a line — a per-line live region would be unusable. */
.lpp-book .lppsync-now {
  margin: 0;
  font-family: var(--mono, ui-monospace, "SF Mono", Menlo, monospace);
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent-ink, #35E0A1);
}

/* ── the highlight ─────────────────────────────────────────────────────────
 * Section-level, because that is the only resolution the data supports. The
 * span is line_from..line_to; nothing here pretends to per-line precision.
 *
 * The lyric list is already the --sunk surface, and --sunk is the most
 * elevated token the book defines, so there is no "one step lighter" to reach
 * for. The tint is mixed from the accent instead; browsers without color-mix
 * keep the --panel declaration above it.
 */

.lpp-book .lyrics li.lppsync-line {
  background: var(--panel, #111118);
  background: color-mix(in srgb, var(--accent, #35E0A1) 14%, transparent);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.lpp-book .lyrics li.lppsync-line-first {
  border-radius: 4px 4px 0 0;
}

.lpp-book .lyrics li.lppsync-line-last {
  border-radius: 0 0 4px 4px;
}

/* Only while following: without it, a reader who never turned the feature on
   could still see a stray outline if a class survived a bfcache restore. */
.lpp-book .lppsync-following .lyrics li.lppsync-line {
  transition: background-color .25s ease;
}

@media (prefers-reduced-motion: reduce) {
  .lpp-book .lppsync-toggle,
  .lpp-book .lppsync-following .lyrics li.lppsync-line {
    transition: none;
  }
}

/* ── 320px ─────────────────────────────────────────────────────────────────
 * Mobile-first: everything above already works at 320px. This only stops the
 * toggle and its note from sharing a cramped row on the narrowest phones.
 */
@media (max-width: 26rem) {
  .lpp-book .lppsync-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .lpp-book .lppsync-toggle {
    justify-content: center;
  }

  .lpp-book .lppsync-note {
    flex: 1 1 auto;
  }
}

/* ── the notes control and panel (2026-08-04) ────────────────────────────────
 *
 * The book's job here is a listening/reading surface: the record plays, the bar
 * being sung lights up, and — if the reader wants it — the note written about
 * that bar comes to meet them instead of sitting 200 lines further down.
 *
 * The panel BORROWS the annotation nodes; it never clones them. One copy in the
 * document means Ctrl-F finds each note once and a screen reader reads it once.
 * That is why there is no separate "hidden original" rule anywhere below.
 */

.lpp-book .lppsync-notesbtn {
  min-height: 2.75rem;          /* 44px floor, same as the follow toggle */
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: 0 .9rem;
  border-radius: 5px;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink, #EDEDF2);
  background: transparent;
  border: 1px solid var(--hair, rgba(255, 255, 255, .18));
}

.lpp-book .lppsync-notesbtn::before {
  content: "";
  width: .55rem;
  height: .55rem;
  border-radius: 50%;
  background: currentColor;
  opacity: .3;
}

.lpp-book .lppsync-notesbtn[aria-pressed="true"] {
  /* Depth from an elevated surface, never a shadow — see the header. */
  background: var(--panel, rgba(255, 255, 255, .07));
  border-color: var(--accent, #35E0A1);
  color: var(--accent-ink, #35E0A1);
}

.lpp-book .lppsync-notesbtn[aria-pressed="true"]::before {
  opacity: 1;
}

.lpp-book .lppsync-notesbtn:hover {
  background: var(--panel, rgba(255, 255, 255, .07));
}

.lpp-book .lppsync-notesbtn:focus-visible {
  outline: 2px solid var(--accent, #35E0A1);
  outline-offset: 2px;
}

/* Hidden when the track has no timing: with nothing to follow there is nothing
   for it to reveal, and a dead control reads as a broken page. */
.lpp-book .lppsync-notesbtn[hidden] {
  display: none;
}

.lpp-book .lppsync-notes {
  flex-basis: 100%;
  margin: .2rem 0 0;
  padding: .1rem 0 0;
  border-top: 1px solid var(--hair, rgba(255, 255, 255, .12));
}

.lpp-book .lppsync-notes[hidden] {
  display: none;
}

/* An annotation that has come up to meet the music. Same content as in the
   annotations block below — it is literally the same node — but it needs to
   read as live rather than as a footnote, so it gets the accent edge the
   highlighted lyric line already uses. */
.lpp-book .annotation.lppsync-note-live {
  margin: .7rem 0 0;
  padding-left: .8rem;
  border-left: 2px solid var(--accent, #35E0A1);
}

/* Reduced motion: the panel appearing is a layout change, not an animation, so
   there is nothing to disable — but the highlight scroll is, and that is
   already handled in hw-book-reader.js via prefers-reduced-motion. */
