:root {
  --grad-from: #0a4771;
  --grad-to: #2e6aa7;
  --accent-light: #9dc0e0;
  --timeline-gap: 2rem;
  --timeline-item-w: 220px;
  --scrollbar-size: 1.5rem;
}

.decade-filter {
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.decade-filter button {
  padding: .5rem 1rem;
  border: 1px solid #d1d5db;
  background: #f3f4f6;
  cursor: pointer;
  border-radius: .375rem;
  font-size: .875rem;
  transition: background .15s ease, color .15s ease;
}

.decade-filter button:hover {
  background: #e5e7eb;
}

.decade-filter button.active {
  background: radial-gradient(circle, var(--grad-from), var(--grad-to));
  color: #fff;
  border: none;
}

.timeline-wrapper {
  position: relative;
}

.scroll-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1px solid #d1d5db;
  background: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,.08);
  opacity: .75;
  transition: opacity .15s ease;
  z-index: 1;
}

.scroll-arrow:hover {
  opacity: 1;
}

.scroll-arrow.left {
  left: .25rem;
}

.scroll-arrow.right {
  right: .25rem;
}

/* remove UL bullets and set stacking context */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: var(--timeline-gap);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  border-top: 3px solid var(--grad-to);
  position: relative;
  z-index: 0;
}

/* lift the dot above the line */
.timeline-item {
  position: relative;
  flex: 0 0 var(--timeline-item-w);
  scroll-snap-align: start;
  z-index: 1;
}

.timeline-item .dot {
  position: absolute;
  top: -0.75rem;
  left: 50%;
  transform: translateX(-50%);
  width: 1.25rem;
  height: 1.25rem;
  background: radial-gradient(circle, var(--grad-from), var(--grad-to));
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--accent-light);
  z-index: 2;
}

.content {
  background: #f3f4f6;
  padding: 1rem;
  border-radius: .375rem;
  text-align: center;
}

.profile-img {
  display: block;
  margin: 0 auto .5rem;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #e5e7eb;
  transition: opacity .3s ease;
}

/* fade portrait on hover */
.profile-img:hover {
  opacity: .6;
}

.title,
.title a {
  margin: .5rem 0 0;
  font-size: 1.125rem;
  color: #111827;
  text-decoration: none;
  display: inline-block;
}

.lifespan {
  display: block;
  margin: .25rem 0 1rem;
  color: #4b5563;
  font-weight: 700;
}

.books {
  list-style: none;
  padding: 0;
  margin: 0;
}

.books li {
  margin-bottom: .5rem;
}

.books a {
  display: block;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: .3rem .6rem;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: .375rem;
  font-size: .875rem;
  color: #0a4771;
  transition: background .15s ease;
}

.books a:hover {
  background: #e2e8f0;
}

@media (max-width: 600px) {
  /* tighten the space between cards */
  .timeline {
    gap: 1rem;
  }

  /* show roughly two cards in view instead of one */
  .timeline-item {
    flex: 0 0 45%;       /* each card is 45% of the viewport */
    scroll-snap-align: center;
  }
}

