/*--------------------------------------------------------------
# IMCO Story Timeline - Independent Page-Spanning Vertical Spine
# Pinned completely to the far left of the page, scaling with total page length
--------------------------------------------------------------*/

:root {
  --timeline-red: #e03a3c;
  --timeline-red-glow: rgba(224, 58, 60, 0.45);
  --timeline-dark: rgba(22, 16, 18, 0.58);
  --timeline-track-bg: rgba(140, 140, 140, 0.22);
}

/* Ensure body allows absolute positioning relative to full page */
body {
  position: relative;
}

/* Base Container - Pinned on the far left edge of the page */
.story-timeline {
  position: absolute;
  left: 28px;
  width: 44px;
  z-index: 990;
  pointer-events: none;
  user-select: none;
}

/* Inner Rail */
.timeline-rail {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Background Track Line (Spans full distance) */
.timeline-track-bg {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 4px;
  height: 100%;
  background: var(--timeline-track-bg);
  border-radius: 4px;
  z-index: 1;
}

/* Active Progress Line (Fills down smoothly on Scroll) */
.timeline-track-fill {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 4px;
  height: 0;
  background: linear-gradient(to bottom, #8f0000, var(--timeline-red));
  border-radius: 4px;
  z-index: 2;
  box-shadow: 0 0 8px var(--timeline-red-glow);
  /* Butter-smooth, fluid fluid spring deceleration */
  transition: height 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: height;
}

/* Timeline Node - Positioned mathematically by year difference */
.timeline-node {
  position: absolute;
  left: 0;
  display: flex;
  align-items: center;
  z-index: 3;
  cursor: pointer;
  pointer-events: auto;
  }

/* Circle Badge with Year */
.timeline-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #cbd5e1;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--heading-font, "Raleway", sans-serif);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -0.3px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  /* Smooth CSS properties without jittery overshoot */
  transition: transform 0.25s ease, background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  will-change: transform;
}

/* GPU-accelerated pulsing ring on active circle (Zero box-shadow animation lag) */
.timeline-circle::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--timeline-red);
  opacity: 0;
  transform: scale(0.9);
  pointer-events: none;
  transition: opacity 0.25s ease;
  will-change: transform, opacity;
}

/* Hover on Circle */
.timeline-node:hover .timeline-circle {
  border-color: var(--timeline-red);
  color: var(--timeline-red);
  transform: scale(1.08);
}

/* Reached / Passed Node */
.timeline-node.passed .timeline-circle {
  background: #ffffff;
  border-color: var(--timeline-red);
  color: var(--timeline-red);
  font-weight: 800;
}

/* Current Active Node */
.timeline-node.active .timeline-circle {
  background: var(--timeline-red);
  border-color: var(--timeline-red);
  color: #ffffff;
  transform: scale(1.14);
  box-shadow: 0 6px 18px var(--timeline-red-glow);
}

/* Trigger smooth radar pulse on active circle */
.timeline-node.active .timeline-circle::after {
  opacity: 0.8;
  animation: circle-radar 2.4s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

@keyframes circle-radar {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  60% {
    transform: scale(1.45);
    opacity: 0;
  }
  100% {
    transform: scale(1.45);
    opacity: 0;
  }
}

/* Message Popup / Bubble - Clean, Compact & Smooth */
.timeline-popup {
  position: absolute;
  left: 56px;
  top: 50%;
  transform: translateY(-50%) translateX(-8px);
  background: var(--timeline-dark);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 8px;
  width: 220px;
  min-width: 200px;
  max-width: 235px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.28), 0 0 1px rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.22);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  /* GPU compositor transition: silky smooth */
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  will-change: transform, opacity;
  z-index: 10000;
}

/* Triangle Pointer to Circle */
.timeline-popup::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 6px solid var(--timeline-dark);
}

/* Show Popup when Active or on Hover */
.timeline-node.active .timeline-popup,
.timeline-node:hover .timeline-popup {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0);
}

.popup-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.popup-tag {
  background: var(--timeline-red);
  color: #ffffff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.4px;
  padding: 2px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  line-height: 1.2;
}

.popup-title {
  margin: 0;
  font-size: 11.5px;
  font-weight: 700;
  color: #ffffff;
  font-family: var(--heading-font, "Raleway", sans-serif);
  line-height: 1.25;
}

.popup-desc {
  margin: 3px 0 0 0;
  font-size: 10.5px;
  line-height: 1.35;
  color: #d1d5db;
}

/* Continuing Future Trail at the bottom - Never covered by trackFill */
.timeline-future-trail {
  position: absolute;
  left: 20px;
  width: 4px;
  height: 75px;
  background: linear-gradient(to bottom, var(--timeline-red), transparent);
  border-radius: 2px;
  z-index: 2;
  pointer-events: none;
}

/* Solid center core dot */
.timeline-future-trail::before {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 2px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  background: var(--timeline-red);
  border-radius: 50%;
  z-index: 2;
}

/* 100% GPU-accelerated smooth radar beacon ring (Zero box-shadow animation) */
.timeline-future-trail::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 2px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  background: var(--timeline-red);
  border-radius: 50%;
  z-index: 1;
  animation: radar-beacon 2.4s cubic-bezier(0.16, 1, 0.3, 1) infinite;
  will-change: transform, opacity;
}

@keyframes radar-beacon {
  0% {
    transform: scale(1);
    opacity: 0.9;
  }
  65% {
    transform: scale(2.8);
    opacity: 0;
  }
  100% {
    transform: scale(2.8);
    opacity: 0;
  }
}

/*--------------------------------------------------------------
# Responsiveness
--------------------------------------------------------------*/
@media (max-width: 1199px) {
  .story-timeline {
    left: 14px;
  }
  .timeline-circle {
    width: 38px;
    height: 38px;
    font-size: 10px;
  }
  .timeline-track-bg,
  .timeline-track-fill,
  .timeline-future-trail {
    left: 17px;
  }
  .timeline-popup {
    left: 48px;
    width: 200px;
    min-width: 190px;
    max-width: 210px;
    padding: 7px 10px;
  }
}

/* Clean hide on mobile screens to preserve full reading width */
@media (max-width: 991px) {
  .story-timeline {
    display: none !important;
  }
}
