/* ============================================================
   THE STORY OF YOUR ARRIVAL — style.css
   ------------------------------------------------------------
   Quick map of this file:
     1. Tokens (colors, fonts)        — change the mood here
     2. Base & background
     3. Hero
     4. Heartbeat divider
     5. Timeline (desktop, horizontal)
     6. Hover preview card
     7. Closing quote
     8. Modal popup
     9. Mobile (vertical timeline)
    10. Accessibility & reduced motion
   ============================================================ */

/* ---------- 1. TOKENS ---------- */
:root {
  --bg-deep:    #05060f;
  --bg-space:   #0a0d24;
  --ink:        #eef0ff;
  --ink-soft:   rgba(222, 228, 255, 0.72);
  --ink-faint:  rgba(200, 208, 248, 0.45);

  --pink:   #ff5470;
  --magenta:#e052ff;
  --purple: #a45dff;
  --blue:   #5c7cfa;
  --sky:    #4aa8ff;
  --cyan:   #2de2ff;

  --glass:        rgba(16, 20, 48, 0.55);
  --glass-border: rgba(150, 170, 255, 0.18);

  --font-display: "Outfit", system-ui, sans-serif;
  --font-body:    "DM Sans", system-ui, sans-serif;

  --node-size: 118px;
  --node-size-featured: 150px;
}

/* ---------- 1b. DAWN / TWILIGHT (MORNING) THEME ----------
   Lighter & warmer than night, but still cosmic. Most of the
   site reads from the tokens below; a few hand-written dark
   surfaces are re-skinned afterward so text stays readable. */
body[data-theme="day"] {
  --ink:       #2a2350;                        /* dark text for a light sky */
  --ink-soft:  rgba(58, 48, 110, 0.80);
  --ink-faint: rgba(70, 60, 120, 0.58);

  --glass:        rgba(255, 255, 255, 0.55);   /* light frosted glass */
  --glass-border: rgba(150, 120, 200, 0.32);

  /* deepen a couple of accents a touch so they read on a pale bg */
  --pink: #ff3d68;
  --sky:  #3f7be0;
  --cyan: #1fb6d6;
}

/* dawn sky: blue overhead → lavender → warm pink horizon,
   with a soft sun glow top-right and a peach glow at the bottom */
body[data-theme="day"] {
  background:
    radial-gradient(ellipse 120% 70% at 50% 115%, #ffd6c4 0%, transparent 55%),
    radial-gradient(ellipse 60% 45% at 85% 8%, #fff1c9 0%, transparent 60%),
    linear-gradient(180deg, #cfe0ff 0%, #e7dcff 45%, #ffe4ec 100%);
}

/* near-white text gradient is invisible on a light bg — use a saturated one */
body[data-theme="day"] .hero__title {
  background: linear-gradient(95deg, #ff5470 0%, #c04bff 45%, #6a7bff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow: 0 0 50px rgba(180, 120, 255, 0.22);
}

/* let the color glows still register against the brighter sky */
body[data-theme="day"] .nebula { opacity: 0.30; }

/* airy, light node interiors instead of the deep-space dark ones */
body[data-theme="day"] .event__node {
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.95), transparent 60%),
    radial-gradient(circle, rgba(255, 255, 255, 0.85) 55%, color-mix(in srgb, var(--event-color) 22%, transparent) 100%);
}

/* small dark surfaces → light, so their (now-dark) text/icons stay visible */
body[data-theme="day"] .event__num,
body[data-theme="day"] .modal__close,
body[data-theme="day"] .modal__nav-btn {
  background: rgba(255, 255, 255, 0.70);
}
body[data-theme="day"] .modal__panel {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.94), rgba(244, 238, 255, 0.92));
}
body[data-theme="day"] .modal__backdrop { background: rgba(40, 30, 70, 0.45); }

/* ---------- THEME TOGGLE BUTTON ----------
   Glassy pill in the corner; uses tokens so it adapts to day/night. */
.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.95rem;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
  transition: color 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}
.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--sky) 70%, transparent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--sky) 40%, transparent);
  transform: translateY(-1px);
}
.theme-toggle__icon { font-size: 1rem; line-height: 1; }

/* ---------- 2. BASE & BACKGROUND ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.6;
  background:
    /* crimson nebula glow, top-left corner */
    radial-gradient(ellipse 48% 42% at 6% 8%, rgba(255, 64, 82, 0.34) 0%, rgba(255, 64, 82, 0) 60%),
    /* warm ember just inside that corner */
    radial-gradient(ellipse 30% 26% at 0% 0%, rgba(255, 138, 76, 0.22) 0%, rgba(255, 138, 76, 0) 55%),
    /* blue nebula on the right */
    radial-gradient(ellipse 52% 58% at 96% 36%, rgba(46, 132, 240, 0.30) 0%, rgba(46, 132, 240, 0) 58%),
    /* cyan glow sweeping up from the bottom-right */
    radial-gradient(ellipse 60% 50% at 80% 110%, rgba(38, 206, 226, 0.20) 0%, rgba(38, 206, 226, 0) 55%),
    /* soft violet depth through the middle */
    radial-gradient(ellipse 95% 70% at 50% 52%, rgba(38, 30, 84, 0.45) 0%, rgba(38, 30, 84, 0) 75%),
    /* near-black base */
    radial-gradient(ellipse 135% 120% at 50% 38%, #080a1c 0%, #050610 55%, #020207 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

#particles {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* big soft color glows floating behind everything */
.nebula {
  position: fixed;
  width: 55vw;
  height: 55vw;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.22;
  z-index: 0;
  pointer-events: none;
}
.nebula--pink { top: -22vw; left: -20vw; background: radial-gradient(circle, #ff4052, transparent 65%); }
.nebula--blue { top: 8vw; right: -20vw; background: radial-gradient(circle, #2e84f0, transparent 65%); }

/* ---------- DEEP-SPACE SCENERY (comet · small planet · planet horizon) ---------- */
.cosmos {
  position: fixed;
  inset: 0;
  z-index: 0;            /* sits with the starfield, behind the page content */
  overflow: hidden;
  pointer-events: none;
}

/* planet horizon — a huge sphere mostly below the fold, with a glowing top rim.
   width/height set the curvature; `bottom` is tuned so the rim sits ~16vh up. */
.cosmos__horizon {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 200vw;
  height: 200vw;
  bottom: calc(16vh - 200vw);   /* lifts the top arc to ~16vh above the fold */
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 2%, rgba(150, 190, 255, 0.20) 0%, transparent 12%),
    radial-gradient(circle, #0b1638 0%, #070d22 55%, #05081a 100%);
  box-shadow:
    inset 0 10px 34px rgba(150, 190, 255, 0.30),
    0 0 120px rgba(60, 120, 230, 0.28);
  border-top: 1.5px solid rgba(175, 205, 255, 0.6);
}

/* the bright pink-white light burst rising from the centre of the horizon */
.cosmos__horizon-flare {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 52vw;
  height: 30vh;
  background: radial-gradient(ellipse at 50% 100%,
    rgba(255, 255, 255, 0.55) 0%,
    rgba(222, 132, 255, 0.34) 16%,
    rgba(120, 130, 255, 0.16) 38%,
    transparent 68%);
  filter: blur(2px);
}

/* small planet floating above the horizon, on the right */
.cosmos__planet {
  position: absolute;
  right: 9vw;
  bottom: 26vh;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%,
    #7e97ff 0%, #3a4aa0 45%, #131c4d 78%, #0a1030 100%);
  box-shadow:
    0 0 30px rgba(92, 124, 250, 0.45),
    inset -10px -8px 20px rgba(0, 0, 0, 0.55),
    inset 7px 6px 16px rgba(180, 200, 255, 0.22);
}
.cosmos__planet::after {  /* faint orbital ring */
  content: "";
  position: absolute;
  inset: -13px -28px;
  border-radius: 50%;
  border: 1px solid rgba(170, 200, 255, 0.28);
  transform: rotate(-22deg);
}

/* comet — a tail with a bright head, lower-left, aimed toward the horizon */
.cosmos__comet {
  position: absolute;
  left: 13vw;
  bottom: 34vh;
  width: 200px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg,
    rgba(180, 210, 255, 0) 0%, rgba(180, 210, 255, 0.55) 78%, #ffffff 100%);
  transform: rotate(16deg);
  filter: drop-shadow(0 0 6px rgba(150, 190, 255, 0.8));
}
.cosmos__comet::after {  /* the glowing head */
  content: "";
  position: absolute;
  right: -2px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  transform: translateY(-50%);
  box-shadow: 0 0 14px 4px rgba(200, 220, 255, 0.9);
  animation: comet-twinkle 3.2s ease-in-out infinite;
}
@keyframes comet-twinkle {
  0%, 100% { box-shadow: 0 0 12px 3px rgba(200, 220, 255, 0.75); }
  50%      { box-shadow: 0 0 18px 5px rgba(225, 238, 255, 1); }
}

/* soften the scenery on the bright dawn theme so it doesn't go harsh */
body[data-theme="day"] .cosmos { opacity: 0.5; }
body[data-theme="day"] .cosmos__horizon {
  background:
    radial-gradient(circle at 50% 4%, rgba(255, 220, 240, 0.55) 0%, transparent 16%),
    radial-gradient(circle, #cfd8ff 0%, #e7dcff 55%, #ffe4ec 100%);
  border-top-color: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 8px 26px rgba(255, 255, 255, 0.5), 0 0 120px rgba(150, 170, 255, 0.25);
}

#page {
  position: relative;
  z-index: 1;
  max-width: 1680px;
  margin: 0 auto;
  padding: clamp(2rem, 5vh, 4.5rem) clamp(1.25rem, 4vw, 4rem) 4rem;
}

/* ---------- 3. HERO ---------- */
.hero { text-align: center; }

.hero__orbit {
  font-size: 1.3rem;
  color: var(--ink-soft);
  position: relative;
  display: inline-block;
  margin-bottom: 0.75rem;
}
.hero__orbit::before {
  content: "";
  position: absolute;
  inset: -10px -34px;
  border: 1px solid rgba(150, 170, 255, 0.25);
  border-radius: 50%;
  transform: rotateX(68deg);
}
.hero__orbit-star { text-shadow: 0 0 16px var(--cyan); }

.hero__eyebrow {
  font-family: var(--font-display);
  font-size: clamp(0.68rem, 1.1vw, 0.85rem);
  font-weight: 400;
  letter-spacing: 0.55em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 1rem;
}
.hero__eyebrow-dot { font-size: 0.5em; vertical-align: middle; color: var(--ink-faint); margin: 0 0.9em; }

.hero__title {
  font-family: var(--font-display);
  font-weight: 200;
  font-size: clamp(2.6rem, 7.5vw, 6rem);
  letter-spacing: 0.01em;
  line-height: 1.05;
  margin: 0 0 1.1rem;
  background: linear-gradient(95deg, #ffd4dd 0%, #f3eaff 35%, #eef0ff 55%, #c4d6ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 80px rgba(160, 120, 255, 0.25);
}

.hero__subtitle {
  font-size: clamp(0.98rem, 1.6vw, 1.25rem);
  color: var(--ink-soft);
  margin: 0 auto;
  max-width: 46ch;
}

/* ---------- 4. HEARTBEAT DIVIDER ---------- */
.heartbeat {
  position: relative;
  max-width: 920px;
  margin: clamp(1.5rem, 4vh, 3rem) auto 0;
}
.heartbeat svg { width: 100%; height: 60px; display: block; overflow: visible; }

.heartbeat__line {
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  /* path length normalized in JS for the draw-in animation */
}
.heartbeat__line--pink { stroke: var(--pink); filter: drop-shadow(0 0 6px rgba(255, 84, 112, 0.8)); }
.heartbeat__line--blue { stroke: var(--sky); filter: drop-shadow(0 0 6px rgba(74, 168, 255, 0.8)); }

.heartbeat__heart {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -54%);
  font-size: 1.5rem;
  color: var(--pink);
  text-shadow: 0 0 18px var(--pink), 0 0 40px var(--magenta);
  animation: heart-pulse 1.6s ease-in-out infinite;
}
@keyframes heart-pulse {
  0%, 100% { transform: translate(-50%, -54%) scale(1); }
  14%      { transform: translate(-50%, -54%) scale(1.22); }
  28%      { transform: translate(-50%, -54%) scale(1); }
}

/* ---------- 5. TIMELINE (DESKTOP / HORIZONTAL) ---------- */
.timeline {
  position: relative;
  margin-top: clamp(3rem, 8vh, 6rem);
  padding: 2rem 0 1rem;
}

/* the glowing line behind the nodes */
.timeline__track {
  /* node centers sit at: section padding (2rem) + date slot (2.4rem)
     + date margin (0.8rem) + half of the featured node */
  position: absolute;
  top: calc(2rem + 2.4rem + 0.8rem + var(--node-size-featured) / 2);
  left: 2%;
  right: 2%;
  height: 2px;
  background: rgba(150, 170, 255, 0.12);
  border-radius: 2px;
  overflow: hidden;
}
.timeline__track-fill {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(0); /* animated to 1 on load */
  background: linear-gradient(90deg,
    var(--pink) 0%, var(--magenta) 20%, var(--purple) 40%,
    var(--blue) 60%, var(--sky) 80%, var(--cyan) 100%);
  box-shadow: 0 0 12px rgba(120, 140, 255, 0.8);
}

.timeline__events {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: clamp(0.5rem, 1.5vw, 1.5rem);
}

.event {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
}

.event__date {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(0.7rem, 1vw, 0.85rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--event-color, var(--blue));
  /* fixed-height slot keeps every node center on the same line */
  height: 2.4rem;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  margin: 0 0 0.8rem;
  text-shadow: 0 0 14px color-mix(in srgb, var(--event-color, var(--blue)) 60%, transparent);
}

/* node row keeps every node's center on the same horizontal line */
.event__node-wrap {
  height: var(--node-size-featured);
  display: flex;
  align-items: center;
}

/* the circular node itself — a real button for accessibility */
.event__node {
  position: relative;
  width: var(--node-size);
  height: var(--node-size);
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--event-color) 65%, transparent);
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,0.07), transparent 55%),
    radial-gradient(circle, rgba(10, 13, 36, 0.92) 55%, color-mix(in srgb, var(--event-color) 18%, transparent) 100%);
  color: var(--event-color);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow:
    0 0 18px color-mix(in srgb, var(--event-color) 35%, transparent),
    inset 0 0 24px color-mix(in srgb, var(--event-color) 14%, transparent);
  transition: box-shadow 0.35s ease, transform 0.35s ease;
  animation: node-pulse 3.4s ease-in-out infinite;
}
.event:nth-child(2n) .event__node { animation-delay: 1.1s; }
.event:nth-child(3n) .event__node { animation-delay: 2.2s; }

@keyframes node-pulse {
  0%, 100% { box-shadow: 0 0 16px color-mix(in srgb, var(--event-color) 30%, transparent), inset 0 0 22px color-mix(in srgb, var(--event-color) 12%, transparent); }
  50%      { box-shadow: 0 0 30px color-mix(in srgb, var(--event-color) 55%, transparent), inset 0 0 30px color-mix(in srgb, var(--event-color) 20%, transparent); }
}

/* decorative outer ring arc */
.event__node::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  border-top-color: color-mix(in srgb, var(--event-color) 80%, transparent);
  border-right-color: color-mix(in srgb, var(--event-color) 35%, transparent);
  animation: ring-spin 14s linear infinite;
}
@keyframes ring-spin { to { transform: rotate(360deg); } }

.event__node:hover,
.event__node:focus-visible {
  transform: scale(1.07);
  box-shadow:
    0 0 42px color-mix(in srgb, var(--event-color) 85%, transparent),
    0 0 90px color-mix(in srgb, var(--event-color) 35%, transparent),
    inset 0 0 34px color-mix(in srgb, var(--event-color) 28%, transparent);
  animation-play-state: paused;
}

.event__node svg {
  width: 42%;
  height: 42%;
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--event-color) 80%, transparent));
}

/* number chip under the node, like the reference */
.event__num {
  font-family: var(--font-display);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  border: 1px solid color-mix(in srgb, var(--event-color) 55%, transparent);
  background: rgba(8, 11, 30, 0.85);
  border-radius: 7px;
  padding: 0.18rem 0.5rem;
  margin-top: 0.9rem;
  position: relative;
}
.event__num::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  width: 1px;
  height: 0.9rem;
  background: color-mix(in srgb, var(--event-color) 55%, transparent);
}

.event__time {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(0.78rem, 1.1vw, 0.95rem);
  letter-spacing: 0.06em;
  color: var(--event-color);
  margin: 0.8rem 0 0.15rem;
  min-height: 1.2em;
}

.event__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.02rem, 1.55vw, 1.35rem);
  color: var(--ink);
  margin: 0.15rem 0 0.5rem;
}

.event__desc {
  font-size: clamp(0.8rem, 1.05vw, 0.95rem);
  color: var(--ink-faint);
  max-width: 24ch;
  margin: 0 auto;
}

.event__underline {
  width: 3.2rem;
  height: 2px;
  border-radius: 2px;
  background: var(--event-color);
  box-shadow: 0 0 10px var(--event-color);
  margin-top: 0.9rem;
  opacity: 0.8;
}

/* featured node (The Day You Arrived) */
.event--featured .event__node {
  width: var(--node-size-featured);
  height: var(--node-size-featured);
  border-width: 2px;
}
.event--featured .event__star {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 1.05rem;
  text-shadow: 0 0 12px var(--event-color), 0 0 30px var(--event-color);
}
.event--featured .event__date { font-size: clamp(0.78rem, 1.15vw, 0.98rem); }
.event--featured .event__title { font-weight: 500; }

/* ---------- 6. HOVER PREVIEW CARD ---------- */
.event__preview {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  width: 190px;
  padding: 0.5rem;
  border-radius: 14px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55), 0 0 24px color-mix(in srgb, var(--event-color) 22%, transparent);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  pointer-events: none;
  z-index: 5;
}
.event__node-wrap:hover .event__preview,
.event__node:focus-visible + .event__preview,
.event__node-wrap:focus-within .event__preview {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.event__preview img {
  width: 100%;
  height: 104px;
  object-fit: cover;
  border-radius: 9px;
  display: block;
}
.event__preview-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding-top: 0.45rem;
}
.event__preview-label::before { content: "▸"; color: var(--event-color); font-size: 0.8em; }

/* ---------- 7. CLOSING QUOTE ---------- */
.closing {
  display: flex;
  justify-content: center;
  margin-top: clamp(3rem, 8vh, 5.5rem);
}
.closing__pill {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: 0.95rem 2.2rem;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 0 40px rgba(92, 124, 250, 0.16), inset 0 0 30px rgba(92, 124, 250, 0.05);
}
.closing__text {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(0.72rem, 1.2vw, 0.92rem);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: center;
}
.closing__star  { color: var(--cyan); text-shadow: 0 0 12px var(--cyan); }
.closing__heart { color: var(--pink); text-shadow: 0 0 12px var(--pink); }

/* ---------- 8. MODAL ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}
.modal[hidden] { display: none; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 5, 14, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal__panel {
  position: relative;
  width: min(640px, 100%);
  max-height: min(92vh, 92dvh);
  overflow-y: auto;
  border-radius: 22px;
  background:
    linear-gradient(160deg, rgba(26, 32, 70, 0.85), rgba(10, 13, 36, 0.92));
  border: 1px solid var(--glass-border);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.7),
    0 0 60px color-mix(in srgb, var(--event-color, var(--blue)) 22%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 1.1rem 1.1rem 1.4rem;
}

.modal__close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 2;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: rgba(8, 11, 30, 0.7);
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.modal__close:hover,
.modal__close:focus-visible {
  box-shadow: 0 0 18px color-mix(in srgb, var(--event-color, var(--blue)) 70%, transparent);
  transform: scale(1.08);
}

.modal__media {
  border-radius: 14px;
  overflow: hidden;
  background: #04050e;
  aspect-ratio: 16 / 10;
}
.modal__media img,
.modal__media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.modal__media video { object-fit: contain; background: #000; }

.modal__thumbs {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}
.modal__thumb {
  width: 64px;
  height: 46px;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid transparent;
  padding: 0;
  background: #0a0d24;
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.modal__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.modal__thumb.is-active,
.modal__thumb:hover,
.modal__thumb:focus-visible {
  border-color: var(--event-color, var(--blue));
  box-shadow: 0 0 12px color-mix(in srgb, var(--event-color, var(--blue)) 60%, transparent);
}
.modal__thumb--video::after {
  content: "▶";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.35);
  text-shadow: 0 0 8px rgba(0,0,0,0.8);
}

.modal__body { padding: 1rem 0.4rem 0.2rem; }

.modal__date {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--event-color, var(--blue));
  margin: 0 0 0.3rem;
}
.modal__title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  margin: 0 0 0.5rem;
  color: var(--ink);
}
.modal__desc {
  color: var(--ink-soft);
  font-size: 1rem;
  margin: 0;
}

.modal__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.2rem;
  padding: 0 0.2rem;
}
.modal__nav-btn {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: rgba(8, 11, 30, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 0.55rem 1.2rem;
  cursor: pointer;
  transition: color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.modal__nav-btn:hover,
.modal__nav-btn:focus-visible {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--event-color, var(--blue)) 70%, transparent);
  box-shadow: 0 0 16px color-mix(in srgb, var(--event-color, var(--blue)) 40%, transparent);
}
.modal__counter {
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.25em;
  color: var(--ink-faint);
}

/* ---------- 9. STACKED / VERTICAL TIMELINE ----------
   Used on narrow screens AND whenever there are more than six
   moments (the js adds `timeline--stacked` — see applyTimelineLayout
   in main.js), so a long list never gets cramped on a wide desktop. */
.timeline--stacked .timeline__track {
  top: 0;
  bottom: 0;
  left: calc(1rem + var(--node-size-featured) / 2);
  right: auto;
  width: 2px;
  height: auto;
}
.timeline--stacked .timeline__track-fill {
  width: 100%;
  height: 100%;
  transform-origin: top center;
  transform: scaleY(0);
  background: linear-gradient(180deg,
    var(--pink) 0%, var(--magenta) 20%, var(--purple) 40%,
    var(--blue) 60%, var(--sky) 80%, var(--cyan) 100%);
}

.timeline--stacked .timeline__events {
  flex-direction: column;
  gap: 3rem;
  padding-left: 1rem;
}

.timeline--stacked .event {
  display: grid;
  grid-template-columns: var(--node-size-featured) 1fr;
  column-gap: 1.4rem;
  align-items: center;
  text-align: left;
  width: 100%;
}

/* node spans both rows; date + body stack in the right column */
.timeline--stacked .event__node-wrap {
  grid-column: 1;
  grid-row: 1 / 3;
  height: auto;
  width: var(--node-size-featured);
  justify-content: center;
}
.timeline--stacked .event__date {
  grid-column: 2;
  grid-row: 1;
  height: auto;
  display: block;
  margin: 0 0 0.2rem;
}
.timeline--stacked .event__body { grid-column: 2; grid-row: 2; min-width: 0; }
.timeline--stacked .event__desc { max-width: none; margin: 0; }
.timeline--stacked .event__underline { margin-top: 0.7rem; }
.timeline--stacked .event__num { display: none; }

/* previews follow the node in stacked mode, to the right */
.timeline--stacked .event__preview {
  bottom: auto;
  top: 50%;
  left: calc(100% + 10px);
  transform: translateY(-50%) translateX(6px);
}
.timeline--stacked .event__node-wrap:hover .event__preview,
.timeline--stacked .event__node-wrap:focus-within .event__preview {
  transform: translateY(-50%) translateX(0);
}

/* empty state — shown until the first moment is added */
.timeline--empty .timeline__track { display: none; }
.timeline__empty {
  list-style: none;
  flex: 1 1 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 28vh;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(1rem, 2vw, 1.35rem);
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  text-align: center;
}
.timeline__empty-star { color: var(--cyan); text-shadow: 0 0 14px var(--cyan); }

/* ---------- 9b. SMALL-SCREEN SIZE TWEAKS ---------- */
@media (max-width: 920px) {
  :root { --node-size: 92px; --node-size-featured: 112px; }
  .modal__panel { padding: 0.8rem 0.8rem 1.1rem; }
}

@media (max-width: 480px) {
  :root { --node-size: 74px; --node-size-featured: 90px; }
  .event { gap: 1rem; }
  .event__preview { display: none; } /* hover previews don't exist on touch; tap opens the popup */
  .modal__nav-btn { padding: 0.5rem 0.85rem; font-size: 0.72rem; }
  /* keep just the horizon on small phones; comet + planet would crowd it */
  .cosmos__comet, .cosmos__planet { display: none; }
}

/* ---------- 10. ACCESSIBILITY & REDUCED MOTION ---------- */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.noscript-fallback {
  position: relative;
  z-index: 2;
  max-width: 720px;
  margin: 2rem auto;
  padding: 1.5rem 2rem;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  color: var(--ink-soft);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
  .timeline__track-fill { transform: none !important; }
  html { scroll-behavior: auto; }
}
