/* ========================================
   diplomatic.quest - Techno-Fae Diplomatic Salon
   ======================================== */

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

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

body {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    color: #2A1F17;
    background: #1C1410;
    overflow-x: hidden;
}

/* --- Fairy-Light Particle Canvas --- */
#fairy-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* --- Root Network SVG --- */
#root-network {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.15;
}

/* --- Biome Base Styles --- */
.biome {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.biome-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.biome-content {
    position: relative;
    z-index: 3;
}

.biome-foreground {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
}

.biome-transition {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120px;
    z-index: 6;
}

.biome-transition svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* ========================================
   BIOME 1: THE CANOPY
   ======================================== */
#biome-canopy {
    min-height: 100vh;
    height: 100vh;
    background: #1C1410;
    display: flex;
    align-items: center;
    justify-content: center;
}

#biome-canopy .biome-content {
    text-align: center;
    will-change: transform;
}

.canopy-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(3rem, 9vw, 7.5rem);
    color: #EDE4D4;
    letter-spacing: 0.04em;
    line-height: 1.06;
    margin-bottom: 1.5rem;
}

.canopy-subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.7rem, 0.85vw, 0.85rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(62, 207, 180, 0.4);
    max-width: 40em;
    margin: 0 auto;
}

/* ========================================
   BIOME 2: THE MYCELIUM CHAMBER
   ======================================== */
#biome-mycelium {
    min-height: 120vh;
    height: auto;
    background: #F2E8D5;
    padding: 10vh 0 16vh;
}

.mycelium-bg {
    background:
        radial-gradient(ellipse at 25% 30%, rgba(62, 207, 180, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 60%, rgba(62, 207, 180, 0.06) 0%, transparent 55%);
}

.mycelium-content {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
}

/* --- Glassmorphic Cards --- */
.glass-card {
    background: rgba(242, 232, 213, 0.12);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border: 1px solid transparent;
    border-image: linear-gradient(135deg, #C8A952 0%, #D4618C 50%, #3ECFB4 100%) 1;
    border-radius: 2px 16px 2px 16px;
    box-shadow:
        0 8px 32px rgba(28, 20, 16, 0.4),
        inset 0 0 20px rgba(62, 207, 180, 0.05);
    padding: 2.5rem 2.5rem;
    opacity: 0;
    transform: translateY(40px) scale(0.97);
    transition:
        opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.card-label {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.7rem, 0.85vw, 0.85rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(92, 61, 46, 0.6);
    margin-bottom: 1.2rem;
}

.glass-card h2 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    line-height: 1.12;
    letter-spacing: 0.02em;
    color: #2A1F17;
    margin-bottom: 1.2rem;
}

.glass-card p {
    max-width: 38em;
    margin-bottom: 1rem;
    color: #2A1F17;
}

.glass-card p:last-child {
    margin-bottom: 0;
}

/* Manifesto card */
.card-manifesto {
    grid-column: 2 / 7;
    grid-row: 1;
    z-index: 2;
}

/* Principles card */
.card-principles {
    grid-column: 5 / 11;
    grid-row: 1;
    z-index: 3;
    margin-top: 8rem;
}

/* --- Hexagonal Sigil List --- */
.hex-list {
    list-style: none;
    padding: 0;
}

.hex-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    color: #2A1F17;
}

.hex-sigil {
    flex-shrink: 0;
    margin-top: 0.35rem;
}

/* --- Circuit Vines --- */
.circuit-vines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.circuit-vines path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.circuit-vines.visible path {
    stroke-dashoffset: 0;
}

/* --- Mushroom Divider --- */
.mushroom-divider {
    position: absolute;
    bottom: 130px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: flex-end;
    gap: 6px;
    z-index: 5;
}

.mushroom {
    position: relative;
    background: #5C3D2E;
    opacity: 0.35;
}

.mushroom::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 50% 50% 0 0;
    background: inherit;
}

.mushroom.m1 { width: 6px; height: 14px; }
.mushroom.m1::before { width: 18px; height: 10px; }

.mushroom.m2 { width: 8px; height: 20px; }
.mushroom.m2::before { width: 26px; height: 14px; }

.mushroom.m3 { width: 10px; height: 28px; }
.mushroom.m3::before { width: 34px; height: 18px; }

.mushroom.m4 { width: 7px; height: 18px; }
.mushroom.m4::before { width: 22px; height: 12px; }

.mushroom.m5 { width: 5px; height: 12px; }
.mushroom.m5::before { width: 16px; height: 9px; }

/* ========================================
   BIOME 3: THE TREATY GROVE
   ======================================== */
#biome-treaty {
    min-height: 100vh;
    height: auto;
    padding: 12vh 0;
}

.treaty-bg {
    background: linear-gradient(105deg, #1C1410 38%, #F2E8D5 42%);
}

.treaty-content {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 4rem 2rem;
    position: relative;
}

.card-treaty {
    max-width: 680px;
    width: 90%;
    z-index: 3;
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    box-shadow:
        0 8px 32px rgba(28, 20, 16, 0.5),
        0 0 40px rgba(200, 169, 82, 0.08),
        inset 0 0 20px rgba(62, 207, 180, 0.05);
}

.card-treaty h2 {
    color: #EDE4D4;
}

.card-treaty p {
    color: #EDE4D4;
}

.card-treaty .card-label {
    color: rgba(237, 228, 212, 0.5);
}

.treaty-aside {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 300;
    font-size: clamp(1.1rem, 1.4vw, 1.3rem);
    color: rgba(200, 169, 82, 0.7) !important;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(200, 169, 82, 0.2);
}

.vine-treaty {
    z-index: 1;
}

/* ========================================
   BIOME 4: THE THRONE OF THORNS
   ======================================== */
#biome-thorns {
    min-height: 100vh;
    height: auto;
    background: #140E0A;
    padding: 12vh 0 8vh;
}

.thorns-bg {
    background:
        radial-gradient(ellipse at 50% 30%, rgba(212, 97, 140, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 30% 70%, rgba(212, 97, 140, 0.04) 0%, transparent 40%);
}

.thorns-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 2rem;
}

/* --- Thorns Statement --- */
.thorns-statement {
    position: relative;
    text-align: center;
    padding: 4rem 3rem;
    margin-bottom: 6rem;
    max-width: 900px;
    width: 100%;
}

.thorns-headline {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: clamp(2.8rem, 8vw, 7rem);
    line-height: 1.06;
    letter-spacing: 0.04em;
    color: #D4618C;
    margin-bottom: 1.5rem;
}

.thorns-sub {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 300;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    color: rgba(237, 228, 212, 0.5);
    line-height: 1.4;
}

/* --- Thorn Border System --- */
.thorn-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.thorn {
    position: absolute;
    width: 0;
    height: 0;
}

/* Top-left */
.thorn-tl {
    top: -7px;
    left: 15%;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 8px solid #D4618C;
}

/* Top-right */
.thorn-tr {
    top: -7px;
    right: 15%;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 8px solid #D4618C;
}

/* Top-mid */
.thorn-tm {
    top: -7px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 7px solid #D4618C;
}

/* Bottom-left */
.thorn-bl {
    bottom: -7px;
    left: 20%;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 8px solid #D4618C;
}

/* Bottom-right */
.thorn-br {
    bottom: -7px;
    right: 20%;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 8px solid #D4618C;
}

/* Bottom-mid */
.thorn-bm {
    bottom: -7px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 7px solid #D4618C;
}

/* Left-mid */
.thorn-lm {
    left: -7px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-right: 8px solid #D4618C;
}

/* Right-mid */
.thorn-rm {
    right: -7px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 8px solid #D4618C;
}

/* --- Thorns Triad Cards --- */
.thorns-triad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    max-width: 1000px;
    width: 100%;
    margin-bottom: 6rem;
}

.card-closing {
    background: rgba(242, 232, 213, 0.06);
    border-image: linear-gradient(135deg, #D4618C 0%, #C8A952 50%, #D4618C 100%) 1;
    position: relative;
}

.card-closing .card-label {
    color: rgba(237, 228, 212, 0.4);
}

.card-closing p {
    color: #EDE4D4;
    font-size: clamp(0.9rem, 1vw, 1rem);
}

.card-closing-1 {
    transform: translateY(40px) scale(0.97);
}

.card-closing-2 {
    transform: translateY(60px) scale(0.97);
}

.card-closing-3 {
    transform: translateY(50px) scale(0.97);
}

/* --- Thorn Hover Effects on Interactive Cards --- */
.card-closing {
    transition:
        opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.8s cubic-bezier(0.16, 1, 0.3, 1),
        border-image 0.3s ease;
    cursor: default;
}

.card-closing::before,
.card-closing::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    transition:
        opacity 0.2s ease,
        transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card-closing::before {
    top: -6px;
    left: 30%;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 7px solid #D4618C;
    transform: translateY(4px);
}

.card-closing::after {
    bottom: -6px;
    right: 30%;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 7px solid #D4618C;
    transform: translateY(-4px);
}

.card-closing:hover::before,
.card-closing:hover::after {
    opacity: 1;
    transform: translateY(0);
}

.card-closing:hover {
    border-image: linear-gradient(135deg, #D4618C 0%, #D4618C 50%, #D4618C 100%) 1;
}

/* --- Root Convergence --- */
.root-convergence {
    text-align: center;
    margin-top: 2rem;
}

.tap-root {
    width: 200px;
    height: 100px;
    opacity: 0.6;
}

/* --- Data Spores --- */
.data-spore {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--color);
    left: var(--x);
    top: var(--y);
    opacity: 0.3;
    animation: sporeDrift var(--dur) ease-in-out var(--delay) infinite;
    box-shadow: 0 0 6px var(--color);
}

@keyframes sporeDrift {
    0% {
        transform: translate(0, 0);
        opacity: 0.3;
    }
    33% {
        transform: translate(8px, -12px);
        opacity: 0.7;
    }
    66% {
        transform: translate(-5px, -6px);
        opacity: 0.4;
    }
    100% {
        transform: translate(0, 0);
        opacity: 0.3;
    }
}

/* Agitated spores in Biome 4 */
.spore-thorns {
    animation: sporeDriftFast var(--dur) ease-in-out var(--delay) infinite;
}

@keyframes sporeDriftFast {
    0% {
        transform: translate(0, 0);
        opacity: 0.4;
    }
    25% {
        transform: translate(15px, -20px);
        opacity: 0.8;
    }
    50% {
        transform: translate(-10px, -8px);
        opacity: 0.5;
    }
    75% {
        transform: translate(12px, -15px);
        opacity: 0.9;
    }
    100% {
        transform: translate(0, 0);
        opacity: 0.4;
    }
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 900px) {
    .card-manifesto {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .card-principles {
        grid-column: 1 / -1;
        grid-row: 2;
        margin-top: 0;
    }

    .thorns-triad {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .card-closing-1,
    .card-closing-2,
    .card-closing-3 {
        transform: translateY(40px) scale(0.97);
    }

    .thorns-statement {
        padding: 3rem 1.5rem;
    }

    .treaty-content {
        padding: 4rem 1rem;
    }

    .card-treaty {
        width: 95%;
    }
}

@media (max-width: 600px) {
    .mycelium-content {
        padding: 0 1rem;
        gap: 1rem;
    }

    .glass-card {
        padding: 1.8rem 1.5rem;
    }

    .thorns-headline {
        font-size: clamp(2rem, 7vw, 4rem);
    }

    .thorns-triad {
        padding: 0 1rem;
    }
}
