:root {
    --ink: #101522;
    --parchment: #F2E8D2;
    --glacial: #94B8C7;
    --teal: #2D6F73;
    --violet: #6B5A8E;
    --red: #C4473A;
    --gold: #D8A84E;
    --graphite: #29303A;
}

/* Compliance lexicon: Interprets “rational quest” as a cartographic expedition through doubt; Space Mono only for tiny coordinate labels. */

@keyframes vellum-breathe {
    0%, 100% { opacity: .86; transform: rotate(-5deg) translateY(0); }
    50% { opacity: 1; transform: rotate(-5deg) translateY(-8px); }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    color: var(--parchment);
    background: var(--ink);
    font-family: "Alegreya Sans", sans-serif;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 8% 18%, rgba(148, 184, 199, .16), transparent 28%),
        radial-gradient(circle at 72% 42%, rgba(107, 90, 142, .18), transparent 30%),
        radial-gradient(circle at 88% 94%, rgba(216, 168, 78, .24), transparent 34%),
        linear-gradient(135deg, #101522 0%, #29303A 44%, #F2E8D2 100%);
    z-index: -5;
}

.map-texture {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: .33;
    z-index: -4;
    background-image:
        repeating-linear-gradient(8deg, rgba(242, 232, 210, .05) 0 1px, transparent 1px 26px),
        repeating-linear-gradient(97deg, rgba(148, 184, 199, .045) 0 1px, transparent 1px 39px),
        radial-gradient(ellipse at center, transparent 0 55%, rgba(16, 21, 34, .72) 100%);
    mix-blend-mode: screen;
}

.cursor-lens {
    position: fixed;
    width: 170px;
    height: 170px;
    border-radius: 50%;
    pointer-events: none;
    border: 1px solid rgba(148, 184, 199, .35);
    background: radial-gradient(circle, rgba(148, 184, 199, .16), rgba(107, 90, 142, .09) 45%, transparent 70%);
    transform: translate(-50%, -50%) scale(.65);
    opacity: 0;
    z-index: 20;
    backdrop-filter: hue-rotate(18deg) contrast(1.15) saturate(1.35);
    transition: opacity .35s ease, transform .2s ease;
}

.cursor-lens.active { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.atlas-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 520vh;
    pointer-events: none;
    z-index: 1;
}

.contour {
    fill: none;
    stroke: rgba(242, 232, 210, .22);
    stroke-width: 2;
    stroke-dasharray: 8 12;
}

.contour-two, .contour-four { stroke: rgba(148, 184, 199, .2); }
.contour-three { stroke: rgba(107, 90, 142, .28); }
.contour-five { stroke: rgba(216, 168, 78, .28); }

.route-path {
    fill: none;
    stroke: url(#routeGradient);
    stroke-width: 5;
    stroke-linecap: round;
    stroke-dasharray: var(--route-length, 1);
    stroke-dashoffset: var(--route-length, 1);
    filter: url(#softGlow);
}

.bridge-lines path {
    fill: none;
    stroke: rgba(148, 184, 199, .54);
    stroke-width: 3;
    stroke-dasharray: 360;
    stroke-dashoffset: 360;
    transition: stroke-dashoffset 1s ease;
}

body.crossing-visible .bridge-lines path { stroke-dashoffset: 0; }

.expedition-legend {
    position: fixed;
    top: 26px;
    right: 28px;
    z-index: 12;
    display: grid;
    gap: 8px;
    padding: 14px 16px;
    color: var(--parchment);
    background: rgba(16, 21, 34, .48);
    border: 1px solid rgba(242, 232, 210, .22);
    transform: rotate(1.5deg);
    backdrop-filter: blur(9px);
}

.legend-title, .coordinates, .symbol, .evidence-island b, .probability-veil {
    font-family: "Space Mono", monospace;
    text-transform: uppercase;
    letter-spacing: .09em;
}

.legend-title { font-size: 10px; color: var(--glacial); }
.expedition-legend a { color: var(--parchment); text-decoration: none; font-size: 13px; }
.expedition-legend a.active { color: var(--gold); }

.quest { position: relative; z-index: 2; }

.scene {
    min-height: 100vh;
    position: relative;
    padding: 8vh 7vw;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 7vw;
    overflow: hidden;
}

.coordinates {
    position: absolute;
    left: 7vw;
    top: 5vh;
    font-size: 11px;
    color: rgba(148, 184, 199, .8);
}

.title-cluster {
    align-self: center;
    max-width: 780px;
    margin-left: 4vw;
    transform: translateY(4vh) rotate(-1deg);
}

.overline {
    display: block;
    color: var(--glacial);
    font-family: "Space Mono", monospace;
    font-size: 12px;
    letter-spacing: .18em;
    text-transform: uppercase;
}

h1, h2 {
    font-family: "Cormorant Garamond", serif;
    font-weight: 600;
    line-height: .92;
    margin: 0;
}

h1 {
    font-size: clamp(74px, 13vw, 190px);
    letter-spacing: -.07em;
    color: transparent;
    -webkit-text-stroke: 1px rgba(242, 232, 210, .78);
    text-shadow: 0 14px 52px rgba(0, 0, 0, .42);
}

h1 span { color: var(--red); -webkit-text-stroke: 0; }

h2 {
    font-size: clamp(48px, 7vw, 100px);
    color: var(--parchment);
    margin: 10px 0 18px;
}

.inscription, blockquote, .final-quote {
    font-family: "Fraunces", serif;
    font-weight: 650;
}

.inscription {
    max-width: 560px;
    color: rgba(242, 232, 210, .76);
    font-size: clamp(23px, 3vw, 42px);
    line-height: 1.05;
}

.vellum {
    position: absolute;
    background: rgba(242, 232, 210, .13);
    border: 1px solid rgba(242, 232, 210, .18);
    backdrop-filter: blur(3px);
    box-shadow: 0 30px 70px rgba(0, 0, 0, .28);
}

.veil-one { width: 54vw; height: 28vh; left: 19vw; top: 28vh; transform: rotate(-5deg); }
.veil-one { animation: vellum-breathe 8s ease-in-out infinite; }

.cartouche {
    position: relative;
    background: linear-gradient(135deg, rgba(242, 232, 210, .13), rgba(16, 21, 34, .34));
    border: 1px solid rgba(242, 232, 210, .28);
    padding: clamp(24px, 4vw, 48px);
    color: var(--parchment);
    box-shadow: 0 26px 80px rgba(0, 0, 0, .26);
    backdrop-filter: blur(8px);
    clip-path: polygon(0 18px, 18px 0, calc(100% - 34px) 0, 100% 34px, 100% calc(100% - 18px), calc(100% - 18px) 100%, 26px 100%, 0 calc(100% - 26px));
}

.cartouche::after {
    content: "";
    position: absolute;
    right: 18px;
    top: 18px;
    width: 62px;
    height: 62px;
    border-top: 1px solid rgba(216, 168, 78, .52);
    border-right: 1px solid rgba(216, 168, 78, .52);
}

.cartouche p, .margin-note, .evidence-island p {
    font-size: clamp(18px, 1.55vw, 23px);
    line-height: 1.42;
    margin: 0;
}

.symbol { display: block; color: var(--glacial); font-size: 11px; }
.symbol.danger { color: var(--red); }
.symbol.gold { color: var(--gold); }

.opening-cairn { width: min(520px, 86vw); align-self: end; margin: 0 0 10vh 7vw; }
.fen-text { width: min(620px, 82vw); margin-top: 23vh; margin-left: 39vw; }
.ridge-text { width: min(610px, 82vw); margin-top: 13vh; margin-left: 6vw; }
.crossing-text { width: min(610px, 82vw); margin-top: 14vh; margin-left: 42vw; }
.conclusion-text { width: min(660px, 86vw); margin-top: 18vh; margin-left: 14vw; }

.margin-note {
    align-self: center;
    color: rgba(242, 232, 210, .68);
    border-left: 1px solid rgba(148, 184, 199, .45);
    padding: 22px;
    background: rgba(16, 21, 34, .22);
    transform: rotate(2deg);
}

.note-two, .note-four { transform: rotate(-2deg); }

.compass {
    position: absolute;
    right: 18vw;
    top: 16vh;
    width: 170px;
    height: 170px;
    color: var(--glacial);
    font-family: "Space Mono", monospace;
    opacity: .86;
}

.ring { position: absolute; inset: 0; border: 1px solid rgba(148, 184, 199, .52); border-radius: 50%; }
.ring::before, .ring::after { content: ""; position: absolute; inset: 22px; border: 1px dashed rgba(242, 232, 210, .28); border-radius: 50%; }
.ring::after { inset: 48px; border-color: rgba(216, 168, 78, .35); }
.needle { position: absolute; left: 50%; top: 50%; color: var(--red); font-size: 72px; transform: translate(-50%, -50%) rotate(var(--needle-rotate, -28deg)); transform-origin: 50% 62%; transition: transform .2s ease; }
.compass span { position: absolute; font-size: 11px; }
.compass span:nth-of-type(1) { top: -18px; left: 50%; }
.compass span:nth-of-type(2) { right: -18px; top: 50%; }
.compass span:nth-of-type(3) { bottom: -18px; left: 50%; }
.compass span:nth-of-type(4) { left: -18px; top: 50%; }

.fog {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(107, 90, 142, .38), rgba(148, 184, 199, .11), transparent 65%);
    filter: blur(16px);
    transition: opacity .8s ease, transform .8s ease;
}
.fog-a { width: 48vw; height: 38vh; left: -7vw; top: 24vh; }
.fog-b { width: 52vw; height: 42vh; right: 4vw; top: 38vh; }
.fog-c { width: 34vw; height: 30vh; left: 26vw; top: 8vh; }
.scene-fen.examined .fog { opacity: .28; transform: scale(1.25); }

.bias-thorns { position: absolute; left: 10vw; bottom: 14vh; width: 360px; height: 150px; }
.bias-thorns i { position: absolute; bottom: 0; width: 2px; background: var(--red); transform-origin: bottom; box-shadow: 0 0 18px rgba(196, 71, 58, .6); }
.bias-thorns i:nth-child(1) { height: 88px; left: 20px; transform: rotate(-28deg); }
.bias-thorns i:nth-child(2) { height: 132px; left: 82px; transform: rotate(18deg); }
.bias-thorns i:nth-child(3) { height: 68px; left: 144px; transform: rotate(-9deg); }
.bias-thorns i:nth-child(4) { height: 118px; left: 206px; transform: rotate(24deg); }
.bias-thorns i:nth-child(5) { height: 94px; left: 268px; transform: rotate(-22deg); }
.bias-thorns i:nth-child(6) { height: 54px; left: 328px; transform: rotate(12deg); }

.contradiction-thread {
    position: absolute;
    left: 22vw;
    top: 52vh;
    width: 0;
    height: 2px;
    background: var(--red);
    box-shadow: 0 0 18px rgba(196, 71, 58, .8);
    transform: rotate(-11deg);
    transition: width 1.2s cubic-bezier(.2, .8, .1, 1);
}
.scene-fen.examined .contradiction-thread { width: 48vw; }
.contradiction-thread span { position: absolute; right: -120px; top: -28px; color: var(--red); font-family: "Space Mono", monospace; font-size: 10px; text-transform: uppercase; }

.evidence-island {
    position: absolute;
    left: 9vw;
    top: 18vh;
    width: 240px;
    padding: 22px;
    color: var(--graphite);
    background: rgba(242, 232, 210, .78);
    border: 1px solid rgba(45, 111, 115, .46);
    transform: rotate(-6deg);
}
.evidence-island b { color: var(--teal); font-size: 11px; }

blockquote {
    position: absolute;
    right: 12vw;
    top: 24vh;
    width: min(420px, 36vw);
    margin: 0;
    color: rgba(242, 232, 210, .72);
    font-size: clamp(28px, 4vw, 58px);
    line-height: .98;
    transform: rotate(4deg);
}

.premise-stones { position: absolute; left: 18vw; bottom: 14vh; display: flex; gap: 24px; }
.stone {
    width: 82px;
    height: 92px;
    border: 1px solid rgba(148, 184, 199, .45);
    background: linear-gradient(145deg, rgba(41, 48, 58, .92), rgba(242, 232, 210, .18));
    color: var(--parchment);
    font-family: "Space Mono", monospace;
    transform: skew(-8deg) rotate(var(--r, 0deg));
    cursor: pointer;
}
.stone:nth-child(1) { --r: -7deg; }
.stone:nth-child(2) { --r: 4deg; margin-top: -28px; }
.stone:nth-child(3) { --r: 10deg; }

.bridge-facets { position: absolute; left: 12vw; bottom: 20vh; width: 46vw; height: 260px; }
.bridge-facets span {
    position: absolute;
    width: 160px;
    height: 88px;
    border: 1px solid rgba(148, 184, 199, .72);
    background: linear-gradient(135deg, rgba(148, 184, 199, .08), rgba(242, 232, 210, .18));
    clip-path: polygon(20% 0, 100% 22%, 82% 100%, 0 70%);
    opacity: 0;
    transform: translateY(44px) rotate(-8deg);
    transition: opacity .7s ease, transform .7s ease;
}
.bridge-facets span:nth-child(1) { left: 0; top: 108px; transition-delay: .05s; }
.bridge-facets span:nth-child(2) { left: 120px; top: 70px; transition-delay: .2s; }
.bridge-facets span:nth-child(3) { left: 250px; top: 110px; transition-delay: .35s; }
.bridge-facets span:nth-child(4) { left: 380px; top: 58px; transition-delay: .5s; }
.bridge-facets span:nth-child(5) { left: 510px; top: 100px; transition-delay: .65s; }
.bridge-facets span:nth-child(6) { left: 640px; top: 52px; transition-delay: .8s; }
body.crossing-visible .bridge-facets span { opacity: 1; transform: translateY(0) rotate(0deg); }

.probability-veil {
    position: absolute;
    left: 19vw;
    top: 22vh;
    color: rgba(148, 184, 199, .78);
    font-size: 13px;
    padding: 20px 34px;
    border: 1px solid rgba(148, 184, 199, .28);
    background: rgba(148, 184, 199, .06);
    transform: rotate(-3deg);
}

.dawn-wash {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 88% 18%, rgba(216, 168, 78, .62), rgba(242, 232, 210, .23) 30%, transparent 64%);
    opacity: 0;
    transition: opacity 1.4s ease;
}
body.dawn-visible .dawn-wash { opacity: 1; }

.wax-seal {
    width: 108px;
    height: 108px;
    display: grid;
    place-items: center;
    margin-top: 28px;
    border-radius: 50%;
    background: radial-gradient(circle, #C4473A, #8f2d28);
    color: var(--parchment);
    font-family: "Fraunces", serif;
    font-size: 18px;
    transform: rotate(-12deg);
    box-shadow: 0 18px 38px rgba(0, 0, 0, .28);
}

.final-quote { right: 10vw; top: 58vh; color: var(--graphite); text-shadow: 0 1px 0 rgba(242, 232, 210, .3); }
.scene-dawn { color: var(--graphite); }
.scene-dawn .cartouche { background: rgba(242, 232, 210, .62); color: var(--graphite); border-color: rgba(216, 168, 78, .55); }
.scene-dawn h2 { color: var(--graphite); }
.scene-dawn .margin-note { color: rgba(41, 48, 58, .76); background: rgba(242, 232, 210, .34); }

.flag {
    margin-top: 24px;
    border: 1px solid rgba(216, 168, 78, .6);
    background: rgba(216, 168, 78, .12);
    color: var(--gold);
    padding: 10px 14px;
    font-family: "Space Mono", monospace;
    text-transform: uppercase;
    font-size: 11px;
    cursor: pointer;
}

.flag-crossing { position: absolute; right: 19vw; bottom: 22vh; }

.fragment-panel {
    position: fixed;
    left: 50%;
    bottom: 28px;
    width: min(560px, 88vw);
    transform: translate(-50%, 130%) rotate(-1deg);
    z-index: 30;
    padding: 28px;
    color: var(--graphite);
    background: rgba(242, 232, 210, .94);
    border: 1px solid rgba(45, 111, 115, .36);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .36);
    transition: transform .45s cubic-bezier(.2, .8, .2, 1);
}
.fragment-panel.open { transform: translate(-50%, 0) rotate(-1deg); }
.fragment-panel button { float: right; border: 0; background: var(--graphite); color: var(--parchment); padding: 8px 12px; font-family: "Space Mono", monospace; }
.fragment-panel p { margin: 26px 0 0; font-family: "Fraunces", serif; font-size: 28px; line-height: 1.1; }

.hover-note {
    position: fixed;
    z-index: 31;
    max-width: 260px;
    padding: 14px 16px;
    color: var(--graphite);
    background: rgba(242, 232, 210, .92);
    border: 1px solid rgba(45, 111, 115, .35);
    font-size: 16px;
    pointer-events: none;
    opacity: 0;
    transform: translate(16px, 18px) rotate(2deg);
    transition: opacity .2s ease;
}
.hover-note.show { opacity: 1; }

.scene .cartouche, .scene blockquote, .margin-note, .evidence-island, .premise-stones, .probability-veil {
    opacity: 0;
    transform: translateY(32px) rotate(var(--entry-rot, 0deg));
    transition: opacity .75s ease, transform .75s ease;
}
.scene.in-view .cartouche, .scene.in-view blockquote, .scene.in-view .margin-note, .scene.in-view .evidence-island, .scene.in-view .premise-stones, .scene.in-view .probability-veil {
    opacity: 1;
    transform: translateY(0) rotate(var(--entry-rot, 0deg));
}
.note-one, .note-three { --entry-rot: 2deg; }
.note-two, .note-four { --entry-rot: -2deg; }
.evidence-island { --entry-rot: -6deg; }
blockquote { --entry-rot: 4deg; }

@media (max-width: 860px) {
    .expedition-legend { display: none; }
    .scene { grid-template-columns: 1fr; padding: 10vh 6vw; }
    .margin-note { align-self: end; }
    .fen-text, .ridge-text, .crossing-text, .conclusion-text, .opening-cairn { margin-left: 0; width: 100%; }
    blockquote { position: relative; right: auto; top: auto; width: 100%; margin: 30px 0; }
    .bridge-facets { left: 4vw; width: 90vw; transform: scale(.7); transform-origin: left bottom; }
    .premise-stones { left: 7vw; }
    .compass { right: 8vw; top: 14vh; width: 120px; height: 120px; }
    .needle { font-size: 54px; }
}
