/* Base Styles */
html {
  scroll-behavior: smooth;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: bold;
  color: white;
  background: linear-gradient(0deg, rgba(59,59,59,1) 0%, rgba(19,19,20,1) 35%, rgba(0,0,0,1) 100%);
  background-attachment: fixed;
  background-size: cover;
  min-height: 100vh;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-y: scroll;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none;  /* IE 10+ */
}

body::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* HEADER */
header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 4rem 1rem;
  min-height: 60vh;
  box-sizing: border-box;
}

header h1 {
  font-size: clamp(2rem, 8vw, 4rem);
  margin: 0;
}

header h2 {
  font-size: clamp(1rem, 4vw, 1.5rem);
  font-weight: 400;
  margin: 1rem 0 10rem;
}

.arrow-down {
  width: 2px;
  height: 48px;
  background: white;
  margin: 1rem auto 0 auto;
  position: relative;
}
.arrow-down::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid white;
}

/* TIMELINE CONTAINER */
.timeline-container {
  position: relative;
  padding-top: 5rem; /* Start with good padding at top */
  width: 100%;
  padding: 2rem;
  box-sizing: border-box;
  /* Remove transition to avoid "animation" of padding */
  transition: none;
  overflow: visible; /* Ensure popup can appear above without being cut off */
}

#line-container {
  position: relative;
  width: 100%;
  min-height: 100%;
  margin: 0 auto;
  overflow: visible;
}

/* POPUP CONTAINER: ensure positioning context */
#popup-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* Let clicks pass through to elements beneath */
  z-index: 10;
}

/* DOTS AND LINES */
.dot {
  position: absolute;
  width: 0.625rem;
  height: 0.625rem;
  background-color: white;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.line-segment {
  position: absolute;
  background-color: white;
  z-index: 1;
}
.horizontal {
  height: 1px;
}
.vertical {
  width: 1px;
}

/* DATE LABELS */
.date-label {
  position: absolute;
  font-size: clamp(0.875rem, 3vw, 1.125rem);
  white-space: nowrap;
  text-align: left;
  cursor: pointer;
  transition: color 0.3s ease;
  transform: translateY(-7.5rem);
  z-index: 5;
}
.date-label:hover {
  color: #cccccc;
}
.date-label.right {
  text-align: right;
  transform: translate(-100%, -7.5rem);
}

/* POPUP */
.popup {
  position: absolute;
  background-color: rgba(37, 37, 37, 0.95);
  border-radius: 0.5rem;
  padding: 1.25rem;
  width: clamp(12.5rem, 50vw, 25rem);
  max-width: 90vw;
  box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  z-index: 100;
  /* Remove transitions to eliminate animations */
  transition: none;
}

.popup.show {
  opacity: 1;
  pointer-events: auto;
  /* Remove transform/transition for no animation */
}

.popup.expanded {
  width: clamp(15rem, 60vw, 30rem);
}

.popup h3 {
  margin-top: 0;
  font-size: clamp(1rem, 3vw, 1.25rem);
}

.popup p {
  font-size: clamp(0.875rem, 2.5vw, 1rem);
  margin-bottom: 0.625rem;
  font-weight: normal;
  line-height: 1.5;
}

.popup .read-more {
  background: none;
  border: none;
  color: #4a90e2;
  cursor: pointer;
  padding: 0;
  font-size: clamp(0.875rem, 2.5vw, 0.875rem);
  transition: color 0.2s ease;
}

.popup .read-more:hover {
  color: #7ab0ff;
  text-decoration: underline;
}

.popup .event-image {
  max-width: 100%;
  height: auto;
  margin-top: 0.625rem;
  border-radius: 0.25rem;
  display: block;
}

.popup-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
  padding: 0;
}

.popup-close:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

/* RESPONSIVE */
@media (max-width: 64em) {
  .timeline-container {
    padding: 1rem;
  }
}
@media (max-width: 48em) {
  .timeline-container {
    padding: 0.625rem;
  }
  .date-label {
    transform: translateY(-5rem);
  }
  .date-label.right {
    transform: translate(-100%, -5rem);
  }
}
@media (max-width: 30em) {
  .timeline-container {
    padding: 0.5rem;
  }
  .date-label {
    transform: translateY(-3.75rem);
  }
  .date-label.right {
    transform: translate(-100%, -3.75rem);
  }
  .popup,
  .popup.expanded {
    width: 85vw;
    max-width: 20rem;
  }
}
