/* ============================
   diplomacy.boo - Styles
   ============================ */

:root {
    --bg-primary: #0d0f1a;
    --bg-secondary: #141828;
    --phosphor: #7a9e7a;
    --text-primary: #c8d8c8;
    --text-secondary: #a8b8a8;
    --deco-gold: #8b7a4a;
    --shadow-deep: #0a0c14;
    --seal-red: #6b3a3a;
    --moss: #5a7a5a;
    --pilaster-dark: #1a1a28;
    --pilaster-mid: #2b2b3d;

    --font-display: 'Poiret One', sans-serif;
    --font-body: 'Crimson Pro', serif;
    --font-mono: 'Share Tech Mono', monospace;

    --ease-enter: cubic-bezier(0.25, 0.1, 0.25, 1.0);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-primary);
    background-image: radial-gradient(ellipse at center, var(--bg-secondary) 0%, var(--shadow-deep) 70%);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 18px;
    line-height: 1.75;
    overflow-x: hidden;
}

::selection {
    background: var(--phosphor);
    color: var(--bg-primary);
}

/* ============================
   The Foyer
   ============================ */
.foyer {
    height: 100vh;
    background: var(--shadow-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Art Deco Pilasters */
.pilaster {
    position: absolute;
    top: 0;
    width: 40px;
    height: 100%;
    opacity: 0;
    transition: opacity 2s ease;
    z-index: 10;
}

.pilaster.visible {
    opacity: 0.6;
}

.pilaster-left {
    left: 0;
    background: repeating-linear-gradient(
        180deg,
        var(--pilaster-dark) 0px,
        var(--pilaster-mid) 2px,
        var(--pilaster-dark) 4px,
        var(--pilaster-dark) 20px
    );
    border-right: 1px solid var(--phosphor);
}

.pilaster-right {
    right: 0;
    background: repeating-linear-gradient(
        180deg,
        var(--pilaster-dark) 0px,
        var(--pilaster-mid) 2px,
        var(--pilaster-dark) 4px,
        var(--pilaster-dark) 20px
    );
    border-left: 1px solid var(--phosphor);
}

.foyer-center {
    text-align: center;
    z-index: 20;
}

/* Embassy Seal */
.embassy-seal {
    margin-bottom: 2rem;
}

.seal-path {
    filter: drop-shadow(0 0 4px var(--phosphor));
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 3s ease;
}

.embassy-seal.drawn .seal-path {
    stroke-dashoffset: 0;
}

.site-title {
    font-family: var(--font-display);
    font-size: clamp(36px, 7vw, 72px);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--text-primary);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.5s ease, transform 1.5s ease;
}

.site-title.visible {
    opacity: 1;
    transform: translateY(0);
}

.site-title {
    text-shadow: 0 0 0px var(--phosphor);
    animation: title-glow 4s ease-in-out infinite paused;
}

.site-title.visible {
    animation-play-state: running;
}

@keyframes title-glow {
    0%, 100% { text-shadow: 0 0 0px rgba(122, 158, 122, 0.4); }
    50% { text-shadow: 0 0 3px rgba(122, 158, 122, 0.4); }
}

.site-subtitle {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 16px;
    color: var(--text-secondary);
    opacity: 0;
    transition: opacity 1s ease 2s;
    margin-top: 1rem;
    letter-spacing: 0.1em;
}

.foyer.active .site-subtitle {
    opacity: 0.7;
}

/* ============================
   Ectoplasmic Divider
   ============================ */
.ecto-divider {
    height: 4px;
    background: radial-gradient(ellipse at center, rgba(122, 158, 122, 0.05), transparent);
    margin: 0;
}

/* ============================
   Art Deco Fan Divider
   ============================ */
.deco-fan-divider {
    height: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='40'%3E%3Cpath d='M40,40 L40,0 M40,40 L20,0 M40,40 L60,0 M40,40 L10,5 M40,40 L70,5 M40,40 L0,15 M40,40 L80,15' fill='none' stroke='%238b7a4a' stroke-width='0.5' opacity='0.15'/%3E%3C/svg%3E");
    background-repeat: repeat-x;
    background-position: center;
    opacity: 0.4;
}

/* ============================
   The Treaty Room
   ============================ */
.treaty-room {
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    padding: 80px 0;
}

.treaty-diagonal-fg {
    position: relative;
    z-index: 10;
    clip-path: polygon(0 10%, 100% 0%, 100% 90%, 0 100%);
    background: var(--bg-secondary);
    padding: clamp(60px, 10vw, 120px) clamp(20px, 8vw, 100px);
    opacity: 0;
    transform: translateX(-60px);
    transition: opacity 0.8s var(--ease-enter), transform 0.8s var(--ease-enter);
}

.treaty-diagonal-fg.visible {
    opacity: 1;
    transform: translateX(0);
}

.treaty-diagonal-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    clip-path: polygon(0 5%, 100% 15%, 100% 95%, 0 85%);
    z-index: 5;
    opacity: 0;
    transform: translateX(60px);
    transition: opacity 0.8s var(--ease-enter) 0.3s, transform 0.8s var(--ease-enter) 0.3s;
}

.treaty-diagonal-bg.visible {
    opacity: 0.6;
    transform: translateX(0);
}

.treaty-content {
    max-width: 640px;
    margin: 0 auto;
}

/* Spectral Stamps */
.spectral-stamp {
    position: absolute;
    padding: 8px 20px;
    border: 1px dashed var(--moss);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.08em;
    color: var(--moss);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.stamp-1 { transition-delay: 0s; }
.stamp-2 { transition-delay: 0.15s; }
.stamp-3 { transition-delay: 0.3s; }

.treaty-diagonal-bg.visible .spectral-stamp {
    opacity: 0.35;
}

/* ============================
   Cipher Labels
   ============================ */
.cipher-label {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.08em;
    color: var(--moss);
    display: block;
    margin-bottom: 1rem;
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(28px, 4vw, 56px);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    line-height: 1.3;
}

.body-text {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.75;
}

.body-text strong,
.body-text em {
    color: var(--text-primary);
    font-weight: 600;
}

/* ============================
   The Cipher Chamber
   ============================ */
.cipher-chamber {
    min-height: 100vh;
    position: relative;
    padding: 100px 20px;
    overflow: hidden;
}

.cipher-bg-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.08;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='40'%3E%3Cpath d='M40,40 L40,0 M40,40 L20,0 M40,40 L60,0 M40,40 L10,5 M40,40 L70,5 M40,40 L0,15 M40,40 L80,15' fill='none' stroke='%233d4a3d' stroke-width='0.5'/%3E%3C/svg%3E");
    background-repeat: repeat;
    pointer-events: none;
}

/* Floating fragments */
.float-frag {
    position: absolute;
    pointer-events: none;
}

.frag-1 { top: 10%; left: 5%; animation: drift-1 20s ease-in-out infinite; }
.frag-2 { top: 50%; right: 8%; animation: drift-2 18s ease-in-out infinite; }
.frag-3 { bottom: 15%; left: 15%; animation: drift-3 22s ease-in-out infinite; }

@keyframes drift-1 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(15px, -12px); }
}

@keyframes drift-2 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-10px, 18px); }
}

@keyframes drift-3 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(12px, -15px); }
}

/* Exchange cards */
.cipher-exchanges {
    position: relative;
    z-index: 10;
    max-width: 1000px;
    margin: 0 auto;
}

.exchange-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 60px;
    perspective: 1200px;
}

.exchange-card {
    background: var(--bg-secondary);
    border: 1px solid rgba(122, 158, 122, 0.1);
    padding: clamp(24px, 3vw, 40px);
    opacity: 0;
    transform: rotateY(90deg);
    transition: opacity 0.8s var(--ease-enter), transform 0.8s var(--ease-enter);
}

.exchange-card.visible {
    opacity: 1;
    transform: rotateY(0deg);
}

.card-left { transition-delay: 0s; }
.card-right { transition-delay: 0.3s; }

.card-heading {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: clamp(18px, 2vw, 24px);
    color: var(--text-primary);
    margin-bottom: 1rem;
    letter-spacing: 0.02em;
}

/* ============================
   The Archive Vault
   ============================ */
.archive-vault {
    min-height: 100vh;
    padding: 100px 20px;
    position: relative;
}

.vault-corridor {
    max-width: 540px;
    margin: 0 auto;
}

.classified-doc {
    position: relative;
    padding: 40px;
    margin-bottom: 40px;
    background: transparent;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.6s var(--ease-spring), transform 0.6s var(--ease-spring);
    overflow: hidden;
}

.classified-doc.visible {
    opacity: 1;
    transform: scale(1);
}

.doc-1 {
    clip-path: polygon(0% 3%, 8% 1%, 15% 2.5%, 25% 0.5%, 35% 2%, 45% 1%, 55% 3%, 65% 0.8%, 75% 2.2%, 85% 0.5%, 92% 1.8%, 100% 0%, 100% 100%, 0% 100%);
    transform: rotate(-0.5deg);
}

.doc-2 {
    clip-path: polygon(0% 1%, 10% 2.5%, 20% 0.5%, 30% 2%, 40% 0%, 50% 2.8%, 60% 1%, 70% 2.5%, 80% 0.5%, 90% 2%, 100% 1%, 100% 100%, 0% 100%);
    transform: rotate(0.5deg);
}

.doc-3 {
    clip-path: polygon(0% 2%, 12% 0.5%, 22% 2.5%, 32% 0%, 42% 1.5%, 52% 2.8%, 62% 0.5%, 72% 2%, 82% 0.8%, 92% 2.5%, 100% 0.5%, 100% 100%, 0% 100%);
    transform: rotate(-0.3deg);
}

.classified-doc.visible.doc-1 { transform: scale(1) rotate(-0.5deg); }
.classified-doc.visible.doc-2 { transform: scale(1) rotate(0.5deg); }
.classified-doc.visible.doc-3 { transform: scale(1) rotate(-0.3deg); }

.doc-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cpath d='M100,20 L160,60 L160,130 Q160,160 100,180 Q40,160 40,130 L40,60 Z' fill='none' stroke='%237a9e7a' stroke-width='2'/%3E%3Cpath d='M100,50 L130,80 L100,110 L70,80 Z' fill='none' stroke='%237a9e7a' stroke-width='1.5'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
}

.doc-heading {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: clamp(20px, 2.5vw, 28px);
    color: var(--text-primary);
    margin-bottom: 1rem;
}

/* ============================
   The Sealed Door
   ============================ */
.sealed-door {
    min-height: 80vh;
    background: var(--shadow-deep);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
}

.cracked-seal {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    cursor: pointer;
    position: relative;
}

.seal-half {
    transition: transform 0.6s ease;
}

.cracked-seal:hover .seal-left {
    transform: translateX(-8px);
}

.cracked-seal:hover .seal-right {
    transform: translateX(8px);
}

.seal-valediction {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.6s ease;
    white-space: nowrap;
}

.cracked-seal:hover .seal-valediction {
    opacity: 1;
}

.valediction-text {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 14px;
    color: var(--phosphor);
    text-shadow: 0 0 12px var(--phosphor);
    text-align: center;
}

.fan-footer {
    margin-top: 60px;
    width: 100%;
}

/* ============================
   Mobile
   ============================ */
@media (max-width: 768px) {
    .pilaster {
        width: 20px;
    }

    .exchange-pair {
        grid-template-columns: 1fr;
    }

    .treaty-diagonal-fg,
    .treaty-diagonal-bg {
        clip-path: none;
    }

    .classified-doc {
        clip-path: none;
    }

    .seal-valediction {
        white-space: normal;
        width: 200px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: var(--shadow-deep);
}

::-webkit-scrollbar-thumb {
    background: var(--deco-gold);
    border-radius: 2px;
    opacity: 0.5;
}
