/* ============================================
   diplomatic.quest — Cold War Dossier Aesthetic
   ============================================ */

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

html {
    scroll-behavior: smooth;
    font-size: 18px;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #FAF8F5;
    color: #2B2D42;
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    line-height: 1.72;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* --- Hidden SVG defs --- */
.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Redaction Background Layer --- */
.redaction-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.redaction-bar {
    position: absolute;
    height: 14px;
    background-color: #2B2D42;
    opacity: 0.06;
    transition: opacity 0.3s ease;
    pointer-events: auto;
    cursor: default;
}

.redaction-bar:hover {
    opacity: 0.4;
}

.redaction-bar::after {
    content: 'CLASSIFIED';
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.2em;
    color: #2B2D42;
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
    pointer-events: none;
}

.redaction-bar:hover::after {
    opacity: 0.7;
}

/* --- Content Column --- */
.content-column {
    max-width: 720px;
    width: 90%;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

/* --- Dossier Sections --- */
.dossier-section {
    width: 100%;
    min-height: 100vh;
    padding: 120px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.section-bg-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* Pattern backgrounds via CSS with SVG data URIs */
.section-arrival .section-bg-pattern,
.section-cipher .section-bg-pattern {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='52'%3E%3Cpath d='M15 0 L30 13 L30 39 L15 52 L0 39 L0 13 Z' fill='none' stroke='%23BFCDE0' stroke-width='1' opacity='0.12'/%3E%3C/svg%3E");
}

.section-briefing .section-bg-pattern {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12'%3E%3Cpath d='M0 0 L12 12 M12 0 L0 12' fill='none' stroke='%23FFD6E0' stroke-width='0.8' opacity='0.12'/%3E%3C/svg%3E");
}

.section-negotiation .section-bg-pattern {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Ccircle cx='20' cy='20' r='8' fill='none' stroke='%23C3F0CA' stroke-width='1' opacity='0.12'/%3E%3Ccircle cx='20' cy='20' r='16' fill='none' stroke='%23C3F0CA' stroke-width='1' opacity='0.08'/%3E%3C/svg%3E");
}

.section-resolution .section-bg-pattern {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12'%3E%3Ccircle cx='6' cy='6' r='2' fill='%23D4C1EC' opacity='0.12'/%3E%3C/svg%3E");
}

/* --- Typography --- */

/* Display / Headlines */
.site-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    font-size: clamp(48px, 10vw, 96px);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    line-height: 0.95;
    color: #2B2D42;
    text-align: center;
    margin: 40px 0 30px;
}

.section-headline {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    font-size: clamp(36px, 6vw, 64px);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    line-height: 0.95;
    color: #2B2D42;
    margin-bottom: 48px;
}

/* Highlight washes */
.highlight-rose {
    background-color: #FFD6E0;
    padding: 0 8px;
    margin: 0 -8px;
    display: inline;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.highlight-mint {
    background-color: #C3F0CA;
    padding: 0 8px;
    margin: 0 -8px;
    display: inline;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.highlight-lavender {
    background-color: #D4C1EC;
    padding: 0 8px;
    margin: 0 -8px;
    display: inline;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.highlight-gold {
    background-color: #F2D388;
    padding: 0 8px;
    margin: 0 -8px;
    display: inline;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

/* Body / Prose */
.cable-body p {
    color: rgba(43, 45, 66, 0.85);
    text-indent: 2em;
    margin-bottom: 0;
}

.cable-body p:first-child {
    text-indent: 0;
}

/* Captions / Datestamps */
.mono-caption {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 12px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #8D99AE;
}

.classification-marker {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 11px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #8D99AE;
    border: 1px solid rgba(141, 153, 174, 0.3);
    padding: 6px 16px;
    display: inline-block;
}

/* --- Section Header --- */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 48px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(141, 153, 174, 0.2);
}

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

/* --- Datestamp Line --- */
.datestamp {
    text-align: center;
    margin-bottom: 20px;
}

.datestamp-line {
    text-align: center;
    margin-bottom: 8px;
}

/* --- Arrival Section --- */
.arrival-seal-container {
    display: flex;
    justify-content: center;
    margin: 40px 0;
}

.arrival-seal {
    width: 180px;
    height: 180px;
    animation: slowRotate 60s linear infinite;
}

@keyframes slowRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- Diplomatic Seal Breaks --- */
.seal-break {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 40px 0;
    position: relative;
    z-index: 1;
}

.seal-break-svg {
    width: 120px;
    height: 120px;
}

.seal-break .seal-left-half,
.seal-break .seal-right-half,
.seal-break .seal-center-emblem {
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.6s ease;
}

.seal-break.is-split .seal-left-half {
    transform: translateX(-20px) rotate(-15deg);
}

.seal-break.is-split .seal-right-half {
    transform: translateX(20px) rotate(15deg);
}

.seal-break.is-split .seal-center-emblem {
    opacity: 1;
}

.seal-break:not(.is-split) .seal-center-emblem {
    opacity: 0;
}

/* --- Diplomatic Quote / Blockquote --- */
.diplomatic-quote {
    border-left: 3px solid #BFCDE0;
    background-color: #F0F4FF;
    padding: 24px 32px;
    margin: 40px 0;
    position: relative;
}

.diplomatic-quote p {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 600;
    font-size: 1.1rem;
    font-style: italic;
    color: #2B2D42;
    margin-bottom: 12px;
}

.diplomatic-quote cite {
    display: block;
    font-style: normal;
}

/* --- Cable Intro --- */
.cable-intro {
    text-align: center;
    margin-bottom: 32px;
}

/* --- Redaction Inline (Cipher Section) --- */
.redaction-inline {
    background-color: #2B2D42;
    color: #2B2D42;
    padding: 2px 6px;
    cursor: pointer;
    transition: background-color 0.5s ease, color 0.5s ease;
    border-radius: 2px;
    position: relative;
    user-select: none;
}

.redaction-inline.is-revealed {
    background-color: #C3F0CA;
    color: #2B2D42;
}

/* --- Cipher Content --- */
.cipher-content p {
    color: rgba(43, 45, 66, 0.85);
    line-height: 2;
    margin-bottom: 16px;
}

/* --- Timeline --- */
.timeline {
    position: relative;
    padding-left: 40px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #BFCDE0, #D4C1EC, #FFD6E0);
}

.timeline-entry {
    position: relative;
    margin-bottom: 48px;
}

.timeline-marker {
    position: absolute;
    left: -40px;
    top: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #FAF8F5;
    border: 3px solid #BFCDE0;
    z-index: 1;
}

.timeline-entry:nth-child(even) .timeline-marker {
    border-color: #FFD6E0;
}

.timeline-entry:nth-child(3n) .timeline-marker {
    border-color: #C3F0CA;
}

.timeline-date {
    margin-bottom: 8px;
    color: #8D99AE;
}

.timeline-content h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #2B2D42;
    margin-bottom: 8px;
}

.timeline-content p {
    color: rgba(43, 45, 66, 0.85);
    font-size: 0.95rem;
    line-height: 1.72;
}

/* --- Final Seal --- */
.final-seal-container {
    display: flex;
    justify-content: center;
    margin: 48px 0;
}

.final-seal {
    width: 200px;
    height: 200px;
}

.final-seal-piece {
    transition: transform 1s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.8s ease;
}

.final-seal.is-assembled .final-piece-1 {
    transform: translate(0, 0);
}

.final-seal.is-assembled .final-piece-2 {
    transform: translate(0, 0);
}

.final-seal.is-assembled .final-piece-3 {
    opacity: 1;
}

.final-seal:not(.is-assembled) .final-piece-1 {
    transform: translate(-40px, 30px) rotate(-20deg);
    opacity: 0.3;
}

.final-seal:not(.is-assembled) .final-piece-2 {
    transform: translate(40px, 30px) rotate(20deg);
    opacity: 0.3;
}

.final-seal:not(.is-assembled) .final-piece-3 {
    opacity: 0;
}

/* --- Final Quote --- */
.final-quote {
    border-left-color: #F2D388;
    background-color: rgba(242, 211, 136, 0.08);
}

/* --- End Marker --- */
.end-marker {
    text-align: center;
    margin-top: 48px;
    padding: 16px;
    border-top: 1px solid rgba(141, 153, 174, 0.2);
    border-bottom: 1px solid rgba(141, 153, 174, 0.2);
}

/* --- Footer --- */
.dossier-footer {
    width: 100%;
    text-align: center;
    padding: 40px 20px;
    border-top: 1px solid rgba(141, 153, 174, 0.15);
}

/* --- Marginal Annotations --- */
.marginal-annotation {
    display: none;
}

@media (min-width: 1200px) {
    .marginal-annotation {
        display: block;
        position: absolute;
        left: -180px;
        width: 160px;
        font-family: 'Space Mono', monospace;
        font-size: 11px;
        color: #8D99AE;
        letter-spacing: 0.05em;
        border-left: 1px dotted #BFCDE0;
        padding-left: 12px;
        line-height: 1.5;
    }

    .marginal-annotation.marginal-right {
        left: auto;
        right: -180px;
        border-left: none;
        border-right: 1px dotted #BFCDE0;
        padding-left: 0;
        padding-right: 12px;
        text-align: right;
    }
}

/* --- Bounce-Enter Animation --- */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    60% {
        opacity: 1;
        transform: translateY(-8px) scale(1.02);
    }
    80% {
        transform: translateY(3px) scale(0.99);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.bounce-target {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
}

.bounce-target.is-visible {
    animation: bounceIn 600ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
    animation-delay: calc(var(--stagger-index, 0) * 120ms);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    html {
        font-size: 16px;
    }

    .dossier-section {
        padding: 80px 0;
        min-height: auto;
    }

    .section-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

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

    .timeline {
        padding-left: 32px;
    }

    .timeline::before {
        left: 4px;
    }

    .timeline-marker {
        left: -32px;
        width: 14px;
        height: 14px;
    }

    .arrival-seal {
        width: 140px;
        height: 140px;
    }

    .diplomatic-quote {
        padding: 16px 20px;
        margin: 24px 0;
    }
}

@media (max-width: 480px) {
    .site-title {
        font-size: 42px;
    }

    .section-headline {
        font-size: 28px;
    }

    .classification-marker {
        font-size: 9px;
    }
}
