/* ======================================
   gabs.ai — Living Neural Substrate
   ====================================== */

/* --- CSS Custom Properties --- */
:root {
    --abyssal-black: #080B14;
    --neural-midnight: #0E1428;
    --bioluminescent-green: #B8F4E1;
    --synapse-blue: #5B7FFF;
    --membrane-pink: #E8A0BF;
    --neural-silver: #C8D6E5;
    --deep-fog: #5A6A7A;
    --phosphor-teal: #2DD4A8;

    --ease-organic: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

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

body {
    background-color: var(--abyssal-black);
    color: var(--neural-silver);
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.7;
    letter-spacing: 0.005em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Typography --- */
.display-heading {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: clamp(2.2rem, 5vw, 4.8rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--bioluminescent-green);
}

.body-text {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    color: var(--neural-silver);
    opacity: 0.88;
    line-height: 1.7;
    letter-spacing: 0.005em;
}

.blob-label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--synapse-blue);
    display: block;
    margin-bottom: 1.2rem;
}

/* --- SVG Filters (hidden) --- */
#svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Generative Blob Field --- */
#blob-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 2s var(--ease-organic);
}

#blob-field.visible {
    opacity: 1;
}

#blob-field .blob {
    position: absolute;
    border-radius: 40% 60% 60% 40% / 60% 30% 70% 40%;
    mix-blend-mode: screen;
    will-change: border-radius;
    pointer-events: none;
}

/* Individual blob morph animations with varying timings */
@keyframes blobMorph1 {
    0%   { border-radius: 40% 60% 60% 40% / 60% 30% 70% 40%; }
    25%  { border-radius: 50% 50% 40% 60% / 40% 60% 50% 50%; }
    50%  { border-radius: 60% 40% 30% 70% / 40% 60% 40% 60%; }
    75%  { border-radius: 35% 65% 55% 45% / 55% 35% 65% 45%; }
    100% { border-radius: 40% 60% 60% 40% / 60% 30% 70% 40%; }
}

@keyframes blobMorph2 {
    0%   { border-radius: 50% 50% 40% 60% / 50% 40% 60% 50%; }
    33%  { border-radius: 35% 65% 65% 35% / 65% 35% 35% 65%; }
    66%  { border-radius: 65% 35% 40% 60% / 35% 65% 55% 45%; }
    100% { border-radius: 50% 50% 40% 60% / 50% 40% 60% 50%; }
}

@keyframes blobMorph3 {
    0%   { border-radius: 60% 40% 50% 50% / 40% 60% 45% 55%; }
    50%  { border-radius: 40% 60% 55% 45% / 60% 40% 55% 45%; }
    100% { border-radius: 60% 40% 50% 50% / 40% 60% 45% 55%; }
}

@keyframes blobMorph4 {
    0%   { border-radius: 45% 55% 60% 40% / 55% 45% 40% 60%; }
    40%  { border-radius: 55% 45% 35% 65% / 45% 55% 65% 35%; }
    70%  { border-radius: 65% 35% 50% 50% / 35% 65% 50% 50%; }
    100% { border-radius: 45% 55% 60% 40% / 55% 45% 40% 60%; }
}

@keyframes blobMorph5 {
    0%   { border-radius: 55% 45% 45% 55% / 45% 55% 55% 45%; }
    33%  { border-radius: 40% 60% 60% 40% / 60% 40% 40% 60%; }
    66%  { border-radius: 60% 40% 35% 65% / 40% 60% 65% 35%; }
    100% { border-radius: 55% 45% 45% 55% / 45% 55% 55% 45%; }
}

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

.particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    will-change: transform;
}

@keyframes particleFloat {
    0% {
        transform: translateY(100vh) translateX(0px);
        opacity: 0;
    }
    5% {
        opacity: var(--particle-opacity, 0.3);
    }
    95% {
        opacity: var(--particle-opacity, 0.3);
    }
    100% {
        transform: translateY(-10vh) translateX(var(--particle-drift, 30px));
        opacity: 0;
    }
}

/* --- Scroll Indicator --- */
#scroll-indicator {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 100;
    opacity: 0;
    transition: opacity 1s var(--ease-organic);
}

#scroll-indicator.visible {
    opacity: 0.7;
}

#scroll-indicator:hover {
    opacity: 1;
}

/* --- Wordmark --- */
#wordmark {
    position: fixed;
    top: 28px;
    left: 32px;
    z-index: 100;
    opacity: 0;
    transition: opacity 1.2s var(--ease-organic);
}

#wordmark.visible {
    opacity: 1;
}

.wordmark-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: 1rem;
    color: var(--bioluminescent-green);
    letter-spacing: 0.02em;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 40% 60% 55% 45% / 55% 45% 60% 40%;
    background: rgba(14, 20, 40, 0.6);
    border: 1px solid rgba(184, 244, 225, 0.1);
    box-shadow: 0 0 30px rgba(45, 212, 168, 0.06);
    display: inline-block;
    animation: blobMorph3 10s ease-in-out infinite;
}

/* --- Section Layers --- */
.section-layer {
    position: relative;
    z-index: 2;
}

/* --- Opening Section --- */
#opening {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

#hero-content {
    max-width: 800px;
    padding: 0 2rem;
}

#site-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: clamp(3rem, 8vw, 6rem);
    color: var(--bioluminescent-green);
    letter-spacing: -0.02em;
    line-height: 1.05;
    margin-bottom: 1.5rem;
    min-height: 1.2em;
}

#site-title .letter {
    display: inline-block;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.3s var(--ease-organic), transform 0.3s var(--ease-organic);
}

#site-title .letter.visible {
    opacity: 1;
    transform: scale(1);
}

#tagline {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    color: var(--neural-silver);
    opacity: 0;
    transition: opacity 0.6s var(--ease-organic);
    max-width: 500px;
    margin: 0 auto;
}

#tagline.visible {
    opacity: 0.88;
}

/* --- Membrane Zone --- */
#membrane-zone {
    height: 50vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#membrane {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.membrane-blob {
    width: 70vw;
    height: 70vh;
    max-width: 900px;
    background: radial-gradient(ellipse at center, rgba(45, 212, 168, 0.15) 0%, rgba(8, 11, 20, 0.0) 70%);
    border-radius: 50% 50% 50% 50% / 50% 50% 50% 50%;
    filter: url(#membrane-filter);
    opacity: 0.6;
    animation: membranePulse 8s ease-in-out infinite;
    position: absolute;
}

@keyframes membranePulse {
    0%   { transform: scale(1); border-radius: 45% 55% 55% 45% / 55% 45% 50% 50%; }
    50%  { transform: scale(1.05); border-radius: 55% 45% 45% 55% / 45% 55% 50% 50%; }
    100% { transform: scale(1); border-radius: 45% 55% 55% 45% / 55% 45% 50% 50%; }
}

/* --- Conversation River --- */
#conversation-river {
    position: absolute;
    top: 100vh;
    left: 0;
    width: 100%;
    height: 500vh;
    z-index: 1;
    pointer-events: none;
    overflow: visible;
}

#river-path {
    stroke-dasharray: 6000;
    stroke-dashoffset: 6000;
    transition: stroke-dashoffset 0.1s linear;
}

.river-node {
    opacity: 0.6;
    filter: drop-shadow(0 0 12px rgba(91, 127, 255, 0.5));
}

@keyframes nodePulse {
    0%   { r: 4; opacity: 0.6; }
    50%  { r: 5.6; opacity: 1; }
    100% { r: 4; opacity: 0.6; }
}

/* --- Thought Garden --- */
#thought-garden {
    padding: 10vh 0 20vh;
    position: relative;
    z-index: 3;
}

.thought-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 40px;
}

/* Bento-blob positioning */
.thought-blob {
    background: linear-gradient(135deg, var(--neural-midnight) 0%, var(--abyssal-black) 100%);
    border: 1px solid rgba(184, 244, 225, 0.08);
    box-shadow: 0 0 60px rgba(45, 212, 168, 0.06);
    padding: clamp(2rem, 4vw, 3.5rem);
    will-change: border-radius, transform;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.8s var(--ease-organic), transform 0.8s var(--ease-organic), box-shadow 0.4s var(--ease-organic);
}

.thought-blob.in-view {
    opacity: 1;
    transform: scale(1);
}

.thought-blob .display-heading {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    margin-bottom: 1.2rem;
}

.thought-blob .body-text {
    margin-bottom: 1rem;
}

.thought-blob .body-text:last-child {
    margin-bottom: 0;
}

/* Individual blob shapes and morph animations */
.blob-1 {
    grid-column: 1 / 2;
    border-radius: 40% 60% 60% 40% / 60% 30% 70% 40%;
    animation: blobMorph1 10s ease-in-out infinite;
    box-shadow: 0 0 60px rgba(45, 212, 168, 0.08);
}

.blob-2 {
    grid-column: 2 / 3;
    border-radius: 50% 50% 40% 60% / 50% 40% 60% 50%;
    animation: blobMorph2 12s ease-in-out infinite;
    box-shadow: 0 0 60px rgba(91, 127, 255, 0.08);
    margin-top: 80px;
}

.blob-3 {
    grid-column: 1 / 3;
    max-width: 680px;
    margin: 0 auto;
    border-radius: 60% 40% 50% 50% / 40% 60% 45% 55%;
    animation: blobMorph3 9s ease-in-out infinite;
    box-shadow: 0 0 60px rgba(232, 160, 191, 0.08);
}

.blob-4 {
    grid-column: 1 / 2;
    border-radius: 45% 55% 60% 40% / 55% 45% 40% 60%;
    animation: blobMorph4 11s ease-in-out infinite;
    box-shadow: 0 0 60px rgba(184, 244, 225, 0.08);
}

.blob-5 {
    grid-column: 2 / 3;
    border-radius: 55% 45% 45% 55% / 45% 55% 55% 45%;
    animation: blobMorph5 8s ease-in-out infinite;
    box-shadow: 0 0 60px rgba(45, 212, 168, 0.08);
    margin-top: 60px;
}

.blob-6 {
    grid-column: 1 / 3;
    max-width: 720px;
    margin: 0 auto;
    border-radius: 35% 65% 55% 45% / 55% 35% 65% 45%;
    animation: blobMorph2 10s ease-in-out infinite;
    box-shadow: 0 0 60px rgba(91, 127, 255, 0.08);
}

.blob-7 {
    grid-column: 1 / 2;
    grid-column: 1 / 3;
    max-width: 640px;
    margin: 0 auto;
    border-radius: 50% 50% 45% 55% / 55% 45% 55% 45%;
    animation: blobMorph1 12s ease-in-out infinite;
    box-shadow: 0 0 60px rgba(232, 160, 191, 0.06);
}

/* Hover glow intensification */
.thought-blob:hover {
    box-shadow: 0 0 80px rgba(45, 212, 168, 0.15), 0 0 120px rgba(91, 127, 255, 0.08);
}

/* --- Deep Pool --- */
#deep-pool {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    background: linear-gradient(to bottom, var(--abyssal-black) 0%, #050810 100%);
}

#deep-pool::before {
    content: '';
    position: absolute;
    top: -30vh;
    left: 0;
    width: 100%;
    height: 30vh;
    background: linear-gradient(to bottom, transparent, var(--abyssal-black));
    pointer-events: none;
    z-index: 2;
}

#deep-pool-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
}

#terminus-node {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bioluminescent-green);
    box-shadow: 0 0 30px rgba(184, 244, 225, 0.4), 0 0 60px rgba(184, 244, 225, 0.2), 0 0 100px rgba(45, 212, 168, 0.1);
    animation: terminusPulse 2s ease-in-out infinite;
}

@keyframes terminusPulse {
    0%   { transform: scale(1); box-shadow: 0 0 30px rgba(184, 244, 225, 0.4), 0 0 60px rgba(184, 244, 225, 0.2); }
    50%  { transform: scale(1.3); box-shadow: 0 0 40px rgba(184, 244, 225, 0.6), 0 0 80px rgba(184, 244, 225, 0.3), 0 0 120px rgba(45, 212, 168, 0.15); }
    100% { transform: scale(1); box-shadow: 0 0 30px rgba(184, 244, 225, 0.4), 0 0 60px rgba(184, 244, 225, 0.2); }
}

#closing-thought {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-style: italic;
    font-size: 0.9rem;
    color: var(--neural-silver);
    opacity: 0;
    transition: opacity 3s var(--ease-organic);
    max-width: 400px;
}

#closing-thought.visible {
    opacity: 0.6;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .thought-grid {
        grid-template-columns: 1fr;
        gap: 35px;
        padding: 0 20px;
    }

    .blob-1, .blob-2, .blob-3, .blob-4, .blob-5, .blob-6, .blob-7 {
        grid-column: 1 / -1;
        max-width: 100%;
        margin-top: 0;
    }

    #wordmark {
        top: 16px;
        left: 16px;
    }

    #scroll-indicator {
        bottom: 16px;
        right: 16px;
    }

    .membrane-blob {
        width: 90vw;
    }
}

@media (max-width: 480px) {
    .thought-blob {
        padding: 1.5rem;
    }

    #site-title {
        font-size: clamp(2.5rem, 12vw, 4rem);
    }
}

/* --- Selection --- */
::selection {
    background: rgba(91, 127, 255, 0.3);
    color: var(--bioluminescent-green);
}

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

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

::-webkit-scrollbar-thumb {
    background: rgba(184, 244, 225, 0.15);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(184, 244, 225, 0.3);
}
