/* ============================================
   diplomacy.bar - Ocean Deep Diplomatic Salon
   ============================================ */

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

:root {
    --abyss-black: #0A0E1A;
    --trench-indigo: #121832;
    --bathyal-blue: #1A2744;
    --steel-mist: #B8C4D0;
    --tarnished-gold: #C9A84C;
    --phosphor-cyan: #00D4AA;
    --parchment-cream: #E8DCC8;
    --wax-seal-red: #8B1A1A;
    --angler-amber: #D4820A;
    --muted-teal: #5B8FA8;

    --font-display: 'Playfair Display', Georgia, serif;
    --font-section: 'Abril Fatface', Georgia, serif;
    --font-body: 'Lora', Georgia, serif;
    --font-mono: 'Space Mono', 'Courier New', monospace;

    --scroll-progress: 0;
}

html {
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
}

body {
    background-color: var(--trench-indigo);
    color: var(--steel-mist);
    font-family: var(--font-body);
    font-size: 1.125rem;
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* --- Herringbone Overlay --- */
#herringbone-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2;
    pointer-events: none;
    opacity: 0.03;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 4px,
        var(--steel-mist) 4px,
        var(--steel-mist) 5px
    ),
    repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 4px,
        var(--steel-mist) 4px,
        var(--steel-mist) 5px
    );
    background-size: 12px 12px;
}

/* --- Collage Layers --- */
.collage-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    overflow: hidden;
}

.collage-bg {
    z-index: 1;
}

.collage-mid {
    z-index: 5;
}

.collage-element {
    position: absolute;
    will-change: transform;
    transition: opacity 0.8s ease;
}

/* Background collage fragments */
.cartographic-fragment {
    opacity: 0.08;
}

.frag-1 {
    top: 10%;
    left: -5%;
    width: 50vw;
    transform: rotate(-8deg);
}

.frag-2 {
    top: 40%;
    right: -10%;
    width: 40vw;
    transform: rotate(5deg);
}

.treaty-text {
    font-family: var(--font-body);
    font-size: 0.75rem;
    line-height: 1.6;
    color: var(--steel-mist);
    opacity: 0.06;
    max-width: 30vw;
    transform: rotate(-3deg);
}

.treaty-1 {
    top: 20%;
    left: 5%;
    transform: rotate(-5deg);
}

.treaty-2 {
    top: 55%;
    right: 8%;
    transform: rotate(3deg);
}

.treaty-3 {
    top: 75%;
    left: 15%;
    transform: rotate(-2deg);
}

.treaty-fragment {
    font-style: italic;
}

/* Mid-ground stamps */
.passport-stamp {
    opacity: 0.3;
}

.stamp-1 {
    top: 15%;
    right: 12%;
    width: 120px;
    transform: rotate(-15deg);
}

.stamp-2 {
    top: 45%;
    left: 8%;
    width: 140px;
    transform: rotate(8deg);
}

.stamp-3 {
    top: 70%;
    right: 20%;
    width: 100px;
    transform: rotate(-22deg);
}

.stamp-4 {
    top: 30%;
    left: 30%;
    width: 110px;
    transform: rotate(12deg);
}

/* --- Content Layer --- */
#content-layer {
    position: relative;
    z-index: 10;
}

/* --- Sections --- */
.content-section {
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: start;
    padding: 4rem 2rem;
}

.section-inner {
    max-width: 1200px;
    width: 100%;
    position: relative;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3rem;
}

/* --- Content Islands --- */
.content-island {
    position: relative;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.8s ease;
    opacity: 0;
    transform: translateY(40px);
}

.content-island.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Flow offsets - applied via JS based on scroll */
.island-hero {
    text-align: center;
    padding: 2rem;
}

.island-intro {
    max-width: 600px;
    margin-left: auto;
    padding: 2rem;
}

.island-metadata {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: center;
    padding: 1rem;
}

.island-chapter-title {
    padding: 2rem 0;
}

.island-text-block {
    max-width: 640px;
    padding: 2rem;
    background: rgba(26, 39, 68, 0.4);
    border-left: 2px solid rgba(201, 168, 76, 0.2);
    backdrop-filter: blur(4px);
}

.island-text-block p + p {
    margin-top: 1.5rem;
}

.island-quote {
    max-width: 560px;
    margin-left: auto;
    margin-right: 2rem;
    padding: 2.5rem;
    position: relative;
}

.island-quote::before {
    content: '\201C';
    position: absolute;
    top: -0.5rem;
    left: -0.5rem;
    font-family: var(--font-display);
    font-size: 6rem;
    color: var(--tarnished-gold);
    opacity: 0.15;
    line-height: 1;
}

.island-artifact {
    max-width: 580px;
    padding: 0;
}

.island-artifact:nth-child(odd) {
    margin-left: 5%;
}

.island-artifact:nth-child(even) {
    margin-left: auto;
    margin-right: 5%;
}

.island-classified {
    max-width: 620px;
    margin: 0 auto;
}

.island-final {
    text-align: center;
    padding: 3rem;
}

/* --- Typography --- */
.hero-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-style: italic;
    font-size: clamp(4rem, 8vw, 9rem);
    letter-spacing: -0.03em;
    color: var(--tarnished-gold);
    text-transform: uppercase;
    line-height: 0.95;
    text-shadow: 0 0 40px rgba(201, 168, 76, 0.15);
    font-feature-settings: "liga" 1, "kern" 1;
}

.hero-subtitle {
    font-family: var(--font-body);
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--parchment-cream);
    margin-top: 1.5rem;
    opacity: 0.8;
}

.section-heading {
    font-family: var(--font-section);
    font-weight: 400;
    font-size: clamp(2rem, 4vw, 4.5rem);
    color: var(--parchment-cream);
    line-height: 1.1;
    text-shadow: 0 0 40px rgba(201, 168, 76, 0.15);
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 1.125rem;
    line-height: 1.75;
    letter-spacing: 0.01em;
    color: var(--steel-mist);
}

.metadata-text {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.8125rem;
    line-height: 1.5;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #5B8FA8;
}

.metadata-separator {
    color: var(--tarnished-gold);
    opacity: 0.4;
    font-family: var(--font-mono);
}

/* --- Morse Code Dividers --- */
.morse-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding: 1rem 0;
}

.morse-code {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 3px;
}

.morse-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--phosphor-cyan);
    opacity: 0.6;
}

.morse-dash {
    width: 12px;
    height: 3px;
    background: var(--phosphor-cyan);
    opacity: 0.6;
}

.morse-space {
    width: 10px;
}

/* --- Diplomatic Quote --- */
.diplomatic-quote {
    border: none;
    padding: 0;
    margin: 0;
}

.diplomatic-quote p {
    font-family: var(--font-display);
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.25rem, 2.5vw, 2rem);
    line-height: 1.5;
    color: var(--parchment-cream);
    text-shadow: 0 0 40px rgba(201, 168, 76, 0.15);
}

.quote-citation {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(201, 168, 76, 0.15);
}

/* --- Artifact Cards --- */
.artifact-card {
    background: rgba(26, 39, 68, 0.5);
    border: 1px solid rgba(201, 168, 76, 0.15);
    padding: 2rem;
    position: relative;
    backdrop-filter: blur(4px);
    transition: box-shadow 0.4s ease-in-out, transform 0.4s ease-in-out;
}

.artifact-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(184, 196, 208, 0.02) 3px,
        rgba(184, 196, 208, 0.02) 4px
    );
    pointer-events: none;
}

.artifact-card:hover {
    box-shadow: 0 0 20px rgba(201, 168, 76, 0.3);
    transform: translateY(-2px);
}

.artifact-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(91, 143, 168, 0.2);
}

.artifact-title {
    font-family: var(--font-section);
    font-weight: 400;
    font-size: clamp(1.25rem, 2.5vw, 2rem);
    color: var(--tarnished-gold);
    margin-bottom: 1rem;
    text-shadow: 0 0 40px rgba(201, 168, 76, 0.15);
}

.artifact-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 1.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(91, 143, 168, 0.2);
}

/* --- Classified Block --- */
.classified-block {
    background: rgba(10, 14, 26, 0.8);
    border: 1px solid rgba(139, 26, 26, 0.3);
    padding: 2.5rem;
    position: relative;
}

.classified-block::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(139, 26, 26, 0.03) 2px,
        rgba(139, 26, 26, 0.03) 3px
    );
    pointer-events: none;
}

.classified-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(139, 26, 26, 0.3);
}

.classified-stamp {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    letter-spacing: 0.25em;
    color: var(--wax-seal-red);
    text-transform: uppercase;
    border: 2px solid var(--wax-seal-red);
    padding: 0.25rem 0.75rem;
    opacity: 0.8;
}

.classified-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.redacted-line {
    height: 1.125rem;
    background: rgba(184, 196, 208, 0.15);
    width: 100%;
}

.redacted-line.short {
    width: 60%;
}

.classified-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(139, 26, 26, 0.3);
}

/* --- Wax Seals --- */
.wax-seal {
    display: inline-block;
    width: 80px;
    height: 80px;
    filter: drop-shadow(0 4px 12px rgba(139, 26, 26, 0.4));
    transition: transform 0.4s ease-in-out;
}

.seal-hero {
    margin-bottom: 2rem;
}

.seal-final {
    width: 100px;
    height: 100px;
    margin-bottom: 2rem;
}

.wax-seal:hover {
    transform: scale(1.05) rotate(5deg);
}

/* --- Closing Text --- */
.closing-text {
    opacity: 0.5;
    margin-top: 1rem;
}

/* --- Compass Rose Navigation --- */
#compass-nav {
    position: fixed;
    right: 2rem;
    bottom: 2rem;
    z-index: 100;
}

.compass-rose-container {
    position: relative;
    width: 48px;
    height: 48px;
    cursor: pointer;
    transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), height 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.compass-rose-container.expanded {
    width: 280px;
    height: 280px;
}

#compass-rose {
    width: 100%;
    height: 100%;
    transition: opacity 0.4s ease;
}

.compass-labels {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease 0.2s;
}

.compass-rose-container.expanded .compass-labels {
    opacity: 1;
    pointer-events: all;
}

.compass-label {
    position: absolute;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--steel-mist);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    transition: color 0.4s ease-in-out, text-shadow 0.4s ease-in-out;
    white-space: nowrap;
}

.compass-label:hover {
    color: var(--phosphor-cyan);
}

.compass-label.active {
    color: var(--phosphor-cyan);
    text-shadow: 0 0 12px rgba(0, 212, 170, 0.5);
}

.label-n {
    top: 5%;
    left: 50%;
    transform: translateX(-50%);
}

.label-e {
    top: 50%;
    right: 2%;
    transform: translateY(-50%);
}

.label-s {
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
}

.label-w {
    top: 50%;
    left: 2%;
    transform: translateY(-50%);
}

.label-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.compass-indicator {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--phosphor-cyan);
    box-shadow: 0 0 12px rgba(0, 212, 170, 0.6);
    transition: top 0.6s ease, left 0.6s ease;
    pointer-events: none;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* --- Wave-line watermark background (guilloche) --- */
.content-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 40px,
            rgba(201, 168, 76, 0.02) 40px,
            rgba(201, 168, 76, 0.02) 41px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 40px,
            rgba(91, 143, 168, 0.015) 40px,
            rgba(91, 143, 168, 0.015) 41px
        );
    pointer-events: none;
    z-index: -1;
    opacity: 0.5;
}

/* --- Section-specific backgrounds for depth descent --- */
#section-reception {
    background: linear-gradient(180deg, var(--trench-indigo) 0%, rgba(18, 24, 50, 0.95) 100%);
}

#section-negotiation {
    background: linear-gradient(180deg, rgba(18, 24, 50, 0.95) 0%, rgba(14, 19, 40, 0.95) 100%);
}

#section-archives {
    background: linear-gradient(180deg, rgba(14, 19, 40, 0.95) 0%, rgba(10, 14, 26, 0.95) 100%);
}

#section-deep {
    background: linear-gradient(180deg, rgba(10, 14, 26, 0.98) 0%, var(--abyss-black) 100%);
}

#section-epilogue {
    background: linear-gradient(180deg, var(--abyss-black) 0%, rgba(18, 24, 50, 0.9) 100%);
}

/* --- Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes sealPress {
    0% {
        transform: scale(1.3) translateY(-20px);
        opacity: 0;
    }
    60% {
        transform: scale(0.95) translateY(0);
        opacity: 1;
    }
    80% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes pulseGlow {
    0%, 100% {
        opacity: 0.3;
        box-shadow: 0 0 8px rgba(0, 212, 170, 0.2);
    }
    50% {
        opacity: 0.8;
        box-shadow: 0 0 20px rgba(0, 212, 170, 0.5);
    }
}

@keyframes inkSpread {
    from {
        clip-path: inset(0 100% 0 0);
    }
    to {
        clip-path: inset(0 0 0 0);
    }
}

.seal-animate {
    animation: sealPress 1.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.compass-indicator {
    animation: pulseGlow 3s ease-in-out infinite;
}

/* --- Interaction hover effects --- */
.content-island:not(.island-hero) {
    transition: transform 0.4s ease-in-out, opacity 0.8s ease, box-shadow 0.4s ease-in-out;
}

.content-island:hover {
    box-shadow: 0 0 20px rgba(201, 168, 76, 0.1);
}

/* Click effect */
.click-pulse {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 212, 170, 0.4) 0%, transparent 70%);
    pointer-events: none;
    animation: clickPulse 0.6s ease-out forwards;
    z-index: 1000;
}

@keyframes clickPulse {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 100px;
        height: 100px;
        opacity: 0;
        margin-left: -50px;
        margin-top: -50px;
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .hero-title {
        font-size: clamp(2.5rem, 10vw, 4rem);
    }

    .section-heading {
        font-size: clamp(1.5rem, 6vw, 2.5rem);
    }

    .content-section {
        padding: 3rem 1.25rem;
    }

    .island-text-block {
        max-width: 100%;
        padding: 1.5rem;
    }

    .island-quote {
        margin-right: 0;
        max-width: 100%;
    }

    .island-artifact:nth-child(odd),
    .island-artifact:nth-child(even) {
        margin-left: 0;
        margin-right: 0;
    }

    #compass-nav {
        right: 1rem;
        bottom: 1rem;
    }

    .compass-rose-container.expanded {
        width: 220px;
        height: 220px;
    }

    .passport-stamp {
        display: none;
    }

    .cartographic-fragment {
        display: none;
    }

    .artifact-footer {
        flex-direction: column;
        gap: 0.25rem;
    }

    .classified-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .island-metadata {
        flex-direction: column;
        gap: 0.5rem;
    }

    .metadata-separator {
        display: none;
    }

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

/* --- Selection color --- */
::selection {
    background: rgba(201, 168, 76, 0.3);
    color: var(--parchment-cream);
}

/* --- Scrollbar styling --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--abyss-black);
}

::-webkit-scrollbar-thumb {
    background: rgba(201, 168, 76, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(201, 168, 76, 0.5);
}
