:root {
  --main: #003366;
  --accent: #f37126;
}

/* -------------------------------------------------- */
/* SCOPED TIMELINE COMPONENT STYLES                   */
/* Only targets elements inside .timeline-container   */
/* -------------------------------------------------- */

.timeline-container {
  box-sizing: border-box;
}

.timeline-container * {
  box-sizing: border-box;
}

/* Header inside timeline container (if present) */
.timeline-container #title {
  background: #003366;
  padding: 40px 20px;
  text-align: center;
}

.timeline-container #title h2 {
  font-weight: 900;
  color: #f37126;
  font-size: 2.2em;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.timeline-container #title p {
  color: #ffffff;
  margin-top: 8px;
  letter-spacing: .102rem;
  font-weight: 500;
  font-size: 1.1em;
}

/* timeline - Main Horizontal Line (Desktop >= 1024px) */

.timeline-container #line {
  width: 68%;
  max-width: 1440px;
  height: 4px;
  background-color: var(--main);
  margin: 290px auto 160px auto; /* Shifted down for generous breathing room */
  position: relative;
  top: 0;
  white-space: nowrap; /* Prevents 11th branch from wrapping to the left side */
}

.timeline-container #line::after {
  content: '';
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: var(--accent);
  position: absolute;
  right: -5px;
  top: -5px;
}

.timeline-container #line::before {
  content: '';
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: var(--accent);
  position: absolute;
  left: -5px;
  top: -5px;
}

/* branches - 11 Equal Percentage Width Branches */

.timeline-container .branch {
  width: calc(100% / 11.2);
  height: 120px;
  border-left: 3px solid var(--accent);
  position: relative;
  bottom: 145px;
  left: 15px;
  display: inline-block;
  vertical-align: top;
  white-space: normal; /* Restores normal paragraph wrapping inside content */
  transition: all 0.3s ease;
}

.timeline-container .branch::after {
  content: '';
  width: 14px;
  height: 2px;
  border-bottom: 3px solid var(--accent);
  position: absolute;
  bottom: 0;
  left: -2px;
}

.timeline-container .branch::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--accent);
  position: absolute;
  top: -5px;
  left: -6.5px;
}

.timeline-container .mirror-down {
  transform: scaleY(-1);
  top: 30px;
}

/* inner content of branches */

.timeline-container .mirror-down .content {
  transform: scaleY(-1);
  bottom: 0;
}

.timeline-container .content {
  position: absolute;
  left: 16px;
  top: 0px;
  width: 160px;
}

.timeline-container .year {
  font-size: 1.1rem;
  font-weight: 800;
  color: #003366;
}

.timeline-container .text {
  font-size: 0.78rem;
  margin-top: 5px;
  line-height: 1.32;
  color: #334155;
}

/* icons */

.timeline-container .branch img {
  position: absolute;
  top: -90px;
  left: -28px;
  width: 56px;
  height: 56px;
  object-fit: contain;
  transform: scale(0.9);
}

.timeline-container .mirror-down img {
  transform: scale(0.9) scaleY(-1);
}

/* -------------------------------------------------- */
/* Laptop Screens (1280px to 1440px) */
/* -------------------------------------------------- */
@media (max-width: 1440px) {
  .timeline-container #line {
    width: 75%;
    max-width: 1300px;
    margin-top: 260px;
    margin-bottom: 140px;
    top: 0;
  }

  .timeline-container .branch {
    height: 110px;
    bottom: 135px;
    left: 12px;
  }

  .timeline-container .content {
    left: 14px;
    width: 148px;
  }

  .timeline-container .year {
    font-size: 1.02rem;
  }

  .timeline-container .text {
    font-size: 0.75rem;
    line-height: 1.3;
  }

  .timeline-container .branch img {
    width: 50px;
    height: 50px;
    top: -80px;
    left: -25px;
  }
}

/* -------------------------------------------------- */
/* Medium Laptop / Compact Displays (1024px to 1279px)*/
/* -------------------------------------------------- */
@media (max-width: 1279px) {
  .timeline-container #line {
    width: 75%;
    max-width: 1200px;
    margin-top: 240px;
    margin-bottom: 130px;
    transform: scale(0.92);
    transform-origin: top center;
  }

  .timeline-container .content {
    width: 135px;
  }

  .timeline-container .text {
    font-size: 0.72rem;
  }
}

/* -------------------------------------------------- */
/* Mobile & Tablet Ultra-Clean Vertical Layout (< 1024px) */
/* -------------------------------------------------- */
@media (max-width: 1023px) {
  .timeline-container #title {
    padding: 30px 16px;
  }

  .timeline-container #title h2 {
    font-size: 1.8em;
  }

  .timeline-container #title p {
    font-size: 0.95em;
  }

  .timeline-container #line {
    width: 90%;
    max-width: 600px;
    height: auto;
    background-color: transparent;
    margin: 40px auto 0 auto;
    position: relative;
    top: 0 !important;
    left: 0 !important;
    white-space: normal;
    transform: none !important;
    padding: 10px 0 20px 0;
    display: flex;
    flex-direction: column;
    gap: 32px;
  }

  /* Vertical Timeline Line */
  .timeline-container #line::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 0;
    bottom: 0;
    width: 4px;
    height: 100%;
    background-color: var(--main);
    transform: none;
    border-radius: 2px;
  }

  .timeline-container #line::after {
    display: none;
  }

  .timeline-container .branch {
    width: 100% !important;
    height: auto !important;
    border: none !important;
    display: block !important;
    position: relative !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    margin: 0 !important;
    padding: 0 0 0 54px !important;
  }

  /* Dot on the vertical line */
  .timeline-container .branch::before {
    content: '';
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: var(--accent);
    border: 3px solid #ffffff;
    box-shadow: 0 0 0 2px var(--accent);
    position: absolute;
    left: 20px;
    top: 14px;
    transform: translateX(-50%);
    z-index: 10;
  }

  .timeline-container .branch::after {
    display: none;
  }

  .timeline-container .mirror-down {
    transform: none !important;
    top: 0 !important;
  }

  .timeline-container .mirror-down .content {
    transform: none !important;
  }

  .timeline-container .content {
    position: relative !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    text-align: left !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .timeline-container .year {
    font-size: 1.15rem;
    font-weight: 800;
    color: #003366;
    display: inline-block;
    vertical-align: middle;
  }

  .timeline-container .text {
    font-size: 0.85rem;
    line-height: 1.45;
    margin-top: 6px;
    color: #334155;
  }

  /* Icon next to the year */
  .timeline-container .branch img {
    position: static !important;
    display: inline-block !important;
    vertical-align: middle;
    width: 44px !important;
    height: 44px !important;
    margin-right: 10px;
    margin-bottom: 0 !important;
    transform: none !important;
    object-fit: contain;
  }

  .timeline-container .mirror-down img {
    transform: none !important;
  }
}

/* -------------------------------------------------- */
/* CSS Entrance & Staggered Appearing Animation      */
/* -------------------------------------------------- */
@keyframes timelineExpand {
  0% {
    opacity: 0;
    transform: scaleX(0);
  }
  100% {
    opacity: 1;
    transform: scaleX(1);
  }
}

@keyframes branchFadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

.timeline-container #line {
  animation: timelineExpand 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transform-origin: center left;
}

.timeline-container .branch {
  animation: branchFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.timeline-container .branch:nth-child(1)  { animation-delay: 0.12s; }
.timeline-container .branch:nth-child(2)  { animation-delay: 0.18s; }
.timeline-container .branch:nth-child(3)  { animation-delay: 0.24s; }
.timeline-container .branch:nth-child(4)  { animation-delay: 0.30s; }
.timeline-container .branch:nth-child(5)  { animation-delay: 0.36s; }
.timeline-container .branch:nth-child(6)  { animation-delay: 0.42s; }
.timeline-container .branch:nth-child(7)  { animation-delay: 0.48s; }
.timeline-container .branch:nth-child(8)  { animation-delay: 0.54s; }
.timeline-container .branch:nth-child(9)  { animation-delay: 0.60s; }
.timeline-container .branch:nth-child(10) { animation-delay: 0.66s; }
.timeline-container .branch:nth-child(11) { animation-delay: 0.72s; }

@media (prefers-reduced-motion: reduce) {
  .timeline-container #line,
  .timeline-container .branch {
    animation: none !important;
  }
}
