/* ── Reset ─────────────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

a { color: inherit; text-decoration: none; }

/* ── Base ──────────────────────────────────────────── */
body {
  font: 300 16px/1.6 "Poppins", "Helvetica Neue", sans-serif;
  background: #020510;
  color: #dbeafe;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Ensure smooth scrolling and animations on mobile */
* {
  -webkit-tap-highlight-color: transparent;
}

/* ── Stars canvas ─────────────────────────────────── */
#stars-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ── Hero / Header ────────────────────────────────── */
.hero {
  position: relative;
  z-index: 2;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 24px 32px;
  background:
    radial-gradient(ellipse 900px 500px at 50% 30%, rgba(99,179,237,0.12), transparent 70%),
    radial-gradient(ellipse 600px 400px at 20% 70%, rgba(129,140,248,0.08), transparent 70%),
    radial-gradient(ellipse 500px 300px at 80% 80%, rgba(167,139,250,0.07), transparent 70%);
}

.back-link {
  position: absolute;
  top: 28px;
  left: 32px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 1.5px;
  color: rgba(186,220,255,0.55);
  transition: color 0.3s, transform 0.3s;
}
.back-link:hover {
  color: #93c5fd;
  transform: translateX(-3px);
}
.back-link svg { transition: transform 0.3s; }
.back-link:hover svg { transform: translateX(-2px); }

.hero-content {
  max-width: 600px;
}

.hero-label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: rgba(147,197,253,0.6);
  margin-bottom: 8px;
  opacity: 0;
  animation: fadeUp 1s 0.3s ease forwards;
}

.hero-title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 400;
  letter-spacing: 3px;
  background: linear-gradient(135deg, #e0f0ff 0%, #93c5fd 40%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  opacity: 0;
  animation: fadeUp 1s 0.5s ease forwards;
}

.hero-line {
  width: 60px;
  height: 2px;
  margin: 12px auto;
  background: linear-gradient(90deg, transparent, #93c5fd, transparent);
  border-radius: 2px;
  opacity: 0;
  animation: fadeUp 1s 0.7s ease forwards;
}

.hero-sub {
  font-size: 0.95rem;
  color: rgba(186,220,255,0.5);
  letter-spacing: 0.5px;
  opacity: 0;
  animation: fadeUp 1s 0.9s ease forwards;
}

@keyframes fadeUp {
  from { 
    opacity: 0; 
    transform: translate3d(0, 20px, 0);
  }
  to { 
    opacity: 1; 
    transform: translate3d(0, 0, 0);
  }
}

/* ── Timeline section ─────────────────────────────── */
.timeline-section {
  position: relative;
  z-index: 2;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px 100px;
}

/* ── Central line + progress ──────────────────────── */
.timeline-track {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(147,197,253,0.1);
  transform: translateX(-50%);
}

.timeline-line {
  width: 100%;
  height: 0%;
  background: linear-gradient(180deg, #93c5fd 0%, #818cf8 50%, #a78bfa 100%);
  border-radius: 2px;
  transition: height 0.1s linear;
  box-shadow: 0 0 12px rgba(147,197,253,0.3);
}

/* ── Entries container ────────────────────────────── */
.timeline-entries {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 80px;
  padding-top: 40px;
}

/* ── Single entry ─────────────────────────────────── */
.tl-entry {
  position: relative;
  width: 44%;
  opacity: 0;
  transform: translate3d(0, 40px, 0);
  will-change: opacity, transform;
  transition: opacity 0.7s cubic-bezier(0.22,1,0.36,1),
              transform 0.7s cubic-bezier(0.22,1,0.36,1);
}

/* Alternating sides */
.tl-entry:nth-child(odd)  { align-self: flex-start; }
.tl-entry:nth-child(even) { align-self: flex-end; }

/* In-view animation */
.tl-entry.in-view {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  will-change: auto;
}

/* ── Dot on the center line ───────────────────────── */
.tl-dot {
  position: absolute;
  top: 24px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #1e293b;
  border: 2px solid rgba(147,197,253,0.35);
  z-index: 3;
  transition: all 0.5s ease;
}

.tl-entry:nth-child(odd) .tl-dot {
  right: -52px;
  transform: translateX(50%);
}
.tl-entry:nth-child(even) .tl-dot {
  left: -52px;
  transform: translateX(-50%);
}

.tl-entry.in-view .tl-dot {
  background: #93c5fd;
  border-color: #93c5fd;
  box-shadow: 0 0 20px rgba(147,197,253,0.45), 0 0 40px rgba(147,197,253,0.15);
}

/* Pulsing ring */
.tl-dot::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid rgba(147,197,253,0);
  transition: border-color 0.5s;
}
.tl-entry.in-view .tl-dot::after {
  border-color: rgba(147,197,253,0.2);
  animation: pulse-ring 2.5s ease-out infinite;
}

@keyframes pulse-ring {
  0%   { 
    transform: scale3d(1, 1, 1); 
    opacity: 1; 
  }
  100% { 
    transform: scale3d(2.2, 2.2, 1); 
    opacity: 0; 
  }
}

/* ── Card ─────────────────────────────────────────── */
.tl-card {
  position: relative;
  padding: 24px 26px;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(147,197,253,0.12);
  border-radius: 16px;
  transform: translate3d(0, 0, 0);
  transition: border-color 0.4s, box-shadow 0.4s, transform 0.3s;
}

/* Fallback for browsers that don't support backdrop-filter */
@supports not (backdrop-filter: blur(16px)) {
  .tl-card {
    background: rgba(15, 23, 42, 0.92);
  }
}

.tl-entry.in-view .tl-card {
  border-color: rgba(147,197,253,0.22);
}

.tl-card:hover {
  border-color: rgba(147,197,253,0.35);
  box-shadow:
    0 8px 32px rgba(0,0,0,0.3),
    0 0 0 1px rgba(147,197,253,0.08),
    inset 0 1px 0 rgba(255,255,255,0.04);
  transform: translate3d(0, -3px, 0);
}

@media (hover: none) and (pointer: coarse) {
  .tl-card:hover {
    transform: translate3d(0, 0, 0);
  }
}

/* Decorative gradient glow behind card */
.tl-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 17px;
  background: linear-gradient(135deg, rgba(147,197,253,0.1), transparent 40%, rgba(167,139,250,0.08));
  z-index: -1;
  opacity: 0;
  transition: opacity 0.5s;
}
.tl-entry.in-view .tl-card::before {
  opacity: 1;
}

/* ── Connector arm (card → dot) ───────────────────── */
.tl-card::after {
  content: "";
  position: absolute;
  top: 30px;
  width: 32px;
  height: 1px;
  background: linear-gradient(90deg, rgba(147,197,253,0.3), rgba(147,197,253,0));
}

.tl-entry:nth-child(odd) .tl-card::after {
  right: -34px;
  background: linear-gradient(90deg, rgba(147,197,253,0), rgba(147,197,253,0.3));
}
.tl-entry:nth-child(even) .tl-card::after {
  left: -34px;
}

/* ── Card inner elements ──────────────────────────── */
.tl-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(147,197,253,0.08);
  font-size: 1.1rem;
  margin-bottom: 14px;
}

.tl-date {
  display: block;
  font-family: "Poppins", sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: rgba(147,197,253,0.55);
  margin-bottom: 8px;
}

.tl-title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 500;
  color: #e0f0ff;
  margin-bottom: 10px;
  line-height: 1.4;
}

.tl-note {
  font-size: 0.88rem;
  line-height: 1.65;
  color: rgba(186,220,255,0.6);
  white-space: pre-line;
}

.tl-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tl-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.5px;
  color: rgba(147,197,253,0.7);
  border: 1px solid rgba(147,197,253,0.15);
  border-radius: 20px;
  transition: all 0.3s;
}
.tl-link:hover {
  color: #93c5fd;
  border-color: rgba(147,197,253,0.4);
  background: rgba(147,197,253,0.06);
}

/* ── Chapter divider ──────────────────────────────── */
.tl-chapter {
  position: relative;
  width: 100%;
  text-align: center;
  padding: 10px 0;
  align-self: center;
}

.tl-chapter-line {
  display: flex;
  align-items: center;
  gap: 16px;
}
.tl-chapter-line::before,
.tl-chapter-line::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(147,197,253,0.2), transparent);
}

.tl-chapter-label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(147,197,253,0.4);
  white-space: nowrap;
}

/* ── Footer ───────────────────────────────────────── */
.timeline-footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 24px 80px;
}

.timeline-footer p {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.1rem;
  font-style: italic;
  letter-spacing: 2px;
  color: rgba(147,197,253,0.3);
  animation: pulse-text 3s ease-in-out infinite;
}

@keyframes pulse-text {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 0.6; }
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 768px) {
  .hero { padding: 20px 20px 28px; }
  .back-link { top: 20px; left: 20px; }

  .timeline-track {
    left: 20px;
    transform: none;
  }

  .timeline-entries {
    gap: 50px;
    padding-left: 48px;
  }

  .tl-entry,
  .tl-entry:nth-child(odd),
  .tl-entry:nth-child(even) {
    width: 100%;
    align-self: flex-start;
  }

  .tl-dot,
  .tl-entry:nth-child(odd) .tl-dot,
  .tl-entry:nth-child(even) .tl-dot {
    left: -37px;
    right: auto;
    transform: translateX(-50%);
  }

  .tl-card::after,
  .tl-entry:nth-child(odd) .tl-card::after,
  .tl-entry:nth-child(even) .tl-card::after {
    left: -20px;
    right: auto;
    width: 18px;
    background: linear-gradient(90deg, rgba(147,197,253,0.25), transparent);
  }

  .tl-card {
    padding: 20px;
  }

  .tl-chapter {
    padding-left: 0;
  }
}

@media (max-width: 420px) {
  .hero-title { font-size: 2rem; }
  .timeline-entries { padding-left: 40px; }
  .timeline-track { left: 14px; }
  .tl-dot,
  .tl-entry:nth-child(odd) .tl-dot,
  .tl-entry:nth-child(even) .tl-dot {
    left: -33px;
  }
}