:root {
    --ivory: #F2E8D2;
    --burgundy: #7A1E33;
    --brass: #B89555;
    --slate-blue: #8EA7B8;
    --green-black: #2B3A31;
    --void: #111018;
    --display: "Cormorant Garamond", serif;
    --jp: "Noto Serif JP", serif;
    --space: "Space Grotesk", sans-serif;
    --note: "Spectral", serif;
}

/* DESIGN typography tokens: Space Grotesk* Grotesk** for small structural labels */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--void);
    color: var(--ivory);
    font-family: var(--note);
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 18% 12%, rgba(142, 167, 184, 0.18), transparent 30vw),
        radial-gradient(circle at 78% 38%, rgba(122, 30, 51, 0.24), transparent 28vw),
        linear-gradient(115deg, rgba(43, 58, 49, 0.35), transparent 45%, rgba(17, 16, 24, 0.8));
    pointer-events: none;
    z-index: -3;
}

.grain {
    position: fixed;
    inset: 0;
    opacity: 0.32;
    pointer-events: none;
    z-index: 20;
    background-image:
        repeating-radial-gradient(circle at 17% 31%, rgba(242, 232, 210, 0.08) 0 1px, transparent 1px 4px),
        repeating-linear-gradient(103deg, rgba(184, 149, 85, 0.035) 0 1px, transparent 1px 9px);
    mix-blend-mode: soft-light;
}

.cursor-candle {
    position: fixed;
    width: 18rem;
    height: 18rem;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(242, 232, 210, 0.16), rgba(184, 149, 85, 0.07) 32%, transparent 68%);
    pointer-events: none;
    z-index: 18;
    opacity: 0.7;
}

.archive-nav {
    position: fixed;
    top: 1.4rem;
    left: 1.4rem;
    right: 1.4rem;
    display: flex;
    align-items: center;
    gap: 1.1rem;
    z-index: 30;
    font-family: var(--space);
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(242, 232, 210, 0.56);
}

.archive-nav::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(184, 149, 85, 0.5), transparent);
}

.archive-nav a {
    color: rgba(242, 232, 210, 0.58);
    text-decoration: none;
    transition: color 0.35s ease, transform 0.35s ease;
}

.archive-nav a:hover { color: var(--brass); transform: translateY(-2px); }
.archive-mark { color: var(--brass); margin-right: auto; }

.argumentarium { position: relative; }

.theorem-room {
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    padding: 9rem 7vw 6rem;
    border-bottom: 1px solid rgba(184, 149, 85, 0.14);
}

.theorem-room::before {
    content: attr(data-room);
    position: absolute;
    right: 4vw;
    bottom: 2.2rem;
    font-family: var(--space);
    font-size: clamp(5rem, 16vw, 18rem);
    color: rgba(242, 232, 210, 0.025);
    line-height: 0.8;
}

.axiom-hall {
    display: grid;
    grid-template-columns: 1fr 0.7fr;
    align-items: center;
    background:
        linear-gradient(135deg, rgba(17, 16, 24, 0.65), rgba(43, 58, 49, 0.34)),
        radial-gradient(circle at 64% 46%, rgba(242, 232, 210, 0.08), transparent 28rem);
}

.coordinate, .room-index, .lemma-label {
    font-family: var(--space);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-size: 0.74rem;
    color: var(--slate-blue);
}

.kanji {
    position: absolute;
    left: -3vw;
    top: 8vh;
    margin: 0;
    font-family: var(--jp);
    font-weight: 700;
    font-size: clamp(13rem, 34vw, 38rem);
    line-height: 0.78;
    letter-spacing: -0.16em;
    color: rgba(242, 232, 210, 0.84);
    text-shadow: 0 0 42px rgba(184, 149, 85, 0.18);
    clip-path: inset(0 0 8% 0);
}

.hero-vellum {
    position: absolute;
    width: 40vw;
    height: 72vh;
    right: 10vw;
    top: 14vh;
    transform: rotate(7deg);
}

.vellum-plane, .vellum-sheet, .instrument {
    background:
        linear-gradient(135deg, rgba(242, 232, 210, 0.15), rgba(242, 232, 210, 0.04)),
        repeating-linear-gradient(90deg, transparent 0 18px, rgba(184, 149, 85, 0.05) 18px 19px);
    border: 1px solid rgba(242, 232, 210, 0.18);
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.34), inset 0 0 44px rgba(242, 232, 210, 0.035);
}

.theorem-seal {
    position: absolute;
    right: 9vw;
    top: 36vh;
    width: 15rem;
    height: 15rem;
    border: 1px solid rgba(184, 149, 85, 0.72);
    border-radius: 50%;
    display: grid;
    place-content: center;
    text-align: center;
    color: var(--ivory);
    background: radial-gradient(circle, rgba(122, 30, 51, 0.42), transparent 68%);
}

.theorem-seal::before { content: ""; position: absolute; inset: 1.1rem; border: 1px dashed rgba(184,149,85,.45); border-radius: 50%; animation: rotateSeal 28s linear infinite; }
.theorem-seal span { font-family: var(--space); letter-spacing: 0.24em; color: var(--brass); font-size: 0.72rem; }
.theorem-seal strong { display: block; max-width: 9rem; margin-top: .45rem; font-family: var(--display); font-weight: 500; font-size: 1.25rem; }

.margin-note {
    position: absolute;
    max-width: 14rem;
    font-family: var(--jp);
    color: rgba(242, 232, 210, 0.62);
    font-size: 0.86rem;
    line-height: 1.75;
    border-left: 1px solid rgba(184, 149, 85, 0.55);
    padding-left: 1rem;
}

.note-a { left: 7vw; bottom: 14vh; }
.note-b { right: 5vw; bottom: 10vh; }
.note-c { right: 12vw; top: 26vh; }
.note-d { left: 8vw; bottom: 16vh; }

.proof-constellation { position: absolute; inset: 0; pointer-events: none; }
.star { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--ivory); box-shadow: 0 0 16px var(--ivory); opacity: 0.86; }
.line { position: absolute; height: 1px; background: linear-gradient(90deg, transparent, rgba(142, 167, 184, 0.55), transparent); transform-origin: left center; }
.hero-constellation .s1 { left: 18%; top: 22%; } .hero-constellation .s2 { left: 34%; top: 30%; } .hero-constellation .s3 { left: 52%; top: 18%; } .hero-constellation .s4 { left: 71%; top: 42%; } .hero-constellation .s5 { left: 48%; top: 64%; } .hero-constellation .s6 { left: 83%; top: 72%; }
.hero-constellation .l1 { left: 18%; top: 23%; width: 18%; transform: rotate(18deg); } .hero-constellation .l2 { left: 34%; top: 30%; width: 22%; transform: rotate(-20deg); } .hero-constellation .l3 { left: 52%; top: 19%; width: 26%; transform: rotate(38deg); } .hero-constellation .l4 { left: 48%; top: 64%; width: 36%; transform: rotate(10deg); }

.manuscript-room { background: linear-gradient(160deg, rgba(242, 232, 210, 0.09), transparent 38%), var(--void); }
.diagonal-grid { position: absolute; inset: 0; background-image: linear-gradient(126deg, transparent 0 49%, rgba(184,149,85,.12) 49.5% 50%, transparent 50.5% 100%); background-size: 10rem 10rem; opacity: .45; transform: skewY(-8deg); }
.cropped-title, .model-orrery h2, .proof-table h2, .closing-room h2 {
    margin: 0;
    max-width: 64rem;
    font-family: var(--display);
    font-weight: 500;
    font-size: clamp(4rem, 12vw, 13rem);
    line-height: .78;
    color: rgba(242, 232, 210, .9);
}
.cropped-title { margin-left: 12vw; transform: rotate(-4deg); }
.primary-sheet { position: absolute; left: 10vw; bottom: 14vh; width: min(33rem, 72vw); padding: 2rem; transform: rotate(-3deg); }
.vellum-sheet p:not(.lemma-label) { font-size: clamp(1.1rem, 1.6vw, 1.45rem); line-height: 1.65; color: rgba(242,232,210,.78); }
.floating-lemma { position: absolute; width: 18rem; padding: 1.25rem; border: 1px solid rgba(142,167,184,.28); background: rgba(17,16,24,.72); }
.floating-lemma span { font-family: var(--space); color: var(--brass); font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; }
.floating-lemma p { margin-bottom: 0; color: rgba(242,232,210,.68); }
.lemma-one { right: 13vw; bottom: 20vh; transform: rotate(5deg); }
.lemma-two { left: 52vw; top: 18vh; transform: rotate(-8deg); }

.contradiction-balcony { background: radial-gradient(circle at 74% 42%, rgba(122, 30, 51, 0.5), transparent 36rem), linear-gradient(180deg, var(--void), #1b1018); }
.vertical-title { position: absolute; right: 6vw; top: 7rem; margin: 0; writing-mode: vertical-rl; font-family: var(--display); font-size: clamp(5rem, 13vw, 14rem); color: rgba(122, 30, 51, .82); line-height: .8; }
.contradiction-x { position: absolute; left: 18vw; top: 18vh; font-family: var(--display); font-size: clamp(14rem, 31vw, 34rem); color: rgba(122, 30, 51, .58); text-shadow: 0 0 26px rgba(122,30,51,.5); }
.balcony-copy { position: absolute; right: 22vw; bottom: 16vh; width: min(30rem, 58vw); font-size: 1.38rem; line-height: 1.6; color: rgba(242,232,210,.76); }
.fracture-map .s1 { left: 42%; top: 20%; } .fracture-map .s2 { left: 61%; top: 27%; } .fracture-map .s3 { left: 55%; top: 52%; } .fracture-map .s4 { left: 72%; top: 65%; } .fracture-map .s5 { left: 32%; top: 76%; }
.fracture-map .l1 { left: 42%; top: 21%; width: 20%; transform: rotate(17deg); } .fracture-map .l2 { left: 55%; top: 52%; width: 22%; transform: rotate(33deg); } .fracture-map .l3 { left: 32%; top: 76%; width: 26%; transform: rotate(-31deg); background: linear-gradient(90deg, transparent, rgba(122,30,51,.8), transparent); }

.model-orrery { background: linear-gradient(120deg, rgba(43,58,49,.7), transparent 55%), var(--void); }
.model-orrery h2 { max-width: 45rem; }
.orrery { position: absolute; right: 8vw; top: 12vh; width: min(42rem, 78vw); aspect-ratio: 1; border-radius: 50%; }
.orbit { position: absolute; inset: 10%; border: 1px solid rgba(184,149,85,.36); border-radius: 50%; animation: rotateSeal 38s linear infinite; }
.orbit-two { inset: 22%; animation-duration: 27s; animation-direction: reverse; border-color: rgba(142,167,184,.34); }
.orbit-three { inset: 34%; animation-duration: 19s; }
.plaque { position: absolute; top: -0.8rem; left: 50%; transform: translateX(-50%); padding: .4rem .7rem; background: var(--void); border: 1px solid rgba(184,149,85,.45); font-family: var(--space); font-size: .7rem; color: var(--brass); text-transform: uppercase; letter-spacing: .14em; }
.core-seal { position: absolute; inset: 39%; border-radius: 50%; display: grid; place-items: center; color: var(--ivory); font-family: var(--display); font-size: 7rem; background: radial-gradient(circle, rgba(184,149,85,.34), transparent 72%); }
.orrery-text { position: absolute; left: 9vw; bottom: 12vh; width: min(33rem, 76vw); padding: 2rem; }

.proof-table { background: linear-gradient(155deg, rgba(242,232,210,.07), rgba(122,30,51,.12)); }
.proof-table h2 { font-size: clamp(3.4rem, 8vw, 8rem); }
.instrument-row { position: absolute; left: 7vw; right: 7vw; bottom: 8vh; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; transform: rotate(-1.5deg); }
.instrument { min-height: 18rem; padding: 1.2rem; transition: transform .45s ease, background .45s ease; }
.instrument:hover { transform: translateY(-1rem) rotate(2deg); background-color: rgba(122,30,51,.18); }
.instrument span { font-family: var(--space); color: var(--slate-blue); letter-spacing: .16em; }
.instrument strong { display: block; margin: 3rem 0 1rem; font-family: var(--display); font-size: 2rem; font-weight: 500; color: var(--brass); }
.instrument p { color: rgba(242,232,210,.68); line-height: 1.55; }

.closing-room { display: grid; place-content: center; text-align: left; background: radial-gradient(circle at 50% 50%, rgba(142,167,184,.16), transparent 34rem), var(--void); }
.closing-room h2 { font-size: clamp(4rem, 10vw, 10rem); max-width: 74rem; }
.closing-copy { max-width: 43rem; margin-left: 20vw; font-size: 1.35rem; line-height: 1.8; color: rgba(242,232,210,.72); }
.closing-seal { right: auto; left: 7vw; top: auto; bottom: 10vh; }
.final-map .s1 { left: 18%; top: 36%; } .final-map .s2 { left: 29%; top: 24%; } .final-map .s3 { left: 48%; top: 38%; } .final-map .s4 { left: 63%; top: 26%; } .final-map .s5 { left: 78%; top: 48%; } .final-map .s6 { left: 55%; top: 70%; }
.final-map .l1 { left: 18%; top: 36%; width: 16%; transform: rotate(-42deg); } .final-map .l2 { left: 29%; top: 24%; width: 23%; transform: rotate(34deg); } .final-map .l3 { left: 48%; top: 38%; width: 18%; transform: rotate(-28deg); } .final-map .l4 { left: 63%; top: 26%; width: 18%; transform: rotate(39deg); } .final-map .l5 { left: 55%; top: 70%; width: 24%; transform: rotate(-34deg); }

.reveal { opacity: 0; transform: translateY(2.8rem); transition: opacity .9s ease, transform .9s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

@keyframes rotateSeal { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
    .archive-nav a { display: none; }
    .theorem-room { padding: 7rem 6vw 5rem; }
    .axiom-hall { display: block; }
    .hero-vellum, .theorem-seal, .orrery { position: relative; right: auto; top: auto; margin: 18rem auto 0; }
    .margin-note, .primary-sheet, .floating-lemma, .balcony-copy, .orrery-text { position: relative; left: auto; right: auto; top: auto; bottom: auto; margin: 2rem 0; width: auto; max-width: 100%; }
    .cropped-title { margin-left: 0; }
    .vertical-title, .contradiction-x { position: relative; left: auto; right: auto; top: auto; writing-mode: horizontal-tb; }
    .instrument-row { position: relative; left: auto; right: auto; bottom: auto; grid-template-columns: 1fr; margin-top: 3rem; }
    .closing-copy { margin-left: 0; }
}
