/* =============================================
   goomimi.com -- Bionic Terrarium Design System
   ============================================= */

/* CSS Custom Properties */
:root {
    --deep-bg: #1c1f26;
    --infrastructure: #2a2e38;
    --surface: #3a3f47;
    --muted-text: #9ea7b0;
    --light-text: #e0e4e8;
    --tech-accent: #4ecdc4;
    --nature-accent: #7fb685;
    --alert-glitch: #ff6b6b;

    --font-display: 'Anybody', sans-serif;
    --font-secondary: 'Darker Grotesque', sans-serif;
    --font-body: 'IBM Plex Sans', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
    --font-botanical: 'Cormorant Garamond', serif;

    --heading-width: 60;
    --spring-ease: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

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

body {
    background: var(--deep-bg);
    color: var(--muted-text);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.65;
    overflow-x: hidden;
}

/* =============================================
   Scroll Progress Indicator
   ============================================= */
.progress-track {
    position: fixed;
    left: 24px;
    top: 0;
    width: 2px;
    height: 100vh;
    background: rgba(42, 46, 56, 0.5);
    z-index: 1000;
}

.progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: var(--tech-accent);
    transition: height 0.1s linear;
}

.progress-tick {
    position: absolute;
    left: 0;
    width: 10px;
    height: 1px;
    background: var(--tech-accent);
    opacity: 0.4;
}

/* =============================================
   Scan Lines Overlay
   ============================================= */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 2px,
        rgba(255, 107, 107, 0.015) 2px,
        rgba(255, 107, 107, 0.015) 3px
    );
    animation: scanline-drift 8s linear infinite;
}

@keyframes scanline-drift {
    0% { transform: translateY(0); }
    100% { transform: translateY(3px); }
}

/* =============================================
   Noise Blocks
   ============================================= */
.noise-block {
    position: fixed;
    background: var(--alert-glitch);
    opacity: 0;
    pointer-events: none;
    z-index: 998;
}

/* =============================================
   Parallax Container
   ============================================= */
.parallax-container {
    perspective: 1px;
    height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* =============================================
   Chambers (Sections)
   ============================================= */
.chamber {
    position: relative;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
}

.chamber-one { background: var(--deep-bg); }
.chamber-two { background: var(--deep-bg); }
.chamber-three { background: var(--deep-bg); }
.chamber-four { background: var(--deep-bg); }
.chamber-five { background: var(--infrastructure); }

/* =============================================
   Parallax Planes
   ============================================= */
.plane {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.plane-infrastructure {
    z-index: 1;
    transform: translateZ(-0.5px) scale(1.5);
    transform-origin: center center;
}

.plane-content {
    z-index: 2;
    position: relative;
    display: flex;
    align-items: center;
    min-height: 100vh;
}

.plane-botanical {
    z-index: 3;
    pointer-events: none;
    transform: translateZ(0.2px) scale(0.8);
    transform-origin: center center;
}

/* =============================================
   Content Grid (12-column, left-weighted)
   ============================================= */
.content-grid {
    display: grid;
    grid-template-columns: 60px repeat(7, 1fr) repeat(3, 1fr) 60px;
    gap: 20px;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 80px 20px;
    min-height: 100vh;
    align-items: center;
}

.content-main {
    grid-column: 2 / 9;
}

.content-side {
    grid-column: 9 / 12;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 120px;
}

.content-grid-centered {
    justify-items: center;
    text-align: center;
}

.content-center {
    grid-column: 4 / 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

/* =============================================
   Typography -- Display Titles
   ============================================= */
.title-display {
    font-family: var(--font-display);
    font-variation-settings: 'wdth' var(--heading-width);
    font-weight: 800;
    color: var(--light-text);
    letter-spacing: -0.03em;
    line-height: 1.05;
    transition: font-variation-settings 0.8s var(--spring-ease), letter-spacing 0.8s var(--spring-ease);
}

.chamber-one .title-display {
    font-size: clamp(64px, 10vw, 120px);
}

.chamber-two .title-display,
.chamber-three .title-display,
.chamber-four .title-display {
    font-size: clamp(48px, 7vw, 96px);
}

.title-wide {
    --heading-width: 100;
    letter-spacing: 0em;
}

.title-final {
    font-size: clamp(36px, 5vw, 72px);
    color: var(--nature-accent);
}

.chamber-heading.in-view {
    --heading-width: 100;
    letter-spacing: 0em;
}

/* RGB glitch effect on headings during transition */
.chamber-heading.glitch-text {
    animation: rgb-split 0.4s ease-out;
}

@keyframes rgb-split {
    0% {
        text-shadow:
            -3px 0 var(--alert-glitch),
            3px 0 var(--tech-accent),
            0 2px var(--nature-accent);
    }
    50% {
        text-shadow:
            2px -1px var(--alert-glitch),
            -2px 1px var(--tech-accent),
            1px -2px var(--nature-accent);
    }
    100% {
        text-shadow: none;
    }
}

/* =============================================
   Typography -- Secondary Headers
   ============================================= */
.title-secondary {
    font-family: var(--font-secondary);
    font-size: clamp(28px, 3vw, 42px);
    font-weight: 400;
    color: #c8cdd3;
    line-height: 1.15;
    transition: font-weight 0.3s ease;
}

.title-secondary:hover {
    font-weight: 700;
}

/* =============================================
   Typography -- Body Text
   ============================================= */
.body-text {
    font-family: var(--font-body);
    font-size: 17px;
    font-weight: 400;
    line-height: 1.65;
    color: var(--muted-text);
    max-width: 680px;
    margin-bottom: 24px;
}

.botanical-voice {
    font-family: var(--font-botanical);
    font-style: italic;
    font-weight: 300;
    font-size: 19px;
    line-height: 1.7;
    color: var(--nature-accent);
    opacity: 0.85;
}

.body-text-final {
    font-family: var(--font-botanical);
    font-style: italic;
    font-weight: 300;
    font-size: 20px;
    color: var(--nature-accent);
    opacity: 0.7;
}

/* =============================================
   Typography -- Data/Technical Labels
   ============================================= */
.data-label {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 400;
    color: var(--tech-accent);
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    line-height: 1.4;
}

.data-label.dim {
    opacity: 0.25;
}

/* =============================================
   Typography -- Botanical Labels
   ============================================= */
.botanical-label {
    font-family: var(--font-botanical);
    font-size: 16px;
    font-weight: 300;
    font-style: italic;
    color: var(--nature-accent);
    line-height: 1.4;
}

/* =============================================
   Circuit SVG System
   ============================================= */
.circuit-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.circuit-trace {
    stroke: var(--infrastructure);
    stroke-width: 1;
    fill: none;
}

.circuit-trace.broken {
    stroke-dasharray: 8 4;
}

.circuit-trace.vine-circuit {
    stroke: var(--infrastructure);
    stroke-width: 1;
}

.circuit-node {
    fill: none;
    stroke: var(--infrastructure);
    stroke-width: 1;
}

.circuit-node.glow {
    fill: var(--tech-accent);
    opacity: 0.3;
    animation: node-glow 4s ease-in-out infinite alternate;
}

@keyframes node-glow {
    0% { opacity: 0.15; }
    100% { opacity: 0.4; }
}

.data-pulse {
    fill: var(--tech-accent);
    opacity: 0;
    animation: pulse-fade 2s ease-in-out infinite;
}

@keyframes pulse-fade {
    0%, 100% { opacity: 0; }
    50% { opacity: 0.7; }
}

/* Fading circuits for later chambers */
.circuit-svg.fading {
    opacity: 0.2;
}

.circuit-svg.fading-deep {
    opacity: 0.08;
}

/* =============================================
   Lichen Blobs
   ============================================= */
.lichen-blob {
    fill: var(--tech-accent);
    opacity: 0.06;
}

/* =============================================
   Radar Sweep
   ============================================= */
.radar-sweep {
    position: absolute;
    top: 40px;
    right: 80px;
    width: 160px;
    height: 160px;
    opacity: 0.6;
}

.radar-sweep svg {
    width: 100%;
    height: 100%;
}

.radar-arm {
    transform-origin: 100px 100px;
    animation: radar-spin 12s linear infinite;
}

@keyframes radar-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Chamber 5 -- radar stopped */
.chamber-five .radar-sweep {
    display: none;
}

/* =============================================
   Wireframe Shapes
   ============================================= */
.wireframe-shape {
    position: absolute;
    width: 200px;
    height: 200px;
    bottom: 15%;
    right: 20%;
    transform-style: preserve-3d;
    animation: wireframe-rotate 120s linear infinite;
}

.wireframe-small {
    width: 140px;
    height: 140px;
    bottom: 25%;
    right: 15%;
}

.wireframe-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 1px solid var(--surface);
    background: transparent;
}

.wireframe-face::before {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tech-accent);
    opacity: 0.4;
}

.face-1 { transform: rotateX(0deg) rotateY(0deg); }
.face-1::before { top: 0; left: 0; }
.face-2 { transform: rotateX(60deg) rotateY(30deg); }
.face-2::before { top: 0; right: 0; }
.face-3 { transform: rotateX(120deg) rotateY(60deg); }
.face-3::before { bottom: 0; left: 0; }
.face-4 { transform: rotateX(180deg) rotateY(90deg); }
.face-4::before { bottom: 0; right: 0; }
.face-5 { transform: rotateX(240deg) rotateY(120deg); }
.face-5::before { top: 50%; left: 0; }
.face-6 { transform: rotateX(300deg) rotateY(150deg); }
.face-6::before { top: 50%; right: 0; }

@keyframes wireframe-rotate {
    0% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
    100% { transform: rotateX(360deg) rotateY(360deg) rotateZ(180deg); }
}

/* =============================================
   Coordinate Grid
   ============================================= */
.coord-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(58, 63, 71, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(58, 63, 71, 0.05) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
}

/* =============================================
   Botanical SVG System
   ============================================= */
.fern-svg {
    position: absolute;
    pointer-events: none;
}

.fern-frond {
    transition: opacity 0.5s ease;
}

/* Chamber 1 -- barely visible hint */
.fern-hint {
    bottom: 0;
    left: 10%;
    width: 150px;
    height: 200px;
    opacity: 0.4;
}

/* Chamber 2 -- fern appears */
.fern-large {
    left: -5%;
    top: 10%;
    width: 40vw;
    max-width: 500px;
    height: auto;
}

.fern-medium-right {
    right: 5%;
    bottom: 10%;
    width: 200px;
    height: auto;
}

.monstera-leaf {
    position: absolute;
    right: 12%;
    top: 20%;
    width: 280px;
    height: 280px;
}

/* Chamber 3 -- balanced */
.vine-network {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.vine-tendril {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 2s ease;
}

.chamber-three.in-view .vine-tendril {
    stroke-dashoffset: 0;
}

.fern-mid-left {
    left: -3%;
    top: 15%;
    width: 250px;
}

.fern-mid-right {
    right: 0%;
    bottom: 5%;
    width: 220px;
}

/* Chamber 4 -- dense overgrowth */
.plane-botanical-dense .fern-dense-1 {
    left: -5%;
    top: 0;
    width: 45vw;
    max-width: 600px;
}

.plane-botanical-dense .fern-dense-2 {
    right: -3%;
    top: 5%;
    width: 38vw;
    max-width: 500px;
}

.plane-botanical-dense .fern-dense-3 {
    left: 30%;
    bottom: 0;
    width: 30vw;
    max-width: 400px;
}

.monstera-large {
    position: absolute;
    left: 15%;
    bottom: 5%;
    width: 35vw;
    max-width: 500px;
    height: auto;
}

.monstera-right {
    position: absolute;
    right: 5%;
    top: 15%;
    width: 28vw;
    max-width: 400px;
    height: auto;
}

/* Chamber 5 -- maximum density, hybrid forms */
.plane-botanical-max .hybrid-form-1 {
    left: -8%;
    top: 0;
    width: 50vw;
    max-width: 600px;
}

.plane-botanical-max .hybrid-form-2 {
    right: -5%;
    top: 10%;
    width: 40vw;
    max-width: 500px;
}

.plane-botanical-max .hybrid-form-3 {
    left: 25%;
    bottom: 0;
    width: 35vw;
    max-width: 400px;
}

.fern-frond.hybrid {
    filter: drop-shadow(0 0 8px rgba(78, 205, 196, 0.1));
}

/* Hybrid node shapes -- neither circuit nor leaf */
.hybrid-node {
    position: absolute;
    border-radius: 43% 57% 62% 38% / 55% 45% 48% 52%;
    background: radial-gradient(
        ellipse at center,
        rgba(78, 205, 196, 0.08),
        rgba(127, 182, 133, 0.04),
        transparent
    );
    pointer-events: none;
}

.hybrid-node-1 {
    width: 180px;
    height: 160px;
    top: 20%;
    left: 60%;
    animation: hybrid-breathe 6s ease-in-out infinite alternate;
}

.hybrid-node-2 {
    width: 120px;
    height: 140px;
    bottom: 25%;
    left: 15%;
    border-radius: 57% 43% 38% 62% / 45% 55% 52% 48%;
    animation: hybrid-breathe 8s ease-in-out infinite alternate-reverse;
}

.hybrid-node-3 {
    width: 100px;
    height: 100px;
    top: 50%;
    right: 20%;
    border-radius: 62% 38% 43% 57% / 48% 52% 55% 45%;
    animation: hybrid-breathe 7s ease-in-out infinite alternate;
}

@keyframes hybrid-breathe {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    100% {
        transform: scale(1.15);
        opacity: 0.9;
    }
}

/* =============================================
   Scroll Indicator
   ============================================= */
.scroll-indicator {
    margin-top: 60px;
    animation: chevron-pulse 2s ease-in-out infinite;
}

@keyframes chevron-pulse {
    0%, 100% {
        opacity: 0.4;
        transform: translateY(0);
    }
    50% {
        opacity: 1;
        transform: translateY(8px);
    }
}

/* =============================================
   Seed Pod (Chamber 5)
   ============================================= */
.seed-pod {
    width: 80px;
    height: 80px;
    animation: seed-pulse 4s ease-in-out infinite alternate;
}

.seed-pod-svg {
    width: 100%;
    height: 100%;
}

@keyframes seed-pulse {
    0% {
        filter: drop-shadow(0 0 4px rgba(78, 205, 196, 0.2));
        transform: scale(1);
    }
    100% {
        filter: drop-shadow(0 0 12px rgba(127, 182, 133, 0.4));
        transform: scale(1.08);
    }
}

/* =============================================
   Glitch Tear Transitions
   ============================================= */
.glitch-tear {
    position: relative;
    height: 0;
    overflow: visible;
    z-index: 10;
}

.glitch-tear.active .tear-strip {
    animation: tear-shift 0.4s ease-out forwards;
}

.tear-strip {
    position: absolute;
    left: 0;
    width: 100%;
    background: var(--deep-bg);
    overflow: hidden;
}

@keyframes tear-shift {
    0% { transform: translateX(0); }
    30% { transform: translateX(var(--tear-offset)); }
    100% { transform: translateX(0); }
}

/* =============================================
   Section Transition Gradients
   ============================================= */
.chamber::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120px;
    background: linear-gradient(to bottom, transparent, var(--deep-bg));
    pointer-events: none;
    z-index: 4;
}

.chamber::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--tech-accent);
    opacity: 0.2;
    z-index: 5;
}

.chamber-five::after {
    background: linear-gradient(to bottom, transparent, var(--infrastructure));
}

.chamber-five::before {
    display: none;
}

/* =============================================
   Accent Shift (Chambers 4 & 5)
   ============================================= */
.chamber-four .data-pulse {
    fill: var(--nature-accent);
}

.chamber-four .circuit-node.glow {
    fill: var(--nature-accent);
}

.chamber-five .data-pulse {
    fill: var(--nature-accent);
}

/* =============================================
   Reduced Motion
   ============================================= */
@media (prefers-reduced-motion: reduce) {
    .scanlines,
    .noise-block {
        display: none;
    }

    .wireframe-shape,
    .radar-arm,
    .data-pulse,
    .scroll-indicator,
    .seed-pod,
    .hybrid-node {
        animation: none;
    }

    .title-display {
        transition: none;
        --heading-width: 100;
        letter-spacing: 0em;
    }

    .vine-tendril {
        stroke-dashoffset: 0;
    }

    .circuit-node.glow {
        animation: none;
        opacity: 0.3;
    }
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 40px repeat(10, 1fr) 40px;
    }

    .content-main {
        grid-column: 2 / 10;
    }

    .content-side {
        grid-column: 2 / 10;
        padding-top: 20px;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;
    }

    .content-center {
        grid-column: 2 / 10;
    }

    .radar-sweep {
        width: 100px;
        height: 100px;
        top: 20px;
        right: 40px;
    }

    .wireframe-shape {
        width: 120px;
        height: 120px;
    }
}

@media (max-width: 640px) {
    .progress-track {
        left: 12px;
    }

    .content-grid {
        grid-template-columns: 30px 1fr 30px;
        gap: 12px;
    }

    .content-main {
        grid-column: 2 / 3;
    }

    .content-side {
        grid-column: 2 / 3;
    }

    .content-center {
        grid-column: 2 / 3;
    }

    .radar-sweep {
        width: 80px;
        height: 80px;
        top: 12px;
        right: 20px;
    }

    .wireframe-shape,
    .wireframe-small {
        width: 80px;
        height: 80px;
    }

    .monstera-leaf,
    .monstera-large,
    .monstera-right {
        display: none;
    }
}
