:root {
  --fx-ink: #e9edf3;
  --fx-dim: #7c8593;
  --fx-accent: #5aa2ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: #000;
  color: var(--fx-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  -webkit-font-smoothing: antialiased;
}

/* The canvas is fixed and fills the viewport; scroll happens on the tall driver. */
#fx-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  background: #000;
  z-index: 0;
}

/* Tall element that gives us something to scroll. 900vh => generous timeline. */
.fx-scroll {
  position: relative;
  width: 100%;
  height: 900vh;
  z-index: 1;
  pointer-events: none;
}

/* ---- Loader / black gate ---- */
.fx-loader {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: #000;
  transition: opacity 0.8s ease;
}
.fx-loader.is-hidden {
  opacity: 0;
  pointer-events: none;
}
.fx-loader__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fx-dim);
  animation: fx-pulse 1.4s ease-in-out infinite;
}
@keyframes fx-pulse {
  0%,
  100% {
    opacity: 0.2;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.3);
  }
}

/* ---- Minimal chapter typography ---- */
.fx-ui {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease;
  mix-blend-mode: screen;
}
.fx-ui.is-visible {
  opacity: 1;
}

.fx-ui__brand {
  position: absolute;
  top: 28px;
  left: 32px;
  font-size: 0.72rem;
  letter-spacing: 0.42em;
  color: var(--fx-ink);
  opacity: 0.65;
}

.fx-ui__chapters {
  position: absolute;
  left: 32px;
  bottom: 40px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fx-chapter {
  display: flex;
  align-items: baseline;
  gap: 12px;
  opacity: 0.22;
  transform: translateX(-4px);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}
.fx-chapter.is-active {
  opacity: 1;
  transform: translateX(0);
}
.fx-chapter__id {
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  color: var(--fx-accent);
  min-width: 22px;
}
.fx-chapter__label {
  font-size: 0.9rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.fx-ui__hint {
  position: absolute;
  bottom: 40px;
  right: 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: opacity 0.6s ease;
}
.fx-ui__hint-text {
  font-size: 0.6rem;
  letter-spacing: 0.34em;
  color: var(--fx-dim);
  text-transform: uppercase;
}
.fx-ui__hint-line {
  width: 1px;
  height: 46px;
  background: linear-gradient(to bottom, var(--fx-dim), transparent);
  animation: fx-slide 1.8s ease-in-out infinite;
}
@keyframes fx-slide {
  0% {
    transform: scaleY(0.2);
    transform-origin: top;
    opacity: 0.2;
  }
  50% {
    transform: scaleY(1);
    opacity: 0.8;
  }
  100% {
    transform: scaleY(0.2);
    transform-origin: bottom;
    opacity: 0.2;
  }
}
.fx-ui.is-scrolled .fx-ui__hint {
  opacity: 0;
}

.fx-ui__progress {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
}
.fx-ui__progress i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(to right, var(--fx-accent), #cfe0ff);
  box-shadow: 0 0 12px rgba(90, 162, 255, 0.7);
}

@media (max-width: 640px) {
  .fx-chapter__label {
    font-size: 0.78rem;
  }
  .fx-ui__brand {
    top: 18px;
    left: 18px;
  }
  .fx-ui__chapters {
    left: 18px;
    bottom: 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fx-loader__dot,
  .fx-ui__hint-line {
    animation: none;
  }
}
