/* ==========================================================================
   diplomacy.boo -- Haunted Diplomatic Palace
   Glassmorphism / Frosted / Gothic-Ethereal
   ========================================================================== */

/* --- CSS Custom Properties (Palette from DESIGN.md) --- */
:root {
    --midnight-mist: #0d1b2a;
    --phantom-blue: #415a77;
    --ectoplasm: #a8dadc;
    --spirit-white: #e0fbfc;
    --seance-violet: #7b68ae;
    --fog: #1b2838;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--spirit-white);
    background: #000000;
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Background Fade-In (starts black, fades to midnight mist gradient) --- */
body.loaded {
    background: linear-gradient(180deg, var(--midnight-mist) 0%, #0a1628 40%, var(--midnight-mist) 100%);
    transition: background 2s ease;
}

/* --- Perspective Container for Layered Depth --- */
#perspective-container {
    perspective: 1200px;
    position: relative;
    z-index: 1;
}

/* ==========================================================================
   Floating Orbs
   ========================================================================== */
#orbs-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
    opacity: 0;
    transition: opacity 1.5s ease 2s;
}

body.loaded #orbs-container {
    opacity: 1;
}

.orb {
    position: absolute;
    border-radius: 50%;
    will-change: transform;
}

.orb-1 {
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, var(--ectoplasm) 0%, transparent 70%);
    top: 15%;
    left: 10%;
    animation: orbDrift1 18s ease-in-out infinite;
    opacity: 0.6;
}

.orb-2 {
    width: 25px;
    height: 25px;
    background: radial-gradient(circle, var(--seance-violet) 0%, transparent 70%);
    top: 40%;
    left: 75%;
    animation: orbDrift2 22s ease-in-out infinite;
    opacity: 0.5;
}

.orb-3 {
    width: 35px;
    height: 35px;
    background: radial-gradient(circle, var(--ectoplasm) 0%, transparent 70%);
    top: 70%;
    left: 30%;
    animation: orbDrift3 20s ease-in-out infinite;
    opacity: 0.4;
}

.orb-4 {
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, var(--spirit-white) 0%, transparent 70%);
    top: 25%;
    left: 55%;
    animation: orbDrift4 25s ease-in-out infinite;
    opacity: 0.35;
}

.orb-5 {
    width: 30px;
    height: 30px;
    background: radial-gradient(circle, var(--seance-violet) 0%, transparent 70%);
    top: 85%;
    left: 80%;
    animation: orbDrift5 19s ease-in-out infinite;
    opacity: 0.5;
}

.orb-6 {
    width: 22px;
    height: 22px;
    background: radial-gradient(circle, var(--ectoplasm) 0%, transparent 70%);
    top: 55%;
    left: 5%;
    animation: orbDrift6 23s ease-in-out infinite;
    opacity: 0.45;
}

.orb-7 {
    width: 28px;
    height: 28px;
    background: radial-gradient(circle, var(--spirit-white) 0%, transparent 70%);
    top: 10%;
    left: 90%;
    animation: orbDrift7 21s ease-in-out infinite;
    opacity: 0.3;
}

@keyframes orbDrift1 {
    0%, 100% { transform: translate(0, 0) translateZ(100px); }
    25% { transform: translate(60px, 40px) translateZ(100px); }
    50% { transform: translate(-30px, 80px) translateZ(100px); }
    75% { transform: translate(40px, -20px) translateZ(100px); }
}

@keyframes orbDrift2 {
    0%, 100% { transform: translate(0, 0) translateZ(100px); }
    25% { transform: translate(-50px, 60px) translateZ(100px); }
    50% { transform: translate(40px, -40px) translateZ(100px); }
    75% { transform: translate(-20px, 30px) translateZ(100px); }
}

@keyframes orbDrift3 {
    0%, 100% { transform: translate(0, 0) translateZ(100px); }
    33% { transform: translate(70px, -50px) translateZ(100px); }
    66% { transform: translate(-40px, 60px) translateZ(100px); }
}

@keyframes orbDrift4 {
    0%, 100% { transform: translate(0, 0) translateZ(100px); }
    25% { transform: translate(30px, -70px) translateZ(100px); }
    50% { transform: translate(-60px, 20px) translateZ(100px); }
    75% { transform: translate(20px, 50px) translateZ(100px); }
}

@keyframes orbDrift5 {
    0%, 100% { transform: translate(0, 0) translateZ(100px); }
    33% { transform: translate(-50px, -40px) translateZ(100px); }
    66% { transform: translate(30px, 30px) translateZ(100px); }
}

@keyframes orbDrift6 {
    0%, 100% { transform: translate(0, 0) translateZ(100px); }
    50% { transform: translate(80px, -30px) translateZ(100px); }
}

@keyframes orbDrift7 {
    0%, 100% { transform: translate(0, 0) translateZ(100px); }
    25% { transform: translate(-40px, 50px) translateZ(100px); }
    75% { transform: translate(30px, -60px) translateZ(100px); }
}

/* ==========================================================================
   Marble Columns
   ========================================================================== */
#marble-columns {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    display: flex;
    justify-content: space-evenly;
}

.column {
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg, transparent 0%, rgba(168, 218, 220, 0.1) 20%, rgba(168, 218, 220, 0.1) 80%, transparent 100%);
    transform: translateZ(-200px);
}

/* ==========================================================================
   Navigation Orb
   ========================================================================== */
#nav-orb {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 100;
}

.nav-orb-trigger {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--ectoplasm) 0%, rgba(168, 218, 220, 0.3) 60%, transparent 100%);
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    z-index: 101;
    box-shadow: 0 0 20px rgba(168, 218, 220, 0.3);
}

.nav-orb-trigger:hover {
    transform: scale(1.15);
    box-shadow: 0 0 35px rgba(168, 218, 220, 0.5);
}

#nav-orb.active .nav-orb-trigger {
    transform: scale(1.3);
    background: radial-gradient(circle, var(--seance-violet) 0%, rgba(123, 104, 174, 0.3) 60%, transparent 100%);
    box-shadow: 0 0 40px rgba(123, 104, 174, 0.5);
}

.nav-orb-menu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

#nav-orb.active .nav-orb-menu {
    pointer-events: auto;
    opacity: 1;
}

.nav-link {
    position: absolute;
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--spirit-white);
    text-decoration: none;
    white-space: nowrap;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(13, 27, 42, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(168, 218, 220, 0.15);
}

.nav-link:hover {
    background: rgba(123, 104, 174, 0.4);
    color: var(--spirit-white);
    border-color: rgba(123, 104, 174, 0.4);
}

#nav-orb.active .nav-link {
    opacity: 1;
    transform: scale(1);
}

#nav-orb.active .nav-link[data-index="0"] {
    top: -70px;
    left: -30px;
    transition-delay: 0ms;
}
#nav-orb.active .nav-link[data-index="1"] {
    top: -30px;
    left: -110px;
    transition-delay: 100ms;
}
#nav-orb.active .nav-link[data-index="2"] {
    top: 40px;
    left: -120px;
    transition-delay: 200ms;
}
#nav-orb.active .nav-link[data-index="3"] {
    top: 80px;
    left: -80px;
    transition-delay: 300ms;
}
#nav-orb.active .nav-link[data-index="4"] {
    top: 100px;
    left: -20px;
    transition-delay: 400ms;
}

/* ==========================================================================
   Sections (shared)
   ========================================================================== */
.section {
    position: relative;
    padding: 120px 10vw;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: translateZ(0);
}

/* --- Fade Reveal --- */
.fade-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.fade-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Misty Borders --- */
.misty-border {
    width: 100%;
    max-width: 800px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(168, 218, 220, 0.3), transparent);
    margin: 40px auto;
    animation: mistyPulse 4s ease-in-out infinite;
}

@keyframes mistyPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* --- Glass Panel --- */
.glass-panel {
    background: rgba(13, 27, 42, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 60px;
    max-width: 900px;
    width: 100%;
    box-shadow: inset 0 0 30px rgba(180, 200, 255, 0.05);
    border: 1px solid rgba(168, 218, 220, 0.08);
}

/* --- Glass Card --- */
.glass-card {
    background: rgba(13, 27, 42, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 12px;
    padding: 36px;
    box-shadow: inset 0 0 30px rgba(180, 200, 255, 0.1);
    border: 1px solid rgba(168, 218, 220, 0.06);
    transition: box-shadow 0.5s ease, border-color 0.5s ease;
}

.glass-card:hover {
    box-shadow: inset 0 0 40px rgba(168, 218, 220, 0.12), 0 0 20px rgba(168, 218, 220, 0.08);
    border-color: rgba(168, 218, 220, 0.15);
}

/* ==========================================================================
   Typography
   ========================================================================== */
.section-heading {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(2.5rem, 5vw, 4rem);
    color: var(--spirit-white);
    margin-bottom: 40px;
    text-align: center;
    letter-spacing: 0.02em;
}

.body-text {
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--spirit-white);
    margin-bottom: 24px;
    max-width: 680px;
}

.pull-quote {
    font-family: 'Spectral', serif;
    font-weight: 200;
    font-style: italic;
    font-size: 1.35rem;
    line-height: 1.6;
    color: var(--ectoplasm);
    padding: 30px 40px;
    margin: 40px 0;
    position: relative;
    text-align: center;
    max-width: 680px;
}

.quote-mark {
    font-size: 2.5rem;
    color: var(--seance-violet);
    vertical-align: middle;
    opacity: 0.6;
}

.card-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: 1.4rem;
    color: var(--ectoplasm);
    margin-bottom: 12px;
}

.card-text {
    font-family: 'Quicksand', sans-serif;
    font-weight: 300;
    font-size: 0.95rem;
    line-height: 1.7;
    color: rgba(224, 251, 252, 0.8);
}

/* --- Breathing Text Animation --- */
.breathing-text {
    animation: breathe 4s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { transform: scale(1.0); }
    50% { transform: scale(1.02); }
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
#hero {
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-bg-layer {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, var(--midnight-mist) 0%, var(--phantom-blue) 50%, var(--fog) 100%);
    filter: blur(2px);
    opacity: 0.3;
    z-index: -1;
    transform: translateZ(-200px) scale(1.5);
}

.hero-content {
    text-align: center;
    position: relative;
    z-index: 1;
}

#hero-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(3rem, 7vw, 6rem);
    color: var(--spirit-white);
    letter-spacing: 0.08em;
    margin-bottom: 24px;
    min-height: 1.2em;
}

#hero-title .letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

#hero-title .letter.visible {
    opacity: 1;
    transform: translateY(0);
}

#hero-title .letter.space {
    width: 0.3em;
}

.hero-subtitle {
    font-family: 'Spectral', serif;
    font-weight: 200;
    font-style: italic;
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    color: var(--ectoplasm);
    opacity: 0;
    letter-spacing: 0.04em;
}

.hero-subtitle.visible {
    opacity: 0.8;
}

/* ==========================================================================
   Manifesto Section
   ========================================================================== */
#manifesto {
    padding-top: 80px;
    padding-bottom: 80px;
}

.manifesto-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ==========================================================================
   Assembly Section
   ========================================================================== */
.assembly-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    margin-top: 20px;
}

/* --- Ghost Flags --- */
.ghost-flag {
    width: 40px;
    height: 28px;
    border-radius: 2px;
    margin-bottom: 16px;
    opacity: 0.6;
    animation: flagWave 3s ease-in-out infinite;
    transform-origin: left center;
}

.flag-1 { background: linear-gradient(135deg, var(--ectoplasm), transparent); }
.flag-2 { background: linear-gradient(135deg, var(--seance-violet), transparent); }
.flag-3 { background: linear-gradient(135deg, var(--phantom-blue), var(--ectoplasm)); opacity: 0.5; }
.flag-4 { background: linear-gradient(135deg, var(--spirit-white), var(--seance-violet)); opacity: 0.4; }

@keyframes flagWave {
    0%, 100% { transform: skewX(0deg); }
    25% { transform: skewX(-3deg); }
    75% { transform: skewX(3deg); }
}

.flag-1 { animation-delay: 0s; }
.flag-2 { animation-delay: 0.5s; }
.flag-3 { animation-delay: 1s; }
.flag-4 { animation-delay: 1.5s; }

/* ==========================================================================
   Treaties Section
   ========================================================================== */
.treaties-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.treaty-item {
    display: flex;
    align-items: flex-start;
    gap: 30px;
    padding: 24px;
    border-radius: 12px;
    background: rgba(65, 90, 119, 0.15);
    border: 1px solid rgba(168, 218, 220, 0.06);
    transition: background 0.4s ease, border-color 0.4s ease;
}

.treaty-item:hover {
    background: rgba(65, 90, 119, 0.25);
    border-color: rgba(168, 218, 220, 0.15);
}

.treaty-number {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: 2.5rem;
    color: var(--seance-violet);
    line-height: 1;
    flex-shrink: 0;
    width: 50px;
    text-align: center;
    opacity: 0.7;
}

.treaty-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: 1.2rem;
    color: var(--ectoplasm);
    margin-bottom: 8px;
}

.treaty-text {
    font-family: 'Quicksand', sans-serif;
    font-weight: 300;
    font-size: 0.95rem;
    line-height: 1.7;
    color: rgba(224, 251, 252, 0.75);
}

/* ==========================================================================
   Seance Section
   ========================================================================== */
.seance-panel {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.seance-text {
    text-align: center;
    margin-bottom: 50px;
}

.seance-circle {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 50px;
}

.seance-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid var(--ectoplasm);
    opacity: 0.3;
    animation: seanceRotate 12s linear infinite;
}

.seance-ring:nth-child(1) {
    width: 200px;
    height: 200px;
}

.ring-2 {
    width: 150px;
    height: 150px;
    animation-direction: reverse;
    animation-duration: 9s;
    border-color: var(--seance-violet);
    opacity: 0.25;
}

.ring-3 {
    width: 100px;
    height: 100px;
    animation-duration: 15s;
    border-color: var(--spirit-white);
    opacity: 0.2;
}

@keyframes seanceRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.seance-symbol {
    font-size: 2.5rem;
    color: var(--ectoplasm);
    opacity: 0.6;
    animation: breathe 4s ease-in-out infinite;
    z-index: 1;
}

.spectral-footer {
    font-family: 'Spectral', serif;
    font-weight: 200;
    font-style: italic;
    font-size: 0.9rem;
    color: var(--seance-violet);
    opacity: 0.6;
    letter-spacing: 0.1em;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .section {
        padding: 80px 6vw;
    }

    .glass-panel {
        padding: 36px 24px;
    }

    .assembly-grid {
        grid-template-columns: 1fr;
    }

    .treaty-item {
        flex-direction: column;
        gap: 12px;
    }

    .treaty-number {
        width: auto;
        text-align: left;
    }

    #nav-orb {
        top: 16px;
        right: 16px;
    }

    .nav-orb-trigger {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .glass-panel {
        padding: 24px 16px;
    }

    .pull-quote {
        padding: 20px;
        font-size: 1.15rem;
    }

    .seance-circle {
        width: 150px;
        height: 150px;
    }

    .seance-ring:nth-child(1) {
        width: 150px;
        height: 150px;
    }

    .ring-2 {
        width: 110px;
        height: 110px;
    }

    .ring-3 {
        width: 70px;
        height: 70px;
    }
}
