/* ==========================================================================
   diplomacy.bar - Art-Deco Diplomatic Salon
   ========================================================================== */

/* --- CSS Custom Properties --- */
:root {
    --diplomatic-navy: #0B1226;
    --treaty-gold: #C9A84C;
    --parchment-cream: #F5ECD7;
    --wax-seal-red: #8B2500;
    --champagne-mist: #E8DCC8;
    --obsidian-shadow: #050A14;
    --verdigris-tint: #4A7C6F;
    --scroll-progress: 0;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--obsidian-shadow);
    color: var(--champagne-mist);
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: clamp(16px, 1.2vw, 20px);
    line-height: 1.85;
    letter-spacing: 0.01em;
}

/* --- Horizontal Scroll Container --- */
#rooms-container {
    display: flex;
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

#rooms-container::-webkit-scrollbar {
    display: none;
}

/* --- Room Base --- */
.room {
    min-width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
    transition: opacity 200ms ease;
}

.room-heading {
    font-family: 'Poiret One', cursive;
    font-weight: 400;
    font-size: clamp(28px, 3.5vw, 56px);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--treaty-gold);
    text-align: center;
    padding-top: 40px;
}

/* ==========================================================================
   COMPASS ROSE (Fixed)
   ========================================================================== */
#compass-rose {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
    opacity: 0;
    transition: opacity 600ms ease;
}

#compass-rose.visible {
    opacity: 1;
}

#compass-needle {
    transition: transform 300ms ease-out;
    transform: rotate(calc(var(--scroll-progress) * 360deg));
}

/* ==========================================================================
   SCROLL PROGRESS BAR (Fixed Bottom)
   ========================================================================== */
#scroll-progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(201, 168, 76, 0.15);
    z-index: 100;
    opacity: 0;
    transition: opacity 600ms ease;
}

#scroll-progress-bar.visible {
    opacity: 1;
}

#scroll-progress-fill {
    height: 100%;
    width: calc(var(--scroll-progress) * 100%);
    background: var(--treaty-gold);
    transition: width 100ms linear;
}

/* ==========================================================================
   ROOM 1: THE FOYER
   ========================================================================== */
#foyer {
    background: var(--obsidian-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
}

.foyer-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* --- Sunburst Fans --- */
.sunburst-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    pointer-events: none;
}

.sunburst-fan {
    position: absolute;
    width: 200px;
    height: 100px;
    background: repeating-conic-gradient(
        from 0deg,
        transparent 0deg,
        transparent 10deg,
        rgba(201, 168, 76, 0.15) 10deg,
        rgba(201, 168, 76, 0.15) 12deg
    );
    border-radius: 200px 200px 0 0;
    opacity: 0;
    transform: scale(0);
    transform-origin: bottom center;
}

.sunburst-fan.animate {
    animation: sunburstBloom 800ms ease-out forwards;
}

@keyframes sunburstBloom {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.fan-1 { top: 50px; left: 50%; transform: translateX(-50%) scale(0); }
.fan-1.animate { transform: translateX(-50%) scale(1); }
@keyframes fan1bloom {
    from { transform: translateX(-50%) scale(0); opacity: 0; }
    to { transform: translateX(-50%) scale(1); opacity: 1; }
}
.fan-1.animate { animation-name: fan1bloom; }

.fan-2 { top: 120px; left: 15%; transform: rotate(-30deg) scale(0); }
.fan-2.animate { animation-name: fan2bloom; }
@keyframes fan2bloom {
    from { transform: rotate(-30deg) scale(0); opacity: 0; }
    to { transform: rotate(-30deg) scale(1); opacity: 1; }
}

.fan-3 { top: 120px; right: 15%; left: auto; transform: rotate(30deg) scale(0); }
.fan-3.animate { animation-name: fan3bloom; }
@keyframes fan3bloom {
    from { transform: rotate(30deg) scale(0); opacity: 0; }
    to { transform: rotate(30deg) scale(1); opacity: 1; }
}

.fan-4 { bottom: 120px; left: 50%; transform: translateX(-50%) rotate(180deg) scale(0); }
.fan-4.animate { animation-name: fan4bloom; }
@keyframes fan4bloom {
    from { transform: translateX(-50%) rotate(180deg) scale(0); opacity: 0; }
    to { transform: translateX(-50%) rotate(180deg) scale(1); opacity: 1; }
}

.fan-5 { bottom: 100px; left: 10%; transform: rotate(210deg) scale(0); }
.fan-5.animate { animation-name: fan5bloom; }
@keyframes fan5bloom {
    from { transform: rotate(210deg) scale(0); opacity: 0; }
    to { transform: rotate(210deg) scale(1); opacity: 1; }
}

.fan-6 { bottom: 100px; right: 10%; left: auto; transform: rotate(150deg) scale(0); }
.fan-6.animate { animation-name: fan6bloom; }
@keyframes fan6bloom {
    from { transform: rotate(150deg) scale(0); opacity: 0; }
    to { transform: rotate(150deg) scale(1); opacity: 1; }
}

/* --- Gateway Arch --- */
#gateway-arch {
    width: clamp(280px, 40vw, 400px);
    height: auto;
    position: relative;
    z-index: 2;
}

.arch-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
}

.arch-line.animate {
    animation: drawLine 800ms ease-in-out forwards;
}

@keyframes drawLine {
    to { stroke-dashoffset: 0; }
}

/* --- Foyer Title --- */
#foyer-title {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -75%);
    z-index: 3;
    opacity: 0;
    transition: opacity 600ms ease, transform 600ms ease;
}

#foyer-title.animate {
    opacity: 1;
    transform: translate(-50%, -80%);
}

#foyer-title h1 {
    font-family: 'Poiret One', cursive;
    font-weight: 400;
    font-size: clamp(36px, 5vw, 72px);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--treaty-gold);
    white-space: nowrap;
}

/* --- Invitation Line --- */
#invitation-line {
    position: absolute;
    bottom: 25%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(18px, 1.5vw, 24px);
    color: var(--champagne-mist);
    letter-spacing: 0.05em;
    white-space: nowrap;
}

#invitation-text {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    width: 0;
    vertical-align: bottom;
}

#invitation-text.animate {
    animation: typeReveal 800ms steps(22) forwards;
}

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

#typing-cursor {
    display: inline-block;
    opacity: 0;
    animation: none;
    color: var(--treaty-gold);
    font-weight: 400;
}

#typing-cursor.animate {
    opacity: 1;
    animation: blinkCursor 800ms step-end infinite;
}

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

/* ==========================================================================
   ROOM 2: THE MAP ROOM
   ========================================================================== */
#map-room {
    background: var(--diplomatic-navy);
    display: flex;
    align-items: center;
    justify-content: center;
}

.room-frame {
    position: absolute;
    inset: 20px;
    pointer-events: none;
    z-index: 1;
}

.map-room-layout {
    display: flex;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 2;
}

.map-area {
    flex: 0 0 60%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

#world-map {
    width: 90%;
    max-width: 700px;
    height: auto;
}

.map-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 3s ease-in-out;
}

.map-path.animate {
    stroke-dashoffset: 0;
}

.doctrines-area {
    flex: 0 0 40%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 30px;
    padding: 60px 40px 60px 0;
}

.doctrine-block {
    position: relative;
    padding: 24px 28px;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 500ms ease, transform 500ms ease;
}

.doctrine-block.animate {
    opacity: 1;
    transform: translateY(0);
}

.doctrine-block h3 {
    font-family: 'Poiret One', cursive;
    font-weight: 400;
    font-size: clamp(18px, 1.5vw, 24px);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--treaty-gold);
    margin-bottom: 10px;
}

.doctrine-block p {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: clamp(14px, 1.1vw, 18px);
    line-height: 1.85;
    color: var(--champagne-mist);
}

/* --- Deco Bracket Frame --- */
.deco-bracket-frame {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.deco-bracket-frame span {
    position: absolute;
    width: 16px;
    height: 16px;
    border-color: var(--treaty-gold);
    border-style: solid;
}

.bracket-tl { top: 0; left: 0; border-width: 1px 0 0 1px; }
.bracket-tr { top: 0; right: 0; border-width: 1px 1px 0 0; }
.bracket-bl { bottom: 0; left: 0; border-width: 0 0 1px 1px; }
.bracket-br { bottom: 0; right: 0; border-width: 0 1px 1px 0; }

/* --- Deco Frame (Stepped Borders) --- */
.deco-frame {
    border: 1px solid var(--treaty-gold);
    position: relative;
}

.deco-frame::before {
    content: '';
    position: absolute;
    inset: 4px;
    border: 1px solid var(--treaty-gold);
    pointer-events: none;
}

.deco-frame::after {
    content: '';
    position: absolute;
    inset: 8px;
    border: 1px solid var(--treaty-gold);
    pointer-events: none;
}

/* Deco Corner Diamonds */
.deco-corner {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--treaty-gold);
    transform: rotate(45deg);
    z-index: 2;
}

.deco-corner-tl { top: -4px; left: -4px; }
.deco-corner-tr { top: -4px; right: -4px; }
.deco-corner-bl { bottom: -4px; left: -4px; }
.deco-corner-br { bottom: -4px; right: -4px; }

/* ==========================================================================
   ROOM 3: THE CIPHER LOUNGE
   ========================================================================== */
#cipher-lounge {
    background: var(--diplomatic-navy);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.honeycomb-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 30px;
}

.hex-row {
    display: flex;
    gap: 8px;
}

.hex-row-2 {
    margin-top: -28px;
}

.hex-row-3 {
    margin-top: -28px;
}

.hex-card {
    width: clamp(140px, 16vw, 200px);
    height: clamp(160px, 18vw, 230px);
    perspective: 600px;
    cursor: pointer;
}

.hex-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 400ms ease;
    transform-style: preserve-3d;
}

.hex-card:hover .hex-inner {
    transform: rotateY(180deg);
}

.hex-front, .hex-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
    text-align: center;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.hex-front {
    background: var(--obsidian-shadow);
    border: none;
    box-shadow: inset 0 0 12px rgba(201, 168, 76, 0.1);
}

.hex-front::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    border: 1px solid var(--treaty-gold);
    pointer-events: none;
}

.hex-front h4 {
    font-family: 'Poiret One', cursive;
    font-weight: 400;
    font-size: clamp(14px, 1.2vw, 18px);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--treaty-gold);
    margin-bottom: 6px;
}

.hex-front .hex-tagline {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: clamp(12px, 0.9vw, 15px);
    color: var(--champagne-mist);
    opacity: 0.7;
}

.hex-back {
    background: var(--diplomatic-navy);
    transform: rotateY(180deg);
    padding: 20px 14px;
}

.hex-back .dossier-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 10px;
    letter-spacing: 0.2em;
    color: var(--wax-seal-red);
    text-transform: uppercase;
    margin-bottom: 8px;
    opacity: 0.8;
}

.hex-back .dossier-content {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 11px;
    letter-spacing: 0.05em;
    color: var(--champagne-mist);
    line-height: 1.5;
    opacity: 0.8;
}

/* ==========================================================================
   ROOM 4: THE BACK CHANNEL
   ========================================================================== */
#back-channel {
    background: var(--diplomatic-navy);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.diagonal-upper {
    position: absolute;
    inset: 0;
    clip-path: polygon(0 0, 100% 0, 75% 100%, 0 100%);
    background: var(--diplomatic-navy);
    z-index: 1;
}

.chevron-pattern {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        135deg,
        transparent,
        transparent 20px,
        rgba(201, 168, 76, 0.06) 20px,
        rgba(201, 168, 76, 0.06) 22px
    );
}

.diagonal-lower {
    position: absolute;
    inset: 0;
    clip-path: polygon(25% 0, 100% 0, 100% 100%, 0 100%);
    background: var(--parchment-cream);
    z-index: 1;
}

.diplomatic-quote {
    position: relative;
    z-index: 10;
    max-width: 700px;
    text-align: center;
    padding: 40px;
}

.diplomatic-quote p {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(22px, 2.5vw, 38px);
    line-height: 1.6;
    color: var(--treaty-gold);
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

.diplomatic-quote cite {
    display: block;
    margin-top: 20px;
    font-family: 'IBM Plex Mono', monospace;
    font-style: normal;
    font-size: 13px;
    letter-spacing: 0.05em;
    color: var(--diplomatic-navy);
    opacity: 0.8;
}

/* --- Champagne Particles --- */
#particle-field {
    position: absolute;
    inset: 0;
    z-index: 2;
    overflow: hidden;
    pointer-events: none;
}

.champagne-particle {
    position: absolute;
    bottom: -10px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--treaty-gold);
    opacity: 0.5;
    animation: floatUp var(--duration) linear infinite;
    animation-delay: var(--delay);
    left: var(--x);
}

@keyframes floatUp {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0.5;
    }
    50% {
        opacity: 0.7;
    }
    100% {
        transform: translateY(-100vh) translateX(var(--wobble));
        opacity: 0;
    }
}

/* ==========================================================================
   ROOM 5: THE TREATY TABLE
   ========================================================================== */
#treaty-table {
    background: var(--diplomatic-navy);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.table-scene {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    width: 100%;
    max-width: 900px;
}

.treaty-table-surface {
    width: 80%;
    height: 60px;
    background: linear-gradient(
        180deg,
        #5C3A1E 0%,
        #4A2E15 20%,
        #6B4226 40%,
        #4A2E15 60%,
        #5C3A1E 80%,
        #3E2510 100%
    );
    border-radius: 30px;
    position: relative;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(201, 168, 76, 0.15),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

.place-settings {
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
}

.place-setting {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid var(--treaty-gold);
    background: transparent;
}

.closing-statement {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: clamp(16px, 1.3vw, 20px);
    line-height: 1.85;
    color: var(--champagne-mist);
    text-align: center;
    max-width: 650px;
}

.seal-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    margin-top: 20px;
}

#wax-seal {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: radial-gradient(circle at 40% 40%, #B03000, #8B2500 60%, #6B1A00);
    box-shadow:
        inset 0 2px 4px rgba(255, 255, 255, 0.15),
        inset 0 -2px 4px rgba(0, 0, 0, 0.3),
        0 2px 8px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 200ms ease-out, box-shadow 200ms ease-out;
    position: relative;
}

#wax-seal:hover {
    background: radial-gradient(circle at 40% 40%, #C03500, #9B3000 60%, #7B2000);
}

#wax-seal.stamped {
    transform: scale(1.0);
    box-shadow:
        inset 0 2px 4px rgba(255, 255, 255, 0.15),
        inset 0 -2px 4px rgba(0, 0, 0, 0.3),
        0 0 0 4px rgba(139, 37, 0, 0.3),
        0 2px 8px rgba(0, 0, 0, 0.4);
}

#wax-seal:not(.stamped) {
    transform: scale(1.05);
}

#wax-seal:not(.stamped):active {
    transform: scale(0.95);
}

.seal-letter {
    font-family: 'Poiret One', cursive;
    font-size: 28px;
    color: var(--parchment-cream);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

#farewell-message {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(16px, 1.2vw, 20px);
    color: var(--treaty-gold);
    text-align: center;
    max-width: 500px;
    transition: opacity 600ms ease, transform 600ms ease;
}

#farewell-message.farewell-hidden {
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
}

#farewell-message.farewell-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   ART-DECO SUNBURST DIVIDERS
   ========================================================================== */
.sunburst-divider {
    width: 120px;
    height: 60px;
    background: repeating-conic-gradient(
        from 0deg,
        transparent 0deg,
        transparent 10deg,
        rgba(201, 168, 76, 0.2) 10deg,
        rgba(201, 168, 76, 0.2) 12deg
    );
    border-radius: 120px 120px 0 0;
    margin: 20px auto;
}

/* ==========================================================================
   ROOM TRANSITION EFFECTS
   ========================================================================== */
.room.transitioning-out {
    opacity: 0.85;
}

.room.transitioning-in {
    opacity: 1;
}
