/* ---- Tonggak Sejarah: sticky year-progress bar + scroll-driven milestone panels ---- */
.timeline-section {
  padding-bottom: 0;
}

.timeline-track-wrap {
  position: sticky;
  top: var(--nav-height);
  z-index: 5;
  background-color: var(--color-paper);
  border-bottom: 1px solid var(--color-border);
  padding: 1.75rem 0 2rem;
}

.timeline-track {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  overflow: visible;
}

.timeline-line,
.timeline-line-fill {
  position: absolute;
  top: calc(1.8rem + 6px);
  left: 0;
  height: 2px;
}

.timeline-line {
  right: 0;
  background-color: var(--color-border);
  z-index: 0;
}

.timeline-line-fill {
  width: 0;
  background: var(--color-gold);
  transition: width var(--duration-base) var(--ease-out);
  z-index: 0;
}

.timeline-dot {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  flex: 0 0 auto;
  background: none;
  border: none;
  padding: 0 0.25rem;
  cursor: pointer;
}

.timeline-year {
  display: block;
  height: 1.2rem;
  line-height: 1.2rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  transition: color var(--duration-fast) var(--ease-out), font-weight var(--duration-fast) var(--ease-out);
}

.timeline-dot-marker {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--color-border);
  box-shadow: 0 0 0 3px var(--color-paper);
  transition: background-color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
}

.timeline-dot:hover .timeline-dot-marker {
  background-color: var(--color-gold-deep);
}

.timeline-dot.is-active .timeline-year {
  color: var(--color-gold-deep);
}

.timeline-dot.is-active .timeline-dot-marker {
  background-color: var(--color-gold);
  transform: scale(1.35);
  box-shadow: 0 0 0 3px var(--color-paper), 0 0 0 6px rgba(184, 149, 74, 0.25);
}

.timeline-dot:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

.timeline-panels {
  position: relative;
}

.timeline-panel {
  min-height: 68vh;
  display: flex;
  align-items: center;
  padding: 3rem 0;
  opacity: 0.4;
  transition: opacity var(--duration-base) var(--ease-out);
}

.timeline-panel.is-active {
  opacity: 1;
}

.timeline-panel-year {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.75rem, 6vw, 4.5rem);
  line-height: 1;
  color: var(--color-gold);
  margin-bottom: 1rem;
}

.timeline-panel-copy h3 {
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  margin: 0 0 0.9rem;
}

.timeline-panel-copy p {
  color: var(--color-text-muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.timeline-panel-img {
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.timeline-panel-img img {
  display: block;
  width: 100%;
  height: 360px;
  object-fit: cover;
}

@media (max-width: 767.98px) {
  .timeline-track-wrap {
    padding: 1.25rem 0 1.5rem;
  }

  /* The scroll container must be the bounded element (clipped to viewport width);
     .timeline-track itself is the oversized content that scrolls inside it. Putting
     overflow-x on .timeline-track together with its own min-width caused the track
     to blow out past its container and scroll the whole page horizontally instead. */
  .timeline-track-wrap .container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* legacy Edge */
  }

  .timeline-track-wrap .container::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
  }

  .timeline-track {
    min-width: 560px;
    overflow-y: hidden;
  }

  .timeline-panel {
    min-height: auto;
    padding: 2.5rem 0;
  }

  .timeline-panel-img img {
    height: 240px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .timeline-line-fill,
  .timeline-dot-marker,
  .timeline-year,
  .timeline-panel {
    transition: none;
  }
}
