/* ==========================================================================
   Timeline Page Styles
   ========================================================================== */

.timeline-container {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
}

/* --- Era Jump Bar --- */
.era-jump-bar {
  position: sticky;
  top: var(--nav-height);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-secondary);
  z-index: var(--z-base);
  padding: var(--space-3) 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.era-jump-btn {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
  border: 2px solid transparent;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.era-jump-btn:hover {
  color: white;
}

.era-jump-btn.active {
  color: white;
  border-color: currentColor;
}

/* --- Timeline Controls --- */
.timeline-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  flex-wrap: wrap;
}

.timeline-zoom-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.timeline-filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* --- Timeline Spine --- */
.timeline-spine {
  position: relative;
  padding: var(--space-6) 0;
}

.timeline-spine::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--border-primary);
  transform: translateX(-50%);
}

/* --- Era Section --- */
.timeline-era-section {
  position: relative;
  padding: var(--space-7) 0;
  transition: background-color 0.5s ease;
}

.timeline-era-header {
  text-align: center;
  padding: var(--space-6) var(--space-5);
  position: relative;
  z-index: 1;
}

.timeline-era-header h2 {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-2);
}

.timeline-era-header .era-date-range {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* --- Year Marker --- */
.timeline-year-marker {
  text-align: center;
  position: relative;
  z-index: 1;
  margin: var(--space-6) 0 var(--space-4);
}

.timeline-year-marker .year-label {
  display: inline-block;
  padding: var(--space-2) var(--space-4);
  background: var(--bg-card);
  border: 2px solid var(--border-primary);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

/* --- Timeline Entry --- */
.timeline-entry {
  display: flex;
  align-items: flex-start;
  position: relative;
  margin-bottom: var(--space-5);
}

.timeline-entry:nth-child(odd) {
  flex-direction: row;
}

.timeline-entry:nth-child(even) {
  flex-direction: row-reverse;
}

.timeline-entry-content {
  width: calc(50% - 30px);
  background: var(--bg-card);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--card-shadow);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.timeline-entry-content:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
  border-color: var(--accent-primary);
}

.timeline-entry-dot {
  position: absolute;
  left: 50%;
  top: var(--space-4);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 3px solid var(--border-primary);
  transform: translateX(-50%);
  z-index: 1;
  transition: all var(--transition-fast);
}

.timeline-entry:hover .timeline-entry-dot {
  transform: translateX(-50%) scale(1.3);
}

.timeline-entry-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.timeline-entry-emoji {
  font-size: var(--text-xl);
}

.timeline-entry-name {
  font-weight: 700;
  font-size: var(--text-base);
}

.timeline-entry-date {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.timeline-entry-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  display: none;
}

.timeline-entry-content.expanded .timeline-entry-desc {
  display: block;
  margin-top: var(--space-3);
}

.timeline-entry-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.timeline-view-link {
  font-size: var(--text-xs);
  color: var(--text-link);
  font-weight: 600;
  display: none;
}

.timeline-entry-content.expanded .timeline-view-link {
  display: inline;
}

/* --- Cluster / More Button --- */
.timeline-cluster-more {
  text-align: center;
  margin: var(--space-3) 0;
}

.timeline-cluster-more button {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.timeline-cluster-more button:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

/* --- Minimap --- */
.timeline-minimap {
  position: fixed;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 300px;
  background: var(--border-secondary);
  border-radius: var(--radius-full);
  z-index: var(--z-base);
}

.timeline-minimap-indicator {
  position: absolute;
  left: -2px;
  width: 8px;
  height: 30px;
  background: var(--accent-primary);
  border-radius: var(--radius-full);
  transition: top 0.1s ease;
}

/* --- Sticky Era Indicator --- */
.current-era-indicator {
  position: fixed;
  top: calc(var(--nav-height) + var(--space-4));
  left: var(--space-4);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 700;
  color: white;
  z-index: var(--z-base);
  opacity: 0;
  transition: opacity var(--transition-fast), background-color var(--transition-base);
}

.current-era-indicator.visible {
  opacity: 1;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .timeline-spine::before {
    left: 20px;
  }

  .timeline-entry,
  .timeline-entry:nth-child(odd),
  .timeline-entry:nth-child(even) {
    flex-direction: row;
    padding-left: 45px;
  }

  .timeline-entry-content {
    width: 100%;
  }

  .timeline-entry-dot {
    left: 20px;
  }

  .timeline-minimap {
    display: none;
  }

  .current-era-indicator {
    display: none;
  }
}
