/* diplomatic.bar - Cold War Briefing Room */
/* Colors: #0e1117, #161b24, #1e2430, #e8a849, #67b89a, #c45c8a, #d4cfca, #8e8a85 */
/* Fonts: Space Grotesk, Source Serif 4, Share Tech Mono */

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

html {
    scroll-behavior: smooth;
}

body {
    background: #0e1117;
    color: #d4cfca;
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    display: flex;
    min-height: 100vh;
}

/* ============================================
   DOSSIER PANEL (Left, 38%)
   ============================================ */
#dossier-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 38%;
    height: 100vh;
    background: #161b24;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1.5rem;
    overflow: hidden;
    transform: translateX(-100%);
    animation: slideInDossier 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.5s forwards;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='4' cy='4' r='1.5' fill='%2367b89a' opacity='0.04'/%3E%3Crect x='14' y='2' width='4' height='4' fill='none' stroke='%2367b89a' stroke-width='0.5' opacity='0.04'/%3E%3Cpolygon points='12,16 8,22 16,22' fill='none' stroke='%2367b89a' stroke-width='0.5' opacity='0.04'/%3E%3Ccircle cx='20' cy='14' r='1' fill='none' stroke='%2367b89a' stroke-width='0.5' opacity='0.04'/%3E%3C/svg%3E");
}

@keyframes slideInDossier {
    to { transform: translateX(0); }
}

/* Faint horizontal rules like a notepad */
#dossier-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 39px,
        rgba(142, 138, 133, 0.06) 39px,
        rgba(142, 138, 133, 0.06) 40px
    );
    pointer-events: none;
}

/* ============================================
   DIPLOMATIC SEAL
   ============================================ */
#diplomatic-seal {
    position: relative;
    width: 60px;
    height: 60px;
    margin-bottom: 2rem;
    flex-shrink: 0;
    cursor: default;
}

.seal-outer {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid #e8a849;
    opacity: 0.3;
    transition: opacity 0.4s ease;
}

.seal-mid {
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    border: 1.5px solid #e8a849;
    opacity: 0.3;
    transition: opacity 0.4s ease;
}

.seal-inner {
    position: absolute;
    inset: 16px;
    border-radius: 50%;
    border: 1px solid #e8a849;
    opacity: 0.3;
    transition: opacity 0.4s ease;
}

.seal-star {
    position: absolute;
    inset: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.star-square {
    position: absolute;
    width: 14px;
    height: 14px;
    border: 1.5px solid #e8a849;
    opacity: 0.3;
    transition: opacity 0.4s ease;
}

.star-square.rotated {
    transform: rotate(45deg);
}

#diplomatic-seal:hover .seal-outer,
#diplomatic-seal:hover .seal-mid,
#diplomatic-seal:hover .seal-inner,
#diplomatic-seal:hover .star-square {
    opacity: 1;
}

/* ============================================
   DOSSIER NAV
   ============================================ */
#dossier-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
    margin-bottom: 2rem;
    flex-shrink: 0;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0.6rem 0.8rem;
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.75rem, 0.9vw, 0.9rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8e8a85;
    text-decoration: none;
    transition: color 0.3s ease;
    overflow: hidden;
}

.nav-item::before {
    content: attr(data-index);
    margin-right: 1rem;
    color: #67b89a;
    opacity: 0.6;
}

.nav-item .nav-label {
    position: relative;
    z-index: 2;
}

.nav-item .redaction-bar {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: #c45c8a;
    transform-origin: left center;
    transform: scaleX(1);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1;
}

.nav-item:hover .redaction-bar {
    transform: scaleX(0);
}

.nav-item:hover {
    color: #e8a849;
}

/* ============================================
   MINI RADAR
   ============================================ */
#mini-radar {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 2rem;
    flex-shrink: 0;
}

.radar-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(103, 184, 154, 0.15);
    box-shadow:
        inset 0 0 0 12px transparent,
        inset 0 0 0 13px rgba(103, 184, 154, 0.08),
        inset 0 0 0 26px transparent,
        inset 0 0 0 27px rgba(103, 184, 154, 0.06);
}

.radar-sweep-mini {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 0deg, rgba(103, 184, 154, 0.15) 30deg, transparent 31deg);
    animation: sweep 4s linear infinite;
    will-change: transform;
}

@keyframes sweep {
    to { transform: rotate(360deg); }
}

.radar-blip {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #67b89a;
}

.blip-1 { top: 20%; left: 55%; animation: blipFade 3s ease-in-out infinite; }
.blip-2 { top: 60%; left: 30%; animation: blipFade 3s ease-in-out 1s infinite; }
.blip-3 { top: 40%; left: 70%; animation: blipFade 3s ease-in-out 2s infinite; }

@keyframes blipFade {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

/* ============================================
   TELETYPE TICKER
   ============================================ */
#teletype-ticker {
    flex: 1;
    width: 100%;
    overflow: hidden;
    position: relative;
    mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
}

.ticker-content {
    animation: ticker-scroll 30s linear infinite;
}

#dossier-panel:hover .ticker-content {
    animation-play-state: paused;
}

.ticker-content p {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.65rem, 0.8vw, 0.78rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #67b89a;
    opacity: 0.6;
    padding: 0.5rem 0;
    white-space: nowrap;
}

@keyframes ticker-scroll {
    0% { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

/* ============================================
   MOBILE MENU BUTTON
   ============================================ */
#mobile-menu-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    width: 36px;
    height: 36px;
    background: #161b24;
    border: 1px solid rgba(103, 184, 154, 0.3);
    cursor: pointer;
    padding: 8px;
    flex-direction: column;
    justify-content: space-between;
}

#mobile-menu-btn span {
    display: block;
    width: 100%;
    height: 2px;
    background: #67b89a;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#mobile-menu-btn.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
#mobile-menu-btn.active span:nth-child(2) { opacity: 0; }
#mobile-menu-btn.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================
   TREATY LINE (Divider)
   ============================================ */
#treaty-line {
    position: fixed;
    left: 38%;
    top: 0;
    width: 2px;
    height: 100vh;
    background: linear-gradient(180deg, #c45c8a, #e8a849);
    background-size: 100% 200%;
    animation: treatyFlow 4s linear infinite;
    z-index: 101;
    opacity: 0;
    animation: treatyFlow 4s linear infinite, fadeInLine 0.5s ease 1.3s forwards;
}

@keyframes treatyFlow {
    0% { background-position: 0% 0%; }
    100% { background-position: 0% 200%; }
}

@keyframes fadeInLine {
    to { opacity: 1; }
}

/* ============================================
   BRIEFING PANEL (Right, 62%)
   ============================================ */
#briefing-panel {
    margin-left: 38%;
    width: 62%;
    min-height: 100vh;
    padding-left: 2px;
    position: relative;
}

/* ============================================
   BRIEFING SECTIONS
   ============================================ */
.briefing-section {
    min-height: 100vh;
    position: relative;
    padding: 4rem 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ============================================
   SECTION HEADERS
   ============================================ */
.section-header {
    display: flex;
    align-items: baseline;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.section-index {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.75rem, 0.9vw, 0.9rem);
    letter-spacing: 0.08em;
    color: #67b89a;
    opacity: 0.6;
}

.section-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 3rem);
    letter-spacing: -0.03em;
    color: #e8a849;
}

/* ============================================
   PROTOCOL ALPHA (HERO)
   ============================================ */
#protocol-alpha {
    position: relative;
    overflow: hidden;
}

#constellation {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.constellation-lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.constellation-node {
    position: absolute;
    border-radius: 50%;
    background: #e8a849;
}

.node-1 { width: 6px; height: 6px; top: 15%; left: 10%; animation: blipFade 4s ease-in-out infinite; }
.node-2 { width: 8px; height: 8px; top: 30%; left: 35%; animation: blipFade 3.5s ease-in-out 0.5s infinite; }
.node-3 { width: 5px; height: 5px; top: 20%; left: 60%; animation: blipFade 5s ease-in-out 1s infinite; }
.node-4 { width: 7px; height: 7px; top: 40%; left: 85%; animation: blipFade 4.2s ease-in-out 1.5s infinite; }
.node-5 { width: 4px; height: 4px; top: 60%; left: 20%; animation: blipFade 3.8s ease-in-out 2s infinite; }
.node-6 { width: 6px; height: 6px; top: 50%; left: 50%; animation: blipFade 4.5s ease-in-out 0.8s infinite; }
.node-7 { width: 5px; height: 5px; top: 70%; left: 75%; animation: blipFade 3.2s ease-in-out 1.2s infinite; }
.node-8 { width: 4px; height: 4px; top: 80%; left: 40%; animation: blipFade 4.8s ease-in-out 0.3s infinite; }

.hero-content {
    position: relative;
    z-index: 2;
}

.classification-header {
    margin-bottom: 2rem;
}

.typewriter {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.75rem, 0.9vw, 0.9rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #67b89a;
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    width: 0;
    border-right: 2px solid #67b89a;
}

.typewriter.typing {
    animation: typing var(--type-duration, 2.5s) steps(var(--type-steps, 38), end) forwards,
               blink-caret 0.6s step-end infinite;
}

.typewriter.done {
    border-right-color: transparent;
    animation: none;
    width: auto;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: #67b89a; }
    50% { border-color: transparent; }
}

.hero-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.8rem, 7vw, 6rem);
    letter-spacing: -0.03em;
    line-height: 1.1;
    background: linear-gradient(135deg, #e8a849, #67b89a);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s ease, transform 1s ease;
}

.hero-heading.visible {
    opacity: 1;
    transform: translateY(0);
}

.hero-subtitle {
    font-family: 'Source Serif 4', Georgia, serif;
    font-style: italic;
    font-size: clamp(1.05rem, 1.3vw, 1.25rem);
    color: #d4cfca;
    max-width: 540px;
    line-height: 1.72;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.hero-subtitle.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   CIPHER DIVIDERS
   ============================================ */
.cipher-divider {
    height: 80px;
    position: relative;
    overflow: hidden;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='4' cy='4' r='1.5' fill='%2367b89a' opacity='0.15'/%3E%3Crect x='14' y='2' width='4' height='4' fill='none' stroke='%2367b89a' stroke-width='0.5' opacity='0.15'/%3E%3Cpolygon points='12,16 8,22 16,22' fill='none' stroke='%2367b89a' stroke-width='0.5' opacity='0.15'/%3E%3Ccircle cx='20' cy='14' r='1' fill='none' stroke='%2367b89a' stroke-width='0.5' opacity='0.15'/%3E%3C/svg%3E");
}

.cipher-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 2px;
    background: linear-gradient(135deg, #e8a849, #67b89a);
    transform: translateX(-50%) translateY(-50%) scaleX(0);
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: center center;
}

.cipher-divider.visible::after {
    transform: translateX(-50%) translateY(-50%) scaleX(1);
}

/* ============================================
   SIGNAL ANALYSIS (Section 2)
   ============================================ */
.radar-container {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2rem;
    min-height: 600px;
}

#radar-sweep {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    border-radius: 50%;
    z-index: 1;
}

.radar-ring-main {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(103, 184, 154, 0.08);
}

.ring-1 { inset: 0; }
.ring-2 { inset: 25%; }
.ring-3 { inset: 45%; }

.radar-crosshair-h {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(103, 184, 154, 0.08);
}

.radar-crosshair-v {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(103, 184, 154, 0.08);
}

.radar-sweep-arm {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 0deg, rgba(103, 184, 154, 0.15) 30deg, transparent 31deg);
    animation: sweep 4s linear infinite;
    will-change: transform;
}

.radar-blip-main {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #67b89a;
    box-shadow: 0 0 6px rgba(103, 184, 154, 0.5);
}

.blip-a { top: 25%; left: 60%; animation: blipFade 2.5s ease-in-out infinite; }
.blip-b { top: 55%; left: 30%; animation: blipFade 3s ease-in-out 0.8s infinite; }
.blip-c { top: 70%; left: 65%; animation: blipFade 2.8s ease-in-out 1.5s infinite; }
.blip-d { top: 35%; left: 45%; animation: blipFade 3.3s ease-in-out 2.2s infinite; }

.signal-text {
    padding: 1.5rem;
    z-index: 2;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.signal-text.visible {
    opacity: 1;
    transform: translateY(0);
}

.signal-text h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.1rem, 1.5vw, 1.3rem);
    letter-spacing: -0.02em;
    color: #e8a849;
    margin-bottom: 0.8rem;
}

.signal-text p {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(0.9rem, 1vw, 1rem);
    line-height: 1.72;
    color: #d4cfca;
}

.signal-north { grid-column: 1; grid-row: 1; }
.signal-east  { grid-column: 2; grid-row: 1; }
.signal-south { grid-column: 1; grid-row: 2; }
.signal-west  { grid-column: 2; grid-row: 2; }

/* ============================================
   CIPHER GALLERY (Section 3)
   ============================================ */
.cipher-panels {
    display: grid;
    grid-template-columns: 1fr 2px 1.2fr 2px 0.8fr;
    gap: 0;
    min-height: 500px;
}

.cipher-glow-line {
    background: linear-gradient(180deg, transparent, #e8a849, #67b89a, transparent);
    width: 2px;
}

.cipher-panel {
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.cipher-panel.visible {
    opacity: 1;
    transform: translateY(0);
}

.panel-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.65rem, 0.75vw, 0.75rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8e8a85;
}

.cipher-quote {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.1rem, 1.4vw, 1.3rem);
    letter-spacing: -0.02em;
    color: #e8a849;
    line-height: 1.5;
    border-left: 3px solid #e8a849;
    padding-left: 1rem;
}

.cipher-quote.serif-treatment {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 600;
    font-style: italic;
    color: #d4cfca;
    border-left-color: #67b89a;
}

.cipher-quote.mono-treatment {
    font-family: 'Share Tech Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.8rem, 0.95vw, 0.95rem);
    letter-spacing: 0.08em;
    color: #67b89a;
    border-left-color: #c45c8a;
}

.cipher-body p {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(0.88rem, 0.95vw, 0.95rem);
    line-height: 1.72;
    color: #d4cfca;
    opacity: 0.85;
}

/* ============================================
   TREATY ARCHIVE (Section 4)
   ============================================ */
.treaty-timeline {
    display: grid;
    grid-template-columns: 1fr 2px 1fr;
    gap: 0;
    min-height: 400px;
}

.treaty-dividing-line {
    background: linear-gradient(180deg, #c45c8a, #e8a849);
    background-size: 100% 200%;
    animation: treatyFlow 4s linear infinite;
    width: 2px;
}

.treaty-col {
    padding: 1rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.treaty-entry {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.treaty-entry.visible {
    opacity: 1;
    transform: translateY(0);
}

.treaty-date {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.65rem, 0.75vw, 0.75rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8e8a85;
    display: block;
    margin-bottom: 0.75rem;
}

.treaty-entry h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 1.6vw, 1.4rem);
    letter-spacing: -0.02em;
    color: #e8a849;
    margin-bottom: 0.8rem;
}

.treaty-entry p {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(0.9rem, 1vw, 1rem);
    line-height: 1.72;
    color: #d4cfca;
}

/* ============================================
   CLOSING TRANSMISSION
   ============================================ */
.closing-transmission {
    margin-top: 4rem;
    text-align: center;
    padding: 2rem;
}

.closing-transmission .typewriter {
    color: #8e8a85;
}

/* ============================================
   MOBILE OVERLAY
   ============================================ */
#mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(14, 17, 23, 0.85);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#mobile-overlay.active {
    opacity: 1;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    body {
        display: block;
    }

    #dossier-panel {
        position: fixed;
        width: 80%;
        max-width: 320px;
        transform: translateX(-100%);
        animation: none;
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 200;
    }

    #dossier-panel.open {
        transform: translateX(0);
    }

    #mobile-menu-btn {
        display: flex;
    }

    #mobile-overlay {
        display: block;
        pointer-events: none;
    }

    #mobile-overlay.active {
        pointer-events: auto;
    }

    #treaty-line {
        display: none;
    }

    #briefing-panel {
        margin-left: 0;
        width: 100%;
        padding-top: 60px;
    }

    .briefing-section {
        padding: 2rem 1.5rem;
    }

    .radar-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    #radar-sweep {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        margin: 0 auto 2rem;
        width: 200px;
        height: 200px;
    }

    .signal-north, .signal-east, .signal-south, .signal-west {
        grid-column: 1;
    }

    .cipher-panels {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .cipher-glow-line {
        width: 100%;
        height: 2px;
        background: linear-gradient(90deg, transparent, #e8a849, #67b89a, transparent);
    }

    .treaty-timeline {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .treaty-dividing-line {
        width: 100%;
        height: 2px;
        background: linear-gradient(90deg, #c45c8a, #e8a849);
        background-size: 200% 100%;
        animation: treatyFlowH 4s linear infinite;
    }

    @keyframes treatyFlowH {
        0% { background-position: 0% 0%; }
        100% { background-position: 200% 0%; }
    }

    .hero-heading {
        font-size: clamp(2.2rem, 10vw, 3.5rem);
    }
}

@media (max-width: 480px) {
    .briefing-section {
        padding: 1.5rem 1rem;
        min-height: auto;
    }

    .cipher-panels {
        grid-template-columns: 1fr;
    }
}
