/* ============================================================
   CALL RECORD — a real Nexwin call: player, waveform and a
   click-to-seek transcript that follows the audio.

   Used twice on ai-phone-receptionist-australia.html: in the hero
   (.call-record--hero, the booking call) and in the caller-memory section
   (the returning call). It lived in hero-dial.css while the hero was its only
   home; it is here now because it is no longer hero-only.

   The .recorded-demo-* class names below are the hook names
   js/recorded-demo-calls.js queries, so that file drives both players with no
   fork. The *styles* for them are intentionally local and much quieter than the
   homepage's. Do NOT link css/recorded-demo-calls.css to get them — every rule
   in that file is scoped under a .recorded-demo ancestor that does not exist
   here, so it would ship 520 lines that mostly cannot match.

   The waveform bars are not decoration: each carries its recording's measured
   amplitude in --a, so the silences are the caller's real pauses. Regenerate
   after replacing audio by taking 64 RMS buckets of the decoded mp3, dividing
   by the peak and curving with **0.55 (ffmpeg -f s16le | python).
   ============================================================ */

.call-record {
  /* Own fallbacks: this no longer depends on inheriting from a .hero-dial sibling. */
  --dial-teal: 56, 191, 161;
  --dial-cyan: 34, 211, 238;
  width: 100%;
  max-width: 430px;
  text-align: left;
}

.call-record .call-record-eyebrow {
  margin: 0 0 9px;
  font-size: 0.66rem;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(var(--dial-cyan), 0.82);
}

.call-record .call-record-eyebrow span { margin: 0 3px; color: rgba(255, 255, 255, 0.3); }

/* The recording is the claim; the cue list below it is just navigation, so its
   label stays grey rather than taking the eyebrow's cyan a second time. */
.call-record .call-record-eyebrow--quiet {
  margin: 18px 0 10px;
  color: rgba(255, 255, 255, 0.38);
}

.call-record .call-record-title {
  margin: 0 0 5px;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.call-record .call-record-scenario {
  margin: 0;
  font-size: 0.87rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.55);
}

/* ── Player ── */
.call-record .recorded-demo-player {
  margin: 14px 0 0;
  padding: 12px 14px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.call-record .recorded-demo-player audio { display: none; }

.call-record .recorded-demo-player-top {
  display: flex;
  align-items: center;
  gap: 11px;
}

.call-record .recorded-demo-play {
  display: inline-grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  color: #051122;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, rgb(var(--dial-teal)), rgb(var(--dial-cyan)));
  box-shadow: 0 3px 12px rgba(var(--dial-cyan), 0.14);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.call-record .recorded-demo-play:hover {
  filter: brightness(1.08);
  transform: scale(1.04);
  box-shadow: 0 4px 15px rgba(var(--dial-cyan), 0.24);
}

.call-record .recorded-demo-play svg { width: 17px; height: 17px; fill: currentColor; }
.call-record .recorded-demo-icon-pause { display: none; }
.call-record .recorded-demo-player.is-playing .recorded-demo-icon-play { display: none; }
.call-record .recorded-demo-player.is-playing .recorded-demo-icon-pause { display: block; }

.call-record .recorded-demo-audio-meta { min-width: 0; display: grid; gap: 1px; }

.call-record .recorded-demo-now-playing {
  overflow: hidden;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.call-record .recorded-demo-player.is-playing .recorded-demo-now-playing {
  color: rgba(var(--dial-cyan), 0.95);
}

.call-record .recorded-demo-times {
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.42);
}

.call-record .recorded-demo-track-wrap {
  position: relative;
  height: 30px;
  margin-top: 8px;
}

.call-record .recorded-demo-track-wrap:focus-within {
  border-radius: 6px;
  box-shadow: 0 0 0 2px rgba(var(--dial-cyan), 0.8);
}

.call-record .recorded-demo-waveform {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow: hidden;
  pointer-events: none;
}

/* Played region, lit behind the bars. This is how playback reads — the bars
   themselves never animate, because their heights are real data and a wobble
   would throw that away. */
.call-record .recorded-demo-waveform::before {
  content: '';
  position: absolute;
  z-index: 1;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--recorded-demo-progress, 0%);
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(var(--dial-teal), 0.16), rgba(var(--dial-cyan), 0.3));
  transition: width 100ms linear;
}

.call-record .recorded-demo-waveform span {
  display: block;
  position: relative;
  z-index: 2;
  width: 100%;
  min-width: 2px;
  height: calc(100% * var(--a, 0.5));
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  transition: background-color 200ms ease;
}

.call-record .recorded-demo-player.is-playing .recorded-demo-waveform span {
  background: rgba(var(--dial-cyan), 0.62);
}

.call-record .recorded-demo-seek {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.call-record .recorded-demo-seek:disabled { cursor: wait; }

.call-record .recorded-demo-play:focus-visible,
.call-record .recorded-demo-seek:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/* ── Key moments ──
   Cue points into the recording. The spine is the call's duration and the
   timestamps are real structure — a call is a sequence in time, and the point
   of them is how few seconds it takes to resolve. Each cue seeks the audio and
   lights up as the playhead reaches it (js/recorded-demo-calls.js). */
.call-record-log {
  /* Scroll container. position:relative makes it the offsetParent the auto-scroll
     in js/recorded-demo-calls.js measures each line's offsetTop against.
     Deliberately no mask-image fade: a mask clips the focus ring on this
     scrollable region, and the scrollbar already signals there is more. */
  position: relative;
  max-height: 300px;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  margin: 0;
  padding: 2px 10px 2px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--dial-teal), 0.32) transparent;
}

.call-record-log:focus-visible {
  outline: 2px solid var(--primary-accent-color);
  outline-offset: 4px;
  border-radius: 8px;
}

.call-record-log::-webkit-scrollbar { width: 4px; }
.call-record-log::-webkit-scrollbar-track { background: transparent; }

.call-record-log::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(var(--dial-teal), 0.3);
}

.call-record-log::-webkit-scrollbar-thumb:hover { background: rgba(var(--dial-teal), 0.5); }

.call-record-cue {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  column-gap: 14px;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  transition: background-color 160ms ease;
}

.call-record-cue:hover { background: rgba(255, 255, 255, 0.035); }
.call-record-turn.is-current .call-record-cue { background: rgba(var(--dial-cyan), 0.07); }

.call-record-time {
  padding-top: 1px;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.32);
  text-align: right;
  transition: color 200ms ease;
}

/* Each turn's left border stacks into one continuous spine down the call.
   This is a <span>, not a <div>: it lives inside the cue <button>, whose content
   model is phrasing content only. Same reason .call-record-text is a span. */
.call-record-body {
  display: block;
  position: relative;
  padding: 0 0 14px 18px;
  border-left: 1px solid rgba(var(--dial-teal), 0.22);
}

.call-record-turn:last-child .call-record-body {
  padding-bottom: 0;
  border-left-color: transparent;
}

/* Node on the spine: hollow for the caller, filled for Nexwin. */
.call-record-body::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0a1a2e;
  border: 1px solid rgba(255, 255, 255, 0.28);
  transition: background-color 200ms ease, border-color 200ms ease;
}

.call-record-turn.is-ai .call-record-body::before,
.call-record-turn.is-outcome .call-record-body::before {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.call-record-who {
  display: block;
  margin-bottom: 3px;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.34);
}

.call-record-turn.is-ai .call-record-who { color: rgba(var(--dial-teal), 0.85); }

.call-record-text {
  display: block;
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.55);
  transition: color 200ms ease;
}

.call-record-turn.is-ai .call-record-text { color: rgba(255, 255, 255, 0.82); }
.call-record-turn.is-outcome .call-record-text { color: var(--primary-color); font-weight: 500; }

/* Playhead is inside this turn. A colour change, not motion — it still reads
   with prefers-reduced-motion on. */
.call-record-turn.is-current .call-record-time { color: rgba(var(--dial-cyan), 0.9); }
.call-record-turn.is-current .call-record-text { color: #fff; }

.call-record-turn.is-current .call-record-body::before {
  background: rgb(var(--dial-cyan));
  border-color: rgb(var(--dial-cyan));
}

.call-record-cue:focus { outline: none; }

.call-record-cue:focus-visible {
  outline: 2px solid var(--primary-accent-color);
  outline-offset: 3px;
  border-radius: 6px;
}

.call-record-cue:hover .call-record-text { color: rgba(255, 255, 255, 0.95); }

@media (max-width: 560px) {
  .call-record-log { max-height: 260px; }
  .call-record .recorded-demo-waveform { gap: 1px; }
  .call-record .recorded-demo-player { padding: 11px 12px 9px; }
  .call-record-cue { grid-template-columns: 34px minmax(0, 1fr); column-gap: 12px; }
  .call-record-body { padding-left: 15px; padding-bottom: 14px; }
  .call-record-text { font-size: 0.87rem; }
}

/* The three <p> elements above are selected as `.call-record .call-record-*`
   on purpose. In the caller-memory section this block sits inside
   .product-content, whose shared `.product-content p` rule (0-1-1) beats a bare
   class (0-1-0) and was overriding font-size, line-height, colour and margin —
   the eyebrow rendered at 1.2rem. Do not flatten these selectors. */

/* Hero: a narrow column beside the dial. */
.call-record--hero { max-width: 430px; }

/* In a page section it has the full text column, so it can breathe. */
.call-record--section {
  max-width: 640px;
  margin-top: 26px;
}

.call-record--section .call-record-log { max-height: 260px; }

/* Wide section card: split into two columns so the block fills the card instead
   of leaving half of it empty, and so the transcript keeps a readable measure
   rather than stretching to ~1100px lines.

   The children are a flat list (no wrapper divs), so each is placed explicitly:
   intro + player down column 1, transcript label + panel down column 2. Row 4
   is the flexible one and the panel spans rows 2-4, so the panel sets the
   block's height. The player is aligned to the start of that row, directly under
   the copy it belongs to; the leftover height then falls to the bottom of the
   column, where a ragged edge reads as normal — bottom-aligning the player
   instead left a hole floating in the middle of the column. */
@media (min-width: 861px) {
  .call-record--section {
    max-width: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    grid-template-rows: auto auto auto 1fr;
    column-gap: clamp(30px, 4vw, 56px);
  }

  /* :not() matters — the transcript label carries .call-record-eyebrow too. */
  .call-record--section > .call-record-eyebrow:not(.call-record-eyebrow--quiet) { grid-area: 1 / 1; }
  .call-record--section > .call-record-title { grid-area: 2 / 1; }
  .call-record--section > .call-record-scenario { grid-area: 3 / 1; }

  .call-record--section > .recorded-demo-player {
    grid-area: 4 / 1;
    align-self: start;
    width: 100%;
  }

  .call-record--section > .call-record-eyebrow--quiet { grid-area: 1 / 2; margin-top: 0; }

  .call-record--section > .call-record-log {
    grid-area: 2 / 2 / 5 / 3;
    max-height: 320px;
  }
}


/* ── Reduced motion ──
   The recording still plays and the transcript still follows it — those are
   colour changes. Only the progress sweep, the button lift and the panel's
   glide are motion. js/recorded-demo-calls.js reads this same query to swap
   smooth scrolling for an instant jump. */
@media (prefers-reduced-motion: reduce) {
  .call-record .recorded-demo-waveform::before,
  .call-record .recorded-demo-play {
    transition: none;
  }

  .call-record .recorded-demo-play:hover { transform: none; }
  .call-record-log { scroll-behavior: auto; }
  .call-record-cue { transition: none; }
}
