/* =========================================
   diplomacy.boo - Styles
   Ethereal diplomatic correspondence
   Magazine-spread editorial composition
   ========================================= */

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

:root {
    --void: #0A0A0F;
    --light: #F5F2ED;
    --accent-violet: #9B7FE6;
    --accent-teal: #5FD4C8;
    --accent-rose: #E8A0B8;
    --muted: #6B6B78;
    --overlay-dark: #12121F;
    --frosted: rgba(245, 242, 237, 0.12);
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    scrollbar-width: none;
}

html::-webkit-scrollbar {
    display: none;
}

body {
    margin: 0;
    padding: 0;
    background: var(--void);
    color: var(--light);
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    line-height: 1.75;
    overflow-x: hidden;
}

/* --- Canvas Background --- */
#bubble-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* --- Noise Overlay --- */
#noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    opacity: 0.02;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* --- Navigation Dots --- */
#spread-nav {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.nav-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted);
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.4s ease, box-shadow 0.4s ease;
}

.nav-dot:hover {
    transform: scale(1.8);
    background: var(--accent-violet);
    box-shadow: 0 0 12px rgba(155, 127, 230, 0.5);
}

.nav-dot.active {
    background: var(--accent-violet);
    transform: scale(1.4);
    box-shadow: 0 0 8px rgba(155, 127, 230, 0.4);
}

/* --- Spreads Base --- */
.spread {
    position: relative;
    width: 100%;
    min-height: 100vh;
    z-index: 2;
    overflow: hidden;
}

.spread-inner {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    z-index: 2;
}

/* --- Vignette --- */
.spread-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background: radial-gradient(ellipse at center, transparent 40%, var(--overlay-dark) 100%);
}

/* --- Bubble Punctuation --- */
.bubble-punctuation {
    display: flex;
    gap: 8px;
    margin-top: 2em;
    align-items: center;
}

.bp-dot {
    display: block;
    border-radius: 50%;
    animation: bpFloat 4s ease-in-out infinite;
}

.bp-dot-1 {
    width: 12px;
    height: 12px;
    background: var(--accent-violet);
    opacity: 0.5;
    animation-delay: 0s;
}

.bp-dot-2 {
    width: 9px;
    height: 9px;
    background: var(--accent-teal);
    opacity: 0.4;
    animation-delay: 0.6s;
}

.bp-dot-3 {
    width: 14px;
    height: 14px;
    background: var(--accent-rose);
    opacity: 0.35;
    animation-delay: 1.2s;
}

.bp-dot-4 {
    width: 8px;
    height: 8px;
    background: var(--accent-violet);
    opacity: 0.45;
    animation-delay: 1.8s;
}

.bp-dot-5 {
    width: 10px;
    height: 10px;
    background: var(--accent-teal);
    opacity: 0.4;
    animation-delay: 2.4s;
}

@keyframes bpFloat {
    0%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.4;
    }
    50% {
        transform: translateY(-3px) scale(1.15);
        opacity: 0.6;
    }
}


/* =========================================
   SPREAD 1: THE OVERTURE
   ========================================= */
.spread-overture {
    background: var(--void);
}

.overture-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    min-height: 100vh;
}

.overture-bubble-zone {
    width: 70%;
    height: 100vh;
    position: relative;
}

.overture-title-column {
    width: 30%;
    padding: 4vh 5vw 4vh 2vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

.hero-title {
    font-family: 'Bebas Neue', Impact, sans-serif;
    font-weight: 400;
    font-size: clamp(4rem, 12vw, 10rem);
    line-height: 0.92;
    letter-spacing: -0.02em;
    color: var(--light);
    text-transform: uppercase;
    margin: 0;
}

.hero-title .char-line {
    display: block;
}

.hero-title-accent {
    color: var(--accent-violet);
}

.overture-subtitle {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1rem, 1.6vw, 1.4rem);
    color: var(--muted);
    margin-top: 1.5em;
    letter-spacing: 0.05em;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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


/* =========================================
   SPREAD 2: THE NEGOTIATION TABLE
   ========================================= */
.spread-negotiation {
    background: transparent;
}

.negotiation-layout {
    display: flex;
    min-height: 100vh;
}

.negotiation-left {
    width: 50%;
    background: var(--void);
    color: var(--light);
    padding: 8vh 6vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.negotiation-right {
    width: 50%;
    background: var(--light);
    color: var(--void);
    padding: 8vh 6vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.negotiation-divider {
    position: absolute;
    left: 50%;
    top: 0;
    width: 2px;
    height: 100%;
    z-index: 10;
    background: linear-gradient(
        180deg,
        transparent 0%,
        var(--accent-violet) 20%,
        var(--accent-teal) 50%,
        var(--accent-rose) 80%,
        transparent 100%
    );
    animation: dividerShimmer 6s ease-in-out infinite;
}

@keyframes dividerShimmer {
    0%, 100% {
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
}

.spread-heading {
    font-family: 'Bebas Neue', Impact, sans-serif;
    font-weight: 400;
    font-size: clamp(2.5rem, 6vw, 5rem);
    line-height: 0.92;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.6em;
}

.negotiation-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    line-height: 1.75;
    max-width: 480px;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.6s ease-out 0.2s, transform 0.6s ease-out 0.2s;
}

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

.negotiation-right .bp-dot-1 {
    background: var(--accent-rose);
}

.negotiation-right .bp-dot-2 {
    background: var(--accent-violet);
}

.negotiation-right .bp-dot-3 {
    background: var(--accent-teal);
}

.negotiation-right .spread-heading {
    color: var(--void);
}


/* =========================================
   SPREAD 3: THE CHAMBER
   ========================================= */
.spread-chamber {
    background: var(--void);
}

.chamber-layout {
    position: relative;
    min-height: 100vh;
    padding: 10vh 6vw;
    display: block;
}

.chamber-note {
    position: absolute;
    max-width: 380px;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.chamber-note.visible {
    opacity: 1;
    transform: translateY(0) rotate(var(--note-rotate, 0deg));
}

.note-1 {
    top: 12vh;
    left: 8vw;
    --note-rotate: -2deg;
    transform: translateY(15px) rotate(-2deg);
}

.note-1.visible {
    transform: translateY(0) rotate(-2deg);
}

.note-2 {
    top: 22vh;
    right: 10vw;
    --note-rotate: 1.5deg;
    transform: translateY(15px) rotate(1.5deg);
}

.note-2.visible {
    transform: translateY(0) rotate(1.5deg);
}

.note-3 {
    bottom: 25vh;
    left: 15vw;
    --note-rotate: 2.5deg;
    transform: translateY(15px) rotate(2.5deg);
}

.note-3.visible {
    transform: translateY(0) rotate(2.5deg);
}

.note-4 {
    bottom: 15vh;
    right: 14vw;
    --note-rotate: -1deg;
    transform: translateY(15px) rotate(-1deg);
}

.note-4.visible {
    transform: translateY(0) rotate(-1deg);
}

.note-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    line-height: 1.75;
    color: var(--light);
}

.note-attribution {
    font-family: 'Inter', Helvetica, sans-serif;
    font-weight: 300;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--muted);
    display: block;
    margin-top: 0.8em;
}

.note-heading {
    font-family: 'Bebas Neue', Impact, sans-serif;
    font-weight: 400;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    letter-spacing: 0.08em;
    color: var(--accent-teal);
    margin-bottom: 0.4em;
}


/* =========================================
   SPREAD 4: THE ACCORD
   ========================================= */
.spread-accord {
    background: var(--light);
}

.accord-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 10vh 10vw;
    text-align: center;
    position: relative;
}

#accord-shape-canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    height: 320px;
    z-index: 0;
    pointer-events: none;
    opacity: 0.35;
}

.accord-statement {
    font-family: 'Bebas Neue', Impact, sans-serif;
    font-weight: 400;
    font-size: clamp(2.5rem, 6vw, 5rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: var(--void);
    text-transform: uppercase;
    max-width: 800px;
    position: relative;
    z-index: 1;
}

.accord-punctuation {
    justify-content: center;
    margin-top: 3em;
    position: relative;
    z-index: 1;
}

.spread-accord .spread-vignette {
    background: radial-gradient(ellipse at center, transparent 40%, rgba(245, 242, 237, 0.6) 100%);
}


/* =========================================
   SPREAD 5: THE ARCHIVE
   ========================================= */
.spread-archive {
    background: var(--void);
}

.archive-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 8vh 6vw;
    justify-content: center;
}

.archive-heading {
    margin-bottom: 1em;
    color: var(--light);
}

.archive-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: auto;
    gap: 20px;
}

.archive-card {
    background: var(--frosted);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    padding: 2em 2em;
    transition: background 0.4s ease, border-radius 0.4s ease, transform 0.3s ease;
    opacity: 0;
    transform: translateY(15px);
    cursor: default;
}

.archive-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.archive-card:hover {
    background: rgba(245, 242, 237, 0.18);
    border-radius: 16px;
    transform: translateY(-3px);
}

.card-large {
    grid-column: span 2;
}

.card-medium {
    grid-column: span 1;
}

.card-small {
    grid-column: span 1;
}

.card-label {
    font-family: 'Inter', Helvetica, sans-serif;
    font-weight: 300;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent-teal);
    display: block;
    margin-bottom: 0.8em;
}

.card-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    line-height: 1.7;
    color: var(--light);
}


/* =========================================
   ANIMATIONS: Character-by-character reveal
   ========================================= */
.char-span {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.char-span.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Heading chars animation */
.spread-heading .char-span,
.accord-statement .char-span {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.spread-heading .char-span.visible,
.accord-statement .char-span.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Spread transition shimmer on divider line */
@keyframes spreadTransitionPulse {
    0%, 100% {
        box-shadow: 0 0 0 rgba(155, 127, 230, 0);
    }
    50% {
        box-shadow: 0 0 20px rgba(155, 127, 230, 0.3);
    }
}

/* Subtle float for chamber notes after reveal */
@keyframes noteFloat {
    0%, 100% {
        transform: translateY(0) rotate(var(--note-rotate, 0deg));
    }
    50% {
        transform: translateY(-6px) rotate(var(--note-rotate, 0deg));
    }
}

.note-1.visible {
    animation: noteFloat1 8s ease-in-out infinite;
    animation-delay: 0.6s;
}

.note-2.visible {
    animation: noteFloat2 9s ease-in-out infinite;
    animation-delay: 1.2s;
}

.note-3.visible {
    animation: noteFloat3 7s ease-in-out infinite;
    animation-delay: 0.3s;
}

.note-4.visible {
    animation: noteFloat4 10s ease-in-out infinite;
    animation-delay: 1.8s;
}

@keyframes noteFloat1 {
    0%, 100% {
        transform: translateY(0) rotate(-2deg);
    }
    50% {
        transform: translateY(-6px) rotate(-1.5deg);
    }
}

@keyframes noteFloat2 {
    0%, 100% {
        transform: translateY(0) rotate(1.5deg);
    }
    50% {
        transform: translateY(-5px) rotate(2deg);
    }
}

@keyframes noteFloat3 {
    0%, 100% {
        transform: translateY(0) rotate(2.5deg);
    }
    50% {
        transform: translateY(-7px) rotate(2deg);
    }
}

@keyframes noteFloat4 {
    0%, 100% {
        transform: translateY(0) rotate(-1deg);
    }
    50% {
        transform: translateY(-4px) rotate(-0.5deg);
    }
}

/* Accord punctuation glow */
.accord-punctuation .bp-dot-1 {
    background: var(--accent-violet);
}

.accord-punctuation .bp-dot-2 {
    background: var(--accent-teal);
}

.accord-punctuation .bp-dot-3 {
    background: var(--accent-rose);
}

.accord-punctuation .bp-dot-4 {
    background: var(--accent-violet);
}

.accord-punctuation .bp-dot-5 {
    background: var(--accent-teal);
}


/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 900px) {
    .overture-layout {
        flex-direction: column;
    }

    .overture-bubble-zone {
        width: 100%;
        height: 50vh;
    }

    .overture-title-column {
        width: 100%;
        padding: 4vh 6vw;
        align-items: center;
        text-align: center;
    }

    .hero-title {
        font-size: clamp(3rem, 15vw, 6rem);
    }

    .negotiation-layout {
        flex-direction: column;
    }

    .negotiation-left,
    .negotiation-right {
        width: 100%;
        padding: 6vh 6vw;
    }

    .negotiation-divider {
        left: 0;
        top: 50%;
        width: 100%;
        height: 2px;
        background: linear-gradient(
            90deg,
            transparent 0%,
            var(--accent-violet) 20%,
            var(--accent-teal) 50%,
            var(--accent-rose) 80%,
            transparent 100%
        );
    }

    .chamber-note {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        bottom: auto;
        max-width: 100%;
        margin-bottom: 3em;
    }

    .note-1, .note-2, .note-3, .note-4 {
        transform: none;
    }

    .note-1.visible, .note-2.visible, .note-3.visible, .note-4.visible {
        transform: none;
        animation: none;
    }

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

    .card-large,
    .card-medium,
    .card-small {
        grid-column: span 1;
    }

    #spread-nav {
        right: 12px;
    }

    #accord-shape-canvas {
        width: 200px;
        height: 200px;
    }
}

@media (max-width: 600px) {
    .hero-title {
        font-size: clamp(2.5rem, 18vw, 4rem);
    }

    .spread-heading {
        font-size: clamp(2rem, 10vw, 3rem);
    }

    .accord-statement {
        font-size: clamp(1.8rem, 8vw, 3rem);
    }

    .archive-card {
        padding: 1.5em;
    }

    #accord-shape-canvas {
        width: 160px;
        height: 160px;
    }
}
