/* Layout grid: left | center line | right */
.tl {
  --line: 2px;
  --gap: 1.5rem;
  margin: 0 auto;
  max-width: 1100px;
  list-style: none;
  padding: 0;
}

/* ---------------------------------------------------
   Timeline Accent Color Cycle
   Order: Yellow → Red → Green → Black
   Repeats automatically for all leaders
--------------------------------------------------- */

.tl-item:nth-child(4n+1) { --accent: #f39c12; } /* Yellow */
.tl-item:nth-child(4n+2) { --accent: #e74c3c; } /* Red */
.tl-item:nth-child(4n+3) { --accent: #27ae60; } /* Green */
.tl-item:nth-child(4n+4) { --accent: #222222; } /* Black */

/* Dark mode: replace black with grey for better contrast */
body.dark-mode .tl-item:nth-child(4n+4) {
  --accent: #faf3e9;
}

.tl-item {
  display: grid;
  grid-template-columns: 1fr 48px 1fr;
  align-items: start;
  gap: var(--gap);
  margin: 1.25rem 0;
  position: relative;
}

/* Animation Ripple */
@keyframes ripple {
  from {
    opacity: 1;
    transform: scale(0);
  }
  to {
    opacity: 0;
    transform: scale(2);
  }
}

/* Vertical line in the middle */
.tl-item .tl-mid {
  position: relative;
  margin-top: 2.5rem;
}

/* Animated fill spine (Option D storytelling) */
.tl-item .tl-mid::after {
  content: "";
  position: absolute;
  left: calc(50% - var(--line)/2);
  top: -1.25rem;
  width: var(--line);
  height: 0%;
  background: linear-gradient(
    to bottom,
    #f39c12,
    color-mix(in srgb, #f39c12 70%, transparent)
  );
  transition: height 0.5s ease;
  z-index: 1;
}

/* Active leader fills the spine progressively */
.tl-item.is-active .tl-mid::after {
  height: 100%;
}

body.dark-mode .tl-item .tl-mid::before {
  background: rgba(255,255,255,0.18);
}

body.dark-mode .tl-item .tl-mid::after {
  background: linear-gradient(
    to bottom,
    #f39c12,
    rgba(243,156,18,0.25)
  );
}

.tl-toggle::before {
  content: "";
  --size: 20px; /* matches your current .tl-marker size */
  position: absolute;
  left: 0px;
  top: 0px;
  transform: translate(-50%, 0);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  border: 0;
  padding: 0;
  cursor: pointer;
  z-index: 2;
  animation: ripple 1.5s ease-out infinite;

  background: var(--accent, #0d6efd);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent, #0d6efd) 25%, transparent);
}

/* Toggle button (replaces .tl-marker) */
.tl-toggle {
  --size: 20px; /* matches your current .tl-marker size */
  position: absolute;
  left: 50%;
  top: 0.4rem;
  transform: translate(-50%, 0);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  border: 0;
  padding: 0;
  cursor: pointer;
  z-index: 2;


  /* color comes from --accent */
  background: var(--accent, #0d6efd);

  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}


.tl-toggle:hover { transform: translate(-50%, 0) scale(1.05); }
.tl-toggle:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 6px color-mix(in srgb, var(--accent, #0d6efd) 25%, transparent),
    0 0 0 10px rgba(0,0,0,.12);
}
/* Collapsed hint */
.tl-toggle[aria-expanded="false"] { 
    opacity: .9; 
}

/* Hide cards when collapsed via [hidden] */
.tl-card[hidden] { 
    display: none; 
}

/* Marker (circle) with accent color */
.tl-marker {
  position: absolute;
  left: 50%;
  transform: translate(-50%, 0);
  top: 0.4rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--accent, #0d6efd);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent, #0d6efd) 25%, transparent);
}

/* Cards */
.tl-card {
  border-left: 4px solid var(--accent, #0d6efd);
  background: #fff;
  color: #222;
  border-radius: 12px;
  padding: 1rem 1.1rem;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

body.dark-mode .tl-card {
  background: #1f1f1f;
  color: #eee;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

/* Improve readability for muted text in dark mode */
body.dark-mode .text-muted {
  color: #cfcfcf !important;
}

/* Content info */
.img-info-content {
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    column-gap: 2rem;
}

h2.section-header {
    margin-top: 6rem;
}

.section-spacer {margin-top: 6rem;}

.info-content {  
  box-sizing: border-box;
 /* display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-end; */
}

.tl-year { margin: 0; font-weight: 800; text-align: center; }
.tl-title { margin: 0 0 .25rem; font-weight: 600; opacity: .9; text-align: center; }

.tl-name {
  margin: 0 0 .35rem;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.2;
  text-align: center;
  letter-spacing: -0.01em;
  color: inherit;
}

/* Slightly stronger in dark mode for readability */
body.dark-mode .tl-name {
  color: #f5f5f5;
}

.tl-body { margin: 0; opacity: .85; text-align: center; }
.tl-img { width: 25%; height: 25%; border-radius: 50%; border: 4px solid var(--accent);}

/* ---- Cinematic micro‑motion reveal (Hybrid documentary style) ---- */

/* Initial hidden state */
.tl-card {
  opacity: 0;
  transform: translateY(24px) scale(0.98);
  transition:
    opacity 0.7s ease,
    transform 0.7s cubic-bezier(.2,.65,.3,1);
}

/* Visible state when entering viewport */
.tl-card.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Portrait subtle cinematic zoom */
.tl-card .tl-img {
  transform: scale(0.96);
  transition: transform 1.1s ease;
}

.tl-card.is-visible .tl-img {
  transform: scale(1);
}

/* Text stagger feel */
.tl-name,
.tl-body {
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
}

.tl-card.is-visible .tl-name {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.15s;
}

.tl-card.is-visible .tl-body {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.25s;
}

/* Active leader glow (global) */
.tl-card.is-active {
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--accent, #f39c12) 40%, transparent),
    0 0 20px color-mix(in srgb, var(--accent, #f39c12) 35%, transparent);
  transition: box-shadow 0.4s ease;
}

@keyframes leaderPulse {
  0% {
    box-shadow:
      0 0 0 2px color-mix(in srgb, var(--accent, #f39c12) 40%, transparent),
      0 0 20px color-mix(in srgb, var(--accent, #f39c12) 35%, transparent);
  }
  50% {
    box-shadow:
      0 0 0 4px color-mix(in srgb, var(--accent, #f39c12) 25%, transparent),
      0 0 28px color-mix(in srgb, var(--accent, #f39c12) 50%, transparent);
  }
  100% {
    box-shadow:
      0 0 0 2px color-mix(in srgb, var(--accent, #f39c12) 40%, transparent),
      0 0 20px color-mix(in srgb, var(--accent, #f39c12) 35%, transparent);
  }
}


.leader-card.is-active {
  animation: leaderPulse 2.5s ease-in-out infinite;
}

@media (max-width: 768px) {

  /* HYBRID MOBILE EXPERIENCE:
     - Single column storytelling
     - Accordion-friendly spacing
     - Larger visuals
     - Cleaner reading flow
  */

  /* Remove 3-column timeline layout */
  .tl-item {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 2rem 0;
  }

  /* Hide the vertical timeline line on mobile */
  .tl-item .tl-mid::before {
    display: none;
  }

  /* Hide center column spacing */
  .tl-mid {
    display: none;
  }

  /* Stack cards full width */
  .tl-col.tl-left,
  .tl-col.tl-right {
    grid-column: 1;
  }

  /* Toggle moves to top of each card */
  .tl-toggle {
    position: relative;
    left: 0;
    transform: none;
    margin-bottom: .5rem;
  }

  /* Stronger storytelling feel */
  .tl-card {
    border-left: none;
    border-top: 4px solid var(--accent, #0d6efd);
    padding: 1.2rem 1.1rem 1.3rem;
  }

  /* Improve spacing for mobile readability */
  .img-info-content {
    flex-direction: column;
    text-align: center;
    row-gap: 1rem;
  }

  /* Larger portrait for emotional impact */
  .tl-img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
  }

  /* Stronger names on mobile */
  .tl-name {
    font-size: 1.15rem;
    letter-spacing: -0.01em;
  }

  /* Slightly larger body for accessibility */
  .tl-body {
    font-size: 0.95rem;
    line-height: 1.5;
  }

  /* Mobile: keep all cards open */
  .tl-card[hidden] {
    display: block !important;
  }
}

/* === Timeline Desktop Controls === */

.tl-controls {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.tl-controls button {
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1px solid rgba(0,0,0,0.12);
  background: rgba(255,255,255,0.9);
  color: #1f1f1f;

  transition:
    background 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease,
    transform 0.15s ease,
    box-shadow 0.2s ease;
}

/* Hover / focus polish */
.tl-controls button:hover {
  transform: translateY(-1px);
  background: rgba(34,34,34,0.95);
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  border-color: rgba(0, 0, 0, 0.12);
}

.tl-controls button:active {
  transform: translateY(0);
}

/* Dark mode support */
body.dark-mode .tl-controls button {
  background: rgba(25,25,25,0.9);
  color: #f5f5f5;
  border: 1px solid rgba(255,255,255,0.15);
}

body.dark-mode .tl-controls button:hover {
  background: rgba(255,255,255,0.08);
  box-shadow: 0 4px 12px rgba(0,0,0,0.45);
}

/* === Timeline Leader Slider (display only) === */

.tl-slider {
  margin: 2.5rem auto 1.5rem;
  max-width: 720px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .9rem;

  position: sticky;
  top: 57px; /* keeps slider below navbar on desktop */
  z-index: 900;
  background: var(--bs-body-bg, #ffffff);
  box-shadow: 0 4px 10px rgba(0,0,0,0.04);
}

body.dark-mode .tl-slider {
  background: rgb(13 13 13 / 95%);
}

.tl-slider-count {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: .04em;
  opacity: .65;
}

body.dark-mode .tl-slider-count {
  opacity: .75;
}

.tl-slider-track {
  width: 100%;
  height: 6px;
  background: rgba(0,0,0,0.08);
  border-radius: 999px;
  position: relative;
  overflow: hidden;
}

body.dark-mode .tl-slider-track {
  background: rgba(255,255,255,0.12);
}

 .tl-slider-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(
    90deg, 
    #1e1e1e 0%, 
    color-mix(in srgb, #2f2f2f 75%, #1d1d1d) 40%,
    #1f1f1f 100%
  );
  transition: width .7s cubic-bezier(.22,.8,.28,1);
  will-change: width;
}

body.dark-mode .tl-slider-fill {
  background: linear-gradient(
    90deg,
    #ffffff 0%,
    color-mix(in srgb, #faf3e9 75%, #ffffff) 75%,
    #fbf5eb 100%
  );
  transition: width .7s cubic-bezier(.22,.8,.28,1);
  will-change: width;
}

/* ---------------------------------------------------
   OPTIONAL: Slider color sync with active leader
   (Safe to remove later if you decide you don't like it)
   The JS can set:  slider.style.setProperty('--accent', color)
---------------------------------------------------- */

.tl-slider.use-accent .tl-slider-fill {
  background: linear-gradient(
    90deg,
    var(--accent, #1e1e1e) 0%,
    color-mix(in srgb, var(--accent, #1e1e1e) 75%, transparent) 60%,
    color-mix(in srgb, var(--accent, #1e1e1e) 45%, transparent) 100%
  );
}

body.dark-mode .tl-slider.use-accent .tl-slider-fill {
  background: linear-gradient(
    90deg,
    var(--accent, #ffffff) 0%,
    color-mix(in srgb, var(--accent, #ffffff) 75%, transparent) 70%,
    color-mix(in srgb, var(--accent, #ffffff) 40%, transparent) 100%
  );
}

/* Cinematic glow when active leader updates */
.tl-slider.is-active .tl-slider-fill {
  box-shadow:
    0 0 12px rgba(243,156,18,0.45),
    0 0 24px rgba(243,156,18,0.25);
}

@keyframes sliderPulse {
  0% {
    transform: scaleX(1);
    filter: brightness(1);
  }
  50% {
    transform: scaleX(1.015);
    filter: brightness(1.08);
  }
  100% {
    transform: scaleX(1);
    filter: brightness(1);
  }
}

.tl-slider.is-active .tl-slider-fill {
  animation: sliderPulse 1.2s ease;
}

/* Mobile polish */
@media (max-width: 768px) {
  .tl-slider {
    margin: 1.75rem auto 1rem;
    padding: .5rem 1rem;
    position: sticky;
    top: 57px; /* offset so it sits below the navbar */
    z-index: 900;
    background: rgba(255, 255, 255, 0.97);
    border-bottom: 1px solid var(--bs-border-color, rgba(0,0,0,0.08));
    box-shadow: 0 4px 10px rgba(0,0,0,0.04);
  }

  .tl-slider-track {
    height: 5px;
  }

  .tl-slider-count {
    font-size: 0.8rem;
  }
}

/* ---------------------------------------------------
   Scroll To Top Button (Modern Glass Mobile Button)
--------------------------------------------------- */

.scroll-top-btn {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  right: 20px;

  width: 52px;
  height: 52px;

  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25);

  font-size: 22px;
  font-weight: 600;
  line-height: 1;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;

  /* Glass UI effect */
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);

  color: #fff;

  box-shadow:
    0 10px 22px rgba(0,0,0,0.28),
    0 0 0 1px rgba(255,255,255,0.08) inset;

  opacity: 1;
  transform: translateY(16px) scale(.95);

  transition:
    opacity .35s ease,
    transform .35s cubic-bezier(.22,.8,.28,1),
    background .25s ease,
    box-shadow .25s ease;

  z-index: 999;
}

/* Arrow micro‑interaction (indicates upward scroll) */

.scroll-top-btn .scroll-arrow {
  animation: scrollArrowHint 3s ease-in-out infinite;
}

/* 3s animation + 3s pause */
@keyframes scrollArrowHint {

  0% {
    transform: translateY(0);
  }

  20% {
    transform: translateY(-8px);
  }

  25% {
    transform: translateY(0);
  }

  30% {
    transform: translateY(-8px);
  }

  35% {
    transform: translateY(0);
  }
      
  40% {
    transform: translateY(-8px);
  }
  50% {
    transform: translateY(0);
  }
  60%,100% {
    transform: translateY(0);
  }

}

/* Visible state */
.scroll-top-btn.show {
  opacity: 0;
  transform: translateY(0) scale(1);
}

/* Hover / tap feedback */
.scroll-top-btn:hover {
  background: rgba(0,119,182,0.95);
  transform: translateY(-3px) scale(1.05);

  box-shadow:
    0 14px 30px rgba(0,0,0,0.35),
    0 0 0 1px rgba(255,255,255,0.15) inset;
}

.scroll-top-btn:active {
  transform: translateY(0) scale(.98);
}

/* Dark mode adjustment */
body.dark-mode .scroll-top-btn {
  background: rgba(37,37,37,0.75);
  border: 2px solid rgba(255,255,255,0.75);

  box-shadow:
    0 10px 22px rgba(0,0,0,0.6),
    0 0 0 1px rgba(255,255,255,0.05) inset;
}

/* Desktop: hide completely */
@media (min-width: 992px) {
  .scroll-top-btn {
    display: none;
  }
}

/* Mobile polish (larger tap target) */
@media (max-width: 768px) {
  .scroll-top-btn {
    width: 56px;
    height: 56px;
    font-size: 24px;
  }
}