/* ============================================================
   diplomacy.bar - Surrealist Diplomat's Private Library
   Chrome-Metallic Palette | Eclectic-Hybrid Typography
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    --chrome-base: #C0C0C8;
    --diplomatic-charcoal: #1C1C28;
    --brushed-steel: #8A8A9E;
    --treaty-amber: #D4A04A;
    --diplomatic-ice: #A8C4E0;
    --ink-black: #18181F;
    --parchment-white: #F0EDE6;
    --amber-haze: #E8C87A;
    --mirror-flash: #E8E8F0;
    --wax-carmine: #9E3B3B;

    --font-display: 'Playfair Display', Georgia, serif;
    --font-handwriting: 'Caveat', cursive;
    --font-body: 'Source Serif 4', 'Source Serif Pro', Georgia, serif;
    --font-ui: 'Space Grotesk', system-ui, sans-serif;
    --font-accent: 'Homemade Apple', cursive;

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

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

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

body {
    background-color: var(--diplomatic-charcoal);
    color: var(--parchment-white);
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    line-height: 1.72;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Chrome-space: the metallic sheen of negative space */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at 30% 20%, rgba(192, 192, 200, 0.03) 0%, transparent 50%),
                radial-gradient(ellipse at 70% 80%, rgba(192, 192, 200, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* --- Room / Section Base --- */
.room {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.room-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 90vw;
    padding-inline: clamp(2rem, 8vw, 6rem);
}

/* --- Bokeh Fields --- */
.bokeh-field {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 1;
    pointer-events: none;
}

.bokeh-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0;
    will-change: transform, opacity;
}

.bokeh-amber {
    background: radial-gradient(circle, var(--amber-haze) 0%, rgba(232, 200, 122, 0.3) 40%, transparent 70%);
}

.bokeh-ice {
    background: radial-gradient(circle, var(--diplomatic-ice) 0%, rgba(168, 196, 224, 0.25) 40%, transparent 70%);
}

/* Opening bokeh circles - positioned and sized */
.bokeh-1 {
    width: 40vmin; height: 40vmin;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
}

.bokeh-2 {
    width: 25vmin; height: 25vmin;
    left: 20%; top: 30%;
}

.bokeh-3 {
    width: 18vmin; height: 18vmin;
    left: 70%; top: 25%;
}

.bokeh-4 {
    width: 30vmin; height: 30vmin;
    left: 60%; top: 60%;
}

.bokeh-5 {
    width: 15vmin; height: 15vmin;
    left: 10%; top: 65%;
}

.bokeh-6 {
    width: 22vmin; height: 22vmin;
    left: 80%; top: 50%;
}

.bokeh-7 {
    width: 12vmin; height: 12vmin;
    left: 35%; top: 75%;
}

.bokeh-8 {
    width: 28vmin; height: 28vmin;
    left: 45%; top: 15%;
}

/* Staggered fade-in + ambient drift for opening bokeh */
.bokeh-1 { animation: bokehFadeGrow 1s 0s var(--ease-smooth) forwards, bokehDrift1 25s 2s ease-in-out infinite; }
.bokeh-2 { animation: bokehFadeIn 0.8s 1.2s var(--ease-smooth) forwards, bokehDrift2 30s 3s ease-in-out infinite; }
.bokeh-3 { animation: bokehFadeIn 0.8s 1.4s var(--ease-smooth) forwards, bokehDrift3 28s 3.5s ease-in-out infinite; }
.bokeh-4 { animation: bokehFadeIn 0.8s 1.6s var(--ease-smooth) forwards, bokehDrift4 35s 4s ease-in-out infinite; }
.bokeh-5 { animation: bokehFadeIn 0.8s 1.8s var(--ease-smooth) forwards, bokehDrift5 22s 4.5s ease-in-out infinite; }
.bokeh-6 { animation: bokehFadeIn 0.8s 2.0s var(--ease-smooth) forwards, bokehDrift6 32s 5s ease-in-out infinite; }
.bokeh-7 { animation: bokehFadeIn 0.8s 2.2s var(--ease-smooth) forwards, bokehDrift7 27s 5.5s ease-in-out infinite; }
.bokeh-8 { animation: bokehFadeIn 0.8s 2.4s var(--ease-smooth) forwards, bokehDrift8 40s 6s ease-in-out infinite; }

@keyframes bokehFadeGrow {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0); }
    100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
}

@keyframes bokehFadeIn {
    0% { opacity: 0; transform: scale(0.5); }
    100% { opacity: 0.5; transform: scale(1); }
}

@keyframes bokehDrift1 {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    25% { transform: translate(-48%, -53%) scale(1.05); }
    50% { transform: translate(-52%, -48%) scale(0.95); }
    75% { transform: translate(-47%, -51%) scale(1.02); }
}

@keyframes bokehDrift2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(3vw, -2vh) scale(1.08); }
    66% { transform: translate(-2vw, 3vh) scale(0.94); }
}

@keyframes bokehDrift3 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-4vw, 2vh) scale(1.1); }
}

@keyframes bokehDrift4 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(2vw, 3vh) scale(0.9); }
    75% { transform: translate(-3vw, -2vh) scale(1.05); }
}

@keyframes bokehDrift5 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(5vw, -3vh); }
}

@keyframes bokehDrift6 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    40% { transform: translate(-3vw, 4vh) scale(1.12); }
    80% { transform: translate(2vw, -1vh) scale(0.92); }
}

@keyframes bokehDrift7 {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(4vw, 2vh); }
    66% { transform: translate(-2vw, -4vh); }
}

@keyframes bokehDrift8 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-2vw, 5vh) scale(1.06); }
}

/* Interlude drift bokeh */
.bokeh-drift-1, .bokeh-drift-5, .bokeh-drift-8, .bokeh-drift-12, .bokeh-drift-14 {
    width: 30vmin; height: 30vmin;
    left: 20%; top: 30%;
    opacity: 0.4;
    animation: bokehDriftGenericA 28s ease-in-out infinite;
}

.bokeh-drift-2, .bokeh-drift-6, .bokeh-drift-10, .bokeh-drift-13, .bokeh-drift-15 {
    width: 22vmin; height: 22vmin;
    left: 65%; top: 50%;
    opacity: 0.35;
    animation: bokehDriftGenericB 35s ease-in-out infinite;
}

.bokeh-drift-3, .bokeh-drift-7, .bokeh-drift-9, .bokeh-drift-16 {
    width: 18vmin; height: 18vmin;
    left: 40%; top: 60%;
    opacity: 0.3;
    animation: bokehDriftGenericC 24s ease-in-out infinite;
}

.bokeh-drift-4, .bokeh-drift-11 {
    width: 26vmin; height: 26vmin;
    left: 80%; top: 25%;
    opacity: 0.35;
    animation: bokehDriftGenericD 32s ease-in-out infinite;
}

@keyframes bokehDriftGenericA {
    0%, 100% { transform: translate(0, 0) scale(1); }
    30% { transform: translate(5vw, -3vh) scale(1.1); }
    60% { transform: translate(-3vw, 4vh) scale(0.9); }
}

@keyframes bokehDriftGenericB {
    0%, 100% { transform: translate(0, 0) scale(1); }
    40% { transform: translate(-4vw, 2vh) scale(1.08); }
    80% { transform: translate(3vw, -5vh) scale(0.95); }
}

@keyframes bokehDriftGenericC {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(6vw, -2vh); }
}

@keyframes bokehDriftGenericD {
    0%, 100% { transform: translate(0, 0) scale(1); }
    35% { transform: translate(-5vw, 3vh) scale(1.05); }
    70% { transform: translate(4vw, -4vh) scale(0.97); }
}


/* ============================================================
   OPENING SEQUENCE
   ============================================================ */
.room--opening {
    background: var(--diplomatic-charcoal);
    min-height: 100vh;
}

.opening-content {
    position: relative;
    z-index: 3;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

/* Domain title - eclectic font per letter */
.domain-title {
    font-size: clamp(2.8rem, 6vw, 5.2rem);
    font-weight: 700;
    color: var(--parchment-white);
    letter-spacing: 0.02em;
    line-height: 1.1;
    opacity: 0;
    animation: titleResolve 1.5s 2s var(--ease-spring) forwards;
}

.letter {
    display: inline-block;
    transition: transform 1s var(--ease-spring);
}

.letter-playfair-i {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 700;
}

.letter-grotesk {
    font-family: var(--font-ui);
    font-weight: 500;
}

.letter-caveat {
    font-family: var(--font-handwriting);
    font-weight: 700;
}

.letter-source {
    font-family: var(--font-body);
    font-weight: 400;
}

.letter-apple {
    font-family: var(--font-accent);
}

.letter-playfair {
    font-family: var(--font-display);
    font-weight: 700;
}

.letter-dot {
    font-family: var(--font-ui);
    color: var(--treaty-amber);
    font-weight: 700;
}

@keyframes titleResolve {
    0% {
        opacity: 0;
        letter-spacing: 0.3em;
    }
    60% {
        opacity: 1;
        letter-spacing: 0.05em;
    }
    100% {
        opacity: 1;
        letter-spacing: 0.02em;
    }
}

/* Letters initial rotation - animated via JS */
.letter {
    transform: rotate(0deg);
}

.letter.letter--scrambled {
    opacity: 0;
}

.letter.letter--resolving {
    opacity: 1;
    transition: transform 1.2s var(--ease-spring), opacity 0.6s ease;
}

/* Chrome divider line */
.chrome-line {
    width: clamp(200px, 40vw, 500px);
    height: 4px;
    opacity: 0;
    animation: chromeLineReveal 1s 3.5s var(--ease-smooth) forwards;
}

.chrome-line svg {
    width: 100%;
    height: 100%;
}

#chrome-line-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    animation: chromeLineDraw 1s 3.5s var(--ease-smooth) forwards;
}

@keyframes chromeLineReveal {
    to { opacity: 1; }
}

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

/* Subtitle */
.subtitle {
    font-family: var(--font-handwriting);
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    color: var(--treaty-amber);
    opacity: 0;
    animation: subtitleFade 1s 4s var(--ease-smooth) forwards;
}

@keyframes subtitleFade {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Scroll hint */
.scroll-hint {
    position: absolute;
    bottom: 3vh;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    animation: scrollHintAppear 1s 5s var(--ease-smooth) forwards;
}

.scroll-hint-text {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--brushed-steel);
}

.scroll-hint-arrow {
    animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollHintAppear {
    to { opacity: 0.7; }
}

@keyframes scrollBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}


/* ============================================================
   BOKEH INTERLUDES
   ============================================================ */
.bokeh-interlude {
    position: relative;
    min-height: 40vh;
    overflow: hidden;
    background: var(--diplomatic-charcoal);
}

.bokeh-interlude--final {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Ink splatter */
.ink-splatter {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    pointer-events: none;
}

.ink-svg {
    width: clamp(200px, 50vw, 500px);
    height: auto;
    opacity: 0.15;
}

.ink-path {
    transition: d 2s var(--ease-smooth);
}


/* ============================================================
   ROOM 1: THE ANTECHAMBER
   ============================================================ */
.room--antechamber {
    background: linear-gradient(180deg, var(--diplomatic-charcoal) 0%, #1E1E2C 40%, var(--diplomatic-charcoal) 100%);
    min-height: 120vh;
    padding: 8vh 0;
}

.f-pattern {
    display: flex;
    flex-direction: column;
    gap: 4rem;
}

.f-primary {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50vh;
    perspective: 800px;
}

.f-columns {
    display: grid;
    grid-template-columns: 60% 40%;
    gap: 3rem;
    align-items: start;
}

/* Floating Book 3D */
.floating-book {
    position: relative;
    width: 220px;
    height: 300px;
    transform-style: preserve-3d;
    transform: rotateY(-15deg) rotateX(5deg);
    animation: bookFloat 8s ease-in-out infinite, bookRotate 20s ease-in-out infinite;
    cursor: default;
    transition: transform 2s var(--ease-spring);
}

.floating-book.book--open {
    transform: rotateY(-40deg) rotateX(2deg);
}

.book-cover {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 2px 8px 8px 2px;
    overflow: hidden;
}

.book-cover--front {
    z-index: 3;
    transform: translateZ(15px);
    box-shadow:
        4px 4px 20px rgba(0, 0, 0, 0.4),
        -2px 0 10px rgba(0, 0, 0, 0.2),
        inset 0 0 30px rgba(232, 232, 240, 0.1);
}

.book-cover--back {
    z-index: 1;
    transform: translateZ(-15px) rotateY(180deg);
}

.book-chrome-surface {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        var(--brushed-steel) 0%,
        var(--mirror-flash) 20%,
        var(--chrome-base) 40%,
        var(--brushed-steel) 60%,
        var(--mirror-flash) 80%,
        var(--chrome-base) 100%
    );
    background-size: 200% 200%;
    animation: chromeShimmer 6s ease-in-out infinite;
}

@keyframes chromeShimmer {
    0% { background-position: 0% 0%; }
    50% { background-position: 100% 100%; }
    100% { background-position: 0% 0%; }
}

.book-title-emboss {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--diplomatic-charcoal);
    text-shadow: 1px 1px 2px rgba(232, 232, 240, 0.3);
    padding: 2rem;
    line-height: 1.3;
    z-index: 2;
}

.book-spine {
    position: absolute;
    left: 0;
    top: 0;
    width: 30px;
    height: 100%;
    transform: rotateY(90deg) translateZ(0px) translateX(-15px);
    background: linear-gradient(
        to right,
        var(--brushed-steel),
        var(--chrome-base),
        var(--brushed-steel)
    );
    z-index: 2;
}

.book-pages {
    position: absolute;
    right: 5px;
    top: 5px;
    width: calc(100% - 35px);
    height: calc(100% - 10px);
    z-index: 2;
}

.book-page {
    position: absolute;
    inset: 0;
    background: var(--parchment-white);
    border-radius: 0 4px 4px 0;
}

.book-page:nth-child(1) { transform: translateZ(12px); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.book-page:nth-child(2) { transform: translateZ(9px); }
.book-page:nth-child(3) { transform: translateZ(6px); }
.book-page:nth-child(4) { transform: translateZ(3px); }

@keyframes bookFloat {
    0%, 100% { transform: rotateY(-15deg) rotateX(5deg) translateY(0); }
    50% { transform: rotateY(-15deg) rotateX(5deg) translateY(-20px); }
}

@keyframes bookRotate {
    0%, 100% { transform: rotateY(-15deg) rotateX(5deg); }
    25% { transform: rotateY(-5deg) rotateX(8deg); }
    50% { transform: rotateY(-20deg) rotateX(2deg); }
    75% { transform: rotateY(-10deg) rotateX(6deg); }
}

/* Seal Marker */
.seal-marker {
    width: 80px;
    height: 80px;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 2px 8px rgba(158, 59, 59, 0.4));
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.8s var(--ease-smooth), transform 0.8s var(--ease-spring);
}

.seal-marker.visible {
    opacity: 1;
    transform: scale(1);
}

.seal-svg {
    width: 100%;
    height: 100%;
}

.seal-icon {
    transition: d 2s var(--ease-smooth);
}

/* Text Block */
.text-block {
    max-width: 72ch;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s var(--ease-smooth), transform 1s var(--ease-spring);
}

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

.body-text {
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    font-weight: 400;
    line-height: 1.72;
    color: var(--parchment-white);
    margin-bottom: 1.5rem;
}

.annotation {
    font-family: var(--font-handwriting);
    font-size: 1.15em;
    color: var(--treaty-amber);
    font-style: normal;
}

/* Chrome Frame */
.chrome-frame {
    border: 1px solid transparent;
    border-image: linear-gradient(135deg, var(--mirror-flash), var(--brushed-steel), var(--chrome-base), var(--brushed-steel), var(--mirror-flash)) 1;
    padding: 2rem;
    position: relative;
    background: rgba(28, 28, 40, 0.6);
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 1s var(--ease-smooth), transform 1s var(--ease-spring), border-image 0.6s ease;
}

.chrome-frame.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Peeling corner effect */
.chrome-frame::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40px;
    height: 40px;
    background: linear-gradient(225deg, var(--diplomatic-charcoal) 50%, var(--chrome-base) 50%);
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.pull-quote {
    font-family: var(--font-display);
    font-style: italic;
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    line-height: 1.5;
    color: var(--parchment-white);
}

.quote-cite {
    display: block;
    margin-top: 1rem;
    font-family: var(--font-handwriting);
    font-size: 1rem;
    font-style: normal;
    color: var(--brushed-steel);
}

.margin-note {
    font-family: var(--font-accent);
    font-size: 0.9rem;
    color: var(--brushed-steel);
    margin-top: 2rem;
    line-height: 1.8;
    opacity: 0;
    transition: opacity 1.2s var(--ease-smooth);
}

.margin-note.visible {
    opacity: 0.7;
}


/* ============================================================
   ROOM 2: THE MAP ROOM
   ============================================================ */
.room--map-room {
    background: radial-gradient(ellipse at center, #22222E 0%, var(--diplomatic-charcoal) 100%);
    padding: 8vh 0;
}

.room-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-style: italic;
    font-size: clamp(2.8rem, 6vw, 5.2rem);
    color: var(--parchment-white);
    letter-spacing: -0.03em;
    text-align: center;
    margin-bottom: 1rem;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 1.2s var(--ease-smooth), transform 1.2s var(--ease-spring);
}

.room-title.visible {
    opacity: 1;
    transform: scale(1);
}

.room-subtitle {
    font-family: var(--font-handwriting);
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: var(--treaty-amber);
    text-align: center;
    margin-bottom: 4rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1s 0.3s var(--ease-smooth), transform 1s 0.3s var(--ease-spring);
}

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

.map-container {
    position: relative;
    width: 100%;
    height: 60vh;
    min-height: 400px;
}

.map-circle {
    position: absolute;
    width: var(--size);
    height: var(--size);
    left: var(--x);
    top: var(--y);
    border-radius: 50%;
    background: linear-gradient(
        135deg,
        var(--brushed-steel) 0%,
        var(--chrome-base) 30%,
        var(--mirror-flash) 50%,
        var(--chrome-base) 70%,
        var(--brushed-steel) 100%
    );
    background-size: 200% 200%;
    cursor: pointer;
    opacity: 0;
    transform: scale(0);
    transition: transform 0.6s var(--ease-spring), opacity 0.6s ease, box-shadow 0.4s ease;
    animation: mapCircleAppear 0.8s var(--delay) var(--ease-spring) forwards;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.3),
        inset 0 -2px 10px rgba(0, 0, 0, 0.2),
        inset 0 2px 10px rgba(232, 232, 240, 0.2);
}

.map-circle::after {
    content: attr(data-nation);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-ui);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--diplomatic-charcoal);
    text-align: center;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.map-circle:hover::after {
    opacity: 1;
}

.map-circle:hover {
    transform: scale(1.12);
    box-shadow:
        0 8px 30px rgba(212, 160, 74, 0.3),
        inset 0 -2px 10px rgba(0, 0, 0, 0.2),
        inset 0 2px 10px rgba(232, 232, 240, 0.3);
    z-index: 10;
}

.map-circle.visible {
    opacity: 1;
    transform: scale(1);
    animation: mapPulse 4s var(--delay) ease-in-out infinite;
}

@keyframes mapCircleAppear {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes mapPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

/* Tooltip */
.map-tooltip {
    position: fixed;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    transform: translate(-50%, -120%);
}

.map-tooltip.active {
    opacity: 1;
}

.tooltip-chrome-frame {
    background: rgba(28, 28, 40, 0.95);
    border: 1px solid;
    border-image: linear-gradient(135deg, var(--mirror-flash), var(--brushed-steel), var(--chrome-base)) 1;
    padding: 1rem 1.5rem;
    max-width: 300px;
    backdrop-filter: blur(10px);
}

.tooltip-nation {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--treaty-amber);
    margin-bottom: 0.5rem;
}

.tooltip-aphorism {
    font-family: var(--font-handwriting);
    font-size: 1.1rem;
    color: var(--parchment-white);
    line-height: 1.5;
}


/* ============================================================
   ROOM 3: THE TREATY ARCHIVE
   ============================================================ */
.room--treaty-archive {
    background: linear-gradient(180deg, var(--diplomatic-charcoal) 0%, #1A1A26 50%, var(--diplomatic-charcoal) 100%);
    padding: 8vh 0;
}

.treaty {
    margin-bottom: 3rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s var(--ease-smooth), transform 1s var(--ease-spring);
}

.treaty.visible {
    opacity: 1;
    transform: translateY(0);
}

.treaty-chrome-frame {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2rem;
    align-items: start;
    padding: 2.5rem;
    border: 1px solid transparent;
    border-image: linear-gradient(135deg, var(--mirror-flash), var(--brushed-steel), var(--chrome-base), var(--brushed-steel), var(--mirror-flash)) 1;
    background: rgba(28, 28, 40, 0.4);
    position: relative;
    transition: border-image 0.6s ease;
}

/* Curling corner */
.treaty-chrome-frame::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 50px;
    height: 50px;
    background: linear-gradient(315deg, transparent 50%, rgba(192, 192, 200, 0.1) 50%);
}

.treaty-seal {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 6px rgba(158, 59, 59, 0.5));
    animation: sealPulse 8s ease-in-out infinite;
}

.treaty-seal-svg {
    width: 100%;
    height: 100%;
}

.treaty-text {
    flex: 1;
}

.treaty-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-style: italic;
    font-size: clamp(1.3rem, 2.5vw, 1.8rem);
    color: var(--parchment-white);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.treaty-body {
    font-family: var(--font-body);
    font-size: clamp(0.95rem, 1.6vw, 1.1rem);
    line-height: 1.72;
    color: rgba(240, 237, 230, 0.85);
    margin-bottom: 1rem;
}

.treaty-date {
    font-family: var(--font-handwriting);
    font-size: 1.1rem;
    color: var(--treaty-amber);
    opacity: 0.8;
}


/* ============================================================
   ROOM 4: THE CIPHER ROOM
   ============================================================ */
.room--cipher-room {
    background: radial-gradient(ellipse at 50% 30%, #20202E 0%, var(--diplomatic-charcoal) 100%);
    padding: 8vh 0;
}

.cipher-blocks {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    max-width: 72ch;
    margin: 0 auto;
}

.cipher-block {
    padding: 2rem 2.5rem;
    border-left: 3px solid var(--brushed-steel);
    background: rgba(28, 28, 40, 0.3);
    position: relative;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.8s var(--ease-smooth), transform 0.8s var(--ease-spring), border-color 1.5s ease;
}

.cipher-block.visible {
    opacity: 1;
    transform: translateX(0);
}

.cipher-block.decoded {
    border-color: var(--treaty-amber);
}

.cipher-block::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 0;
    width: 3px;
    height: 0%;
    background: var(--treaty-amber);
    transition: height 2s var(--ease-smooth);
}

.cipher-block.decoded::before {
    height: 100%;
}

.cipher-text {
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    color: var(--parchment-white);
    transition: color 0.5s ease;
    letter-spacing: 0.01em;
}

.cipher-block.decoded .cipher-text {
    color: var(--parchment-white);
}


/* ============================================================
   CLOSING / FINAL SECTION
   ============================================================ */
.closing-text {
    position: relative;
    z-index: 3;
    text-align: center;
}

.closing-line {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--parchment-white);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.2s var(--ease-smooth), transform 1.2s var(--ease-spring);
}

.closing-line.visible {
    opacity: 1;
    transform: translateY(0);
}

.closing-line--sub {
    font-family: var(--font-handwriting);
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    color: var(--treaty-amber);
    font-weight: 400;
    margin-top: 0.5rem;
    transition-delay: 0.4s;
}


/* ============================================================
   WAX SEAL CURSOR (Desktop)
   ============================================================ */
@media (pointer: fine) {
    .map-circle,
    .treaty-chrome-frame,
    .chrome-frame {
        cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' fill='%239E3B3B'/%3E%3Ccircle cx='12' cy='12' r='7' fill='none' stroke='%23F0EDE6' stroke-width='0.8'/%3E%3Cpath d='M12 6 L13 10 L17 10 L14 13 L15 17 L12 14 L9 17 L10 13 L7 10 L11 10Z' fill='%23F0EDE6' opacity='0.8'/%3E%3C/svg%3E") 12 12, pointer;
    }
}


/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .f-columns {
        grid-template-columns: 1fr;
    }

    .f-col-right {
        padding-left: 0;
    }

    .floating-book {
        width: 160px;
        height: 220px;
    }

    .map-container {
        height: 50vh;
    }

    .map-circle::after {
        font-size: 0.55rem;
    }

    .treaty-chrome-frame {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .treaty-seal {
        margin: 0 auto;
    }

    .room-content {
        padding-inline: clamp(1.5rem, 5vw, 3rem);
    }

    .bokeh-interlude {
        min-height: 25vh;
    }
}

@media (max-width: 480px) {
    .domain-title {
        font-size: clamp(2rem, 10vw, 3.5rem);
    }

    .floating-book {
        width: 130px;
        height: 180px;
    }

    .cipher-block {
        padding: 1.5rem;
    }
}


/* ============================================================
   UTILITY / ANIMATION CLASSES
   ============================================================ */
.fade-in {
    opacity: 0;
    transition: opacity 1s var(--ease-smooth);
}

.fade-in.visible {
    opacity: 1;
}

/* Chrome gradient animation for shimmering surfaces */
@keyframes chromeFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Seal morph rotation for treaty seals */
@keyframes sealPulse {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(3deg) scale(1.05); }
    50% { transform: rotate(-2deg) scale(1); }
    75% { transform: rotate(1deg) scale(1.02); }
}
