/* ============================================
   gabs.ai - Bioluminescent Generative Lab
   ============================================ */

:root {
    --abyssal-moss: #0A2014;
    --midnight-fern: #0D2B1A;
    --deep-terrarium: #132E1F;
    --forest-shadow: #2D5A3F;
    --lichen: #5A8F6A;
    --phosphor: #488C60;
    --soft-mint: #C8E6D0;
    --pale-sage: #A8D5BA;
    --dawn-dew: #E8F5E9;
    --bioluminescent: #7ECFA0;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background: var(--abyssal-moss);
    color: var(--soft-mint);
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.7;
    overflow-x: hidden;
    letter-spacing: 0.01em;
}

code {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.9em;
    color: #6BAF7B;
    background: rgba(45, 90, 63, 0.3);
    padding: 1px 4px;
    border-radius: 2px;
}

/* --- Dot Grid Substrate --- */
.dot-substrate {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* --- Data Streams --- */
.data-stream {
    position: fixed;
    top: 0;
    height: 100%;
    width: 1px;
    background: var(--forest-shadow);
    z-index: 1;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
}

.stream-left { left: 4vw; }
.stream-right { right: 4vw; }

.stream-annotation {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 200;
    font-size: 10px;
    color: var(--lichen);
    letter-spacing: 0.05em;
    transform: rotate(-90deg);
    white-space: nowrap;
    opacity: 0.5;
}

/* --- EMERGENCE LAYER --- */
.emergence {
    position: relative;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.voronoi-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.emergence-blobs {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.blob {
    position: absolute;
    opacity: 0.6;
}

.blob1 {
    width: 120px;
    height: 120px;
    top: 20%;
    left: 15%;
    animation: blobDrift1 12s ease-in-out infinite;
}

.blob2 {
    width: 80px;
    height: 80px;
    top: 55%;
    right: 20%;
    animation: blobDrift2 10s ease-in-out infinite;
}

.blob3 {
    width: 60px;
    height: 60px;
    top: 70%;
    left: 40%;
    animation: blobDrift3 8s ease-in-out infinite;
}

@keyframes blobDrift1 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(30px, -20px); }
    50% { transform: translate(-15px, 25px); }
    75% { transform: translate(20px, 10px); }
}

@keyframes blobDrift2 {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(-25px, 15px); }
    66% { transform: translate(20px, -18px); }
}

@keyframes blobDrift3 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(18px, -22px); }
}

.emergence-title {
    position: relative;
    z-index: 10;
    font-family: 'Commissioner', sans-serif;
    font-weight: 700;
    font-size: clamp(2.2rem, 4.5vw, 3.4rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--pale-sage);
    line-height: 1.1;
}

.emergence-title .char {
    display: inline-block;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.emergence-title .char.visible {
    opacity: 1;
}

/* --- Branch Divider --- */
.branch-divider {
    display: flex;
    justify-content: center;
    padding: 55px 0;
}

.branch-svg {
    width: clamp(200px, 30vw, 400px);
    height: auto;
}

/* --- GROWTH COLUMN --- */
.growth-column {
    position: relative;
    z-index: 5;
    max-width: 860px;
    width: 65%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 55px;
    padding: 0 0 89px;
}

/* --- Organism Card / Card Flip --- */
.organism-card {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    position: relative;
}

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

.card-flip-container {
    perspective: 1200px;
}

.card-inner {
    position: relative;
    width: 100%;
    min-height: 280px;
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
    transform-style: preserve-3d;
}

.card-flip-container:hover .card-inner,
.card-flip-container.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 4px;
    padding: 34px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card-front {
    background: rgba(10, 32, 20, 0.85);
    border: 1px solid var(--forest-shadow);
    box-shadow: inset 0 0 0 1px rgba(72, 140, 96, 0.2);
    animation: cardPulse 4s ease-in-out infinite;
}

.card-back {
    background: rgba(20, 55, 35, 0.9);
    border: 1px solid var(--forest-shadow);
    transform: rotateY(180deg);
}

@keyframes cardPulse {
    0%, 100% { box-shadow: inset 0 0 0 1px rgba(72, 140, 96, 0.15); }
    50% { box-shadow: inset 0 0 0 1px rgba(72, 140, 96, 0.3); }
}

.card-meta {
    font-family: 'Commissioner', sans-serif;
    font-weight: 200;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--lichen);
    margin-bottom: 13px;
}

.card-title {
    font-family: 'Commissioner', sans-serif;
    font-weight: 500;
    font-size: clamp(1.2rem, 2.2vw, 1.6rem);
    letter-spacing: 0.03em;
    color: var(--dawn-dew);
    line-height: 1.3;
    margin-bottom: 13px;
}

.card-body {
    font-weight: 300;
    color: var(--soft-mint);
    line-height: 1.7;
    max-width: 42em;
}

.card-body-back {
    font-weight: 400;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    color: #9ECFAE;
    line-height: 1.7;
}

.card-shape {
    width: 120px;
    height: 80px;
    margin-top: 21px;
    align-self: flex-end;
}

/* --- Ring Pulse --- */
.ring-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    pointer-events: none;
    z-index: 10;
}

.ring-pulse.active::before,
.ring-pulse.active::after,
.ring-pulse.active span {
    content: '';
    position: absolute;
    border-radius: 50%;
    border: 2px solid var(--bioluminescent);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: ringExpand 0.8s ease-out forwards;
}

.ring-pulse.active::after {
    animation-delay: 0.15s;
}

@keyframes ringExpand {
    0% { width: 0; height: 0; opacity: 0.8; }
    100% { width: 400px; height: 400px; opacity: 0; }
}

/* --- SUBSTRATE SECTION --- */
.substrate-section {
    position: relative;
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 89px 0;
}

.substrate-fade {
    text-align: center;
    mask-image: linear-gradient(to bottom, black 0%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 0%, transparent 100%);
    padding-bottom: 80px;
}

.substrate-text {
    font-weight: 300;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    color: var(--soft-mint);
    opacity: 0.5;
    margin-bottom: 8px;
}

.substrate-domain {
    font-family: 'Commissioner', sans-serif;
    font-weight: 200;
    font-size: 0.85rem;
    letter-spacing: 0.25em;
    color: var(--lichen);
    text-transform: uppercase;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .growth-column {
        width: 90%;
        gap: 34px;
    }

    .card-front,
    .card-back {
        padding: 21px;
    }

    .card-inner {
        min-height: 300px;
    }

    .data-stream {
        display: none;
    }

    .blob1 { width: 80px; height: 80px; }
    .blob2 { width: 60px; height: 60px; }
    .blob3 { width: 40px; height: 40px; }
}

@media (max-width: 480px) {
    .growth-column {
        width: 94%;
    }
}
