/* ============================================
   Life Timeline - Centered Alternating Design
   ============================================ */

.life-timeline {
  position: relative;
  padding: 40px 0;
}

.timeline-heading {
  text-align: center;
  margin-bottom: 48px;
}

/* --- Timeline Container --- */
.timeline {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Central vertical line */
.timeline::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, var(--cardinal), var(--cardinal-light), var(--cardinal));
  border-radius: 2px;
}

/* --- Timeline Item (Mobile: all on right) --- */
.tl-item {
  position: relative;
  padding-left: 40px;
  padding-bottom: 40px;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.tl-item:last-child {
  padding-bottom: 0;
}

.tl-item.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .tl-item {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Node dot */
.tl-item::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 6px;
  width: 18px;
  height: 18px;
  background: var(--white);
  border: 3px solid var(--cardinal);
  border-radius: 50%;
  z-index: 2;
}

.tl-item--highlight::before {
  background: var(--cardinal);
  width: 22px;
  height: 22px;
  left: 10px;
  top: 4px;
  box-shadow: 0 0 0 5px rgba(88, 0, 24, 0.15);
}

/* --- Card --- */
.tl-card {
  background: var(--white);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 24px 28px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tl-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

@media (prefers-reduced-motion: reduce) {
  .tl-card:hover {
    transform: none;
  }
}

/* Year badge */
.tl-year {
  display: inline-block;
  background: var(--cardinal);
  color: var(--white);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: var(--radius-button);
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}

.tl-item--highlight .tl-year {
  background: var(--cardinal-dark);
  box-shadow: 0 2px 8px rgba(88, 0, 24, 0.25);
}

.tl-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--black);
  margin: 0 0 6px;
  line-height: 1.3;
}

.tl-desc {
  color: var(--gray-600);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0;
}

/* --- Desktop: Alternating Left/Right (768px+) --- */
@media (min-width: 768px) {
  .timeline {
    padding: 0;
  }

  /* Center the line */
  .timeline::before {
    left: 50%;
    transform: translateX(-50%);
  }

  /* All items take up half width */
  .tl-item {
    width: 50%;
    padding-bottom: 48px;
  }

  /* Left-side items (odd) - slide from left */
  .tl-item:nth-child(odd) {
    padding-left: 0;
    padding-right: 48px;
    margin-left: 0;
    text-align: right;
    transform: translateX(-24px);
  }

  .tl-item:nth-child(odd).visible {
    transform: translateX(0);
  }

  .tl-item:nth-child(odd)::before {
    left: auto;
    right: -10px;
  }

  .tl-item:nth-child(odd).tl-item--highlight::before {
    right: -12px;
  }

  /* Right-side items (even) - slide from right */
  .tl-item:nth-child(even) {
    margin-left: 50%;
    padding-left: 48px;
    padding-right: 0;
    text-align: left;
    transform: translateX(24px);
  }

  .tl-item:nth-child(even).visible {
    transform: translateX(0);
  }

  .tl-item:nth-child(even)::before {
    left: -10px;
  }

  .tl-item:nth-child(even).tl-item--highlight::before {
    left: -12px;
  }

  /* Small connector line from dot to card */
  .tl-item::after {
    content: '';
    position: absolute;
    top: 14px;
    width: 24px;
    height: 2px;
    background: var(--cardinal);
    opacity: 0.4;
    z-index: 1;
  }

  .tl-item:nth-child(odd)::after {
    right: 0;
  }

  .tl-item:nth-child(even)::after {
    left: 0;
  }
}

/* --- Start/End Caps --- */
.timeline-cap {
  position: relative;
  z-index: 2;
  text-align: center;
  padding-bottom: 24px;
}

.timeline-cap:last-child {
  padding-bottom: 0;
  padding-top: 24px;
}

.timeline-cap-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  background: var(--cardinal);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(88, 0, 24, 0.12);
}

@media (min-width: 768px) {
  .timeline-cap {
    margin-left: calc(50% - 7px);
  }
}
