:root {
  --bg-deep: #03050a;
  --bg-surface: rgba(8, 12, 20, 0.85);
  --accent: #7ec8e3;
  --accent-dim: rgba(126, 200, 227, 0.2);
  --accent-glow: rgba(126, 200, 227, 0.4);
  --text-primary: #eef4f8;
  --text-secondary: rgba(238, 244, 248, 0.65);
  --text-muted: rgba(238, 244, 248, 0.35);
  --font-display: 'Cinzel', serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --radius: 14px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 104px 24px 8px;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.6;
  overflow-x: hidden;
}

::selection {
  background: var(--accent);
  color: var(--bg-deep);
}

#bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: url('../img/bg.jpg') no-repeat center 20% / cover;
  opacity: 0.35;
  transition: opacity 1.8s var(--transition-smooth);
}

#bg-overlay {
  position: fixed;
  inset: 0;
  z-index: 3;
  background:
    radial-gradient(ellipse 120% 95% at 50% 40%,
      rgba(0, 0, 0, 0.25) 0%,
      rgba(0, 0, 0, 0.45) 38%,
      rgba(0, 0, 0, 0.7) 72%,
      rgba(0, 0, 0, 0.92) 100%);
  pointer-events: none;
}

#bg-video {
  position: fixed;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.8s var(--transition-smooth);
}

body.video-ready #bg-video {
  opacity: 1;
}

body.video-ready #bg-layer {
  opacity: 0.06;
}

body.video-off #bg-video {
  opacity: 0;
  pointer-events: none;
}

body.video-off #bg-layer {
  opacity: 0.35;
}

#snow-canvas {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.controls {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10;
  display: flex;
  flex-direction: row;
  gap: 12px;
}

.ctrl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  background: rgba(8, 12, 20, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.35s var(--transition-smooth),
    border-color 0.35s var(--transition-smooth),
    box-shadow 0.35s var(--transition-smooth),
    background 0.35s var(--transition-smooth);
}

.ctrl-btn svg {
  width: 22px;
  height: 22px;
}

.ctrl-btn:hover,
.ctrl-btn:focus-visible {
  color: var(--text-primary);
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-dim);
  outline: none;
}

.ctrl-btn.muted {
  opacity: 0.35;
  color: var(--text-muted);
  border-color: rgba(238, 244, 248, 0.12);
}

#main-content {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(28px, 5vh, 52px);
  width: min(880px, 100%);
  margin: auto 0;
  padding-bottom: clamp(170px, 26vh, 220px);
  animation: fade-in 1.2s ease-out both;
}

.countdown-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  text-align: center;
}

.countdown-eyebrow {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(0.8rem, 2vw, 1.05rem);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.9),
    0 2px 18px rgba(0, 0, 0, 0.85);
}

.countdown {
  display: flex;
  align-items: flex-start;
  gap: clamp(8px, 2.4vw, 26px);
}

.countdown[hidden] {
  display: none;
}

.count-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.count-num {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(2.75rem, 10vw, 6.5rem);
  line-height: 1;
  color: var(--text-primary);
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.9),
    0 0 22px var(--accent-glow),
    0 2px 24px rgba(0, 0, 0, 0.9);
  font-variant-numeric: tabular-nums;
}

.count-num.flip {
  animation: flip 0.5s var(--transition-smooth);
}

.count-label {
  font-family: var(--font-display);
  font-size: clamp(0.55rem, 1.4vw, 0.7rem);
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9);
}

.count-sep {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(2.75rem, 10vw, 6.5rem);
  line-height: 1;
  color: var(--accent-dim);
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.9),
    0 2px 24px rgba(0, 0, 0, 0.9);
  animation: sep-pulse 2.4s ease-in-out infinite;
}

.arrived {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 7vw, 4.5rem);
  letter-spacing: 0.06em;
  color: var(--accent);
  text-shadow:
    0 0 30px var(--accent-glow),
    0 2px 24px rgba(0, 0, 0, 0.9);
  animation: fade-in 1.4s ease-out both;
}

.countdown-target {
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.9),
    0 2px 16px rgba(0, 0, 0, 0.9);
}

.countdown-target .stc {
  font-size: 0.7em;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.quotes-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 720px;
  text-align: center;
}

.quote-text {
  font-size: clamp(0.95rem, 1.7vw, 1.2rem);
  font-weight: 300;
  font-style: italic;
  line-height: 1.7;
  color: var(--text-primary);
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.95),
    0 2px 12px rgba(0, 0, 0, 0.85),
    0 4px 30px rgba(0, 0, 0, 0.9);
  transition: opacity 0.8s var(--transition-smooth);
  height: 5.1em;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.quote-text.is-hidden {
  opacity: 0;
}

.quote-attribution {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.9),
    0 2px 16px rgba(0, 0, 0, 0.9);
  transition: opacity 0.8s var(--transition-smooth);
}

.quote-attribution.is-hidden {
  opacity: 0;
}

.timeline-section {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 5;
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 0 24px 12px;
  pointer-events: none;
}

.patch-road {
  position: relative;
  width: min(640px, 100%);
  pointer-events: auto;
}

.road-stops {
  position: relative;
  display: flex;
  justify-content: space-between;
}

.road-stop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  flex: 1 1 0;
  min-width: 0;
}

.road-stop::after {
  content: '';
  position: absolute;
  top: 30px;
  left: calc(50% + 9px);
  width: calc(100% - 18px);
  height: 2px;
  background: rgba(238, 244, 248, 0.14);
  border-radius: 999px;
  pointer-events: none;
}

.road-stop:last-child::after {
  display: none;
}

.road-stop.is-gone {
  display: none;
}

.stop-version {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.8rem;
  line-height: 1;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.9),
    0 2px 10px rgba(0, 0, 0, 0.9);
  font-variant-numeric: tabular-nums;
  transition: color 0.6s var(--transition-smooth);
}

.stop-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--text-muted);
  background: transparent;
  transition: background 0.6s var(--transition-smooth),
    border-color 0.6s var(--transition-smooth),
    box-shadow 0.6s var(--transition-smooth);
}

.stop-dot svg {
  width: 11px;
  height: 11px;
  color: var(--bg-deep);
}

.stop-date {
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.9),
    0 2px 10px rgba(0, 0, 0, 0.9);
  transition: color 0.6s var(--transition-smooth);
}

.road-stop.past .stop-version,
.road-stop.past .stop-date {
  color: var(--text-muted);
}

.road-stop.past .stop-dot {
  background: rgba(238, 244, 248, 0.25);
  border-color: rgba(238, 244, 248, 0.25);
}

.road-stop.current .stop-version,
.road-stop.current .stop-date {
  color: var(--text-primary);
}

.road-stop.current .stop-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
  animation: dot-pulse 2.4s ease-in-out infinite;
}

.road-stop.final .stop-version,
.road-stop.final .stop-date {
  color: var(--accent);
}

.road-stop.final .stop-dot {
  width: 22px;
  height: 22px;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 22px var(--accent-glow);
}

.road-stop.final .stop-dot svg {
  width: 13px;
  height: 13px;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes flip {
  0% {
    transform: perspective(400px) rotateX(0deg);
    opacity: 1;
  }
  45% {
    transform: perspective(400px) rotateX(90deg);
    opacity: 0.25;
  }
  55% {
    transform: perspective(400px) rotateX(90deg);
    opacity: 0.25;
  }
  100% {
    transform: perspective(400px) rotateX(0deg);
    opacity: 1;
  }
}

@keyframes sep-pulse {
  0%, 100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

@keyframes dot-pulse {
  0%, 100% {
    box-shadow: 0 0 6px var(--accent-dim);
  }
  50% {
    box-shadow: 0 0 20px var(--accent-glow);
  }
}

@media (max-width: 768px) {
  .controls {
    top: 16px;
    right: 16px;
  }

  .ctrl-btn {
    width: 42px;
    height: 42px;
  }

  body {
    padding: 84px 20px 8px;
  }
}

@media (max-width: 480px) {
  .countdown {
    gap: 6px;
  }

  .count-sep {
    margin-top: 0;
  }

  .count-label {
    letter-spacing: 0.18em;
  }

  .patch-road {
    width: 100%;
  }

  .stop-version {
    font-size: 0.68rem;
  }

  .stop-date {
    font-size: 0.6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
