/* Timeline — centered line, items alternate left/right */

.timeline {
  background: var(--color-bg-alt);
  max-width: none;
  padding-inline: 0;
}

.timeline > * {
  max-width: var(--content-width);
  margin-inline: auto;
  padding-inline: var(--padding-page);
}

.timeline ol {
  list-style: none;
  position: relative;
  padding: 0;
  display: flex;
  flex-direction: column-reverse;
}

/* Center line */
.timeline ol::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 0.125rem;
  background: var(--color-border);
  transform: translateX(-50%);
}

/* Item */
.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-block);
  padding-block-end: var(--gap-section);
}

.timeline li:last-child {
  padding-block-end: 0;
}

/* Dot on the center line */
.timeline li::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0.25rem;
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 50%;
  background: var(--color-primary);
  border: 0.1875rem solid var(--color-bg-alt);
  transform: translateX(-50%);
  z-index: 1;
}

/* Year badge */
.timeline time {
  display: block;
  font-family: var(--font-heading), serif;
  font-size: var(--text-2xl);
  font-weight: 400;
  color: var(--color-primary);
  line-height: 1;
  margin-block-end: var(--space-2);
}

/* Content card */
.timeline li > div {
  padding: var(--padding-card);
  background: var(--color-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

.timeline li > div:hover {
  transform: translateY(-0.125rem);
  box-shadow: var(--shadow-lg);
}

.timeline h3 {
  font-size: var(--text-base);
  font-weight: 600;
  margin-block-end: var(--space-2);
}

.timeline p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Optional image */
.timeline figure {
  margin-block-start: var(--space-3);
  border: 0.0625rem solid var(--color-panel-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.timeline figure img {
  width: 100%;
  height: auto;
  display: block;
}

/* Odd items: year left, card right */
.timeline li:nth-child(odd) time {
  text-align: right;
  padding-inline-end: var(--gap-block);
}

/* Even items: card left, year right */
.timeline li:nth-child(even) time {
  order: 1;
  padding-inline-start: var(--gap-block);
}

.timeline li:nth-child(even) > div {
  order: -1;
}

/* Mobile: single column, line on the left */
@media (max-width: 44.999rem) {
  .timeline ol::before {
    left: 0.375rem;
    transform: none;
  }

  .timeline li {
    grid-template-columns: 1fr;
    padding-inline-start: var(--space-8);
  }

  .timeline li::before {
    left: 0;
    transform: none;
  }

  .timeline li:nth-child(odd) time,
  .timeline li:nth-child(even) time {
    text-align: left;
    padding-inline: 0;
    order: 0;
  }

  .timeline li:nth-child(even) > div {
    order: 0;
  }
}
