:root {
    --ring-night: #050816;
    --inner-ocean: #0A6F78;
    --aurora-reed: #8EF2B3;
    --sunline: #F6C85F;
    --cloud-pearl: #EAF6F0;
    --engine-violet: #33205F;
    --rust-clay: #A65F3D;
    --bio-blue: #5DE7FF;
    --title-font: "Fraunces", serif;
    --label-font: "Syne", sans-serif;
    --body-font: "Alegreya Sans", sans-serif;
    --machine-font: "Orbitron", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    color: var(--cloud-pearl);
    background: var(--ring-night);
    font-family: var(--body-font);
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 24% 18%, rgba(93, 231, 255, 0.12), transparent 28%),
        radial-gradient(circle at 78% 86%, rgba(51, 32, 95, 0.55), transparent 34%),
        linear-gradient(180deg, #050816 0%, #081023 42%, #050816 100%);
    z-index: -4;
}

.grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.18;
    z-index: 20;
    background-image:
        linear-gradient(90deg, rgba(234, 246, 240, 0.045) 1px, transparent 1px),
        linear-gradient(0deg, rgba(234, 246, 240, 0.035) 1px, transparent 1px),
        radial-gradient(circle, rgba(246, 200, 95, 0.18) 0 1px, transparent 1px);
    background-size: 89px 89px, 137px 137px, 7px 7px;
    mix-blend-mode: screen;
}

.scroll-orbit {
    position: fixed;
    width: 92vmin;
    height: 92vmin;
    right: -48vmin;
    top: 4vmin;
    border: 1px solid rgba(142, 242, 179, 0.18);
    border-radius: 50%;
    pointer-events: none;
    z-index: 6;
    transform: rotate(0deg);
}

.scroll-orbit::before, .scroll-orbit::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    inset: 12%;
    border: 1px dashed rgba(93, 231, 255, 0.15);
}

.scroll-orbit::after {
    inset: 46% auto auto 46%;
    width: 18px;
    height: 18px;
    background: var(--sunline);
    box-shadow: 0 0 24px var(--sunline);
    border: 0;
}

.ring-index {
    position: fixed;
    width: 250px;
    height: 250px;
    right: 34px;
    top: calc(50% - 125px);
    border: 1px solid rgba(234, 246, 240, 0.2);
    border-radius: 50%;
    z-index: 30;
    transition: transform 700ms cubic-bezier(.2,.8,.2,1);
}

.ring-index::before {
    content: "";
    position: absolute;
    inset: 38px;
    border: 1px dotted rgba(246, 200, 95, 0.35);
    border-radius: 50%;
}

.ring-index a {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 1px;
    height: 1px;
    color: rgba(234, 246, 240, 0.58);
    font-family: var(--label-font);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-decoration: none;
}

.ring-index a span {
    position: absolute;
    width: 118px;
    transform-origin: 0 50%;
    transition: color 350ms ease, text-shadow 350ms ease;
}

.ring-index a:nth-child(1) { transform: rotate(-92deg) translate(112px); }
.ring-index a:nth-child(2) { transform: rotate(-20deg) translate(112px); }
.ring-index a:nth-child(3) { transform: rotate(52deg) translate(112px); }
.ring-index a:nth-child(4) { transform: rotate(124deg) translate(112px); }
.ring-index a:nth-child(5) { transform: rotate(196deg) translate(112px); }
.ring-index a.is-active span { color: var(--aurora-reed); text-shadow: 0 0 14px var(--aurora-reed); }

.scene {
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background:
        radial-gradient(circle at 12% 74%, rgba(10, 111, 120, 0.18), transparent 30%),
        linear-gradient(180deg, rgba(5, 8, 22, 0.2), rgba(5, 8, 22, 0.96));
}

.scene::before {
    content: attr(data-chapter);
    position: absolute;
    left: 4vw;
    top: 5vh;
    color: rgba(246, 200, 95, 0.35);
    font-family: var(--machine-font);
    font-size: clamp(2.5rem, 8vw, 7rem);
    letter-spacing: -0.08em;
    z-index: -1;
}

.ring-curve {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    transform-origin: 50% 55%;
    transition: transform 900ms cubic-bezier(.2,.8,.2,1);
}

.scene-active .ring-curve { transform: rotate(var(--tilt, 0deg)) scale(1.015); }

.land-shadow { fill: rgba(10, 111, 120, 0.22); filter: drop-shadow(0 0 45px rgba(93, 231, 255, 0.12)); }
.land-ribbon { fill: none; stroke: url(#landGlow); stroke-width: 54; stroke-linecap: round; stroke-dasharray: 10 7; opacity: 0.9; }
.sunline { fill: none; stroke: var(--sunline); stroke-width: 5; stroke-linecap: round; filter: drop-shadow(0 0 14px #F6C85F); }
.route-line { fill: none; stroke: var(--cloud-pearl); stroke-width: 2; stroke-dasharray: 8 12; opacity: 0.74; stroke-dashoffset: 700; transition: stroke-dashoffset 1800ms ease; }
.scene-active .route-line { stroke-dashoffset: 0; }

.arc-title {
    font-family: var(--title-font);
    font-size: 76px;
    font-weight: 700;
    fill: var(--cloud-pearl);
    letter-spacing: -0.04em;
    filter: drop-shadow(0 0 20px rgba(93, 231, 255, 0.24));
}

.glints circle { fill: var(--aurora-reed); filter: drop-shadow(0 0 8px #8EF2B3); animation: glint 2.8s ease-in-out infinite alternate; }

.chapter-copy {
    position: absolute;
    max-width: 520px;
    left: clamp(26px, 8vw, 126px);
    bottom: clamp(46px, 12vh, 130px);
    z-index: 5;
}

.kicker, .artifact, .angled-label, .completion-seal, .trail-prompt {
    font-family: var(--label-font);
    text-transform: uppercase;
    letter-spacing: 0.17em;
}

.kicker { color: var(--aurora-reed); font-size: 12px; margin: 0 0 16px; }
h1, h2 {
    font-family: var(--title-font);
    font-weight: 700;
    line-height: 0.86;
    letter-spacing: -0.055em;
    margin: 0;
}
h1 { font-size: clamp(4rem, 11vw, 11.5rem); max-width: 900px; }
h2 { font-size: clamp(3.2rem, 8vw, 8.7rem); }
.chapter-copy p:not(.kicker) {
    font-size: clamp(1.15rem, 1.65vw, 1.55rem);
    line-height: 1.35;
    color: rgba(234, 246, 240, 0.82);
    margin: 22px 0 0;
}
.trail-prompt {
    display: inline-block;
    margin-top: 28px;
    color: var(--sunline);
    text-decoration: none;
    font-size: 12px;
    border-bottom: 1px solid rgba(246, 200, 95, 0.45);
    padding-bottom: 8px;
}

.longitude, .artifact, .completion-seal {
    position: absolute;
    font-family: var(--machine-font);
    color: var(--sunline);
    font-size: 11px;
    letter-spacing: 0.18em;
}
.longitude-a { right: 24vw; top: 26vh; transform: rotate(-17deg); }

.ocean { background: linear-gradient(180deg, #050816 0%, #08182a 34%, #050816 100%); }
.overhead-ocean {
    position: absolute;
    left: -8vw;
    right: -8vw;
    top: -28vh;
    height: 56vh;
    border-radius: 0 0 50% 50%;
    background: linear-gradient(180deg, rgba(93, 231, 255, 0.55), rgba(10, 111, 120, 0.42), rgba(5, 8, 22, 0));
    filter: drop-shadow(0 24px 70px rgba(93, 231, 255, 0.18));
}
.shoreline { position: absolute; inset: auto 12% 10% 12%; height: 36px; border-top: 3px solid var(--cloud-pearl); border-radius: 50%; opacity: 0.5; }
.ripple { position: absolute; left: 8%; right: 8%; height: 80px; border-radius: 50%; border: 1px solid rgba(234, 246, 240, 0.3); animation: ripple 7s ease-in-out infinite; }
.ripple-one { bottom: 18%; }
.ripple-two { bottom: 3%; animation-delay: -3s; }
.wave-shadow { position: absolute; inset: 68% 0 -35% 0; background: repeating-linear-gradient(90deg, transparent 0 36px, rgba(93, 231, 255, 0.08) 40px 48px); transform: skewY(-8deg); animation: drift 9s linear infinite; }
.ocean-copy { right: 12vw; left: auto; top: 38vh; bottom: auto; transform: rotate(-4deg); }
.artifact { left: 12vw; bottom: 18vh; color: var(--cloud-pearl); border: 1px solid rgba(166, 95, 61, 0.6); padding: 12px 16px; background: rgba(166, 95, 61, 0.12); transform: rotate(7deg); }

.city { background: radial-gradient(circle at 80% 35%, rgba(166, 95, 61, 0.18), transparent 28%), #050816; }
.settlements path { fill: var(--rust-clay); stroke: var(--sunline); stroke-width: 2; filter: drop-shadow(0 0 12px rgba(246, 200, 95, 0.32)); }
.city-copy { left: 10vw; top: 22vh; bottom: auto; }
.angled-label { position: absolute; color: var(--bio-blue); font-size: 11px; padding: 8px 12px; border-top: 1px solid currentColor; }
.label-one { left: 48vw; top: 27vh; transform: rotate(-28deg); }
.label-two { right: 16vw; top: 41vh; transform: rotate(12deg); color: var(--sunline); }
.birds { position: absolute; right: 22vw; bottom: 23vh; color: var(--cloud-pearl); font-size: 44px; letter-spacing: 0.55em; opacity: 0.48; transform: rotate(18deg); }

.gate { background: linear-gradient(90deg, #050816 0%, #0A6F78 48%, #33205F 100%); }
.portal { position: absolute; inset: 8vh 34vw 8vh 34vw; min-width: 310px; z-index: 1; }
.portal-rim { position: absolute; inset: 0; border: 2px solid rgba(234, 246, 240, 0.4); border-radius: 48% 48% 8% 8%; box-shadow: inset 0 0 60px rgba(93, 231, 255, 0.12), 0 0 80px rgba(51, 32, 95, 0.55); }
.cloud-band { position: absolute; left: -40%; right: -40%; height: 70px; border-radius: 50%; background: rgba(234, 246, 240, 0.18); filter: blur(10px); animation: cloudMorph 8s ease-in-out infinite; }
.band-one { top: 23%; }
.band-two { top: 51%; animation-delay: -4s; background: rgba(142, 242, 179, 0.13); }
.rain-curtain { position: absolute; inset: 12% 16% 8%; background: repeating-linear-gradient(90deg, transparent 0 11px, rgba(93, 231, 255, 0.36) 12px 14px); opacity: 0.45; animation: rainFall 1.8s linear infinite; }
.sun-shards i { position: absolute; width: 6px; height: 140px; background: var(--sunline); box-shadow: 0 0 24px #F6C85F; transform: rotate(28deg); }
.sun-shards i:nth-child(1) { left: 18%; top: 11%; }
.sun-shards i:nth-child(2) { left: 43%; top: 31%; height: 190px; }
.sun-shards i:nth-child(3) { left: 68%; top: 18%; }
.sun-shards i:nth-child(4) { left: 80%; top: 54%; height: 90px; }
.machine-serial { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); width: 280px; text-align: center; font-family: var(--machine-font); font-size: 10px; letter-spacing: 0.18em; color: var(--sunline); }
.gate-copy { left: 8vw; top: 18vh; bottom: auto; }

.orchard { background: radial-gradient(circle at 50% 80%, rgba(142, 242, 179, 0.18), transparent 34%), linear-gradient(180deg, #050816, #120b2a); }
.engine-orchard { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.vane { position: absolute; width: 18px; height: 52vh; bottom: 13vh; background: linear-gradient(180deg, rgba(234, 246, 240, 0), rgba(234, 246, 240, 0.22), rgba(51, 32, 95, 0)); transform-origin: bottom center; animation: vanePulse 5s ease-in-out infinite; }
.vane-a { left: 58vw; transform: rotate(-18deg); }
.vane-b { left: 70vw; transform: rotate(10deg); animation-delay: -1.5s; }
.vane-c { left: 82vw; transform: rotate(25deg); animation-delay: -3s; }
.tree { position: absolute; bottom: 18vh; width: 4px; height: 135px; background: var(--aurora-reed); box-shadow: 0 0 20px #8EF2B3; }
.tree span { position: absolute; left: 50%; top: -54px; width: 94px; height: 94px; transform: translateX(-50%); border-radius: 45% 55% 50% 45%; background: radial-gradient(circle, rgba(93, 231, 255, 0.85), rgba(142, 242, 179, 0.16) 56%, transparent 70%); animation: glowBreath 3.8s ease-in-out infinite; }
.tree-a { left: 18vw; height: 108px; }
.tree-b { left: 36vw; height: 155px; }
.tree-c { left: 61vw; height: 124px; }
.tree-d { left: 77vw; height: 172px; }
.orchard-copy { left: 9vw; top: 16vh; bottom: auto; }
.completion-seal { right: 14vw; bottom: 19vh; color: var(--aurora-reed); border: 1px solid rgba(142, 242, 179, 0.45); border-radius: 50%; width: 132px; height: 132px; display: grid; place-items: center; text-align: center; padding: 18px; }

@keyframes glint { from { opacity: 0.25; transform: translateY(0); } to { opacity: 1; transform: translateY(-5px); } }
@keyframes ripple { 0%, 100% { transform: translateX(-2%) scaleX(0.96); } 50% { transform: translateX(2%) scaleX(1.05); } }
@keyframes drift { from { transform: translateX(0) skewY(-8deg); } to { transform: translateX(-88px) skewY(-8deg); } }
@keyframes cloudMorph { 0%, 100% { transform: translateX(-7%) scaleY(0.7); } 50% { transform: translateX(7%) scaleY(1.35); } }
@keyframes rainFall { from { background-position: 0 0; } to { background-position: 0 42px; } }
@keyframes vanePulse { 0%, 100% { opacity: 0.22; filter: blur(0); } 50% { opacity: 0.75; filter: blur(1px); } }
@keyframes glowBreath { 0%, 100% { transform: translateX(-50%) scale(0.85); opacity: 0.62; } 50% { transform: translateX(-50%) scale(1.12); opacity: 1; } }

@media (max-width: 900px) {
    .ring-index { transform: scale(0.7); right: -36px; top: 14px; }
    .chapter-copy { left: 24px; right: 24px; max-width: calc(100% - 48px); }
    .ocean-copy, .city-copy, .gate-copy, .orchard-copy { left: 24px; right: 24px; top: 18vh; transform: none; }
    .portal { inset: 24vh 12vw 10vh 12vw; }
    .arc-title { font-size: 54px; }
}
