/* ==========================================================================
   timeline.css — "Our Journey" — vertical alternating spine timeline.
   Redesigned from a horizontal-scroll strip: a central gradient spine with
   cards alternating left/right on desktop, collapsing to a single
   left-aligned column on mobile — no horizontal scroll-jacking at any size.
   Each node uses the shared .reveal utility, so nodes fade in one at a
   time as the page scrolls — a staggered reveal that falls out "for free"
   from a vertical layout (a horizontal strip couldn't do this, since every
   node entered the viewport at once).
   ========================================================================== */

.timeline {
  padding-block: var(--sp-10);
  background: var(--steel-50);
  overflow: hidden;
}

.timeline__head {
  max-width: 640px;
  margin-bottom: var(--sp-9);
}

.timeline__head-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  margin-top: var(--sp-5);
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--flame-500);
}
.timeline__head-link svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s var(--ease);
}
.timeline__head-link:hover svg {
  transform: translateX(3px);
}

/* ---- Track + spine --------------------------------------------------- */
.timeline__track-wrap {
  position: relative;
}

.timeline__track {
  position: relative;
  max-width: 900px;
  margin-inline: auto;
  padding-block: var(--sp-3) 0;
}

.timeline__line {
  position: absolute;
  left: 50%;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: linear-gradient(180deg, var(--indigo-700) 0%, var(--ember-500) 85%, var(--flame-500) 100%);
  transform: translateX(-50%);
  border-radius: 2px;
}

/* ---- Node ---------------------------------------------------------------
   Reset from <button> defaults: full width, block, inherit text-align so
   the odd/even alternation below can control it. */
.timeline__node {
  position: relative;
  display: block;
  width: 50%;
  padding-bottom: var(--sp-7);
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.timeline__node:last-child {
  padding-bottom: 0;
}

.timeline__node:nth-child(odd) {
  left: 0;
  padding-right: var(--sp-8);
  text-align: right;
}
.timeline__node:nth-child(even) {
  left: 50%;
  padding-left: var(--sp-8);
  text-align: left;
}

.timeline__dot {
  position: absolute;
  top: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--paper);
  border: 3px solid var(--indigo-700);
  z-index: 2;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), background 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.timeline__node:nth-child(odd) .timeline__dot {
  right: -9px;
}
.timeline__node:nth-child(even) .timeline__dot {
  left: -9px;
}

.timeline__node:hover .timeline__dot,
.timeline__node:focus-visible .timeline__dot,
.timeline__node.is-active .timeline__dot {
  transform: scale(1.25);
  border-color: var(--ember-500);
  background: var(--ember-500);
  box-shadow: 0 0 0 6px var(--ember-100);
}

/* ---- Card ------------------------------------------------------------ */
.timeline__card {
  display: inline-block;
  max-width: 360px;
  background: var(--paper);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
}
.timeline__node:hover .timeline__card,
.timeline__node:focus-visible .timeline__card,
.timeline__node.is-active .timeline__card {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.timeline__year {
  display: block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1;
  margin-bottom: 0.5em;
  background: var(--grad-ember);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.timeline__text {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--steel-600);
}

/* ---- "Today" endpoint — distinct treatment to mark the culmination --- */
.timeline__node--today .timeline__dot {
  width: 22px;
  height: 22px;
  border-color: var(--flame-500);
  background: var(--flame-500);
  box-shadow: 0 0 0 6px rgba(223, 58, 28, 0.15);
  animation: timeline-pulse 2.4s ease-in-out infinite;
}
.timeline__node--today:nth-child(odd) .timeline__dot {
  right: -11px;
}
.timeline__node--today:nth-child(even) .timeline__dot {
  left: -11px;
}
.timeline__node--today .timeline__card {
  border: 1.5px solid var(--flame-500);
}
.timeline__node--today .timeline__year {
  background: none;
  -webkit-text-fill-color: initial;
  color: var(--flame-500);
}
.timeline__node--today .timeline__text {
  color: var(--ink-700);
  font-weight: 500;
}

@keyframes timeline-pulse {
  0%, 100% {
    box-shadow: 0 0 0 6px rgba(223, 58, 28, 0.15);
  }
  50% {
    box-shadow: 0 0 0 11px rgba(223, 58, 28, 0.06);
  }
}
@media (prefers-reduced-motion: reduce) {
  .timeline__node--today .timeline__dot {
    animation: none;
  }
}

/* ---- Mobile: single column, spine moves to the left edge -------------
   Same markup, no alternation logic needed beyond this — every node
   becomes a full-width block with the line+dot on the left. */
@media (max-width: 720px) {
  .timeline__line {
    left: 9px;
    transform: none;
  }

  .timeline__node,
  .timeline__node:nth-child(odd),
  .timeline__node:nth-child(even) {
    width: 100%;
    left: 0;
    padding-left: var(--sp-7);
    padding-right: 0;
    text-align: left;
  }

  .timeline__node:nth-child(odd) .timeline__dot,
  .timeline__node:nth-child(even) .timeline__dot,
  .timeline__node--today:nth-child(odd) .timeline__dot,
  .timeline__node--today:nth-child(even) .timeline__dot {
    left: 0;
    right: auto;
  }

  .timeline__card {
    display: block;
    max-width: 100%;
  }
}
