/* === RESET & BASE === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background: #1e1c19;
    color: #3a2e24;
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.15vw, 1.2rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    perspective: 1200px;
}

/* === LAYER 0: GLOBE CANVAS === */
#globe-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
}

/* === FILM GRAIN OVERLAY === */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-size: 256px 256px;
}

/* === NAVIGATION RAIL === */
#nav-rail {
    position: fixed;
    left: 0;
    top: 0;
    width: 24px;
    height: 100vh;
    background: #1e1c19;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
}

.nav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #7a6b5a;
    cursor: pointer;
    transition: background 0.4s ease, transform 0.3s ease;
}

.nav-dot.active {
    background: #c47a3a;
    transform: scale(1.4);
}

.nav-dot:hover {
    background: #c47a3a;
}

/* === LAYER 1: DOCUMENT FIELD === */
#document-field {
    position: relative;
    z-index: 10;
    max-width: 70vw;
    margin-left: 8%;
    padding-top: 5vh;
    transform: translateZ(0);
}

/* === DOSSIER SECTIONS === */
.dossier-section {
    min-height: 100vh;
    padding: 8vh 0;
    position: relative;
}

.content-section {
    background: rgba(242,236,224,0.92);
    border: 2px solid #c4b89a;
    padding: 10vh 18% 10vh 12%;
    margin-bottom: 0;
    position: relative;
}

/* === OPENING COLLAGE === */
.collage-opening {
    position: relative;
    width: 100%;
    min-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.collage-opening.visible {
    opacity: 1;
}

.collage-doc {
    position: absolute;
    border-radius: 2px;
    box-shadow: 0 2px 8px rgba(30,28,25,0.15);
}

.doc-1 {
    width: 60%;
    height: 55%;
    background: #e8dfd0;
    top: 20%;
    left: 15%;
    transform: rotate(-2deg);
}

.doc-2 {
    width: 50%;
    height: 45%;
    background: #c4b89a;
    top: 28%;
    left: 25%;
    transform: rotate(1.5deg);
}

.doc-3 {
    width: 55%;
    height: 50%;
    background: #f2ece0;
    top: 22%;
    left: 20%;
    transform: rotate(0.5deg);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.site-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 5vw, 5rem);
    color: #3a2e24;
    letter-spacing: 0.04em;
    line-height: 1.15;
    text-align: center;
}

.site-subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    color: #7a6b5a;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-top: 1.5rem;
    text-align: center;
}

/* === STAMPS === */
.stamp {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: clamp(0.7rem, 0.85vw, 0.85rem);
    color: #9a3b3b;
    border: 2px solid #9a3b3b;
    padding: 6px 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: inline-block;
    transition: border-style 0.4s ease, color 0.4s ease;
}

.stamp:hover {
    border-style: solid;
    color: #c47a3a;
}

.stamp-opening {
    position: absolute;
    bottom: 22%;
    right: 12%;
    transform: rotate(2deg);
    z-index: 3;
    background: rgba(242,236,224,0.9);
}

.stamp-end {
    transform: rotate(-1deg);
    margin-bottom: 2rem;
}

.stamp-classification {
    transform: rotate(1.5deg);
    border-style: dashed;
}

/* === SECTION WATERMARKS === */
.section-watermark {
    position: absolute;
    top: 8vh;
    left: 5%;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 6rem;
    color: rgba(122,107,90,0.15);
    z-index: 0;
    pointer-events: none;
    line-height: 1;
}

/* === SECTION TITLES === */
.section-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 600;
    font-size: clamp(2rem, 4.5vw, 4rem);
    color: #3a2e24;
    letter-spacing: 0.04em;
    line-height: 1.15;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

.section-title.all-caps {
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

/* Typewriter effect */
.section-title .typed-text {
    border-right: 2px solid #7a6b5a;
    animation: blink-caret 0.8s step-end infinite;
}

.section-title.typed-complete .typed-text {
    border-right-color: transparent;
    animation: none;
}

@keyframes blink-caret {
    from, to { border-right-color: transparent; }
    50% { border-right-color: #7a6b5a; }
}

/* === SECTION BODY === */
.section-body {
    position: relative;
    z-index: 1;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.section-body.visible {
    opacity: 1;
    transform: translateY(0);
}

.section-body p {
    margin-bottom: 1.5em;
}

/* === REDACTED TEXT === */
.redacted {
    background: #1a1815;
    color: transparent;
    padding: 2px 4px;
    cursor: pointer;
    transition: background 0.6s ease-in, color 0.6s ease-in;
    position: relative;
}

.redacted.revealed {
    background: transparent;
    color: #3a2e24;
}

.redacted-label {
    position: absolute;
    top: -1.4em;
    left: 0;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem;
    color: #9a3b3b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.redacted.revealed .redacted-label {
    opacity: 1;
}

/* === FLOATING ANNOTATIONS === */
.annotation {
    position: absolute;
    right: -28%;
    width: 200px;
    background: rgba(232,223,208,0.85);
    border: 1px solid #c4b89a;
    padding: 12px 14px;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.7rem, 0.85vw, 0.85rem);
    letter-spacing: 0.06em;
    color: #7a6b5a;
    box-shadow: 0 2px 8px rgba(30,28,25,0.1);
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
    top: 15vh;
}

.annotation.visible {
    opacity: 1;
    transform: translateX(0) rotate(inherit);
}

.annotation-lower {
    top: 45vh;
}

.annotation-label {
    display: block;
    font-weight: 500;
    text-transform: uppercase;
    color: #9a3b3b;
    margin-bottom: 6px;
    font-size: 0.7rem;
}

.annotation p {
    line-height: 1.5;
    margin: 0;
    font-size: 0.75rem;
}

.annotation-connector {
    position: absolute;
    left: -40px;
    top: 50%;
    width: 40px;
    height: 1px;
    border-top: 1px dashed #9a8d7a;
    opacity: 0;
    transition: opacity 0.8s ease 0.2s;
}

.annotation.visible .annotation-connector {
    opacity: 1;
}

/* === SECTION DIVIDERS === */
.section-divider {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.divider-label {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 3rem);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(196,184,154,0.6);
    text-align: center;
    opacity: 0;
    transition: opacity 1s ease;
}

.section-divider.in-view .divider-label {
    opacity: 1;
}

/* === HORIZONTAL RULE MOTIF === */
.hr-motif {
    position: relative;
    width: 60%;
    margin: 4rem auto;
    height: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hr-line {
    width: 100%;
    height: 0;
}

.hr-dashed {
    border-top: 1px dashed #c4b89a;
}

.hr-solid {
    border-top: 1px solid #c4b89a;
}

.hr-diamond {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background: #7a6b5a;
    transform: translate(-50%, -50%) rotate(45deg);
}

/* === END SECTION === */
.end-section {
    background: rgba(242,236,224,0.92);
    border: 2px solid #c4b89a;
    padding: 10vh 18% 10vh 12%;
    text-align: center;
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 10vh;
}

.end-note {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    color: #7a6b5a;
    max-width: 500px;
    line-height: 1.6;
    letter-spacing: 0.03em;
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
    #document-field {
        max-width: 90vw;
        margin-left: 30px;
    }

    .content-section {
        padding: 6vh 8% 6vh 8%;
    }

    .annotation {
        position: relative;
        right: auto;
        top: auto;
        width: 100%;
        margin-top: 2rem;
        transform: none;
        opacity: 1;
    }

    .annotation.visible {
        transform: none;
    }

    .annotation-connector {
        display: none;
    }

    .section-watermark {
        font-size: 3rem;
    }

    .collage-doc {
        position: relative;
        width: 100%;
        height: auto;
        top: auto;
        left: auto;
        transform: none;
    }

    .collage-opening {
        flex-direction: column;
        gap: 1rem;
    }

    .doc-1, .doc-2 {
        display: none;
    }

    .doc-3 {
        position: relative;
        width: 100%;
        height: auto;
        top: auto;
        left: auto;
        transform: none;
        min-height: 60vh;
    }

    .stamp-opening {
        position: relative;
        bottom: auto;
        right: auto;
        transform: none;
        margin-top: 2rem;
    }
}
