/* ==========================================================================
   Dial-trace embed (UK report Section 8.1)
   Five mini-players, each rendering pre-computed dial-response lines plus
   audio playback with synchronised playhead and captions.
   ========================================================================== */

.dial-trace {
  /* Outer container, sits in the report flow like other figures.
     No card, no border: matches the "another graph in the report" goal. */
  margin: 2.5rem 0;
  font-family: var(--font-body, 'Work Sans', sans-serif);
  color: var(--ink-body);
}

.dial-trace__chart {
  /* SVG container */
  width: 100%;
  height: 360px;
  background: var(--surface-canvas, #fff);
  position: relative;
}

.dial-trace__chart svg {
  display: block;
  width: 100%;
  height: 100%;
}

.dial-trace__chart-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dial-trace__chart-line--segment {
  stroke-width: 2.75;
}

.dial-trace__chart-line--total {
  stroke-width: 3.75;
}

.dial-trace__chart-grid {
  stroke: var(--rule-faint, #e5e7eb);
  stroke-width: 1;
  stroke-dasharray: 2 3;
  fill: none;
}

.dial-trace__chart-axis {
  stroke: var(--rule-mid, #9ca3af);
  stroke-width: 1;
  fill: none;
}

.dial-trace__chart-tick-label {
  font-size: 11px;
  fill: var(--ink-muted, #6b7280);
}

.dial-trace__chart-50line {
  stroke: var(--rule-mid, #9ca3af);
  stroke-width: 1;
  stroke-dasharray: 4 3;
  fill: none;
}

.dial-trace__chart-playhead {
  stroke: #FDC100;
  stroke-width: 2.5;
  fill: none;
  pointer-events: none;
}

.dial-trace__chart-playhead-label {
  font-size: 12px;
  font-weight: 600;
  fill: #FDC100;
}

.dial-trace__chart-line-label {
  font-size: 11px;
  font-weight: 500;
}

.dial-trace__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-top: 0.5rem;
  padding: 0 0.25rem;
  font-size: 0.8125rem;
}

.dial-trace__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  white-space: nowrap;
}

.dial-trace__legend-swatch {
  display: inline-block;
  width: 14px;
  height: 3px;
  border-radius: 1px;
}

.dial-trace__legend-swatch--total {
  height: 4px;
}

.dial-trace__audio {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface-faint, #f9fafb);
  border-radius: 6px;
}

.dial-trace__audio-button {
  /* Native button so keyboard tab + Enter/Space work for free */
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--accent, #1f2937);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  transition: background 0.15s ease;
}

.dial-trace__audio-button:hover {
  background: var(--accent-hover, #111827);
}

.dial-trace__audio-button:disabled {
  background: var(--rule-mid, #9ca3af);
  cursor: not-allowed;
}

.dial-trace__audio-button:focus-visible {
  outline: 2px solid #FDC100;
  outline-offset: 2px;
}

.dial-trace__audio-time {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
  color: var(--ink-muted, #6b7280);
  min-width: 5em;
}

.dial-trace__audio-progress {
  flex: 1 1 auto;
  position: relative;
  height: 6px;
  background: var(--rule-faint, #e5e7eb);
  border-radius: 3px;
  cursor: pointer;
}

.dial-trace__audio-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: var(--accent, #1f2937);
  border-radius: 3px;
  transition: width 0.05s linear;
}

.dial-trace__caption-strip {
  margin-top: 0.5rem;
  padding: 0.625rem 0.875rem;
  background: var(--surface-faint, #f9fafb);
  border-radius: 6px;
  min-height: 3rem;
  display: flex;
  align-items: center;
}

.dial-trace__caption-text {
  font-style: italic;
  font-size: 0.875rem;
  color: var(--ink-body, #1f2937);
  line-height: 1.4;
  margin: 0;
}

.dial-trace__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  color: var(--accent, #1f2937);
  text-decoration: none;
  float: right;
}

.dial-trace__cta:hover {
  text-decoration: underline;
}

.dial-trace__chart-figure-number,
.dial-trace .chart__figure-number {
  /* Match the existing chart-engine figure number styling */
  font-size: 0.8125rem;
  color: var(--ink-muted, #6b7280);
  margin-top: 0.5rem;
  margin-bottom: 0;
  clear: both;
}

.dial-trace__error {
  padding: 1rem;
  background: var(--surface-faint, #f9fafb);
  border-left: 3px solid var(--rule-mid, #9ca3af);
  font-size: 0.875rem;
  color: var(--ink-body);
}

/* Mobile responsive */
@media (max-width: 700px) {
  .dial-trace__chart {
    height: 280px;
  }

  .dial-trace__legend {
    gap: 0.5rem 0.75rem;
    font-size: 0.75rem;
  }

  .dial-trace__caption-strip {
    min-height: 2.5rem;
    padding: 0.5rem 0.625rem;
  }

  .dial-trace__caption-text {
    font-size: 0.8125rem;
  }

  .dial-trace__audio-time {
    font-size: 0.75rem;
    min-width: 4em;
  }
}

/* Reduced motion: keep playhead motion (it represents time, not decoration),
   but skip any container fade-in animation. Container animation is owned by
   .report-reveal so this just defers to that rule's reduced-motion handling. */
