/* =========================================
   diplomacy.quest — Cold War Intelligence Dossier
   ========================================= */

/* ---- Reset & Base ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: #0D0F14;
    color: #D4CABB;
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: #C4A265;
    color: #0D0F14;
}

/* ---- Fixed Background Map Layer ---- */
#map-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

#world-map {
    width: 160%;
    height: 160%;
    position: absolute;
    top: -30%;
    left: -30%;
    opacity: 0.12;
    transition: transform 2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

#world-map .continent {
    fill: none;
    stroke: #2A2A3A;
    stroke-width: 0.5;
}

#world-map .hotspot {
    fill: #2A2A3A;
    opacity: 0.08;
    animation: hotspot-pulse 4s ease-in-out infinite;
}

@keyframes hotspot-pulse {
    0%, 100% { opacity: 0.08; }
    50% { opacity: 0.18; }
}

#world-map .hotspot:nth-child(2) { animation-delay: 0.8s; }
#world-map .hotspot:nth-child(3) { animation-delay: 1.6s; }
#world-map .hotspot:nth-child(4) { animation-delay: 2.4s; }
#world-map .hotspot:nth-child(5) { animation-delay: 3.2s; }

/* ---- Fade Overlay (self-destruct) ---- */
#fade-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #0D0F14;
    opacity: 0;
    z-index: 9999;
    pointer-events: none;
    transition: opacity 4s ease-in;
}

#fade-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* ---- HERO: The Briefing Desk ---- */
.hero-section {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1;
    background:
        repeating-linear-gradient(
            90deg,
            #0D0F14 0px,
            #111318 2px,
            #0D0F14 4px
        ),
        repeating-linear-gradient(
            0deg,
            #0D0F14 0px,
            #0F1117 1px,
            #0D0F14 3px
        );
    overflow: hidden;
}

.desk-lamp-glow {
    position: absolute;
    top: 8%;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    height: 500px;
    background: radial-gradient(ellipse at center, #1A1510 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.8s ease-in;
    pointer-events: none;
}

.desk-lamp-glow.visible {
    opacity: 1;
}

.manila-folder {
    position: relative;
    width: clamp(300px, 50vw, 500px);
    opacity: 0;
    transition: opacity 0.8s ease-in;
}

.manila-folder.visible {
    opacity: 1;
}

.folder-svg {
    width: 100%;
    height: auto;
}

.folder-rect {
    fill: rgba(196, 162, 101, 0.15);
    stroke: rgba(196, 162, 101, 0.3);
    stroke-width: 1;
}

.folder-line {
    stroke: rgba(196, 162, 101, 0.15);
    stroke-width: 0.5;
}

.folder-title {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Special Elite', cursive;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    letter-spacing: 0.12em;
    color: #C4A265;
    text-transform: uppercase;
    white-space: nowrap;
}

.folder-stamp {
    position: absolute;
    bottom: 18%;
    right: 12%;
    font-family: 'Special Elite', cursive;
    font-size: clamp(0.9rem, 1.8vw, 1.3rem);
    color: #A0522D;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    transform: rotate(-22deg);
    border: 2px solid #A0522D;
    padding: 2px 10px;
    border-radius: 2px;
    opacity: 0.7;
}

.folder-date {
    position: absolute;
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: clamp(0.55rem, 1vw, 0.7rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6B7B6B;
    white-space: nowrap;
}

.scroll-instruction {
    margin-top: 3rem;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6B7B6B;
    opacity: 0;
    transition: opacity 0.6s ease-in;
    animation: blink-instruction 2s ease-in-out infinite;
}

.scroll-instruction.visible {
    opacity: 1;
}

@keyframes blink-instruction {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* ---- Redaction Clusters ---- */
.redaction-cluster {
    position: relative;
    z-index: 1;
    width: 70vw;
    margin: 0 auto;
    padding: 2rem 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
    margin-left: calc(50vw - 35vw - 3%);
}

.redaction-bar {
    height: 6px;
    background: #1A1A1A;
    border: 1px solid rgba(42, 45, 56, 0.3);
    opacity: 0;
    transform: scaleX(0);
    transform-origin: left center;
    transition: opacity 0.4s ease-out, transform 0.5s ease-out;
}

.redaction-bar.revealed {
    opacity: 1;
    transform: scaleX(1);
}

/* ---- Thread Lines ---- */
.thread-line {
    display: block;
    width: 60px;
    height: 180px;
    margin: -1rem auto 0;
    position: relative;
    z-index: 2;
    overflow: visible;
}

.pin-point {
    fill: #C4A265;
    opacity: 0.3;
}

.thread-path {
    fill: none;
    stroke: #C4A265;
    stroke-width: 0.8;
    opacity: 0.3;
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 1.2s ease-out;
}

.thread-path.drawn {
    stroke-dashoffset: 0;
}

/* ---- Dispatch Panels ---- */
.dispatch-panel {
    position: relative;
    z-index: 1;
    width: 70vw;
    margin: 0 auto;
    margin-left: calc(50vw - 35vw - 3%);
    background: #161920;
    border: 1px solid #2A2D38;
    padding: 0;
    clip-path: inset(100% 0 0 0);
    transition: clip-path 0.8s ease-out;
    margin-bottom: 0;
}

.dispatch-panel.revealed {
    clip-path: inset(0 0 0 0);
}

/* ---- Classification Stamps ---- */
.classification-stamp {
    position: absolute;
    font-family: 'Special Elite', cursive;
    font-size: clamp(2rem, 4vw, 4rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #A0522D;
    opacity: 0;
    z-index: 0;
    pointer-events: none;
    border: 3px solid #A0522D;
    padding: 4px 16px;
    border-radius: 2px;
    transition: opacity 0.6s ease-out 0.2s;
    white-space: nowrap;
}

.dispatch-panel.revealed .classification-stamp {
    opacity: 0.06;
}

/* Final stamp styling */
.final-stamp {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    transform: rotate(0deg) !important;
    font-size: clamp(2.5rem, 5vw, 5rem);
    text-align: center;
    margin: 0 auto;
    display: none;
}

/* ---- Cable Header ---- */
.cable-header {
    padding: clamp(1rem, 2vw, 2rem) clamp(2rem, 4vw, 4rem);
    padding-bottom: 0.5rem;
}

.cable-routing {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.routing-left,
.routing-right {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: clamp(0.55rem, 1vw, 0.75rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6B7B6B;
}

.routing-right {
    text-align: right;
}

.cable-rule {
    width: 100%;
    height: 1px;
    background: #2A2D38;
    margin: 0.75rem 0;
}

.cable-timestamp {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: clamp(0.6rem, 1.1vw, 0.8rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6B7B6B;
    overflow: hidden;
    white-space: nowrap;
}

.cable-timestamp .typed-char {
    display: inline;
}

/* Typewriter cursor */
.cable-timestamp .cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: #C4A265;
    vertical-align: text-bottom;
    margin-left: 2px;
    animation: cursor-blink 530ms step-end infinite;
}

@keyframes cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ---- Dispatch Content ---- */
.dispatch-content {
    position: relative;
    padding: clamp(1.5rem, 3vw, 3rem) clamp(2rem, 4vw, 4rem);
    padding-left: clamp(3rem, 5vw, 5rem);
}

.left-margin-rule {
    position: absolute;
    left: clamp(2rem, 3.5vw, 3.5rem);
    top: 0;
    bottom: 0;
    width: 1px;
    background: #8B7355;
    opacity: 0.3;
}

.content-body {
    position: relative;
}

.dispatch-title {
    font-family: 'Special Elite', cursive;
    font-size: clamp(1.6rem, 3.5vw, 3rem);
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #C4A265;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.dispatch-epigraph {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    color: #C4A265;
    margin-bottom: 1.5rem;
    padding-left: 1rem;
    border-left: 2px solid rgba(196, 162, 101, 0.3);
    line-height: 1.6;
}

.dispatch-content p {
    margin-bottom: 1.25rem;
    color: #D4CABB;
}

.dispatch-content p:last-child {
    margin-bottom: 0;
}

/* Inline redactions */
.redacted-inline {
    background: #1A1A1A;
    color: #1A1A1A;
    padding: 0 2px;
    border-radius: 1px;
    border-bottom: 1px solid #8B3A3A;
    user-select: none;
}

/* ---- Final Dispatch ---- */
.dispatch-final .dispatch-content {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.final-body {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.end-of-file-stamp {
    font-family: 'Special Elite', cursive;
    font-size: clamp(3rem, 6vw, 6rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #A0522D;
    opacity: 0.15;
    border: 4px solid rgba(160, 82, 45, 0.15);
    padding: 8px 32px;
    border-radius: 3px;
}

.self-destruct-notice {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: clamp(0.65rem, 1.2vw, 0.85rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6B7B6B;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .dispatch-panel {
        width: 92vw;
        margin-left: auto;
        margin-right: auto;
    }

    .redaction-cluster {
        width: 92vw;
        margin-left: auto;
        margin-right: auto;
    }

    .cable-routing {
        flex-direction: column;
    }

    .routing-right {
        text-align: left;
    }

    .classification-stamp {
        font-size: clamp(1.2rem, 3vw, 2rem);
    }
}

@media (max-width: 480px) {
    .dispatch-content {
        padding-left: clamp(2.5rem, 4vw, 3rem);
    }

    .left-margin-rule {
        left: clamp(1.5rem, 2.5vw, 2rem);
    }

    .folder-stamp {
        font-size: 0.7rem;
    }
}
