/* =========================================================================
   conversations.css
   /listening/conversations/ — the short conversation lessons (src/listening/
   conversations/*.njk, _data/conversations.js, js/conversations.js). A lesson
   is six conversations of four lines; a line is a row you tap to hear, with
   the speaker's name, the line, how it sounds, and a one-line note.
   Design-system tokens (--esl-*). The hub also loads video-lessons.css and
   listening.css for the shared shelf and card classes.
   ========================================================================= */

.cv-page { --cv-a: var(--esl-lv-b1); --cv-a-soft: var(--esl-lv-b1-soft); --cv-b: var(--esl-lv-a1); --cv-b-soft: var(--esl-lv-a1-soft); }

.esl-prose .cv-series { margin: 0 0 4px; font-size: var(--esl-fs-sm); font-weight: 700; color: var(--esl-ink-muted); }
.cv-series a { text-decoration: none; }
.cv-series a:hover, .cv-series a:focus-visible { text-decoration: underline; text-underline-offset: 2px; }
.esl-prose .cv-facts { margin: 8px 0 0; font-size: .92rem; font-weight: 600; color: var(--esl-ink-soft); }

/* Slim video row under the header: thumbnail left of the text at every width. */
.cv-topwatch { max-width: var(--esl-measure); }
.cv-topwatch .esl-watch { flex-wrap: nowrap; gap: 12px; margin: 14px 0 0; padding: 8px 10px; }
.cv-topwatch .esl-watch__thumb { flex: 0 0 112px; }
.cv-topwatch .esl-watch__text { flex: 1 1 0; }
.cv-topwatch .esl-watch__play { width: 30px; height: 30px; font-size: .8rem; }
@media (max-width: 480px) { .cv-topwatch .esl-watch__title { -webkit-line-clamp: 1; } }

/* ---- Controls: speed + say-it-yourself ------------------------------------ */
.cv-bar {
  position: sticky;
  top: 56px;                      /* under the sticky site header */
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  max-width: var(--esl-measure);
  margin: 14px 0 0;
  padding: 8px 12px;
  background: var(--esl-surface);
  border: 1px solid var(--esl-border);
  border-radius: var(--esl-radius-lg);
  box-shadow: var(--esl-shadow-sm);
}
.cv-bar[hidden] { display: none; }
.cv-bar__group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cv-bar__label { font-size: var(--esl-fs-xs); font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--esl-ink-muted); margin-right: 2px; }
.cv-chip {
  min-height: 34px;
  padding: 4px 12px;
  border: 1px solid var(--esl-border);
  border-radius: var(--esl-radius-pill);
  background: var(--esl-surface);
  color: var(--esl-ink);
  font: inherit;
  font-size: var(--esl-fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.cv-chip:hover, .cv-chip:focus-visible { border-color: var(--esl-action); background: var(--esl-action-soft); }
.cv-chip.is-on { background: var(--esl-action); border-color: var(--esl-action); color: var(--esl-ink-inverse); }
.esl-prose .cv-rolehint {
  max-width: var(--esl-measure);
  margin: 10px 0 0;
  padding: 8px 12px;
  background: var(--esl-note-bg);
  border-left: 3px solid var(--esl-note-accent);
  border-radius: var(--esl-radius-sm);
  font-size: var(--esl-fs-sm);
  line-height: 1.5;
  color: var(--esl-ink-soft);
}

.esl-prose .cv-jump { max-width: var(--esl-measure); margin: 14px 0 0; font-size: var(--esl-fs-sm); line-height: 1.8; color: var(--esl-ink-muted); }
.cv-jump__label { font-weight: 700; margin-right: 6px; }
.cv-jump a { display: inline-block; margin-right: 14px; font-weight: 600; white-space: nowrap; }

/* ---- One conversation ------------------------------------------------------ */
.cv-dialog {
  max-width: var(--esl-measure);
  margin: var(--esl-space-5) 0 0;
  padding: 14px 16px 16px;
  background: var(--esl-surface);
  border: 1px solid var(--esl-border);
  border-radius: var(--esl-radius-lg);
  box-shadow: var(--esl-shadow-sm);
  scroll-margin-top: 120px;        /* site header + the sticky controls */
}
.esl-prose .cv-dialog__title { margin: 0; font-size: var(--esl-fs-lg); line-height: 1.3; }
.esl-prose .cv-dialog__tools { margin: 8px 0 0; min-height: 0; }
.cv-playall {
  min-height: 36px;
  padding: 5px 14px;
  border: 1px solid var(--esl-action);
  border-radius: var(--esl-radius-pill);
  background: var(--esl-surface);
  color: var(--esl-action);
  font: inherit;
  font-size: var(--esl-fs-sm);
  font-weight: 700;
  cursor: pointer;
}
.cv-playall:hover, .cv-playall:focus-visible { background: var(--esl-action-soft); }
.cv-playall.is-on { background: var(--esl-action); color: var(--esl-ink-inverse); }

.esl-prose .cv-lines { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; max-width: none; }
.esl-prose .cv-line {
  display: grid;
  grid-template-columns: 5.6em minmax(0, 1fr) auto;
  gap: 2px 10px;
  align-items: start;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-left: 4px solid var(--cv-a);
  border-radius: var(--esl-radius);
  background: var(--cv-a-soft);
}
.esl-prose .cv-line--b { border-left-color: var(--cv-b); background: var(--cv-b-soft); }
.cv-line[role="button"] { cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease; }
.cv-line[role="button"]:hover,
.cv-line[role="button"]:focus-visible { border-color: var(--esl-action); border-left-color: var(--esl-action); outline: none; }
.cv-line.is-playing { border-color: var(--esl-action); border-left-color: var(--esl-action); box-shadow: var(--esl-shadow-md); }
.cv-who { font-size: var(--esl-fs-sm); font-weight: 800; color: var(--esl-ink-soft); padding-top: 2px; overflow-wrap: anywhere; }
.cv-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cv-text { font-size: var(--esl-fs-md); font-weight: 600; line-height: 1.4; color: var(--esl-ink); }
.cv-hl { font-weight: 800; background: linear-gradient(transparent 62%, rgba(255, 213, 79, .65) 62%); }
.cv-respell { font-size: var(--esl-fs-sm); font-style: italic; color: var(--esl-ink-muted); overflow-wrap: anywhere; }
.cv-note { font-size: var(--esl-fs-sm); line-height: 1.45; color: var(--esl-ink-soft); }
.cv-play { font-size: 1rem; opacity: .55; padding-top: 2px; }
.cv-line:not([role="button"]) .cv-play { display: none; }      /* no script: nothing to press */
.cv-line.is-playing .cv-play { opacity: 1; }

/* Say-it-yourself: the chosen speaker's lines are covered until tapped or
   until the learner's turn has passed. The row stays its full height. */
.cv-page[data-cv-hide="A"] .cv-line[data-sp="A"]:not(.is-shown) .cv-body,
.cv-page[data-cv-hide="B"] .cv-line[data-sp="B"]:not(.is-shown) .cv-body {
  filter: blur(7px);
  opacity: .55;
  user-select: none;
}
.cv-line.is-turn { border-color: var(--esl-warning, #b7791f); border-left-color: var(--esl-warning, #b7791f); }
.cv-line.is-turn .cv-who::after { content: " — your turn"; font-weight: 600; color: var(--esl-ink-muted); }

.cv-keys { margin: 12px 0 0; padding: 10px 12px; background: var(--esl-surface-sunk); border-radius: var(--esl-radius); }
.esl-prose .cv-keys__head { margin: 0 0 4px; font-size: var(--esl-fs-xs); font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--esl-ink-muted); }
.esl-prose .cv-keys__list { margin: 0; padding-left: 1.2em; font-size: var(--esl-fs-sm); line-height: 1.55; max-width: none; }
.esl-prose .cv-keys__list li { margin: 0; }

.cv-after { max-width: var(--esl-measure); margin-top: var(--esl-space-5); }
.cv-after .esl-watch { margin: 0; }

/* ---- Previous / next lesson ------------------------------------------------ */
.cv-pn { display: flex; gap: var(--esl-space-3); max-width: var(--esl-measure); margin: var(--esl-space-5) 0; }
.esl-prose .cv-pn__link {
  flex: 1 1 0;
  min-width: 0;
  max-width: 50%;
  padding: 10px 14px;
  border: 1px solid var(--esl-border);
  border-radius: var(--esl-radius-lg);
  background: var(--esl-surface);
  color: var(--esl-ink);
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
}
.esl-prose .cv-pn__link:hover, .esl-prose .cv-pn__link:focus-visible { border-color: var(--esl-ink); text-decoration: none; }
.cv-pn__next { margin-left: auto; text-align: right; }
.cv-pn__kicker { display: block; font-size: var(--esl-fs-sm); font-weight: 400; color: var(--esl-ink-muted); }

/* ---- Hub ------------------------------------------------------------------- */
.esl-prose .cv-card__kicker { margin: 0 0 2px; font-size: var(--esl-fs-xs); font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--esl-ink-muted); }
.cv-card .esl-hubcard__desc { font-size: var(--esl-fs-sm); }
.esl-prose .cv-shelf__more { margin: calc(var(--esl-space-3) * -1) 0 var(--esl-space-5); font-size: var(--esl-fs-sm); color: var(--esl-ink-muted); }

@media (max-width: 34rem) {
  /* Phone: the controls take three rows, too much to keep on screen — they
     scroll away with the header; every conversation has its own play button. */
  .cv-bar { position: static; padding: 8px 10px; gap: 6px 14px; }
  .cv-dialog { scroll-margin-top: 70px; }
  .cv-dialog { padding: 12px 10px 12px; }
  /* Phone: the name sits above the line, not beside it. */
  .esl-prose .cv-line { grid-template-columns: minmax(0, 1fr) auto; padding: 8px 10px; }
  .cv-who { grid-column: 1 / -1; padding-top: 0; }
  .cv-pn { flex-direction: column; }
  .esl-prose .cv-pn__link { max-width: none; }
  .cv-pn__next { margin-left: 0; }
}

@media print {
  .cv-bar, .cv-rolehint, .cv-dialog__tools, .cv-play, .cv-topwatch, .cv-after, .cv-pn { display: none !important; }
  .cv-dialog { break-inside: avoid; box-shadow: none; }
  .cv-page .cv-line .cv-body { filter: none !important; opacity: 1 !important; }
}
