/* Container styles */
.timeline-container {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  height: 70vh;
  padding: 20px;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  --new-bg-image: none;
}

/* Background layer for dreamy transition effect */
.timeline-container::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--new-bg-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  z-index: -1;
  pointer-events: none;
  will-change: opacity, transform, filter;
  transform: scale(1) translateZ(0);
  filter: blur(0) brightness(1) saturate(1);
}

.timeline-container.transitioning::after {
  animation: dreamyFade 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes dreamyFade {
  0% {
    opacity: 0;
    filter: blur(15px) brightness(1.25) saturate(1.15);
    transform: scale(1.06) translateZ(0);
  }
  40% {
    opacity: 0.4;
    filter: blur(8px) brightness(1.12) saturate(1.08);
    transform: scale(1.03) translateZ(0);
  }
  100% {
    opacity: 1;
    filter: blur(0) brightness(1) saturate(1);
    transform: scale(1) translateZ(0);
  }
}

.timeline-container::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  transition: background 0.3s ease;
  z-index: 0;
  will-change: background;
}

.timeline-container:hover::before {
  background: rgba(0, 0, 0, 0.5);
}

/* Filter styles */
.timeline-filter {
  display: flex;
  justify-content: space-evenly;
}

.filter-btn {
  width: 100%;
  padding: 10px 15px;
  border: none;
  border-radius: 0;
  font-size: 2rem;
  font-family: var(--e-global-typography-accent-font-family);
  font-weight: 600;
  background: var(--e-global-color-primary);
  color: var(--e-global-color-text);
  cursor: pointer;
  transition: 0.3s;
  text-align: center;
}

.filter-btn:nth-child(2) { background: rgba(194, 14, 26, 0.6); }
.filter-btn:nth-child(3) { background: rgba(194, 14, 26, 0.4); }
.filter-btn:nth-child(4) { background: rgba(194, 14, 26, 0.2); }
.filter-btn.active { background: var(--e-global-color-primary); }
.filter-btn:hover { background: var(--e-global-color-primary); }


/* Timeline styles */
.timeline {
  position: absolute;
  bottom: 5%;
  left: 0;
  width: 100%;
  margin-bottom: 30px;
  z-index: 10;
}

.timeline-inner {
  display: flex;
  justify-content: flex-start;
  max-width: 1300px;
  margin: 0 auto 0 0;
  padding: 0rem 10% 1rem 2rem;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* Internet Explorer 10+ */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.timeline-inner::-webkit-scrollbar {
  display: none;
}

.timeline-year-btn {
  position: relative;
  padding: 10px 15px;
  margin-bottom: 10px;
  font-size: 2rem; /* Will be dynamically adjusted by JavaScript */
  font-family: var(--e-global-typography-accent-font-family);
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: 0.3s;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: max-content;
}

.timeline-year-btn::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 50%;
  width: 15px;
  height: 15px;
  background-color: white;
  transform: translateX(-50%) rotate(45deg);
  transform-origin: bottom center;
}

.timeline-year-btn.active {
  scale: 1.2;
  transform-origin: bottom center;
}

.timeline-year-btn.active::after {
  background-color: var(--e-global-color-primary);
}

.timeline-line {
  position: relative;
  width: 100%;
  max-width: 90%;
  height: 2px;
  margin: 20px 0;
  background: white;
}

.timeline-line::after {
  content: '';
  position: absolute;
  right: -5px;
  top: -4px;
  width: 10px;
  height: 10px;
  background: white;
  transform: rotate(45deg);
}

/* Content styles */
.timeline-content {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: start;
  width: 100%;
  height: 40vh;
  z-index: 10;
  overflow: hidden;
}

.timeline-content-inner {
  max-width: 1300px;
  margin: 0 auto 0 10%;
  text-align: start;
}

#timeline-title,
#timeline-content {
  color: white;
  padding-inline-end: 50%;
}

#timeline-title {
  font-size: 24px;
  font-weight: bold;
}

#timeline-content {
  font-size: 16px;
  margin-top: 10px;
}

/* Mobile styles */
@media (max-width: 768px) {
  .timeline-container::before {
    background: rgba(0, 0, 0, 0.5);
  }

  .timeline {
    bottom: 0;
    flex-direction: column;
    align-items: center;
    overflow-x: scroll;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .timeline::-webkit-scrollbar {
    display: none;
  }

  .timeline-year-btn {
    width: 80%;
    text-align: center;
  }

  #timeline-title,
  #timeline-content {
    padding-inline-end: 0;
  }
}
