/* ==========================================================================
   Timeline Carousel (3D Perspective)
   Template: page-heritage.php
   JS: timeline.js sets inline transform/opacity/zIndex on cards
   ========================================================================== */

/* ---------- Container ---------- */
.timeline {
  position: relative;
  overflow: hidden;
  min-height: 650px;
  background-color: var(--color-bg-card);
  user-select: none;
}

.timeline.is-dragging {
  cursor: grabbing;
}

/* ---------- Year pills ---------- */
.timeline__years {
  position: absolute;
  top: 2rem;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
  padding: 0 1rem;
  justify-content: flex-start;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
  .timeline__years {
    justify-content: center;
  }
}

.timeline__years::-webkit-scrollbar {
  display: none;
}

.timeline__year-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: var(--font-weight-bold);
  font-family: var(--font-body);
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.timeline__year-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.timeline__year-btn.is-active {
  background-color: var(--color-primary);
  color: #fff;
  transform: scale(1.1);
}

/* ---------- Track ---------- */
.timeline__track {
  position: relative;
  height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: grab;
  transform-style: preserve-3d;
}

.timeline.is-dragging .timeline__track {
  cursor: grabbing;
}

/* ---------- Cards ---------- */
.timeline__card {
  position: absolute;
  width: 320px;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  transform: scale(0.7);
  pointer-events: none;
  background-color: #27272a; /* zinc-800 */
  border: 1px solid #3f3f46; /* zinc-700 */
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
  padding: 2rem;
  cursor: pointer;
}

.timeline__card:hover {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.timeline__card.is-active {
  opacity: 1;
  transform: scale(1.1);
  z-index: 3;
  pointer-events: auto;
  box-shadow:
    0 0 0 2px var(--color-primary),
    0 0 0 6px #18181b, /* ring-offset = zinc-900 */
    0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

/* ---------- Year badge (floats above card) ---------- */
.timeline__card-badge {
  position: absolute;
  top: -1rem;
  left: 2rem;
}

.timeline__card-badge-inner {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: var(--font-weight-bold);
  background-color: #3f3f46; /* zinc-700 */
  color: #d4d4d8; /* zinc-300 */
  transition: all 0.3s ease;
}

.timeline__card.is-active .timeline__card-badge-inner {
  background-color: var(--color-primary);
  color: #fff;
}

/* ---------- Card body ---------- */
.timeline__card-body {
  margin-top: 1rem;
}

.timeline__card-title {
  font-size: 1.25rem;
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-body);
  color: #d4d4d8; /* zinc-300 */
  margin-bottom: 1rem;
  transition: color 0.3s ease;
}

.timeline__card.is-active .timeline__card-title {
  color: #fff;
}

.timeline__card-desc {
  font-size: 0.875rem;
  color: #71717a; /* zinc-500 */
  line-height: 1.6;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  transition: all 0.3s ease;
}

.timeline__card.is-active .timeline__card-desc {
  color: #a1a1aa; /* zinc-300-ish */
  -webkit-line-clamp: unset;
  overflow: visible;
}

/* ---------- Progress bar (active card only) ---------- */
.timeline__card-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  background: transparent;
  transition: background 0.3s ease;
}

.timeline__card.is-active .timeline__card-progress {
  background: linear-gradient(
    to right,
    transparent,
    var(--color-primary),
    transparent
  );
}

/* ---------- Navigation arrows ---------- */
.timeline__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background-color: #27272a; /* zinc-800 */
  border: 1px solid #3f3f46; /* zinc-700 */
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.timeline__nav:hover {
  background-color: #3f3f46; /* zinc-700 */
}

.timeline__nav:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.timeline__nav--prev {
  left: 1rem;
}

.timeline__nav--next {
  right: 1rem;
}

@media (min-width: 768px) {
  .timeline__nav {
    width: 48px;
    height: 48px;
  }

  .timeline__nav--prev {
    left: 2rem;
  }

  .timeline__nav--next {
    right: 2rem;
  }
}

.timeline__nav svg {
  width: 1.25rem;
  height: 1.25rem;
}

@media (min-width: 768px) {
  .timeline__nav svg {
    width: 1.5rem;
    height: 1.5rem;
  }
}

/* ---------- Dots ---------- */
.timeline__dots {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

.timeline__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background-color: rgba(255, 255, 255, 0.3);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s ease;
}

.timeline__dot:hover {
  background-color: rgba(255, 255, 255, 0.5);
}

.timeline__dot.is-active {
  background-color: var(--color-primary);
  width: 32px;
  border-radius: var(--radius-full);
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .timeline__card {
    transition-duration: 0.01ms;
  }
}
