:root {
    /* Interactive highlights IntersectionObserver` triggers animations at `threshold: 0.3` — animations begin when 30% of the containing module enters the viewport. IntersectionObserver`. Each illustration uses: */
    --violet: #8B2FC9;
    --gold: #D4A017;
    --teal: #17A2A2;
    --parchment: #F2E8D5;
    --edge: #DDD0B8;
    --dark: #1A1712;
    --dark-soft: #2A2520;
    --umber: #3D2B1F;
    --cream: #E8DCC8;
    --red: #C73B3B;
    --moss: #6B7F3A;
    --stone: #8A7E6B;
    --fox: #C4A67A;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--parchment);
    color: var(--umber);
    font-family: "Inconsolata", monospace;
    font-size: clamp(0.85rem, 1.8vw, 1.1rem);
    line-height: 1.7;
    transition: background-color 0.25s ease, color 0.25s ease;
}

body.in-dark-zone {
    background: var(--dark);
    color: var(--cream);
}

.grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 20;
    opacity: 0.08;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.4' numOctaves='6' type='fractalNoise'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.7'/%3E%3C/svg%3E");
}

#cabinet {
    position: relative;
    z-index: 2;
}

.float-field {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.float-glyph {
    position: absolute;
    width: clamp(18px, 2.5vw, 32px);
    height: clamp(18px, 2.5vw, 32px);
    opacity: 0.1;
    fill: none;
    stroke: var(--umber);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    will-change: transform;
}

.glyph-one { top: 12%; left: 6%; animation: floatOne 56s linear infinite; }
.glyph-two { top: 28%; right: 8%; animation: floatTwo 74s linear infinite; }
.glyph-three { top: 58%; left: 4%; animation: floatThree 68s linear infinite; }
.glyph-four { top: 78%; right: 14%; animation: floatFour 82s linear infinite; }
.glyph-five { top: 42%; left: 84%; animation: floatFive 49s linear infinite; }
.glyph-six { top: 8%; left: 72%; animation: floatSix 90s linear infinite; }
.glyph-seven { top: 88%; left: 34%; animation: floatSeven 61s linear infinite; }
.glyph-eight { top: 66%; right: 35%; animation: floatEight 77s linear infinite; }

@keyframes floatOne { 50% { transform: translate(40vw, 20vh) rotate(160deg); } 100% { transform: translate(0, 0) rotate(360deg); } }
@keyframes floatTwo { 50% { transform: translate(-30vw, 18vh) rotate(-130deg); } 100% { transform: translate(0, 0) rotate(-360deg); } }
@keyframes floatThree { 50% { transform: translate(48vw, -22vh) rotate(90deg); } 100% { transform: translate(0, 0) rotate(360deg); } }
@keyframes floatFour { 50% { transform: translate(-28vw, -30vh) rotate(120deg); } 100% { transform: translate(0, 0) rotate(360deg); } }
@keyframes floatFive { 50% { transform: translate(-50vw, 11vh) rotate(-80deg); } 100% { transform: translate(0, 0) rotate(-360deg); } }
@keyframes floatSix { 50% { transform: translate(-20vw, 54vh) rotate(180deg); } 100% { transform: translate(0, 0) rotate(360deg); } }
@keyframes floatSeven { 50% { transform: translate(18vw, -44vh) rotate(-110deg); } 100% { transform: translate(0, 0) rotate(-360deg); } }
@keyframes floatEight { 50% { transform: translate(24vw, -18vh) rotate(70deg); } 100% { transform: translate(0, 0) rotate(360deg); } }

.threshold {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: clamp(1.5rem, 5vw, 5rem);
    background: radial-gradient(circle at center, var(--parchment) 0%, var(--edge) 100%);
    position: relative;
    box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.1);
}

.threshold::before,
.threshold::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(196, 166, 122, 0.18), rgba(196, 166, 122, 0));
}

.threshold::before { width: 32vw; height: 32vw; left: 7%; top: 14%; }
.threshold::after { width: 24vw; height: 24vw; right: 8%; bottom: 13%; }

.threshold-inner {
    width: min(94vw, 980px);
    text-align: center;
    position: relative;
    z-index: 2;
}

.title-sigil {
    width: 100%;
    min-height: 150px;
    filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.15));
}

.path-text {
    font-family: "Righteous", "Inter", sans-serif;
    font-size: clamp(2.4rem, 6vw, 5.2rem);
    letter-spacing: 0.04em;
    fill: transparent;
    stroke-width: 1.6px;
    stroke-linejoin: round;
}

.archive-code,
.drawer-label {
    display: inline-block;
    color: var(--stone);
    font-size: clamp(0.72rem, 1.4vw, 0.92rem);
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.daily-enigma {
    min-height: 4.4rem;
    margin: 1.25rem auto 0;
    color: var(--gold);
    font-family: "Bungee Shade", "Righteous", cursive;
    font-size: clamp(1.2rem, 3vw, 2.4rem);
    line-height: 1.25;
    max-width: 780px;
    text-shadow: 1px 1px 0 rgba(61, 43, 31, 0.22);
}

.collection {
    min-height: 150vh;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 16px;
    padding: clamp(1rem, 4vw, 4rem);
    background: var(--parchment);
}

.module {
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 800ms cubic-bezier(0.16, 1, 0.3, 1), transform 800ms cubic-bezier(0.16, 1, 0.3, 1), scale 220ms ease, border-color 220ms ease;
    border: 1px solid rgba(138, 126, 107, 0.46);
    background: radial-gradient(circle at 50% 42%, var(--parchment) 0%, var(--edge) 100%);
    box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.08), 0 18px 36px rgba(61, 43, 31, 0.11);
}

.module.visible {
    opacity: 1;
    transform: translateY(0);
}

.module::before,
.module::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, rgba(196, 166, 122, 0.12), rgba(196, 166, 122, 0));
    z-index: 0;
}

.module::before {
    width: 190px;
    height: 190px;
    left: var(--fox-x, 24%);
    top: var(--fox-y, 48%);
    transform: translate(-50%, -50%);
}

.module::after {
    width: 120px;
    height: 120px;
    left: var(--fox2-x, 70%);
    top: var(--fox2-y, 22%);
    transform: translate(-50%, -50%);
}

.specimen > *, .archive-heading > *, .departure-card > *, .exam-module > * {
    position: relative;
    z-index: 1;
}

.specimen {
    padding: clamp(1.5rem, 3.5vw, 3.6rem);
    min-height: 350px;
}

.specimen.wide { grid-column: span 7; margin-top: 2rem; }
.specimen.tall { grid-column: span 5; min-height: 630px; padding-left: clamp(1rem, 5vw, 4rem); }
.specimen.small { grid-column: span 4; min-height: 360px; margin-top: -10px; }
.specimen.medium { grid-column: span 5; margin-left: -12px; padding: clamp(1.2rem, 3vw, 2.8rem) clamp(2rem, 5vw, 4.6rem); }
.specimen.narrow { grid-column: span 3; min-height: 520px; margin-top: -16px; }
.specimen.large { grid-column: span 8; margin-left: -8px; }

h2 {
    margin: 0.75rem 0 0.7rem;
    color: var(--violet);
    font-family: "Righteous", "Inter", sans-serif;
    font-size: clamp(2rem, 4.2vw, 4.4rem);
    line-height: 0.98;
    letter-spacing: 0.04em;
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.15);
}

p {
    max-width: 68ch;
}

.marginalia {
    display: block;
    margin-top: 1rem;
    color: var(--red);
    font-family: "Caveat", cursive;
    font-size: clamp(0.9rem, 1.6vw, 1.2rem);
    transform: rotate(-2deg);
}

.specimen-svg {
    display: block;
    width: min(100%, 360px);
    height: auto;
    margin: 0.5rem auto 1.25rem;
}

.path-line {
    fill: none;
    stroke: var(--violet);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.path-line.ready {
    stroke-dasharray: var(--path-length);
    stroke-dashoffset: var(--path-length);
}

.path-line.drawn {
    animation: drawPath var(--draw-duration, 3.4s) cubic-bezier(0.25, 0.1, 0.25, 1) forwards, colorCycle var(--draw-duration, 3.4s) cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
    animation-delay: var(--draw-delay, 0ms);
}

@keyframes drawPath {
    to { stroke-dashoffset: 0; }
}

@keyframes colorCycle {
    0% { stroke: var(--violet); }
    50% { stroke: var(--gold); }
    100% { stroke: var(--teal); }
}

.examination {
    min-height: 100vh;
    padding: clamp(1rem, 3vw, 3rem);
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, var(--dark) 0%, var(--dark-soft) 100%);
}

.module-dark,
.exam-module {
    color: var(--cream);
}

.exam-module {
    width: min(1200px, 100%);
    min-height: 88vh;
    display: grid;
    grid-template-columns: 0.85fr 1.15fr;
    gap: clamp(1rem, 3vw, 3rem);
    align-items: center;
    padding: clamp(1.5rem, 5vw, 5rem);
    border: 1px solid rgba(232, 220, 200, 0.18);
    background: radial-gradient(circle at 60% 30%, rgba(42, 37, 32, 0.92), var(--dark));
    box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.42), 0 20px 80px rgba(0, 0, 0, 0.35);
}

.exam-module h2,
.module-dark h2 {
    color: var(--cream);
    text-shadow: 2px 2px 0 rgba(139, 47, 201, 0.45);
}

.inverted {
    color: rgba(232, 220, 200, 0.72);
}

.exam-svg {
    width: 100%;
    max-height: 72vh;
}

.exam-svg .path-line {
    stroke-width: 2.4;
}

.secondary-line {
    opacity: 0;
    transition: opacity 600ms ease;
}

.exam-module.revealed .secondary-line {
    opacity: 1;
}

.hotspot {
    fill: rgba(212, 160, 23, 0.14);
    stroke: var(--gold);
    stroke-width: 2;
    cursor: crosshair;
    transition: fill 180ms ease, transform 180ms ease;
    transform-origin: center;
}

.hotspot:hover {
    fill: rgba(23, 162, 162, 0.3);
    transform: scale(1.15);
}

.exam-note {
    position: absolute;
    right: clamp(1rem, 4vw, 4rem);
    bottom: clamp(1rem, 4vw, 3rem);
    color: var(--red);
    font-family: "Caveat", cursive;
    font-size: clamp(1rem, 2vw, 1.6rem);
    transform: rotate(2deg);
}

.archive {
    min-height: 120vh;
    padding: clamp(1rem, 4vw, 4rem);
    background: linear-gradient(180deg, var(--dark-soft) 0, var(--parchment) 18%, var(--parchment) 100%);
}

.archive-heading {
    width: min(900px, 100%);
    padding: clamp(1.5rem, 4vw, 3rem);
    margin-bottom: 16px;
}

.glyph-mosaic {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 12px;
}

.glyph-tile {
    min-height: clamp(120px, 16vw, 190px);
    grid-column: span 3;
    display: grid;
    place-items: center;
    padding: 1rem;
    cursor: default;
}

.glyph-tile:nth-child(4n + 1) { grid-column: span 4; }
.glyph-tile:nth-child(5n) { grid-column: span 2; }
.glyph-tile:nth-child(7n) { margin-top: -10px; }

.glyph-tile svg {
    width: 74%;
    max-width: 120px;
}

.glyph-tile::after {
    content: attr(data-label);
    position: absolute;
    inset: auto 10px 8px;
    opacity: 0;
    background: none;
    color: var(--violet);
    font-family: "Righteous", sans-serif;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-align: center;
    transform: translateY(8px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.glyph-tile:hover {
    scale: 1.02;
    border-color: var(--teal);
}

.glyph-tile:hover::after {
    opacity: 1;
    transform: translateY(0);
}

.departure {
    min-height: 80vh;
    display: grid;
    place-items: center;
    padding: clamp(2rem, 6vw, 6rem);
    background: linear-gradient(180deg, var(--parchment), rgba(242, 232, 213, 0.05));
}

.departure-card {
    width: min(840px, 100%);
    padding: clamp(1.25rem, 5vw, 4rem);
    text-align: center;
    background: radial-gradient(circle, rgba(242, 232, 213, 0.72), rgba(221, 208, 184, 0.18));
    animation: evaporate 10s ease-in-out infinite alternate;
}

.departure-sigil {
    width: 100%;
    min-height: 110px;
}

.departure .path-text {
    font-family: "Bungee Shade", "Righteous", cursive;
    font-size: clamp(1.2rem, 3vw, 2.4rem);
    stroke-width: 1.3px;
}

@keyframes evaporate {
    from { opacity: 1; }
    to { opacity: 0.64; }
}

@media (max-width: 768px) {
    .collection,
    .glyph-mosaic {
        display: block;
        padding: 1rem;
    }

    .specimen,
    .glyph-tile,
    .archive-heading {
        width: 100%;
        margin: 0 0 16px !important;
        min-height: auto;
    }

    .specimen:nth-child(odd) { padding: 24px 16px 44px 32px; }
    .specimen:nth-child(even) { padding: 42px 26px 24px 16px; }

    .exam-module {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .exam-note {
        position: relative;
        right: auto;
        bottom: auto;
        margin-top: 1rem;
    }

    .float-glyph:nth-child(n + 7) {
        display: none;
    }

    .float-glyph {
        opacity: 0.13;
    }
}

@media (max-width: 480px) {
    .title-sigil { min-height: 115px; }
    .daily-enigma { min-height: 5.6rem; }
    .glyph-tile { min-height: 120px; }
}
