/* =============================================
   diplomacy.boo — Generative Diplomatic Theater
   ============================================= */

/* === CSS Custom Properties === */
:root {
    --forest-deep: #0a1f0f;
    --forest-mid: #1a2e1f;
    --forest-surface: #2d5a3f;
    --green-primary: #4a7c59;
    --green-bright: #22c55e;
    --green-accent: #16a34a;
    --green-dark: #0d3b1e;
    --gold: #b8860b;
    --surface-light: #e8f0eb;
    --surface-lightest: #f2f7f4;

    --font-display: 'Instrument Serif', serif;
    --font-body: 'Space Grotesk', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
    --font-ui: 'Inter', sans-serif;
}

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

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

body {
    background: var(--forest-deep);
    color: var(--surface-light);
    font-family: var(--font-body);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === Scroll Container === */
.scroll-container {
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
}

.scroll-container::-webkit-scrollbar {
    width: 2px;
}

.scroll-container::-webkit-scrollbar-track {
    background: var(--forest-deep);
}

.scroll-container::-webkit-scrollbar-thumb {
    background: var(--gold);
}

/* === Spread (Full Viewport Section) === */
.spread {
    min-height: 100vh;
    height: 100vh;
    width: 100%;
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
}

/* === Voronoi Canvas === */
.voronoi-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.7;
}

.voronoi-bg {
    opacity: 0.15;
}

/* === Navigation Indicators === */
.nav-indicators {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid var(--gold);
    background: transparent;
    cursor: pointer;
    transition: all 0.4s ease;
}

.nav-dot.active {
    background: var(--gold);
    box-shadow: 0 0 8px rgba(184, 134, 11, 0.4);
    transform: scale(1.3);
}

/* === Surveillance Bar === */
.surveillance-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 28px;
    background: rgba(10, 31, 15, 0.92);
    border-top: 1px solid rgba(184, 134, 11, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--green-bright);
}

.surv-item {
    opacity: 0.7;
}

/* =============================================
   SPREAD 1: Protocol Spread
   ============================================= */
.spread-protocol {
    background: var(--forest-deep);
    display: flex;
    align-items: center;
    justify-content: center;
}

.protocol-overlay {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    padding: 40px;
}

.protocol-header {
    text-align: center;
}

.classification-stamp {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.25em;
    color: var(--gold);
    display: block;
    margin-bottom: 32px;
    opacity: 0.8;
    animation: stampFlicker 4s ease-in-out infinite;
}

@keyframes stampFlicker {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.4; }
    75% { opacity: 0.9; }
}

.domain-title {
    font-family: var(--font-display);
    font-size: clamp(3rem, 8vw, 7rem);
    font-weight: 400;
    color: var(--surface-lightest);
    line-height: 1.1;
    margin-bottom: 24px;
}

.domain-title .char {
    display: inline-block;
    animation: charOscillate var(--char-duration, 3s) ease-in-out infinite;
    animation-delay: var(--char-delay, 0s);
}

.domain-title .char.dot {
    color: var(--gold);
}

@keyframes charOscillate {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(var(--char-amplitude, -0.5px)); }
}

.protocol-subtitle {
    font-family: var(--font-body);
    font-size: clamp(0.875rem, 2vw, 1.125rem);
    font-weight: 300;
    color: var(--surface-light);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    opacity: 0.6;
}

.protocol-metadata {
    display: flex;
    gap: 48px;
    margin-top: 60px;
}

.meta-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.meta-label {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.2em;
    color: var(--green-accent);
    opacity: 0.6;
}

.meta-value {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.15em;
    color: var(--gold);
}

.scroll-indicator {
    position: absolute;
    bottom: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
    0%, 100% { opacity: 0.4; transform: translateY(0); }
    50% { opacity: 0.8; transform: translateY(4px); }
}

.scroll-text {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.3em;
    color: var(--gold);
}

.scroll-arrow {
    width: 16px;
    height: 16px;
    border-right: 1px solid var(--gold);
    border-bottom: 1px solid var(--gold);
    transform: rotate(45deg);
}

/* =============================================
   SPREAD 2: Dossier Grid
   ============================================= */
.spread-dossier {
    background: var(--forest-mid);
}

.dossier-overlay {
    position: relative;
    z-index: 10;
    height: 100%;
    width: 100%;
    padding: 60px 40px 60px;
    display: flex;
    flex-direction: column;
}

.spread-heading {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 400;
    color: var(--surface-lightest);
    margin-bottom: 40px;
    padding-left: 8px;
    border-left: 3px solid var(--gold);
}

.dossier-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 20px;
    flex: 1;
    padding-bottom: 30px;
}

.dossier-card {
    background: rgba(10, 31, 15, 0.7);
    border: 1px solid rgba(74, 124, 89, 0.2);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    cursor: default;
}

.dossier-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.dossier-card:hover {
    border-color: rgba(184, 134, 11, 0.4);
    transform: translateY(-2px);
    background: rgba(10, 31, 15, 0.85);
}

.dossier-card:hover::before {
    opacity: 1;
}

.card-index {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.2em;
    color: var(--gold);
    opacity: 0.5;
    margin-bottom: 12px;
}

.card-title {
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    font-weight: 400;
    color: var(--surface-lightest);
    margin-bottom: 12px;
}

.card-body {
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 300;
    line-height: 1.65;
    color: var(--surface-light);
    opacity: 0.7;
    flex: 1;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(74, 124, 89, 0.15);
}

.card-tag {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.2em;
    color: var(--green-accent);
    padding: 3px 8px;
    border: 1px solid rgba(22, 163, 74, 0.3);
}

.card-timestamp {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--green-bright);
    opacity: 0.4;
}

/* =============================================
   SPREAD 3: Treaty Architecture
   ============================================= */
.spread-treaty {
    background: var(--forest-deep);
    background-image:
        linear-gradient(rgba(74, 124, 89, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(74, 124, 89, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
}

.treaty-overlay {
    position: relative;
    z-index: 10;
    height: 100%;
    width: 100%;
    padding: 60px 40px;
    display: flex;
    flex-direction: column;
}

.treaty-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}

.treaty-timeline {
    position: relative;
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.timeline-line {
    position: absolute;
    left: 80px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, transparent, var(--gold), var(--gold), transparent);
}

.treaty-node {
    position: relative;
    padding: 16px 0 16px 120px;
    cursor: default;
    transition: all 0.4s ease;
}

.treaty-node::before {
    content: '';
    position: absolute;
    left: 74px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid var(--gold);
    background: var(--forest-deep);
    transition: all 0.4s ease;
    z-index: 2;
}

.treaty-node:hover::before,
.treaty-node.active::before {
    background: var(--gold);
    box-shadow: 0 0 12px rgba(184, 134, 11, 0.5);
}

.treaty-node.active::before {
    animation: nodePulse 2s ease-in-out infinite;
}

@keyframes nodePulse {
    0%, 100% { box-shadow: 0 0 12px rgba(184, 134, 11, 0.5); }
    50% { box-shadow: 0 0 24px rgba(184, 134, 11, 0.8); }
}

.node-year {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.15em;
    color: var(--gold);
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    text-align: right;
}

.node-label {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: var(--surface-lightest);
    display: block;
    margin-bottom: 6px;
    transition: color 0.4s ease;
}

.treaty-node:hover .node-label,
.treaty-node.active .node-label {
    color: var(--gold);
}

.node-detail {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 300;
    line-height: 1.6;
    color: var(--surface-light);
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.treaty-node:hover .node-detail,
.treaty-node.active .node-detail {
    opacity: 0.6;
    max-height: 80px;
}

.treaty-annotation {
    text-align: center;
    padding-top: 20px;
}

.annotation-text {
    font-family: var(--font-display);
    font-size: 1rem;
    font-style: italic;
    color: var(--gold);
    opacity: 0.5;
}

/* =============================================
   SPREAD 4: The Cipher
   ============================================= */
.spread-cipher {
    background: var(--forest-deep);
}

.cipher-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.3;
}

.cipher-overlay {
    position: relative;
    z-index: 10;
    height: 100%;
    width: 100%;
    padding: 60px 40px;
    display: flex;
    flex-direction: column;
}

.cipher-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 80px;
}

.cipher-wheel-wrapper {
    width: 340px;
    height: 340px;
    flex-shrink: 0;
}

.cipher-svg {
    width: 100%;
    height: 100%;
}

.cipher-readout {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 360px;
}

.readout-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(74, 124, 89, 0.15);
}

.readout-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.2em;
    color: var(--green-accent);
    opacity: 0.6;
}

.readout-value {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.1em;
    color: var(--gold);
}

.mono-flash {
    animation: monoFlash 1.5s step-end infinite;
}

@keyframes monoFlash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.cipher-footer-text {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-style: italic;
    color: var(--surface-light);
    opacity: 0.4;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* =============================================
   SPREAD 5: Communiqué
   ============================================= */
.spread-communique {
    background: var(--forest-mid);
}

.communique-overlay {
    position: relative;
    z-index: 10;
    height: 100%;
    width: 100%;
    padding: 60px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.communique-content {
    max-width: 640px;
    text-align: center;
}

.communique-body {
    margin-top: 40px;
}

.communique-text {
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 300;
    line-height: 1.8;
    color: var(--surface-light);
    opacity: 0.7;
    margin-bottom: 40px;
}

.communique-seal {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
}

.seal-svg {
    width: 120px;
    height: 120px;
    animation: sealRotate 30s linear infinite;
}

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

.communique-metadata {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.meta-mono {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.15em;
    color: var(--green-accent);
    opacity: 0.5;
}

.communique-border-top,
.communique-border-bottom {
    position: absolute;
    left: 40px;
    right: 40px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    opacity: 0.3;
}

.communique-border-top { top: 40px; }
.communique-border-bottom { bottom: 40px; }

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 768px) {
    .dossier-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(3, 1fr);
        gap: 12px;
    }

    .protocol-metadata {
        gap: 24px;
    }

    .cipher-container {
        flex-direction: column;
        gap: 40px;
    }

    .cipher-wheel-wrapper {
        width: 240px;
        height: 240px;
    }

    .nav-indicators {
        right: 12px;
    }

    .treaty-node {
        padding-left: 100px;
    }

    .node-year {
        width: 50px;
        font-size: 9px;
    }

    .timeline-line {
        left: 65px;
    }

    .treaty-node::before {
        left: 59px;
    }
}

@media (max-width: 480px) {
    .dossier-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        overflow-y: auto;
    }

    .protocol-metadata {
        flex-direction: column;
        gap: 16px;
    }

    .spread-heading {
        font-size: 1.8rem;
    }
}
