/* css/timeline.css — Journey Timeline left-panel styles.
   Skin tokens ONLY — no hardcoded hex, font names, border radii, or shadow values.
   All colors/fonts/radii come from CSS custom properties defined by skin files.
   Wave 5.3 */

/* ── Progress counter (Wave 8 P4.2) ──
   Sits above the milestone list. Tells viewers exactly how far through
   the run they are ("Beat 17 / 37 · ~2m left") so the timeline answers
   both "where am I" and "how much is left" in one place. */
.timeline-progress {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 10px 16px 6px;
  font-size: 0.75rem;
  font-family: var(--font-base);
  color: var(--fg);
  opacity: 0.75;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.timeline-progress__counter {
  font-weight: 600;
}

.timeline-progress__eta {
  opacity: 0.85;
}

/* Collapsed left panel: hide the progress counter (mirrors how labels
   are hidden — only the dot rail remains in this mode). */
.chat-app[data-collapsed-left="true"] .timeline-progress {
  display: none;
}

/* ── Timeline container ── */
.timeline {
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 0;
  list-style: none;
  overflow-y: auto;
  flex: 1;
}

/* ── Milestone node ── */
.timeline-node {
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 8px 0 8px 4px;
  gap: 4px;
}

/* Connecting line between milestones (vertical bar via ::before) */
.timeline-node::before {
  content: "";
  position: absolute;
  left: 9px;       /* centres under the 20px dot */
  top: 28px;
  bottom: -8px;
  width: 2px;
  background: var(--border);
  z-index: 0;
}
.timeline-node:last-child::before {
  display: none;
}

/* ── Node header (dot + label) ── */
.timeline-node__header {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 1;
}

/* ── Timeline dot ── */
.timeline-dot {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  z-index: 1;
  transition: background 0.2s, box-shadow 0.2s;
}

[data-state="done"] .timeline-dot {
  background: var(--accent);
  border: 2px solid var(--accent);
  color: var(--bg-elev);
}

/* Wave 8 P5.3: explicit ✓ marker on done milestones. Without it, done
   dots only differ from active by losing the pulse animation — easy to
   miss in skins where active and done share the same accent fill.
   `content` sits inside the existing 20×20 flex-centred dot, so no
   layout shift. Brutalist (sparks-six) repaints the dot yellow but
   leaves the ::after rule alone, so the ✓ shows in black against
   yellow there too. */
[data-state="done"] .timeline-dot::after {
  content: "✓";
  font-size: 0.7rem;
  line-height: 1;
  font-weight: 700;
}

[data-state="active"] .timeline-dot {
  background: var(--accent);
  border: 2px solid var(--accent);
  color: var(--bg-elev);
  animation: timeline-pulse 1.4s infinite;
  box-shadow: 0 0 0 0 var(--accent);
}

[data-state="pending"] .timeline-dot {
  background: transparent;
  border: 2px solid var(--border);
  color: transparent;
}

@keyframes timeline-pulse {
  0%   { box-shadow: 0 0 0 0 var(--accent); opacity: 1; }
  50%  { box-shadow: 0 0 0 6px transparent; opacity: 0.8; }
  100% { box-shadow: 0 0 0 0 transparent; opacity: 1; }
}

/* ── Node label ── */
.timeline-node__label {
  font-size: 0.875rem;
  font-family: var(--font-base);
  color: var(--fg);
  font-weight: 500;
  line-height: 1.3;
}

[data-state="done"] .timeline-node__label {
  opacity: 0.7;
}

[data-state="active"] .timeline-node__label {
  font-weight: 700;
  color: var(--accent);
}

[data-state="pending"] .timeline-node__label {
  opacity: 0.45;
}

/* ── Substages (visible only when parent milestone is active) ── */
.timeline-substages {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 30px;
  margin-top: 2px;
}

.timeline-substage {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
}

.timeline-substage__dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid var(--border);
}

.timeline-substage[data-state="done"] .timeline-substage__dot {
  background: var(--accent);
  border-color: var(--accent);
}

.timeline-substage[data-state="active"] .timeline-substage__dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.timeline-substage__label {
  font-size: 0.8125rem;
  font-family: var(--font-base);
  color: var(--fg);
  opacity: 0.75;
}

.timeline-substage[data-state="active"] .timeline-substage__label {
  opacity: 1;
  font-weight: 600;
  color: var(--accent);
}

.timeline-substage[data-state="done"] .timeline-substage__label {
  opacity: 0.55;
}

/* ── Profile preview (under Onboarding milestone) ── */
.timeline-profile-preview {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 30px;
  margin-top: 4px;
}

.timeline-profile-field {
  font-size: 0.78rem;
  font-family: var(--font-base);
  color: var(--fg);
  opacity: 0.7;
}

.timeline-profile-field__key {
  font-weight: 600;
}

/* ── Settings strip ── */
.timeline-settings {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.timeline-skin-selector {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 4px;
}

/* ── Mode toggle button (☀/☾) next to skin selector ── */
/* WCAG 2.5.5: ≥44×44 touch target */
[data-mode-toggle] {
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  padding: 0 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
[data-mode-toggle]:hover {
  background: var(--bg);
}

.timeline-settings__btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-base);
  font-size: 0.8125rem;
  color: var(--fg);
  opacity: 0.7;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, opacity 0.15s;
}
.timeline-settings__btn:hover {
  background: var(--bg-elev);
  border-color: var(--border);
  opacity: 1;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .timeline-dot {
    animation: none;
  }
  .timeline-node {
    transition: none;
  }
}

/* ── Collapsed left panel: hide labels, show dots only ── */
.chat-app[data-collapsed-left="true"] .timeline-node__label,
.chat-app[data-collapsed-left="true"] .timeline-substages,
.chat-app[data-collapsed-left="true"] .timeline-profile-preview,
.chat-app[data-collapsed-left="true"] .timeline-settings__btn,
.chat-app[data-collapsed-left="true"] .timeline-skin-selector select {
  display: none;
}
