/* --- HORIZONTAL TIMELINE --- */

.timeline {
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden; /* Hide vertical scroll */
  padding: 50px 0;
  margin-top: 50px; /* Add space below title */
  text-align: center;
}

.timeline::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Chrome, Safari and Opera */
}
.timeline {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

.timeline ol {
  font-size: 0;
  display: inline-flex;
  padding: 320px 0; /* Increase padding to prevent cutoff */
  transition: all 1s;
}

.timeline ol li {
  position: relative;
  display: inline-block;
  list-style-type: none;
  width: 160px;
  height: 3px;
  background: #e2e8f0;
}

.timeline ol li:last-child {
  width: 280px;
}

.timeline ol li:not(:first-child) {
  margin-left: 14px;
}

.timeline ol li:not(:last-child)::after {
  content: "★";
  position: absolute;
  top: calc(50% - 10px); /* nudge up 10px */
  left: calc(100% - 15px); /* nudge left 15px */
  bottom: 0;
  width: 12px;
  height: 12px;
  transform: translateY(-70%);
  color: var(--accent-color);
  font-size: 24px;
}

.timeline ol li div {
  position: absolute;
  left: calc(100% + 7px);
  width: 280px;
  font-size: 1rem;
  white-space: normal;
  color: #555;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  padding: 15px; /* Add padding to the box */
  transition: all 0.3s ease;
  height: 290px; /* Set fixed height for all boxes */
}

.timeline ol li div:hover {
  transform: scale(1.02) rotate(1deg);
  box-shadow: 0 10px 25px rgba(0,0,0,0.12);
}

.timeline ol li:nth-child(odd) div:hover {
  transform: translateY(-100%) scale(1.02) rotate(1deg);
}

.timeline ol li div::before {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
}

.timeline ol li:nth-child(odd) div {
  top: -16px;
  transform: translateY(-100%);
}

.timeline ol li:nth-child(odd) div::before {
  top: 100%;
  left: 0;
  border-width: 8px 8px 0 0;
  border-color: white transparent transparent transparent;
}

.timeline ol li:nth-child(even) div {
  top: calc(100% + 16px);
}

.timeline ol li:nth-child(even) div::before {
  top: -8px;
  left: 0; /* Align with the start of the box */
  border-width: 8px 0 0 8px;
  border-color: transparent transparent transparent white;
}

.timeline ol li div img {
    width: 100%;
    height: 140px; /* reduced height to show more of faces */
    object-fit: cover;
    object-position: center 25%; /* favour upper third of image for faces */
    border-radius: 8px 8px 0 0;
    margin: 0; /* remove overflow-causing negative margins */
    max-width: 100%;
  }
.timeline ol li div time {
    display: block;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--accent-color);
    padding: 0;
}

.timeline ol li div p {
    padding: 0;
}


@media screen and (max-width: 768px) {
  /* Convert horizontal timeline to a vertical timeline on small screens */
  .timeline {
    position: relative;
    padding-left: 36px; /* space for the vertical line and markers */
    overflow-x: hidden; /* prevent horizontal scrolling */
    white-space: normal;
  }

  /* main vertical line */
  .timeline::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #e2e8f0;
    border-radius: 2px;
  }

  .timeline ol {
    padding: 0;
    transform: none !important;
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 24px;
  }

  .timeline ol li {
    display: block;
    height: auto;
    background: transparent;
    width: 100%;
    margin-left: 0 !important;
    margin-bottom: 0;
    position: relative;
    padding-left: 12px;
  }

  /* circular marker on the vertical line */
  .timeline ol li::before {
    /* show a star marker and nudge it slightly left a bit more */
    content: "★";
    position: absolute;
    left: -25px; /* moved 5px left from -20px */
    font-size: 18px;
    color: var(--accent-color);
    text-shadow: 0 0 4px #fff;
    line-height: 1;
  }

  .timeline ol li div {
    position: static;
    width: calc(100% - 48px); /* account for left padding and star marker space */
    height: auto !important;
    margin: 0 0 0 12px;
    transform: none !important;
    padding: 6px 12px 15px 12px;
    box-sizing: border-box;
  }

  .timeline .arrows { display: none; }
}
