/*
 * Beat read-along: Margin, a reading column with Liris at its edge
 * (web/landing/sections/read-along.html). Linked in the page head by lib/landing.ts
 * while the beat is enabled; the shells' sheets it builds on are linked by the page
 * itself, once each and before every section sheet. Every class here starts with the
 * beat id, and every rule is scoped by [data-beat]: the frame's variant
 * (read-along-margin) is styled here and nowhere else.
 *
 * Layout: the copy on the left, the Margin window on the right (the mirror of the beat
 * before it); one column below 1024 px. In the window Liris small at the column's left
 * edge and the paragraph beside her; below 560 px of frame, Liris above the paragraph.
 * The paragraph is set generously in the serif, upright: a page being read, not the
 * narrator's aside. The word being said is ReaderFlow's violet; a hairline under the
 * column fills as she reads. Read aloud and Restart sit in the frame's toolbar, the time
 * in its status.
 */

.use-case[data-beat="read-along"] {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  grid-template-areas: "copy frame";
  align-items: center;
  gap: 28px clamp(28px, 4vw, 56px);
}

.use-case[data-beat="read-along"] .use-case-copy { grid-area: copy; }
.use-case[data-beat="read-along"] .use-case-mount { grid-area: frame; min-width: 0; }

@media (max-width: 1023px) {
  .use-case[data-beat="read-along"] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "copy" "frame";
    gap: 24px;
  }
}

/* ── Inside the window: Liris at the edge, the column beside her ───────── */

[data-beat="read-along"] .demo-frame-body {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "stage" "main";
  gap: 18px;
}

@container demo-frame (min-width: 560px) {
  [data-beat="read-along"] .demo-frame-body {
    grid-template-columns: clamp(112px, 24cqi, 176px) minmax(0, 1fr);
    grid-template-areas: "stage main";
    align-items: start;
    gap: clamp(20px, 4cqi, 36px);
    padding: clamp(20px, 4cqi, 36px) clamp(20px, 5cqi, 44px) clamp(24px, 4cqi, 36px) clamp(16px, 3cqi, 28px);
  }
}

/* On a phone she stands above the page, small, not as tall as the screen. */
[data-beat="read-along"] .read-along-liris {
  width: min(132px, 42%);
  margin: 0 auto;
}

@container demo-frame (min-width: 560px) {
  [data-beat="read-along"] .read-along-liris {
    width: 100%;
    margin: 0;
  }
}

/* ── The page ──────────────────────────────────────────────────────────── */

[data-beat="read-along"] .read-along-page {
  display: grid;
  gap: 18px;
  min-width: 0;
  max-width: 34em;
}

/* One more step of specificity than ReaderFlow.css's register rule, so this holds
   whatever order the sheets come in (the page links ReaderFlow.css before it anyway). */
[data-beat="read-along"] .read-along-flow .reader-flow-segment .reader-flow-text {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(20px, 3.6cqi, 26px);
  line-height: 1.65;
  color: var(--text);
  hyphens: none;
}

/* A word is a place to start from: a little room round it for a finger. */
[data-beat="read-along"] .read-along-flow .reader-flow-segment .w {
  padding: 1px 0;
  border-radius: 4px;
}

/* ── The progress: a hairline filling as she reads ─────────────────────── */

[data-beat="read-along"] .read-along-progress {
  position: relative;
  height: 2px;
  overflow: hidden;
  border-radius: 1px;
  background: var(--line);
}

[data-beat="read-along"] .read-along-progress-fill {
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
}

/* ── The toolbar: Read aloud, Restart ──────────────────────────────────── */

[data-beat="read-along"] .read-along-icon {
  width: 12px;
  height: 12px;
  flex: none;
}

[data-beat="read-along"] .read-along-icon[hidden] { display: none; }
