/* ==========================================================================
   Presenter vs listener timeline

   Two aligned lanes over the same time axis, so the delay is visible as a
   literal gap: what the studio feed carries, and what actually reaches air.
   ========================================================================== */

.tl {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px 28px 26px;

  /* --text-faint (#7d7693) reaches only 4.33:1 on --surface, just under the
     4.5:1 AA floor for the small print in here. Lighten it for this component
     only; it passes on --surface, --black and --black-2 alike. */
  --text-faint: #8a83a1;
}

.tl-head {
  text-align: center;
  margin-bottom: 26px;
}

.tl-head h3 {
  font-size: 1.15rem;
  margin-bottom: 6px;
}

.tl-head p {
  color: var(--text-faint);
  font-size: .88rem;
  margin: 0 auto;
  /* Centred prose needs an explicit measure: without it the paragraph spans
     the full 1120px container and runs to 115ch. */
  max-width: 42rem;
}

/* time axis */
.tl-axis {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 0 14px;
  margin-bottom: 8px;
}

/* minmax(0, 1fr), not 1fr: an auto minimum lets the longest label stretch its
   own track, which desyncs the ticks from the lanes on narrow screens. */
.tl-axis .tl-ticks {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  font-family: var(--mono);
  /* .74rem rendered at 11.8px, under a 12px floor. */
  font-size: .75rem;
  color: var(--text-faint);
}

.tl-axis .tl-ticks span {
  border-left: 1px solid var(--border);
  padding-left: 7px;
  padding-bottom: 4px;
}

/* one lane: label + segmented bar */
.tl-row {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 0 14px;
  align-items: stretch;
  margin-bottom: 10px;
}

.tl-label {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-right: 10px;
  text-align: right;
}

.tl-label b {
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.tl-label span {
  font-size: .75rem;
  color: var(--text-faint);
}

/* The base --purple only reaches 4.4:1 on --surface. Use the lighter tint of
   the same hue for the 13px lane label so it clears AA. */
.tl-row.studio .tl-label b {
  color: #a78bfa;
}

.tl-row.air .tl-label b {
  color: var(--orange);
}

.tl-lane {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--border);
  min-height: 62px;
}

.tl-seg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 6px;
  text-align: center;
  font-size: .78rem;
  font-weight: 700;
  line-height: 1.25;
  border-left: 1px solid var(--border);
  color: #fff;
  min-width: 0;
}

.tl-seg:first-child {
  border-left: none;
}

.tl-seg i {
  font-style: normal;
  /* .68rem rendered at 10.9px — this is the subtitle that explains each step,
     so it is reading text rather than a label. Raised to a 12px floor. */
  font-size: .75rem;
  font-weight: 600;
  opacity: .78;
}

/* studio lane: always live audio */
.tl-seg.live {
  background: linear-gradient(180deg, #2a2140 0%, #1d1730 100%);
}

.tl-seg.live.bad {
  background: linear-gradient(180deg, #7f1d1d 0%, #5b1414 100%);
}

.tl-seg.live.bad i {
  color: #fca5a5;
}

/* air lane: filler while held back, then the delayed voice */
.tl-seg.filler {
  background: linear-gradient(180deg, #3b2a12 0%, #241908 100%);
}

.tl-seg.filler i {
  color: var(--orange-lite);
}

.tl-seg.delayed {
  background: linear-gradient(180deg, #3a2a5e 0%, #241a3e 100%);
}

.tl-seg.delayed i {
  color: #c4b5fd;
}

.tl-seg.discarded {
  background: repeating-linear-gradient(45deg, #2a1420 0 8px, #1d0f18 8px 16px);
  color: var(--text-faint);
}

.tl-seg.discarded i {
  color: #f87171;
}

/* the gap marker sitting under the air lane */
.tl-gap {
  margin-left: 162px;
  margin-top: 2px;
  margin-bottom: 18px;
  border-left: 2px dashed var(--orange); /* check: allow-sidestripe - connects the gap marker to the air lane */
  padding: 6px 0 6px 12px;
  font-size: .82rem;
  color: var(--text-dim);
}

.tl-gap b {
  color: var(--orange);
}

/* event markers under the lanes */
.tl-events {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 0 14px;
}

.tl-events .tl-marks {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  font-family: var(--mono);
  /* .7rem rendered at 11.2px. These markers carry the timings, so they are
     reading text, not labels. */
  font-size: .75rem;
}

.tl-events .tl-marks span {
  border-left: 1px solid transparent;
  padding-left: 7px;
  padding-right: 4px;
  color: var(--text-faint);
  white-space: normal;
  overflow-wrap: break-word;
}

.tl-events .tl-marks span.act {
  color: var(--orange-lite);
}

.tl-events .tl-marks span.dump {
  color: #fca5a5;
}

.tl-note {
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: .84rem;
  color: var(--text-faint);
  line-height: 1.55;
  /* Capped here rather than in style.css: this file loads after it, so a rule
     in style.css would lose the cascade. 42rem matches the other prose blocks
     on the page. At .84rem that renders 80ch, so trim to 35rem for ~66ch. */
  max-width: 35rem;
}

.tl-note strong {
  color: var(--text-dim);
}

/* Below ~760px four columns leave each segment around 99px — wide enough not
   to clip, but narrow enough that the step text has to drop to 10.6px to
   fit, and the subtitle is hidden entirely. A lane you have to squint at is
   not a timeline. The lane stacks into one full-width row per step instead:
   order still reads top-to-bottom, and both the label and its subtitle come
   back at a readable size. */
@media (max-width: 760px) {
  .tl {
    padding: 22px 16px;
  }

  .tl-axis {
    display: none;
  }

  .tl-row,
  .tl-events {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .tl-label {
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
    text-align: left;
    padding: 0 0 8px;
  }

  .tl-label b {
    font-size: .82rem;
  }

  .tl-label span {
    display: block;
    font-size: .75rem;
  }

  .tl-lane {
    grid-template-columns: 1fr;
    border-radius: var(--radius-sm);
  }

  .tl-seg {
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 11px 14px;
    font-size: .84rem;
    text-align: left;
    border-left: none;
    border-top: 1px solid var(--border);
  }

  /* Stacked, the lane separates rows with a top border, so the first row
     would otherwise open with a stray line against the label above it. */
  .tl-seg:first-child {
    border-top: none;
  }

  .tl-seg i {
    display: block;
    flex: 0 0 auto;
    text-align: right;
  }

  .tl-gap {
    margin-left: 0;
  }

  /* Stack the event list one full-width row per moment — an ellipsis would
     hide the part that matters ("the slip" / "DUMP"). */
  .tl-events {
    gap: 6px;
    margin-top: 16px;
  }

  .tl-events > span {
    display: none;
  }

  .tl-events .tl-marks {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .tl-events .tl-marks span {
    padding-left: 0;
  }
}
