:root {
  /* Typography compliance tokens: IBM Plex Mono** for tiny altitude ticks; IBM Plex Sans** for calm readability; Roboto Slab** lettering for “continua.quest” carved across layered vector ridges. */
  --night: #050716;
  --glacial: #081A3A;
  --cyan: #00F5FF;
  --violet: #9B5CFF;
  --green: #44FFB1;
  --snow: #E8E7FF;
  --magenta: #FF2BD6;
  --haze: #6C7CFF;
  --display: "Roboto Slab", Georgia, serif;
  --slab: "Zilla Slab", Georgia, serif;
  --body: "IBM Plex Sans", Inter, Roboto, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--night);
  color: var(--snow);
  font-family: var(--body);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 12%, rgba(0,245,255,.16), transparent 25%),
    radial-gradient(circle at 85% 20%, rgba(155,92,255,.18), transparent 28%),
    linear-gradient(180deg, var(--night) 0%, var(--glacial) 48%, #050716 100%);
  z-index: -4;
}

.design-tokens { display: none; }

.continuum { position: relative; isolation: isolate; }

.chapter {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  padding: 9vh 7vw;
  display: grid;
  align-items: center;
}

.chapter::before {
  content: attr(data-chapter);
  position: absolute;
  top: 8vh;
  right: 5vw;
  font-family: var(--mono);
  font-size: .72rem;
  color: rgba(232,231,255,.45);
  letter-spacing: .22em;
  text-transform: uppercase;
}

.chapter::after {
  content: "ALT " attr(data-altitude);
  position: absolute;
  left: 3vw;
  bottom: 6vh;
  font-family: var(--mono);
  color: rgba(0,245,255,.45);
  writing-mode: vertical-rl;
  letter-spacing: .18em;
}

.hero { min-height: 112vh; }
.snowline { background: linear-gradient(180deg, rgba(8,26,58,.22), rgba(5,7,22,.72)); }
.pass { background: radial-gradient(circle at 72% 34%, rgba(255,43,214,.12), transparent 31%); }
.summit { background: linear-gradient(180deg, rgba(8,26,58,.5), rgba(5,7,22,.95)); }
.beyond { min-height: 108vh; background: radial-gradient(ellipse at 50% 72%, rgba(68,255,177,.1), transparent 42%); }

.site-title {
  position: relative;
  z-index: 7;
  max-width: 12ch;
  margin: 6vh 0 0 4vw;
  font-family: var(--display);
  font-size: clamp(4rem, 13vw, 12rem);
  line-height: .82;
  font-weight: 900;
  letter-spacing: -.08em;
  color: var(--snow);
  text-shadow: 0 0 18px rgba(0,245,255,.38), 12px 0 0 rgba(255,43,214,.12), -12px 0 0 rgba(68,255,177,.1);
  animation: titleDrift 8s ease-in-out infinite alternate;
}

.site-title::before,
.site-title::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  clip-path: polygon(0 28%, 100% 22%, 100% 37%, 0 43%);
  opacity: .72;
  pointer-events: none;
}

.site-title::before { color: var(--cyan); transform: translate(-10px, 2px); }
.site-title::after { color: var(--magenta); transform: translate(8px, -2px); clip-path: polygon(0 58%, 100% 54%, 100% 66%, 0 69%); }

.chapter-note {
  position: relative;
  z-index: 9;
  width: min(440px, 80vw);
  padding: 1.15rem 1.25rem 1.3rem;
  border-left: 1px solid var(--cyan);
  background: linear-gradient(90deg, rgba(8,26,58,.72), rgba(8,26,58,.08));
  box-shadow: 0 0 34px rgba(0,245,255,.09);
  backdrop-filter: blur(2px);
}

.note-left { margin-left: 4vw; align-self: start; }
.note-right { justify-self: end; margin-right: 6vw; }
.note-center { justify-self: center; text-align: center; border-left: 0; border-top: 1px solid var(--green); background: rgba(5,7,22,.35); }
.high { align-self: start; margin-top: 7vh; }

.coord {
  display: block;
  margin-bottom: .65rem;
  color: var(--green);
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .16em;
}

h2 {
  margin: 0 0 .7rem;
  font-family: var(--slab);
  font-weight: 600;
  font-size: clamp(2.1rem, 5vw, 5.8rem);
  line-height: .9;
  color: var(--snow);
}

p { margin: 0; color: rgba(232,231,255,.74); font-size: clamp(1rem, 1.35vw, 1.22rem); line-height: 1.65; }

.starfield {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(232,231,255,.8) 0 1px, transparent 1px),
    radial-gradient(circle, rgba(0,245,255,.55) 0 1px, transparent 1px);
  background-size: 93px 93px, 151px 151px;
  background-position: var(--stars-x, 0) var(--stars-y, 0), calc(var(--stars-x, 0) * -.5) calc(var(--stars-y, 0) * .3);
  opacity: .32;
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  opacity: .12;
  background: repeating-linear-gradient(180deg, transparent 0 4px, rgba(0,245,255,.18) 5px, transparent 7px);
  mix-blend-mode: screen;
}

.route-progress {
  position: fixed;
  left: 1.4rem;
  top: 14vh;
  width: 2px;
  height: 0;
  z-index: 28;
  background: linear-gradient(var(--cyan), var(--green), var(--magenta));
  box-shadow: 0 0 16px var(--cyan);
}

.aurora {
  position: absolute;
  z-index: 1;
  width: 72vw;
  height: 24vh;
  filter: blur(18px);
  opacity: .42;
  border-radius: 50%;
  background: linear-gradient(100deg, transparent, var(--cyan), var(--green), var(--violet), transparent);
  transform: rotate(-10deg);
  animation: auroraFlow 12s ease-in-out infinite alternate;
}

.aurora-one { top: 18vh; left: 22vw; }
.aurora-two { top: 5vh; left: -18vw; opacity: .25; transform: rotate(14deg); }
.aurora-three { top: 18vh; right: -15vw; opacity: .34; }

.glitch-seam {
  position: absolute;
  left: -4vw;
  right: -4vw;
  height: 9px;
  z-index: 10;
  background: linear-gradient(90deg, transparent, rgba(0,245,255,.55), transparent 35%, rgba(255,43,214,.45), transparent);
  box-shadow: 0 0 22px rgba(0,245,255,.35);
  animation: seamWind 6s steps(6) infinite;
}
.seam-one { top: 42vh; }
.seam-two { top: 56vh; height: 4px; animation-delay: -2s; }

.mountains, .contours, .route, .morph-stage, .summit-lines, .final-route {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  pointer-events: none;
}

.mountains.far { z-index: 2; fill: rgba(108,124,255,.22); filter: drop-shadow(0 -12px 30px rgba(0,245,255,.12)); }
.mountains.mid { z-index: 4; fill: rgba(8,26,58,.88); stroke: rgba(0,245,255,.28); stroke-width: 2; }
.mountains.foreground { z-index: 8; fill: rgba(5,7,22,.94); stroke: rgba(232,231,255,.18); stroke-width: 1.4; }

.route { z-index: 12; inset: auto 0 0; height: 100%; }
.route-line {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 12 18;
  filter: drop-shadow(0 0 12px var(--cyan));
  animation: trailPulse 3.5s linear infinite;
}
.route-line.alt { stroke: var(--green); }
.route-line.final { stroke: var(--haze); stroke-width: 2; }

.scroll-invitation {
  position: absolute;
  bottom: 11vh;
  left: 16vw;
  z-index: 14;
  font-family: var(--mono);
  color: var(--cyan);
  font-size: .76rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  animation: breathe 2.8s ease-in-out infinite;
}

.contours { top: 9vh; left: 8vw; width: 72vw; height: 72vh; z-index: 3; fill: none; stroke: rgba(68,255,177,.32); stroke-width: 2; }
.broken-horizon { position: absolute; top: 28vh; left: 0; right: 0; height: 28px; z-index: 5; background: repeating-linear-gradient(90deg, transparent 0 46px, rgba(0,245,255,.35) 48px 93px, transparent 96px 120px); opacity: .42; }

.pixel-snow, .magenta-sparks { position: absolute; inset: 0; pointer-events: none; z-index: 11; }
.snowflake, .spark { position: absolute; width: 3px; height: 3px; background: var(--snow); box-shadow: 0 0 8px currentColor; opacity: .7; }
.spark { background: var(--magenta); color: var(--magenta); }

.cairn { position: absolute; left: 22vw; bottom: 25vh; z-index: 13; width: 70px; height: 92px; }
.cairn i { position: absolute; left: 50%; transform: translateX(-50%); border: 1px solid rgba(0,245,255,.55); background: rgba(8,26,58,.75); box-shadow: 0 0 18px rgba(0,245,255,.22); }
.cairn i:nth-child(1) { bottom: 0; width: 62px; height: 22px; border-radius: 55% 45% 48% 52%; }
.cairn i:nth-child(2) { bottom: 23px; width: 46px; height: 20px; border-radius: 45% 52% 44% 55%; }
.cairn i:nth-child(3) { bottom: 45px; width: 26px; height: 30px; border-radius: 50%; background: var(--cyan); opacity: .65; }

.morph-stage { z-index: 4; bottom: 5vh; height: 72vh; }
.morph-stage path { fill: rgba(8,26,58,.8); stroke: var(--green); stroke-width: 2; filter: drop-shadow(0 -10px 24px rgba(68,255,177,.2)); transition: d .28s linear; }

.glyph.compass { position: absolute; right: 16vw; top: 28vh; z-index: 10; width: 85px; height: 85px; border: 1px solid rgba(68,255,177,.62); clip-path: polygon(50% 0, 100% 100%, 50% 72%, 0 100%); box-shadow: 0 0 24px rgba(68,255,177,.2); animation: compassFloat 5s ease-in-out infinite; }

.moon-portal { position: absolute; left: 16vw; top: 14vh; z-index: 2; width: clamp(150px, 18vw, 280px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 45% 45%, var(--snow), var(--cyan) 36%, rgba(155,92,255,.5) 52%, transparent 64%); box-shadow: 0 0 55px rgba(0,245,255,.42), inset 20px 0 rgba(255,43,214,.24); animation: portalGlitch 7s steps(7) infinite; }
.summit-lines { height: 72vh; z-index: 5; fill: none; stroke: rgba(232,231,255,.55); stroke-width: 2; filter: drop-shadow(0 0 14px rgba(108,124,255,.28)); }
.inscription { position: absolute; left: 8vw; bottom: 22vh; z-index: 12; font-family: var(--display); font-size: clamp(2.4rem, 6vw, 7rem); line-height: .9; max-width: 10ch; color: rgba(232,231,255,.86); text-shadow: 0 0 18px rgba(155,92,255,.35); }

.endless-ridge { position: absolute; left: -5vw; right: -5vw; bottom: 0; height: 48vh; z-index: 3; background: linear-gradient(145deg, transparent 0 28%, rgba(0,245,255,.18) 29%, rgba(8,26,58,.86) 31% 100%), linear-gradient(18deg, rgba(5,7,22,1) 0 46%, transparent 47%); filter: drop-shadow(0 -24px 45px rgba(68,255,177,.16)); }
.final-route { z-index: 9; height: 100%; }
.embedded-action { display: inline-block; margin-top: 1.4rem; color: var(--green); font-family: var(--slab); font-size: 1.35rem; text-decoration: none; border-bottom: 1px solid var(--green); text-shadow: 0 0 12px rgba(68,255,177,.45); }

@keyframes titleDrift { from { filter: hue-rotate(0deg); } to { filter: hue-rotate(8deg); } }
@keyframes auroraFlow { from { transform: translateX(-4vw) rotate(-10deg) scaleX(.92); } to { transform: translateX(8vw) rotate(-4deg) scaleX(1.08); } }
@keyframes seamWind { 0%, 100% { transform: translateX(-3vw) scaleX(.9); opacity: .18; } 45% { transform: translateX(7vw) scaleX(1.08); opacity: .68; } 52% { transform: translateX(2vw) scaleX(.7); opacity: .35; } }
@keyframes trailPulse { to { stroke-dashoffset: -60; } }
@keyframes breathe { 0%,100% { opacity: .35; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-10px); } }
@keyframes compassFloat { 0%,100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-18px) rotate(7deg); } }
@keyframes portalGlitch { 0%,100% { transform: translate(0,0); } 30% { transform: translate(8px,-2px); } 32% { transform: translate(-5px,3px); } 70% { transform: translate(2px,0); } }

@media (max-width: 760px) {
  .chapter { padding: 8vh 5vw; }
  .site-title { margin-left: 0; font-size: clamp(3.5rem, 18vw, 7rem); }
  .chapter-note { width: 90vw; margin-left: 0; margin-right: 0; justify-self: start; }
  .note-right { justify-self: start; }
  .inscription { bottom: 18vh; }
}
