/* -------------------------------
   BASE TIMELINE STYLING
------------------------------- */
.timeline {
  position: relative;
  max-width: 1200px;
  margin: 100px auto;
}

/* Central vertical line */
.timeline::after {
  content: '';
  position: absolute;
  width: 3px;
  height: 100%;
  background: #000;
  top: 0;
  left: 50%;
  margin-left: -1.5px;
  z-index: -1;
  animation: drawline 10s linear forwards; /* optional */
}

@keyframes drawline {
  0%   { height: 0; }
  100% { height: 100%; }
}

/* Container: left or right side */
.timeline-container {
  position: relative;
  width: 50%;
  padding: 0 50px;
  margin-bottom: 4rem;
}

/* Left vs. Right containers at LARGE screens */
.left-container {
  left: -10%; /* Nudges content left of center line */
}
.right-container {
  left: 50%;   /* Nudges content right of center line */
}

/* Year label */
.year-flat {
  text-align: center;
  margin-bottom: 20px;
  font-size: 24px;
  font-weight: 700;
  color: #000;
}

/* Text box styling */
.text-box {
  background-color: #FFFAEC;
  border: 1px solid #ccc;
  padding: 1.2rem;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  font-size: 15px;
  margin-bottom: 1rem;
}

.text-box h2 {
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.text-box p {
  line-height: 1.4;
}

/* Images */
.timeline-photo {
  display: block;
  width: 100%;
  max-height: 800px;
  border: 1px solid #ccc;
  transition: transform 1s ease-in-out;
}

/* Fade-in effect */
.fade-container {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 1s ease-out, transform 1s ease-out;
}
.fade-container.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* -------------------------------
   1) MID SCREENS: 900px - 1399px
   - Keep left-right layout, but narrower & smaller images
------------------------------- */
@media (max-width: 1399px) and (min-width: 900px) {
  .timeline-container {
    width: 45%;       /* Slightly narrower than 50% to prevent overflow */
    padding: 0 30px;  /* Less padding horizontally */
  }
  .left-container {
    left: -5%;        /* Less offset so it stays on screen */
  }
  .right-container {
    left: 50%;
  }
  .timeline-photo {
    max-width: 90%;   /* Shrink images a bit */
    margin: 0 auto;
    display: block;
  }
  .text-box {
    font-size: 14px;  /* Slightly smaller text */
  }
}

/* -------------------------------
   2) SMALL SCREENS: < 900px
   - Single-column stack
------------------------------- */
@media (max-width: 900px) {
  .timeline {
    margin: 50px auto; 
  }
  /* Shift center line left for single column */
  .timeline::after {
    left: 30px;
    margin-left: 0;
  }
  /* Containers take full width, stacked */
  .timeline-container {
    width: 90%;
    margin: 0 auto 4rem auto;
    padding: 0 20px;
    left: 0;  /* override the -10% or 50% */
  }
  .left-container,
  .right-container {
    left: 0; 
  }
  
  .year-flat {
    text-align: left;
    margin-left: 30px;
  }

  .text-box {
    font-size: 14px;
    padding: 1rem;
  }
  .timeline-photo {
    width: 80%;
    margin-left: 30px;
    max-height: 600px; /* shorter images on small screens if you like */
  }
}
