/**
 * Timeline Scrubber
 * Colored era-segment bar with stop dots. Bracketed nav links.
 *
 * Layout (top to bottom):
 *   1. Colored bar: era segments + stop dots + cursor glow
 *   2. Meta row: era labels (left-aligned in segments) + nav links (right)
 */

.timeline-scrubber {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #1a1e1c;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 8px 1rem 0;
  user-select: none;
}

/* ── Year labels above the bar ── */
.timeline-years {
  position: relative;
  height: 14px;
  margin-bottom: 4px;
}

.timeline-year {
  position: absolute;
  transform: translateX(-50%);
  font-family: var(--sf-font-mono, "SF Mono", monospace);
  font-size: 0.55rem;
  letter-spacing: 0.02em;
  color: rgba(255,255,255,0.25);
  opacity: 0;
  transition: opacity 0.15s ease;
}

/* Show every other year */
.timeline-year--visible {
  opacity: 1;
  color: rgba(255,255,255,0.5);
}

/* Current year always visible + highlighted */
.timeline-year--current {
  opacity: 1;
  color: #fff;
  font-weight: 700;
}

/* Reveal all years on scrubber hover */
.timeline-scrubber:hover .timeline-year {
  opacity: 1;
}

/* ── Colored era bar ── */
.timeline-bar {
  position: relative;
  height: 6px;
  overflow: visible;
}

/* Era color segments — fills the bar */
.timeline-segments {
  position: absolute;
  inset: 0;
}

.timeline-segment {
  position: absolute;
  top: 0;
  height: 100%;
}

/* Era segment colors — narrative arc progression */
.timeline-segment[data-era="2024-2026"] { background: #3a7a5a; }  /* quiet green */
.timeline-segment[data-era="2027-2028"] { background: #5a8a4a; }  /* shifting */
.timeline-segment[data-era="2029-2030"] { background: #b85a6a; }  /* fracture pink */
.timeline-segment[data-era="2033-2034"] { background: #c44a4a; }  /* conflict red */
.timeline-segment[data-era="2035"]      { background: #7a4a3a; }  /* ash/aftermath */

/* ── Stop dots on the bar ── */
.timeline-stops {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.timeline-stop {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  text-decoration: none;
  z-index: 2;
  padding: 6px;
  margin: -6px;
}

.stop-dot {
  display: block;
  border-radius: 50%;
  background: rgba(255,255,255,0.85);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.timeline-stop--major .stop-dot {
  width: 8px;
  height: 8px;
}

.timeline-stop--minor .stop-dot {
  width: 5px;
  height: 5px;
  background: rgba(255,255,255,0.5);
}

.timeline-stop--active .stop-dot {
  background: #fff;
  box-shadow: 0 0 6px rgba(255,255,255,0.6), 0 0 14px rgba(255,255,255,0.3);
  width: 10px;
  height: 10px;
}

.timeline-stop:hover .stop-dot {
  transform: scale(1.5);
  box-shadow: 0 0 8px rgba(255,255,255,0.5);
}

/* Tooltip */
.timeline-stop::before {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  font-family: var(--sf-font-mono, "SF Mono", monospace);
  white-space: nowrap;
  background: rgba(0,0,0,0.85);
  color: #ccc;
  padding: 3px 8px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.1);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.timeline-stop:hover::before {
  opacity: 1;
}

/* ── Current position — glow pip ── */
.timeline-cursor {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px rgba(255,255,255,0.7), 0 0 16px rgba(255,255,255,0.3);
  z-index: 3;
}

/* ── Meta row: era labels + nav ── */
.timeline-meta {
  display: flex;
  align-items: center;
  padding: 0.3rem 1rem 0.35rem;
}

.timeline-eras {
  position: relative;
  flex: 1;
  height: 14px;
  min-width: 0;
}

.timeline-era {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 2px;
}

.era-name {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.6);
  font-family: var(--sf-font-mono, "SF Mono", monospace);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Bracketed nav links ── */
.timeline-nav {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.timeline-nav__link {
  font-family: var(--sf-font-mono, "SF Mono", monospace);
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.timeline-nav__link:hover {
  color: #fff;
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .timeline-meta {
    padding: 0.25rem 0.5rem;
  }

  .timeline-stop--minor .stop-dot {
    width: 3px;
    height: 3px;
  }

  .timeline-stop--major .stop-dot {
    width: 6px;
    height: 6px;
  }

  .timeline-cursor {
    width: 8px;
    height: 8px;
  }

  .timeline-eras {
    display: none;
  }

  /* Show every 3rd year on mobile */
  .timeline-year--visible {
    opacity: 0;
  }
  .timeline-year:nth-child(3n+1) {
    opacity: 1;
    color: rgba(255,255,255,0.5);
  }
  .timeline-year--current {
    opacity: 1;
  }

  .timeline-nav__link {
    font-size: 0.55rem;
  }
}

@media (max-width: 480px) {
  .timeline-nav {
    gap: 0.25rem;
  }
}
