/* ========================================
   desca.work — Blobitecture Immersive Scroll
   ======================================== */

/* ----- Color Palette Reference -----
   Deep Substrate:       #0B1420
   Membrane Surface:     #1E2D3D
   Inner Glow:           #2A4A5E
   Bioluminescent Core:  #3ECFB2
   Warm Pulse:           #E8734A
   Frost Layer:          #C8D8E4
   Ghost Text:           #8BA4B8
   Membrane Edge:        #152535
   Secondary Blue-Gray:  #7B9BAF
----- */

:root {
    --deep-substrate: #0B1420;
    --membrane-surface: #1E2D3D;
    --inner-glow: #2A4A5E;
    --bioluminescent-core: #3ECFB2;
    --warm-pulse: #E8734A;
    --frost-layer: #C8D8E4;
    --ghost-text: #8BA4B8;
    --membrane-edge: #152535;
    --secondary-blue-gray: #7B9BAF;
}

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

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

body {
    background-color: var(--deep-substrate);
    color: var(--frost-layer);
    font-family: 'Anybody', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.2rem);
    line-height: 1.65;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ----- SVG Defs (hidden) ----- */
.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ----- Noise Background ----- */
#noise-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    opacity: 1;
}

/* ----- Amniotic Particles ----- */
#particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: #3ECFB2;
    pointer-events: none;
    will-change: transform;
}

/* ----- Pulse Rings ----- */
#pulse-rings-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100;
    pointer-events: none;
    overflow: hidden;
}

.pulse-ring {
    position: absolute;
    border: 2px solid #3ECFB2;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0.6;
    pointer-events: none;
    animation: pulseExpand 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

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

/* ----- Navigation ----- */
#blob-nav {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: flex-end;
}

.nav-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(139, 164, 184, 0.3);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.nav-dot:hover {
    background: rgba(62, 207, 178, 0.6);
    transform: scale(1.5);
}

.nav-dot.active {
    background: #3ECFB2;
    transform: scale(1.3);
    box-shadow: 0 0 10px rgba(62, 207, 178, 0.5);
}

.nav-label {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Azeret Mono', monospace;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #7B9BAF;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
}

.nav-dot:hover .nav-label {
    opacity: 1;
}

/* ----- Chambers ----- */
.chamber {
    position: relative;
    width: 100%;
    overflow: hidden;
}

#aperture {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#bifurcation {
    height: 120vh;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    position: relative;
}

#colony {
    height: 150vh;
    position: relative;
}

#convergence {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#dissolution {
    height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

/* ----- Blob Shared Styles ----- */
.blob-inner {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.blob-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80%;
    height: 80%;
    transform: translate(-50%, -50%);
    background: radial-gradient(ellipse at center, rgba(62, 207, 178, 0.1) 0%, transparent 70%);
    pointer-events: none;
    transition: opacity 0.4s ease-in-out;
}

.blob-content {
    position: relative;
    z-index: 2;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
}

/* ----- Typography ----- */
.site-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: clamp(2.8rem, 6vw, 5.5rem);
    letter-spacing: -0.03em;
    line-height: 1.0;
    color: #C8D8E4;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
}

.site-title.visible {
    opacity: 1;
}

.site-tagline {
    font-family: 'Anybody', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.6vw, 1.3rem);
    line-height: 1.65;
    color: #8BA4B8;
    margin-top: 1.5rem;
    max-width: 480px;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.site-tagline.visible {
    opacity: 1;
}

.blob-heading {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    letter-spacing: -0.03em;
    line-height: 1.0;
    color: #C8D8E4;
    margin-bottom: 1rem;
}

.blob-text {
    font-family: 'Anybody', sans-serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
    line-height: 1.65;
    color: #8BA4B8;
    max-width: 360px;
}

.blob-meta {
    font-family: 'Azeret Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #7B9BAF;
    margin-top: 1.2rem;
}

/* ----- Aperture Blob ----- */
.aperture-blob {
    width: 80vw;
    height: 75vh;
    max-width: 900px;
    max-height: 700px;
    background: #1E2D3D99;
    backdrop-filter: blur(12px) saturate(1.2);
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
    clip-path: url(#apertureClip);
    box-shadow: inset 0 0 60px #15253599;
    transform: scale(0);
    opacity: 0;
    will-change: transform, opacity;
    transition: none;
    position: relative;
    animation: blobBreathe1 12s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
    animation-play-state: paused;
}

.aperture-blob.inflated {
    transform: scale(1);
    opacity: 1;
    animation-play-state: running;
}

/* ----- Bifurcation Blobs ----- */
.bifurc-blob {
    width: 42vw;
    height: 60vh;
    max-width: 520px;
    max-height: 500px;
    background: #1E2D3D99;
    backdrop-filter: blur(12px) saturate(1.2);
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
    box-shadow: inset 0 0 50px #15253599;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    will-change: transform;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
}

.bifurc-left {
    clip-path: url(#bifurcLeftClip);
    left: 5%;
    animation: blobBreathe2 14s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

.bifurc-right {
    clip-path: url(#bifurcRightClip);
    right: 5%;
    animation: blobBreathe3 11s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

.bifurc-blob.visible {
    opacity: 1;
}

.luminous-seam {
    position: absolute;
    top: 20%;
    left: 50%;
    width: 2px;
    height: 60%;
    transform: translateX(-50%);
    background: #3ECFB2;
    opacity: 0;
    filter: blur(4px);
    box-shadow: 0 0 8px rgba(62, 207, 178, 0.5);
    transition: opacity 0.6s ease-in-out;
    z-index: 5;
}

.luminous-seam.glowing {
    opacity: 0.5;
}

/* ----- Colony Blobs ----- */
.colony-blob {
    position: absolute;
    width: 38vw;
    height: 34vh;
    max-width: 440px;
    max-height: 340px;
    background: #1E2D3D99;
    backdrop-filter: blur(12px) saturate(1.2);
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
    box-shadow: inset 0 0 40px #15253599;
    left: var(--blob-x);
    top: var(--blob-y);
    opacity: 0;
    transform: translateX(var(--enter-x, 100px));
    will-change: transform, opacity;
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.6s ease-in-out;
    cursor: pointer;
}

.colony-blob:hover {
    transform: scale(1.05) translateX(0);
    box-shadow: inset 0 0 40px #15253599, 0 0 30px #2A4A5E44;
}

.colony-blob:hover .blob-glow {
    opacity: 2.5;
    background: radial-gradient(ellipse at center, rgba(62, 207, 178, 0.25) 0%, transparent 70%);
}

.colony-blob:active {
    box-shadow: inset 0 0 40px #15253599, 0 0 20px #E8734A33;
}

.colony-blob.visible {
    opacity: 1;
    transform: translateX(0);
}

#colony-blob-1 { clip-path: url(#colonyClip1); --enter-x: -120px; }
#colony-blob-2 { clip-path: url(#colonyClip2); --enter-x: 120px; }
#colony-blob-3 { clip-path: url(#colonyClip3); --enter-x: -120px; }
#colony-blob-4 { clip-path: url(#colonyClip4); --enter-x: 120px; }
#colony-blob-5 { clip-path: url(#colonyClip5); --enter-x: -120px; }
#colony-blob-6 { clip-path: url(#colonyClip6); --enter-x: 120px; }

.colony-blob:nth-child(1) { animation: blobBreathe1 13s ease-in-out infinite; }
.colony-blob:nth-child(2) { animation: blobBreathe2 11s ease-in-out infinite; animation-delay: -3s; }
.colony-blob:nth-child(3) { animation: blobBreathe3 15s ease-in-out infinite; animation-delay: -5s; }
.colony-blob:nth-child(4) { animation: blobBreathe1 12s ease-in-out infinite; animation-delay: -7s; }
.colony-blob:nth-child(5) { animation: blobBreathe2 14s ease-in-out infinite; animation-delay: -2s; }
.colony-blob:nth-child(6) { animation: blobBreathe3 10s ease-in-out infinite; animation-delay: -8s; }

.colony-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: clamp(1.2rem, 2.2vw, 1.8rem);
    letter-spacing: -0.03em;
    line-height: 1.0;
    color: #C8D8E4;
    margin-bottom: 0.8rem;
}

.colony-desc {
    font-family: 'Anybody', sans-serif;
    font-weight: 400;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    line-height: 1.65;
    color: #8BA4B8;
}

/* ----- Convergence Blob ----- */
.convergence-blob {
    width: 75vw;
    height: 80vh;
    max-width: 850px;
    max-height: 650px;
    background: #1E2D3D99;
    backdrop-filter: blur(12px) saturate(1.2);
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
    clip-path: url(#convergenceClip);
    box-shadow: inset 0 0 60px #15253599;
    opacity: 0;
    will-change: transform, opacity;
    transition: opacity 0.8s ease-in-out;
    animation: blobBreathe2 13s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
    position: relative;
}

.convergence-blob.visible {
    opacity: 1;
}

.convergence-heading {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: clamp(2rem, 4vw, 3.2rem);
    letter-spacing: -0.03em;
    line-height: 1.0;
    color: #C8D8E4;
    margin-bottom: 2rem;
}

.convergence-text {
    max-width: 560px;
    text-align: left;
}

.convergence-text p {
    font-family: 'Anybody', sans-serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
    line-height: 1.65;
    color: #8BA4B8;
    margin-bottom: 1.2rem;
}

.convergence-text p:last-child {
    margin-bottom: 0;
}

/* ----- Dissolution ----- */
.dissolution-blob {
    width: 60vw;
    height: 50vh;
    max-width: 700px;
    max-height: 450px;
    background: #1E2D3D99;
    backdrop-filter: blur(12px) saturate(1.2);
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
    clip-path: url(#convergenceClip);
    box-shadow: inset 0 0 50px #15253599;
    opacity: 0;
    will-change: transform, opacity, filter;
    transition: opacity 1s ease-in-out, filter 1s ease-in-out;
    animation: blobBreathe3 14s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
    position: relative;
}

.dissolution-blob.visible {
    opacity: 1;
}

.dissolution-blob.dissolving {
    backdrop-filter: blur(30px) saturate(1.2);
    -webkit-backdrop-filter: blur(30px) saturate(1.2);
}

.dissolution-content {
    text-align: center;
}

.dissolution-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    line-height: 1.5;
    color: #8BA4B8;
    max-width: 480px;
    transition: opacity 0.8s ease-in-out;
}

.final-glyph {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(30, 45, 61, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 3rem;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
    box-shadow: 0 0 20px rgba(62, 207, 178, 0.2);
}

.final-glyph.visible {
    opacity: 1;
}

.final-glyph span {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3ECFB2;
    box-shadow: 0 0 6px rgba(62, 207, 178, 0.6);
}

/* Warm Pulse accent on active nav dot */
.nav-dot:active {
    background: #E8734A;
    box-shadow: 0 0 12px #E8734A66;
}

/* Inner glow accenting for blob content zones */
.blob-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, #2A4A5E11 0%, transparent 60%);
    pointer-events: none;
    z-index: -1;
}

/* ----- Blob Breathing Animations ----- */
@keyframes blobBreathe1 {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.015) rotate(0.5deg); }
    50% { transform: scale(0.99) rotate(-0.3deg); }
    75% { transform: scale(1.01) rotate(0.2deg); }
}

@keyframes blobBreathe2 {
    0%, 100% { transform: scale(1) rotate(0deg); }
    30% { transform: scale(1.02) rotate(-0.4deg); }
    60% { transform: scale(0.985) rotate(0.5deg); }
    85% { transform: scale(1.008) rotate(-0.2deg); }
}

@keyframes blobBreathe3 {
    0%, 100% { transform: scale(1) rotate(0deg); }
    20% { transform: scale(0.99) rotate(0.3deg); }
    45% { transform: scale(1.018) rotate(-0.5deg); }
    70% { transform: scale(0.995) rotate(0.4deg); }
}

/* Keep aperture blob inflated while breathing */
.aperture-blob.inflated {
    animation: apertureBreath 12s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

@keyframes apertureBreath {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
    25% { transform: scale(1.015) rotate(0.5deg); opacity: 1; }
    50% { transform: scale(0.99) rotate(-0.3deg); opacity: 1; }
    75% { transform: scale(1.01) rotate(0.2deg); opacity: 1; }
}

/* ----- Bifurcation breathing overrides ----- */
.bifurc-left.visible {
    animation: bifurcLeftBreath 14s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

@keyframes bifurcLeftBreath {
    0%, 100% { transform: translateY(-50%) scale(1) rotate(0deg); opacity: 1; }
    30% { transform: translateY(-50%) scale(1.02) rotate(-0.4deg); opacity: 1; }
    60% { transform: translateY(-50%) scale(0.985) rotate(0.5deg); opacity: 1; }
    85% { transform: translateY(-50%) scale(1.008) rotate(-0.2deg); opacity: 1; }
}

.bifurc-right.visible {
    animation: bifurcRightBreath 11s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

@keyframes bifurcRightBreath {
    0%, 100% { transform: translateY(-50%) scale(1) rotate(0deg); opacity: 1; }
    20% { transform: translateY(-50%) scale(0.99) rotate(0.3deg); opacity: 1; }
    45% { transform: translateY(-50%) scale(1.018) rotate(-0.5deg); opacity: 1; }
    70% { transform: translateY(-50%) scale(0.995) rotate(0.4deg); opacity: 1; }
}

/* ----- Convergence visible breathing ----- */
.convergence-blob.visible {
    animation: convergenceBreath 13s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

@keyframes convergenceBreath {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
    30% { transform: scale(1.02) rotate(-0.4deg); opacity: 1; }
    60% { transform: scale(0.985) rotate(0.5deg); opacity: 1; }
    85% { transform: scale(1.008) rotate(-0.2deg); opacity: 1; }
}

/* ----- Scroll-linked transform classes ----- */
.chamber {
    will-change: transform;
}

/* ----- Responsive ----- */
@media (max-width: 768px) {
    #blob-nav {
        right: 12px;
        gap: 12px;
    }

    .nav-dot {
        width: 10px;
        height: 10px;
    }

    .nav-label {
        display: none;
    }

    .aperture-blob {
        width: 90vw;
        height: 70vh;
    }

    .bifurc-blob {
        width: 85vw;
        height: 45vh;
        position: relative;
        top: auto;
        transform: none;
    }

    #bifurcation {
        flex-direction: column;
        align-items: center;
        gap: 2rem;
        padding: 4rem 0;
    }

    .bifurc-left,
    .bifurc-right {
        left: auto;
        right: auto;
    }

    .luminous-seam {
        width: 60%;
        height: 2px;
        top: 50%;
        left: 20%;
        transform: translateY(-50%);
    }

    .colony-blob {
        width: 80vw;
        height: 28vh;
        position: relative;
        left: 10%;
        top: auto;
        margin-bottom: 2rem;
    }

    #colony {
        height: auto;
        min-height: 150vh;
        padding: 4rem 0;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .convergence-blob {
        width: 90vw;
        height: 75vh;
    }

    .dissolution-blob {
        width: 85vw;
        height: 45vh;
    }
}
