.scrolling-timeline {
  padding: 80px 0;
  overflow: hidden;
  width: 100%;
  background-color: rgb(var(--color-background));
  color: rgb(var(--color-text));
}

.scrolling-timeline__heading {
  margin-bottom: 60px;
}

.scrolling-timeline__wrapper {
  position: relative;
  display: flex;
  overflow: hidden;
  width: 100vw;
  /* Mask edges for a smooth fading effect */
  mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
}

.scrolling-timeline__track {
  display: flex;
  width: max-content;
  animation: timeline-scroll var(--scroll-speed, 30s) linear infinite;
}

/* Pause the scrolling when the user hovers over the track */
.scrolling-timeline__track:hover {
  animation-play-state: paused;
}

.scrolling-timeline__group {
  display: flex;
  padding-right: 40px; /* Matches the gap so loops are seamless */
  gap: 40px;
}

.scrolling-timeline__node {
  display: flex;
  flex-direction: column;
  width: 320px;
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
  transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), opacity 0.4s ease, filter 0.4s ease;
  position: relative;
}

/* Apply focus card effect: blur and scale down unhovered cards */
.scrolling-timeline__group:has(.scrolling-timeline__node:hover) .scrolling-timeline__node:not(:hover) {
  opacity: 0.6;
  filter: blur(3px);
  transform: scale(0.96);
}

.scrolling-timeline__node:hover {
  transform: translateY(-8px);
}

.scrolling-timeline__image-wrap {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 12px;
  overflow: hidden;
  background-color: rgb(var(--color-image-background));
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.scrolling-timeline__image-wrap theme-image,
.scrolling-timeline__image-wrap img,
.scrolling-timeline__image-wrap svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* The timeline connecting line and dot */
.scrolling-timeline__marker {
  position: relative;
  height: 24px;
  display: flex;
  align-items: center;
  margin: 24px 0 16px 0;
}

.scrolling-timeline__line {
  position: absolute;
  top: 50%;
  left: 0;
  /* Extend to cover the gap between cards */
  right: -40px;
  height: 2px;
  background-color: rgba(var(--color-text), 0.15);
  transform: translateY(-50%);
}

.scrolling-timeline__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: rgb(var(--color-text));
  position: relative;
  z-index: 1;
  box-shadow: 0 0 0 4px rgba(var(--color-text), 0.1);
  transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.4s ease;
}

.scrolling-timeline__node:hover .scrolling-timeline__dot {
  transform: scale(1.4);
  box-shadow: 0 0 0 8px rgba(var(--color-text), 0.2);
}

.scrolling-timeline__title {
  margin-bottom: 8px;
}

.scrolling-timeline__subtitle {
  color: rgb(var(--color-light-text));
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 13px;
}

.scrolling-timeline__description {
  color: rgba(var(--color-text), 0.7);
  line-height: 1.6;
}

@keyframes timeline-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@media (max-width: 768px) {
  .scrolling-timeline {
    padding: 60px 0;
  }
  .scrolling-timeline__node {
    width: 260px;
  }
}
