/* ===========================================
   diplomacy.quest - Anti-Design Gilded Anarchy
   =========================================== */

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

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

body {
    background-color: #0d0b08;
    color: #d4c08a;
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 20px;
    line-height: 1.65;
    letter-spacing: 0.015em;
    overflow-x: hidden;
}

/* --- Scroll Progress Line --- */
#scroll-progress-line {
    position: fixed;
    left: 24px;
    top: 0;
    width: 1px;
    height: 100vh;
    background: rgba(201, 169, 78, 0.15);
    z-index: 100;
}

#scroll-progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 0%;
    background: #c9a94e;
    transition: height 0.1s linear;
}

.waypoint {
    position: absolute;
    left: -2.5px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #8a7d5a;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.waypoint[data-chamber="0"] { top: 10%; }
.waypoint[data-chamber="1"] { top: 28%; }
.waypoint[data-chamber="2"] { top: 48%; }
.waypoint[data-chamber="3"] { top: 68%; }
.waypoint[data-chamber="4"] { top: 88%; }

.waypoint.active {
    transform: scale(1.33);
    background: #c9a94e;
    box-shadow: 0 0 8px rgba(201, 169, 78, 0.5);
}

/* --- Chambers (Sections) --- */
.chamber {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* --- Leather Texture Panel --- */
.leather-panel {
    position: absolute;
    inset: 0;
    background-color: #1a1610;
    background-image:
        repeating-conic-gradient(
            rgba(201, 169, 78, 0.04) 0% 25%,
            transparent 0% 50%
        ),
        linear-gradient(
            2deg,
            transparent 0%,
            rgba(201, 169, 78, 0.06) 50%,
            transparent 50.5%,
            transparent 100%
        ),
        linear-gradient(
            178deg,
            transparent 0%,
            rgba(201, 169, 78, 0.05) 30%,
            transparent 30.5%,
            transparent 100%
        ),
        linear-gradient(
            91deg,
            transparent 0%,
            rgba(201, 169, 78, 0.04) 60%,
            transparent 60.3%,
            transparent 100%
        ),
        radial-gradient(
            ellipse at 30% 40%,
            rgba(0, 0, 0, 0.15),
            transparent 70%
        );
    background-size: 2px 2px, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.3);
    will-change: transform;
    z-index: 0;
}

/* --- Wax Seals --- */
.wax-seal {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #c9a94e, #8a7d5a);
    z-index: 10;
    opacity: 0.7;
}

.wax-seal-crisis {
    background: radial-gradient(circle at 40% 35%, #5c1a1a, #1a1610);
}

.wax-seal-final {
    width: 32px;
    height: 32px;
    opacity: 1;
    background: radial-gradient(circle at 40% 35%, #c9a94e, #a6903c, #8a7d5a);
    box-shadow: 0 0 12px rgba(201, 169, 78, 0.3);
}

/* --- Treaty Dividers --- */
.treaty-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
    z-index: 5;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    padding: 20px 0;
}

.treaty-divider .diamond {
    display: block;
    width: 4px;
    height: 4px;
    background: #8a7d5a;
    transform: rotate(45deg);
    flex-shrink: 0;
}

.treaty-divider .rule-line {
    display: block;
    height: 1px;
    flex: 1;
    background: #8a7d5a;
}

/* ============================
   CHAMBER 1: THE ANTECHAMBER
   ============================ */
#antechamber {
    height: 100vh;
    min-height: 100vh;
}

.antechamber-content {
    position: relative;
    z-index: 5;
    text-align: center;
}

.domain-title {
    font-family: 'Homemade Apple', cursive;
    font-size: clamp(36px, 6vw, 72px);
    color: #c9a94e;
    letter-spacing: 0.02em;
    line-height: 1.2;
    text-shadow: 0 0 40px rgba(201, 169, 78, 0.15);
}

/* ============================
   CHAMBER 2: THE BRIEFING ROOM
   ============================ */
#briefing-room {
    min-height: 150vh;
    padding: 15vh 20px;
    flex-direction: column;
    justify-content: center;
    gap: 0;
}

.briefing-content {
    position: relative;
    z-index: 5;
    max-width: 680px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10vh;
    align-items: center;
}

.briefing-text {
    max-width: 480px;
    padding: 30px 40px;
    position: relative;
}

.briefing-text p {
    font-family: 'Caveat', cursive;
    font-size: 22px;
    line-height: 1.7;
    color: #d4c08a;
}

.briefing-text-1 {
    align-self: flex-start;
    transform: translateX(-30px);
}

.briefing-text-2 {
    align-self: flex-end;
    transform: translateX(30px);
}

.briefing-text-3 {
    align-self: flex-start;
    transform: translateX(-10px);
}

/* Blobs */
.blob {
    position: absolute;
    z-index: 2;
    pointer-events: none;
    will-change: transform;
}

.blob-1 {
    width: 400px;
    height: 400px;
    top: 10%;
    right: -5%;
}

.blob-2 {
    width: 350px;
    height: 350px;
    top: 40%;
    left: -8%;
}

.blob-3 {
    width: 300px;
    height: 300px;
    bottom: 10%;
    right: 5%;
}

/* Blob morph animation */
@keyframes blobMorph1 {
    0%, 100% {
        d: path('M250,80 C320,80 400,130 420,200 C440,270 400,350 350,390 C300,430 220,440 170,400 C120,360 70,300 80,230 C90,160 180,80 250,80 Z');
    }
    50% {
        d: path('M260,90 C340,70 410,140 430,210 C450,280 410,360 360,400 C310,440 230,450 180,410 C130,370 60,310 70,240 C80,170 190,90 260,90 Z');
    }
}

@keyframes blobMorph2 {
    0%, 100% {
        d: path('M230,70 C310,60 390,120 410,190 C430,260 380,340 330,380 C280,420 200,430 150,390 C100,350 80,280 90,210 C100,140 150,80 230,70 Z');
    }
    50% {
        d: path('M240,80 C320,65 400,130 420,200 C440,270 390,350 340,390 C290,430 210,440 160,400 C110,360 70,290 80,220 C90,150 160,90 240,80 Z');
    }
}

@keyframes blobMorph3 {
    0%, 100% {
        d: path('M260,90 C330,70 400,140 420,210 C440,280 390,360 340,400 C290,440 210,430 160,380 C110,330 90,260 100,190 C110,120 190,110 260,90 Z');
    }
    50% {
        d: path('M270,100 C340,80 410,150 430,220 C450,290 400,370 350,410 C300,450 220,440 170,390 C120,340 80,270 90,200 C100,130 200,120 270,100 Z');
    }
}

.blob-1 .blob-path { animation: blobMorph1 10s ease-in-out infinite; }
.blob-2 .blob-path { animation: blobMorph2 12s ease-in-out infinite 2s; }
.blob-3 .blob-path { animation: blobMorph3 8s ease-in-out infinite 4s; }

/* ============================
   CHAMBER 3: THE NEGOTIATION HALL
   ============================ */
#negotiation-hall {
    min-height: 150vh;
    padding: 10vh 20px;
    flex-direction: column;
}

.blob-4 {
    width: 320px;
    height: 320px;
    top: 15%;
    left: -5%;
    z-index: 2;
}

@keyframes blobMorph4 {
    0%, 100% {
        d: path('M240,85 C310,75 395,135 415,205 C435,275 385,345 335,385 C285,425 205,435 155,395 C105,355 85,275 95,205 C105,135 170,95 240,85 Z');
    }
    50% {
        d: path('M250,95 C320,85 405,145 425,215 C445,285 395,355 345,395 C295,435 215,445 165,405 C115,365 75,285 85,215 C95,145 180,105 250,95 Z');
    }
}

.blob-4 .blob-path { animation: blobMorph4 11s ease-in-out infinite 1s; }

.negotiation-content {
    position: relative;
    z-index: 5;
    max-width: 680px;
    width: 100%;
    margin: 0 auto;
}

.chamber-title {
    font-family: 'Homemade Apple', cursive;
    font-size: clamp(32px, 5vw, 56px);
    color: #c9a94e;
    text-align: center;
    margin-bottom: 40px;
}

.treaty-text {
    font-family: 'Caveat', cursive;
    font-size: 20px;
    line-height: 1.65;
    color: #d4c08a;
}

.treaty-text p {
    margin-bottom: 28px;
}

/* Anti-design disrupted words */
.disrupted-word {
    display: inline-block;
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.disrupted-word.active.rotate-pos {
    transform: rotate(3deg);
}

.disrupted-word.active.rotate-neg {
    transform: rotate(-3deg);
}

.disrupted-word.active.scale-up {
    transform: scale(1.3);
    color: #c9a94e;
}

.disrupted-word.active.opacity-fade {
    opacity: 0.6;
}

/* ============================
   CHAMBER 4: THE CRISIS ROOM
   ============================ */
#crisis-room {
    min-height: 150vh;
    padding: 15vh 20px;
    flex-direction: column;
    justify-content: center;
    gap: 60px;
}

.blob-5 {
    width: 450px;
    height: 450px;
    top: 5%;
    right: -10%;
    z-index: 2;
}

.blob-6 {
    width: 380px;
    height: 380px;
    bottom: 10%;
    left: -8%;
    z-index: 2;
}

@keyframes blobMorph5 {
    0%, 100% {
        d: path('M255,75 C325,65 405,125 425,195 C445,265 395,345 345,395 C295,445 215,440 160,395 C105,350 80,270 90,200 C100,130 185,85 255,75 Z');
    }
    50% {
        d: path('M265,85 C335,75 415,135 435,205 C455,275 405,355 355,405 C305,455 225,450 170,405 C115,360 70,280 80,210 C90,140 195,95 265,85 Z');
    }
}

@keyframes blobMorph6 {
    0%, 100% {
        d: path('M245,80 C315,70 395,130 415,200 C435,270 385,350 335,390 C285,430 205,440 155,400 C105,360 85,280 95,210 C105,140 175,90 245,80 Z');
    }
    50% {
        d: path('M235,90 C305,80 385,140 405,210 C425,280 375,360 325,400 C275,440 195,450 145,410 C95,370 75,290 85,220 C95,150 165,100 235,90 Z');
    }
}

@keyframes blobPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.blob-5 .blob-path { animation: blobMorph5 9s ease-in-out infinite 3s; }
.blob-6 .blob-path { animation: blobMorph6 10s ease-in-out infinite 5s; }

#crisis-room .blob {
    animation: blobPulse 8s ease-in-out infinite;
}

/* Crisis Panels */
.crisis-panel {
    position: relative;
    z-index: 5;
    width: 300px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crisis-panel .leather-panel {
    border-radius: 4px;
}

.crisis-panel-1 {
    transform: rotate(3deg) translateX(60px);
}

.crisis-panel-2 {
    transform: rotate(-5deg) translateX(-40px);
}

.crisis-panel-3 {
    transform: rotate(1deg) translateX(20px);
}

.crisis-word {
    position: relative;
    z-index: 6;
    font-family: 'Homemade Apple', cursive;
    font-size: 36px;
    color: #c9a94e;
    text-shadow: 0 0 20px rgba(201, 169, 78, 0.2);
}

.redaction-bar {
    position: absolute;
    z-index: 7;
    width: 70%;
    height: 24px;
    background: rgba(13, 11, 8, 0.7);
    top: 50%;
    left: 15%;
    transform: translateY(-50%);
}

/* Crisis Fragments */
.crisis-fragments {
    position: relative;
    z-index: 5;
    width: 100%;
    max-width: 680px;
    height: 200px;
    margin: 0 auto;
}

.fragment {
    position: absolute;
    font-family: 'Patrick Hand', cursive;
    font-size: 16px;
    color: #8a7d5a;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.fragment.visible {
    opacity: 1;
}

.fragment-1 { top: 10%; left: 5%; transform: rotate(-2deg); }
.fragment-2 { top: 30%; right: 10%; transform: rotate(1deg); }
.fragment-3 { top: 55%; left: 15%; transform: rotate(3deg); }
.fragment-4 { top: 75%; right: 5%; transform: rotate(-1deg); }
.fragment-5 { top: 45%; left: 50%; transform: rotate(2deg); color: #5c1a1a; }

/* ============================
   CHAMBER 5: THE ACCORD
   ============================ */
#accord {
    min-height: 100vh;
    padding: 15vh 20px;
    flex-direction: column;
}

.blob-7 {
    width: 500px;
    height: 500px;
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

@keyframes blobMorph7 {
    0%, 100% {
        d: path('M250,90 C320,80 400,140 420,210 C440,280 390,350 340,390 C290,430 210,440 160,400 C110,360 80,280 90,210 C100,140 180,100 250,90 Z');
    }
    50% {
        d: path('M260,100 C330,90 410,150 430,220 C450,290 400,360 350,400 C300,440 220,450 170,410 C120,370 70,290 80,220 C90,150 190,110 260,100 Z');
    }
}

.blob-7 .blob-path { animation: blobMorph7 12s ease-in-out infinite; }

.accord-content {
    position: relative;
    z-index: 5;
    max-width: 680px;
    width: 100%;
    margin: 0 auto;
    text-align: center;
}

.accord-title {
    margin-bottom: 50px;
}

.accord-text {
    font-family: 'Caveat', cursive;
    font-size: 22px;
    line-height: 1.75;
    color: #d4c08a;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    body {
        font-size: 18px;
    }

    #scroll-progress-line {
        left: 12px;
    }

    .blob {
        opacity: 0.7;
    }

    .blob-1, .blob-5 { width: 250px; height: 250px; }
    .blob-2, .blob-6 { width: 220px; height: 220px; }
    .blob-3 { width: 200px; height: 200px; }
    .blob-7 { width: 300px; height: 300px; }

    .briefing-text {
        max-width: 100%;
        padding: 20px;
    }

    .briefing-text-1,
    .briefing-text-2,
    .briefing-text-3 {
        transform: none;
        align-self: center;
    }

    .crisis-panel {
        width: 250px;
        height: 160px;
    }

    .crisis-panel-1 { transform: rotate(2deg) translateX(20px); }
    .crisis-panel-2 { transform: rotate(-3deg) translateX(-20px); }
    .crisis-panel-3 { transform: rotate(1deg) translateX(10px); }
}

/* --- Rare palette utilities --- */
.text-dark { color: #1a1a1a; }
.bg-parchment { background-color: #f0e8d4; }
