/* Narration player: floating "Listen" launcher + playback bar.
   Styled to match the guides' own .toc-toggle/.toc-panel conventions
   (monospace uppercase labels, --rule borders, --shadow, flat hairline
   radius) rather than a generic rounded-shadow widget, and themes for
   free via each guide's existing custom properties. */

.narration-launcher {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 10px 16px;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--shadow), 0 4px 16px rgba(0, 0, 0, .14);
}
.narration-launcher:hover,
.narration-launcher:focus-visible { color: var(--accent); border-color: var(--accent); }
.narration-launcher.hidden { display: none; }

.narration-bar {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 50;
  width: min(420px, calc(100vw - 40px));
  padding: 14px 16px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: var(--shadow), 0 8px 30px rgba(0, 0, 0, .2);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.narration-bar.open { opacity: 1; transform: translateY(0); pointer-events: auto; }

.narration-row { display: flex; align-items: center; }
.narration-row-top { justify-content: space-between; margin-bottom: 8px; }

.narration-now { display: flex; flex-direction: column; min-width: 0; }
.narration-eyebrow {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.narration-section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.narration-close {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.narration-close:hover, .narration-close:focus-visible { color: var(--accent); }

.narration-caption {
  font-size: 0.92rem;
  line-height: 1.4;
  margin-bottom: 10px;
  min-height: 1.3em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.narration-follow {
  display: flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.narration-follow input { margin: 0; accent-color: var(--accent); }

.narration-row-controls { gap: 8px; }
.narration-row-timeline { gap: 12px; margin-bottom: 12px; }
.narration-mute { margin-left: auto; }

.narration-btn {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--rule);
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.narration-btn:hover, .narration-btn:focus-visible { border-color: var(--accent); color: var(--accent); }
.narration-play { width: 30px; height: 30px; }
.narration-seek {
  width: 40px;
  height: 30px;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.narration-progress {
  flex: 1 1 auto;
  height: 4px;
  border-radius: 999px;
  background: var(--surface-2);
  cursor: pointer;
  overflow: hidden;
  min-width: 40px;
}
.narration-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
}

.narration-time {
  flex: 0 0 auto;
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
}

.narration-volume {
  flex: 0 0 auto;
  width: 56px;
  accent-color: var(--accent);
}

/* Active section link while narration is playing, distinct from scrollspy's .active */
.toc-list a.narrating {
  color: var(--accent);
  font-weight: 600;
}

/* Figure spotlight, triggered when the narration reaches a figure call-out */
.wrap section figure {
  border-radius: 6px;
  transition: box-shadow 0.3s ease;
}
.wrap section figure.narration-spotlight {
  box-shadow: 0 0 0 2px var(--accent), 0 0 24px rgba(0, 0, 0, .18);
}

@media (max-width: 640px) {
  .narration-bar, .narration-launcher { left: 12px; }
  .narration-bar { width: calc(100vw - 24px); padding: 12px; }
  .narration-volume { display: none; }
}
