.timeline {
  width: 100%;
  display:flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  position: relative;
  margin: 0;
  overflow-x: hidden;
}


.timeline-header {
  position: sticky;
  top: 0;
  background-color: #FFFFFF;
  width: 100%;
  z-index: 500;
  padding: 16px 24px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.timeline-nav-wrap {
  max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    border-bottom: 1px solid #7A7D81;
    scroll-snap-type: x mandatory;
}

.timeline-nav {
  font-family: 'Poppins', 'Helvetica Neue', Arial, 'Noto Sans',
    'Liberation Sans', sans-serif;
  display: flex;
  gap: 24px;
  color: #7A7D81;
  padding: 18px 0 0 0;
}

.timeline-nav .nav-item {
  flex-shrink: 0;
  scroll-snap-align: start;
}

.timeline-nav a {
  text-decoration: none;
  color: #7A7D81;
  padding: 0 4px 4px;
  display: flex;
}

.timeline-nav .nav-item.active a {
  font-weight: 500;
  color: var(--duda-yellow);
  border-bottom: 4px solid var(--duda-yellow);
}

/* vertical line in center */
.timeline::after {
  content: '';
  position: absolute;
  top: 140px;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%); 
  width: 1px;
  background-color: #7D98A3; 
}

.timeline-item {
  width: 100%;
  position:relative;
}


.timeline-item:nth-child(odd) {
  background: #F7F9FA;
}

/* dashed line between items */
.timeline-item::before {
  content: "";
  position: absolute;
  top:130px;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px; /* total line width: 100px; adjust as needed */
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    #7D98A3 0,
    #7D98A3 1px,     /* line thickness */
    transparent 1px,
    transparent 25px /* space between lines */
  );
  z-index: 1;
}


.date-container {
  font-family: 'Poppins', 'Helvetica Neue', Arial, 'Noto Sans',
    'Liberation Sans', sans-serif;
  width: 90px;
  height: 90px;
	position: relative;
	display: flex;
	align-items:center;
	justify-content: center;
  font-size: 24px;
  color: #FFFFFF;
  top: 32px;
  left: 50%;
  margin-left: -45px;
  margin-top: 12px;
  z-index: 100;
}

.date-text {
  position: absolute;
  z-index: 300;
  font-size: 20px;
}

.ball {
	border-radius: 50%;
	width: 90px;
	height: 90px;
  position: absolute;
  z-index: 200;
}

/* loops through colors for each ball */
.timeline-item:nth-child(4n+1) .ball {
  background-color: var(--duda-yellow);
}
.timeline-item:nth-child(4n+2) .ball {
  background-color: var(--duda-red);
}
.timeline-item:nth-child(4n+3) .ball {
  background-color: var(--duda-blue-darkest);
}
.timeline-item:nth-child(4n+4) .ball {
  background-color: var(--duda-green-dark);
}

.curve-line {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 2px solid var(--duda-yellow);
    box-sizing: border-box;
		position: absolute;
    background: #FFFFFF;
}

.timeline-item:nth-child(4n+1) .curve-line {
    border-color: var(--duda-yellow);
}
.timeline-item:nth-child(4n+2) .curve-line {
    border-color: var(--duda-red);
}
.timeline-item:nth-child(4n+3) .curve-line {
    border-color: var(--duda-blue-darkest);
}
.timeline-item:nth-child(4n+4) .curve-line {
    border-color: var(--duda-green-dark);
}


.horz-line {
  width: 200%;
  height: 1px;
  border-top: 1px solid #5B7458;
  position: absolute;
  left: 100%;
  z-index: -1;
}

.item-content {
  width: 100%;
  padding: 0px 24px 80px;
}

.item-content h3 {
  background-color: #5B7458;
  color: #FFFFFF;
  font-family: sans-serif;
  padding: 16px;
  margin: 0;
  width: 100%;
  z-index: 500;
}

.flex-content {
  display: flex;
  gap: 160px;
}

/* reverse odd items */


@media screen and (min-width: 767px) {
  .timeline-item:nth-child(even) .flex-content {
    flex-direction: row-reverse;
  }
}

.text-col .text {
  max-width: 72%;
}

.text-item p {
  margin: 0;
}
.text-item {
  margin-bottom: 60px;
}

.image-col, .text-col {
  width: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-grid {
  display: grid;
  width: 100%;
  gap: 16px;
  grid-template-columns: repeat(2, 1fr);
  max-width: 77%;
  margin: 0 auto;
}

@media screen and (max-width: 768px) {

  .image-grid {
    max-width: 95%;
  }

  .text-col .text {
    max-width: 95%;
  }

}

/* All images */
.image-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 1 image — full width */
.image-grid img:only-child {
  grid-column: 1 / -1;
}

/* 2 images — stacked */
.image-grid img:first-child:nth-last-child(2),
.image-grid img:first-child:nth-last-child(2) ~ img {
  grid-column: 1 / -1;
}

/* 3 images — TOP full (only when NOT flipped) */
.image-grid:not(.flip) img:first-child:nth-last-child(3) {
  grid-column: 1 / -1;
}


.image-grid.flip img {
  grid-column: auto;
}

/* When flipped, last image spans full width */
.image-grid.flip img:last-child:nth-child(3) {
  grid-column: 1 / -1;
}


/* Initial state */
[data-aos='left-rotate'] {
  transform: scale(0.5); /* Start with no rotation */
  transform-origin: center;
  transition-property: transform; /* Specify the property to animate */
  transition-duration: 1000ms; /* Set the animation duration */
  transition-timing-function: ease-out; /* Define the easing function */
}

/* Animated state when aos-animate is added */
[data-aos='left-rotate'].aos-animate {
  transform: scale(1.2); /* Rotate 360 degrees */
}

/* Initial state */
[data-aos='right-rotate'] {
  transform: scale(0.5); /* Start with no rotation */
  transform-origin: center center;
  transition-property: transform; /* Specify the property to animate */
  transition-duration: 1000ms; /* Set the animation duration */
  transition-timing-function: ease-out; /* Define the easing function */
}

/* Animated state when aos-animate is added */
[data-aos='right-rotate'].aos-animate {
  transform: scale(1); /* Rotate 360 degrees */
}



@media screen and (max-width: 768px) {
  .timeline {
    align-items: flex-start;
    justify-content: flex-start;
  }

  .timeline::after {
    left: 48px;
    transform: translateX(0);
    top: 100px;
  }
  
  .timeline::before {
    height: 32px;
  }

  .timeline-item {
    display: flex;
    scroll-margin-top: 132px;
  }

  .timeline-item::before {
    content: "";
    position: absolute;
    top:130px;
    bottom: 50px;
    left: 48px;
    transform: translateX(-50%);
    width: 20px; 
  }

  .item-content {
    width: auto;
    padding-top: 64px;
    padding-bottom: 32px;
  }


  .date-container {
    border-radius: 50%;
    width: 76px;
    height: 76px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    left: 12px;
    margin-left: 0px;
    margin-top: 0;
    flex-shrink: 0;
  }

  .curve-line {
      width: 76px;
      height: 76px;
      border: 2px solid var(--duda-yellow);
  }

  .ball {
    width: 76px;
    height: 76px;
    top: 0;
    left: 0;
    margin-left: 0;
  }

  .date-text {
    font-size: 16px;
    margin-top: 0;
  }

  .flex-content {
    flex-direction: column;
    gap: 32px;
  }

  .flex-content .text-col,
  .flex-content .image-col {
    width: 100%;
  }

  .text-item {
    margin-bottom: 32px;
  }
}

