:root {
  color-scheme: dark;
  --ink: #070809;
  --paper: #f3f3f1;
  --accent: #f04421;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  scroll-behavior: smooth;
  scroll-snap-type: y proximity;
  scrollbar-width: none;
  background: var(--ink);
}

html::-webkit-scrollbar { width: 0; height: 0; }

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  overscroll-behavior-y: none;
  touch-action: pan-y;
  background: var(--ink);
  color: var(--paper);
  font-family: Arial, sans-serif;
}

.camera-journey {
  position: relative;
  height: 900dvh;
  background: var(--ink);
}

.camera-stage {
  position: sticky;
  top: 0;
  z-index: 2;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--ink);
  contain: paint;
}

.camera-world {
  position: absolute;
  top: 0;
  left: 0;
  width: 500dvw;
  height: 600dvh;
  background: var(--ink);
  animation: camera-follow-route linear both;
  animation-timeline: scroll(root block);
}

.camera-world.is-js-driven { animation: none; }

.world-thread {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  display: none;
}

/* The signal path is now authored inside every scene image. Keeping the old
   world-space SVG would create the detached duplicate line the artwork replaces. */
.world-thread,
.seam-thread {
  display: none !important;
}

.world-thread-shadow,
.world-thread-core {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.world-thread-shadow {
  stroke: rgba(7, 8, 9, 0.88);
  stroke-width: 8.4px;
}

.world-thread-core {
  stroke: var(--accent);
  stroke-width: 1.35px;
  opacity: 0.86;
}

.world-thread-mobile { display: none; }

.seam-thread {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  display: none;
}

.seam-thread-shadow,
.seam-thread-core {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.seam-thread-shadow {
  stroke: rgba(7, 8, 9, 0.92);
  stroke-width: 4.8px;
}

.seam-thread-core {
  stroke: var(--accent);
  stroke-width: 1.4px;
  opacity: 0.9;
}

.seam-thread-mobile { display: none; }

.page-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100dvw;
  height: 100dvh;
  overflow: hidden;
  background: var(--ink);
  transform: translate3d(var(--world-x), var(--world-y), 0);
}

.page-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--ink);
}

.journey-waypoints {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.journey-step {
  display: block;
  width: 1px;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: normal;
  opacity: 0;
}

@keyframes camera-follow-route {
  0% { transform: translate3d(0, 0, 0); }
  12.5% { transform: translate3d(-100dvw, 0, 0); }
  25% { transform: translate3d(-200dvw, 0, 0); }
  37.5% { transform: translate3d(-300dvw, 0, 0); }
  50% { transform: translate3d(-400dvw, -100dvh, 0); }
  62.5% { transform: translate3d(-400dvw, -200dvh, 0); }
  75% { transform: translate3d(-400dvw, -300dvh, 0); }
  87.5% { transform: translate3d(-400dvw, -400dvh, 0); }
  100% { transform: translate3d(-400dvw, -500dvh, 0); }
}

.page-rail {
  position: fixed;
  top: 50%;
  right: 18px;
  z-index: 20;
  display: grid;
  gap: 11px;
  width: 104px;
  transform: translateY(-50%);
}

.page-rail a {
  position: relative;
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  min-height: 16px;
  color: rgba(243, 243, 241, 0.34);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-decoration: none;
  transition: color 220ms ease;
}

.page-rail a::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -13px;
  width: 7px;
  height: 1px;
  background: currentColor;
  transition: width 220ms ease, background 220ms ease;
}

.page-rail a span { font-variant-numeric: tabular-nums; }

.page-rail a b {
  overflow: hidden;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-weight: 400;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(6px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.page-rail:hover a b,
.page-rail:focus-within a b,
.page-rail a.is-active b {
  opacity: 1;
  transform: translateX(0);
}

.page-rail a.is-active {
  color: var(--paper);
}

.page-rail a:focus-visible {
  color: var(--paper);
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

.page-rail a.is-active::before {
  width: 12px;
  background: var(--accent);
}

.rail-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -18px;
  width: 1px;
  overflow: hidden;
  background: rgba(243, 243, 241, 0.12);
}

.rail-progress {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--progress, 0%);
  background: var(--accent);
  transition: height 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

@media (max-width: 760px) {
  .world-thread-desktop { display: none; }
  .world-thread-mobile { display: block; }
  .seam-thread-desktop { display: none; }
  .seam-thread-mobile { display: block; }

  .page-rail {
    top: auto;
    right: max(10px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    left: max(10px, env(safe-area-inset-left));
    grid-template-columns: repeat(9, minmax(0, 1fr));
    gap: 0;
    width: auto;
    min-height: 50px;
    padding: 5px 2px 2px;
    transform: none;
    border-top: 1px solid rgba(243, 243, 241, 0.16);
    background: #070809;
  }

  .page-rail a {
    place-items: center;
    grid-template-columns: 1fr;
    min-width: 0;
    min-height: 44px;
    font-size: 8px;
    letter-spacing: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .page-rail a b {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .page-rail a::before {
    top: 2px;
    left: 50%;
    width: 8px;
    transform: translateX(-50%);
  }

  .page-rail a.is-active::before { width: 20px; }

  .rail-line {
    top: -1px;
    right: 0;
    bottom: auto;
    left: 0;
    width: 100%;
    height: 1px;
  }

  .rail-progress {
    width: var(--progress, 0%);
    height: 100%;
    transition: width 260ms cubic-bezier(0.16, 1, 0.3, 1);
  }
}

@media (max-width: 760px) and (max-height: 520px) {
  .page-rail {
    right: max(6px, env(safe-area-inset-right));
    bottom: max(4px, env(safe-area-inset-bottom));
    left: max(6px, env(safe-area-inset-left));
    min-height: 42px;
    padding-top: 2px;
  }

  .page-rail a { min-height: 38px; }
}

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

  .rail-progress { transition: none; }

  .camera-journey {
    height: auto;
    min-height: 0;
  }

  .camera-stage {
    position: relative;
    height: auto;
    overflow: visible;
    contain: none;
  }

  .camera-world {
    position: relative;
    width: 100%;
    height: auto;
    animation: none;
    transform: none;
  }

  .page-frame {
    position: relative;
    width: 100%;
    transform: none !important;
  }

  .world-thread { display: none; }
  .journey-waypoints { display: none; }
}
