/* Timeline interaction/layout adapted from CodePen by januaryofmine: https://codepen.io/januaryofmine/pen/pYMLwg */

#timeline-root {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

#timeline-root .hltb-timeline-section {
  width: 100%;
  max-width: none;
  margin: 24px 0 0;
  padding: 32px 0 72px;
  background: transparent;
  border: none;
  border-radius: 0;
  box-sizing: border-box;
}

#timeline-root .hltb-timeline-header {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 36px;
  padding: 0 clamp(20px, 4vw, 32px);
  text-align: center;
  box-sizing: border-box;
}

#timeline-root .hltb-timeline-header h2 {
  margin: 0 0 12px;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  line-height: 1.1;
  color: var(--color-accent);
  letter-spacing: -0.03em;
}

#timeline-root .hltb-timeline-stage {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 clamp(24px, 5vw, 80px);
  box-sizing: border-box;
}

#timeline-root .hltb-timeline {
  --hltb-timeline-card-width: min(440px, calc(50vw - 5rem));
  width: 100%;
  max-width: none;
  overflow-x: clip;
  padding-bottom: 24px;
}

#timeline-root .hltb-timeline-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

#timeline-root .hltb-timeline-item {
  list-style: none;
  position: relative;
  width: 4px;
  margin: 0 auto;
  padding-top: 48px;
  background: var(--color-ink);
}

#timeline-root .hltb-timeline-item::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%) rotate(45deg);
  width: 14px;
  height: 14px;
  z-index: 2;
  background: var(--color-bg);
  border: 2px solid var(--color-ink);
  box-sizing: border-box;
}

#timeline-root .hltb-timeline-card {
  position: relative;
  bottom: 0;
  width: var(--hltb-timeline-card-width);
  padding: 20px 18px 16px;
  background: var(--color-surface);
  border: 2px solid var(--color-ink);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  box-sizing: border-box;
  visibility: hidden;
  opacity: 0;
  transition:
    transform 0.55s ease,
    opacity 0.55s ease,
    visibility 0.55s ease;
}

#timeline-root .hltb-timeline-item:nth-of-type(odd) .hltb-timeline-card {
  left: 40px;
  transform: translate3d(72px, -8px, 0) rotate(8deg);
}

#timeline-root .hltb-timeline-item:nth-of-type(even) .hltb-timeline-card {
  left: calc(-1 * (var(--hltb-timeline-card-width) + 36px));
  transform: translate3d(-72px, -8px, 0) rotate(-8deg);
}

#timeline-root .hltb-timeline-item.hltb-timeline-in-view .hltb-timeline-card {
  transform: none;
  visibility: visible;
  opacity: 1;
}

#timeline-root .hltb-timeline-date {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 4.5rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--color-accent);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#timeline-root .hltb-timeline-card-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  min-height: 4.5rem;
}

#timeline-root .hltb-timeline-label {
  margin: 0;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.45;
  font-weight: 600;
  color: var(--color-ink);
}

#timeline-root .hltb-timeline-description {
  margin: 0;
  text-align: center;
  font-size: 0.82rem;
  line-height: 1.4;
  font-weight: 400;
  color: var(--color-text-muted);
}

/* Endpoint cards: Today + Start saving */
#timeline-root .hltb-timeline-item-target .hltb-timeline-card,
#timeline-root .hltb-timeline-item-start .hltb-timeline-card {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  box-shadow: 0 10px 28px rgba(168, 61, 39, 0.22);
}

#timeline-root .hltb-timeline-item-target .hltb-timeline-date,
#timeline-root .hltb-timeline-item-start .hltb-timeline-date {
  background: #fff;
  color: var(--color-accent-hover);
}

#timeline-root .hltb-timeline-item-target .hltb-timeline-label,
#timeline-root .hltb-timeline-item-start .hltb-timeline-label {
  color: #fff;
  font-weight: 800;
}

#timeline-root .hltb-timeline-item-target .hltb-timeline-description,
#timeline-root .hltb-timeline-item-start .hltb-timeline-description {
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.84rem;
  line-height: 1.45;
}

#timeline-root .hltb-timeline-net-worth {
  margin-top: 0.15rem;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

#timeline-root .hltb-timeline-item-start .hltb-timeline-card-body {
  min-height: 5.5rem;
}

@media screen and (max-width: 900px) {
  #timeline-root .hltb-timeline {
    --hltb-timeline-card-width: min(300px, calc(100vw - 6rem));
  }

  #timeline-root .hltb-timeline-item:nth-of-type(even) .hltb-timeline-card {
    left: calc(-1 * (var(--hltb-timeline-card-width) + 32px));
  }
}

@media screen and (max-width: 640px) {
  #timeline-root .hltb-timeline-section {
    margin-top: 16px;
    padding: 24px 0 56px;
  }

  #timeline-root .hltb-timeline-header {
    margin-bottom: 28px;
  }

  #timeline-root .hltb-timeline-stage {
    padding: 0 clamp(16px, 4vw, 24px);
  }

  #timeline-root .hltb-timeline {
    --hltb-timeline-card-width: calc(100vw - 5.75rem);
  }

  #timeline-root .hltb-timeline-item {
    margin-left: 20px;
    margin-right: 0;
  }

  #timeline-root .hltb-timeline-item:nth-of-type(even) .hltb-timeline-card,
  #timeline-root .hltb-timeline-item:nth-of-type(odd) .hltb-timeline-card {
    left: 40px;
    transform: translate3d(48px, -6px, 0) rotate(6deg);
  }

  #timeline-root .hltb-timeline-item.hltb-timeline-in-view:nth-of-type(even) .hltb-timeline-card,
  #timeline-root .hltb-timeline-item.hltb-timeline-in-view:nth-of-type(odd) .hltb-timeline-card {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hltb-timeline-section * {
    animation: none !important;
    transition: none !important;
  }

  #timeline-root .hltb-timeline-card {
    visibility: visible;
    opacity: 1;
    transform: none !important;
  }

  #timeline-root .hltb-timeline-item:nth-of-type(odd) .hltb-timeline-card,
  #timeline-root .hltb-timeline-item:nth-of-type(even) .hltb-timeline-card {
    transform: none !important;
  }
}
