/*
 * The speaking surfaces of the trainer page /7-days (trainer-rework ui.md): SprintCard, Recorder,
 * CheckFeedback and BeforeAfter, NoMicTimer. Split out of trainer-parts.css (trainer-redesign KD-T21) and
 * linked right after it, so the cascade order of every moved rule stays as built. Every value comes from
 * tokens.css. Three type styles only: the display heading (--fs-headline), the body (--fs-body) and the
 * small line (--fs-small).
 */

/* SprintCard (TX13): the label over the phrase starts, drawn as chips (kit.py .label, .chip); the label's
   TX_LABEL size sits in trainer-frame.css (TEST-028 keeps this file on three type styles) */
.sprint-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.sprint-card__rescue-label {
  margin: 0;
  color: var(--ink-2);
  font-weight: 600;
  letter-spacing: var(--tx-label-tracking);
  text-transform: uppercase;
}

.sprint-card__phrases {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin: 0;
  padding: 0;
  list-style: none;
}

.sprint-card__phrase {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-min);
  padding: 0 var(--space-md);
  border: var(--tx-pick-border-width) solid var(--option-line);
  border-radius: var(--tx-chip-radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
}

/* Recorder (TR10a, TR15 to TR18) */
.recorder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.recorder p {
  margin: 0;
}

.record-control {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--tx-record-size);
  height: var(--tx-record-size);
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: var(--on-primary);
}

.recorder__timer {
  font-family: var(--font-display);
  font-size: var(--fs-headline);
  font-weight: 800;
}

.recorder__recorded {
  font-weight: 700;
}

/* CheckFeedback and BeforeAfter (TR19, TR29): ✓ and – marks besides colour */
.check-feedback {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.check-feedback p {
  margin: 0;
}

.before-after {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.before-after__column {
  flex: 1;
  padding: var(--space-sm);
  border-radius: var(--radius-card);
  background: var(--surface);
  border: 1px solid var(--line);
}

.before-after__column:last-child {
  border-color: var(--tool-accent);
}

.before-after__label,
.before-after__count,
.before-after__pauses {
  font-size: var(--fs-small);
  color: var(--ink-2);
}

.before-after__seconds {
  font-family: var(--font-display);
  font-size: var(--fs-headline);
  font-weight: 800;
}

.feedback-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  margin: 0;
  padding: 0;
  list-style: none;
}

.feedback-row {
  display: flex;
  gap: var(--space-xs);
}

/* CheckFeedback rows: the mark (✓ or –) and the text carry the result with the colour (UX-004) */
.feedback-row__mark {
  min-width: 1.5em;
  font-weight: 700;
  color: var(--ink-2);
}

.feedback-row[data-heard="yes"] .feedback-row__mark {
  color: var(--tool-accent-ink);
}

.feedback-row[data-heard="no"] .feedback-row__phrase {
  color: var(--ink-2);
}

/* NoMicTimer (TR51) */
.no-mic {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.no-mic__notice {
  margin: 0;
}

.no-mic__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

/* CompareRecordings (TR43, TR55) */
.compare-recordings {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.compare-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.compare-row__play {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: var(--on-primary);
}

.compare-missing {
  margin: 0;
}

/* The goose of the summary (week) and of check failed (offline), IMPL-017: the boards put it at the heading, which
   the part frame owns, so it leads the screen's body: at the end of the line on the phone summary (TX15, beside the
   heading), at the start on phone check failed (TX18), centred on the desktop stage */
.week-summary > .goose {
  align-self: flex-end;
}

.check-failed__notice:has(> .goose) {
  justify-content: flex-start;
  padding: 0;
}

/* Check failed (TX18) draws the goose above the heading, which the part frame owns: the wrappers between the part
   and its pieces step aside (display: contents), so the goose takes its place after the part bar in one column;
   the DOM order, and so the reading and Tab order, stays as built (the goose is decorative) */
.trainer-part:has(.check-failed) :is(.trainer-band, .part-body, .speaking-slot, .speaking-part, .check-failed) {
  display: contents;
}

.trainer-part:has(.check-failed) .part-bar {
  order: -2;
}

.trainer-part:has(.check-failed) .check-failed__notice {
  order: -1;
}

/* Desktop rows of the step 7 and check screens (trainer_desk_stage.py summary and check; TX14 desk): the summary
   stats three across in TX_STAGE_ROW_PX, check failed's actions in one row, compare in two columns */
@media (min-width: 64rem) {
  .week-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--tx-card-row-gap);
    width: var(--tx-stage-row);
    max-width: 100%;
  }

  .week-summary > :not(.week-summary__stat) {
    grid-column: 1 / -1;
  }

  .week-summary > .goose,
  .week-summary > .button,
  .programme-door .button {
    justify-self: center;
    align-self: center;
  }

  .week-summary__stat {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }

  .check-failed__notice:has(> .goose) {
    justify-content: center;
  }

  /* Out of the band the part bar would shrink to its label on the centred stage: half a stage row, as the summary */
  .trainer-part:has(.check-failed) .part-bar {
    width: min(100%, calc(var(--tx-stage-row) / 2));
  }

  .check-failed__actions {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
  }

  .compare-recordings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
  }
}
