/* lotus.dev - Generative Botanical Systems */
/* Color Palette */
:root {
    --bg-deep: #0a0612;
    --bg-surface: #1a1028;
    --accent-pink: #ff2d7b;
    --accent-cyan: #00e5c7;
    --accent-gold: #ffc53d;
    --text-primary: #f0e6f4;
    --text-secondary: #8a7d96;
    --glitch-green: #39ff14;
    --glitch-red: #ff0000;
    --glitch-blue: #0000ff;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-deep);
    color: var(--text-primary);
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    overflow-x: hidden;
}

/* Scan Lines Overlay */
#scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.08) 2px,
        rgba(0, 0, 0, 0.08) 4px
    );
    pointer-events: none;
    z-index: 9999;
}

/* Stage Base */
.stage {
    position: relative;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* ============================================
   STAGE 1: SURFACE BLOOM (HERO)
   ============================================ */
.stage-bloom {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-deep) 100%);
    min-height: 100vh;
}

.lotus-bloom {
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    width: 60vmin;
    height: 60vmin;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lotus-svg {
    width: 100%;
    height: 100%;
}

.lotus-svg .petal {
    fill: url(#petalGrad);
    mix-blend-mode: screen;
    transform-origin: 0px 0px;
    opacity: 0;
}

.lotus-svg .petal.bloomed {
    opacity: 1;
    transition: transform 1.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.6s ease;
}

.hero-text {
    position: absolute;
    left: 20%;
    top: 65%;
    z-index: 10;
}

.hero-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(3.5rem, 9vw, 6.5rem);
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: -0.03em;
    font-feature-settings: 'ss01';
    transform: rotate(-3deg);
    line-height: 1;
    opacity: 0;
}

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

.hero-title .char {
    display: inline-block;
    opacity: 0;
    animation: typeChar 0.06s ease forwards;
}

@keyframes typeChar {
    to { opacity: 1; }
}

.hero-subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-top: 0.75rem;
    transform: rotate(-3deg);
    opacity: 0;
    transition: opacity 0.6s ease;
}

.hero-subtitle.visible {
    opacity: 1;
}

.scroll-chevron {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    animation: chevronPulse 2s ease-in-out infinite;
    z-index: 10;
}

@keyframes chevronPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

/* Glitch effect class */
.glitch-active {
    filter: drop-shadow(3px 0 0 rgba(255, 0, 0, 0.7)) drop-shadow(-2px 0 0 rgba(0, 255, 0, 0.7)) drop-shadow(0 2px 0 rgba(0, 0, 255, 0.7)) drop-shadow(-1px 0 0 #00ff00);
}

/* ============================================
   STAGE 2: PETAL ARCHIVE
   ============================================ */
.stage-archive {
    min-height: 100vh;
    background: var(--bg-deep);
    position: relative;
}

.specimen-cards {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 100vh;
}

.specimen-card {
    position: absolute;
    left: var(--card-x);
    top: var(--card-y);
    width: clamp(180px, 20vw, 280px);
    background: var(--bg-surface);
    border: 1px solid rgba(138, 125, 150, 0.2);
    padding: 0;
    transform: scale(0.3);
    opacity: 0;
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.6s ease;
}

.specimen-card.in-view {
    transform: scale(1) rotate(var(--card-rotate, 0deg));
    opacity: 1;
}

.card-petal {
    width: 100%;
    aspect-ratio: 3/4;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.card-petal svg {
    width: 80%;
    height: 80%;
}

.card-label {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(138, 125, 150, 0.15);
}

.label-text {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

/* ============================================
   STAGE 3: ROOT NETWORK
   ============================================ */
.stage-roots {
    min-height: 150vh;
    background: var(--bg-deep);
    position: relative;
}

.root-network {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.root-network line {
    stroke-linecap: round;
}

.root-text-blocks {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 150vh;
    z-index: 2;
}

.root-text-block {
    position: absolute;
    left: var(--block-x);
    top: var(--block-y);
    max-width: 380px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.root-text-block.visible {
    opacity: 1;
    transform: translateY(0);
}

.root-text-block p {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    color: var(--text-primary);
}

.root-text-block .highlight {
    color: var(--accent-cyan);
}

/* ============================================
   STAGE 4: SEED GEOMETRY
   ============================================ */
.stage-seed {
    min-height: 100vh;
    background: var(--bg-deep);
    display: flex;
    align-items: center;
    justify-content: center;
}

.seed-pod-container {
    width: 60vmin;
    height: 60vmin;
    animation: seedBreathe 4s ease-in-out infinite;
}

@keyframes seedBreathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

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

.seed-pod .cell {
    fill: transparent;
    stroke: var(--text-secondary);
    stroke-width: 0.5;
    transition: fill 0.4s ease;
}

.seed-pod .cell.filled {
    fill-opacity: 0.15;
}

.seed-pod .cell-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem;
    fill: var(--text-secondary);
    text-anchor: middle;
    dominant-baseline: central;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.seed-pod .cell-text.visible {
    opacity: 1;
}

/* ============================================
   STAGE 5: MUD/SOURCE
   ============================================ */
.stage-mud {
    min-height: 100vh;
    background: var(--bg-deep);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.source-root-line {
    position: absolute;
    top: 0;
    left: 50%;
    width: 1px;
    height: 30%;
    background: var(--accent-pink);
    opacity: 0.3;
    transform: translateX(-50%);
}

.source-code {
    text-align: center;
}

.source-code pre {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 2.4;
    text-align: left;
    display: inline-block;
}

.source-code code {
    font-family: inherit;
}

.footer-mark {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hero-text {
        left: 10%;
        top: 60%;
    }

    .specimen-card {
        width: clamp(140px, 40vw, 200px);
    }

    .root-text-block {
        max-width: 280px;
        left: 10% !important;
    }

    #root-block-2, #root-block-4 {
        left: 50% !important;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .glitch-active {
        filter: none;
    }

    .specimen-card {
        transition: opacity 0.3s ease;
        transform: none !important;
    }

    .specimen-card.in-view {
        transform: none !important;
    }

    @keyframes seedBreathe {
        0%, 100% { transform: none; }
    }

    @keyframes chevronPulse {
        0%, 100% { opacity: 0.5; }
    }

    .lotus-svg .petal {
        transition: opacity 0.3s ease;
    }
}