/* ============================================
   mystery.boo — Blobitecture Hallucination
   Forest-green | Glitch-art | Z-pattern | Tilt-3D
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --deep-forest: #081C15;
    --forest-core: #1B4332;
    --moss: #2D6A4F;
    --fern: #40916C;
    --leaf: #52B788;
    --pale-mint: #B7E4C7;
    --dew: #D8F3DC;
    --void: #040D09;

    --font-display: 'Libre Baskerville', Georgia, serif;
    --font-body: 'Source Sans 3', 'Source Sans Pro', sans-serif;

    --tilt-x: 0deg;
    --tilt-y: 0deg;
}

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

html {
    scroll-behavior: smooth;
    background-color: var(--void);
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.75;
    color: var(--pale-mint);
    background-color: var(--void);
    overflow-x: hidden;
}

h1 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(2.5rem, 6vw, 5rem);
    letter-spacing: 0.02em;
    color: var(--dew);
    line-height: 1.1;
}

h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    letter-spacing: 0.02em;
    color: var(--dew);
    margin-bottom: 1rem;
    line-height: 1.25;
}

p {
    margin-bottom: 1em;
}

p:last-child {
    margin-bottom: 0;
}

/* --- Section Base --- */
section {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6rem 4rem;
    overflow: hidden;
}

/* --- Grid Container (12-column) --- */
.grid-container {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2rem;
    width: 100%;
    max-width: 1400px;
    position: relative;
    z-index: 2;
}

/* --- Blob Shapes --- */
.blob-container {
    border-radius: 48% 52% 68% 32% / 42% 58% 36% 64%;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.hero-blob-shape {
    animation: blobMorph 10s ease-in-out infinite alternate;
}

.text-blob-shape {
    animation: blobMorph 10s ease-in-out infinite alternate;
    background: var(--forest-core);
    border: 3px solid var(--moss);
    padding: clamp(2rem, 4vw, 3.5rem);
}

.tall-blob-shape {
    animation: blobMorph 10s ease-in-out infinite alternate;
    border: 3px solid var(--moss);
}

.closing-blob-shape {
    animation: blobMorph 10s ease-in-out infinite alternate;
    background: var(--forest-core);
    border: 3px solid var(--moss);
    padding: clamp(2.5rem, 5vw, 4rem);
}

@keyframes blobMorph {
    0% {
        border-radius: 48% 52% 68% 32% / 42% 58% 36% 64%;
    }
    50% {
        border-radius: 62% 38% 44% 56% / 55% 35% 65% 45%;
    }
    100% {
        border-radius: 35% 65% 52% 48% / 60% 40% 55% 45%;
    }
}

/* --- Glitch-Art Treatment --- */
.glitch-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    mix-blend-mode: screen;
    background-size: cover;
    background-position: center;
}

/* RGB channel layers for glitch effect */
.glitch-red {
    background: linear-gradient(135deg, var(--moss) 0%, var(--deep-forest) 40%, var(--fern) 60%, var(--forest-core) 100%);
    background-blend-mode: overlay;
    opacity: 0.8;
    transform: translate(5px, -2px);
    animation: glitchShift 8s steps(3) infinite;
}

.glitch-green {
    background: linear-gradient(225deg, var(--leaf) 0%, var(--deep-forest) 35%, var(--moss) 65%, var(--void) 100%);
    background-blend-mode: overlay;
    opacity: 0.7;
    transform: translate(-5px, 3px);
    animation: glitchShift 6s steps(4) infinite;
}

.glitch-blue {
    background: linear-gradient(315deg, var(--fern) 0%, var(--void) 30%, var(--leaf) 70%, var(--deep-forest) 100%);
    background-blend-mode: overlay;
    opacity: 0.6;
    transform: translate(2px, 5px);
    animation: glitchShift 10s steps(2) infinite;
}

/* Scan lines overlay */
.glitch-layer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 3px,
        var(--deep-forest) 3px,
        var(--deep-forest) 4px
    );
    opacity: 0.3;
    pointer-events: none;
    z-index: 5;
}

/* Glitch displacement keyframes */
@keyframes glitchShift {
    0%, 90%, 100% { transform: translate(5px, -2px); }
    92% { transform: translate(-12px, -2px); }
    94% { transform: translate(8px, 1px); }
    96% { transform: translate(-3px, -4px); }
    98% { transform: translate(15px, 2px); }
}

/* --- Abstract-Tech Motifs (Mycelial Network) --- */
.circuit-motif {
    position: absolute;
    width: 200px;
    height: 100px;
    opacity: 0.4;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* ============================
   SECTION 1: HERO
   ============================ */
.hero {
    background-color: var(--void);
    padding-top: 10vh;
    padding-bottom: 10vh;
}

.hero-text {
    grid-column: 1 / 6;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
    z-index: 2;
}

.hero-text h1 {
    text-shadow: 0 0 60px rgba(82, 183, 136, 0.15);
}

.hero-blob {
    grid-column: 7 / 13;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.hero-blob-shape {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-width: 500px;
}

/* ============================
   SECTION 2: FIRST ZIG
   ============================ */
.first-zig {
    background-color: var(--void);
}

.blob-left {
    grid-column: 1 / 6;
    display: flex;
    align-items: center;
    z-index: 2;
}

.blob-right {
    grid-column: 7 / 13;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.tall-blob-shape {
    width: 100%;
    aspect-ratio: 3 / 4;
    max-width: 400px;
}

/* ============================
   SECTION 3: ZAG
   ============================ */
.section-zag {
    background-color: #081C15;
}

.section-zag .blob-left {
    grid-column: 1 / 6;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.section-zag .blob-right {
    grid-column: 7 / 13;
    display: flex;
    align-items: center;
    z-index: 2;
}

/* ============================
   SECTION 4: RESOLUTION
   ============================ */
.resolution {
    background-color: var(--void);
    min-height: 100vh;
}

.closing-blob-wrapper {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    grid-column: 1 / -1;
}

.closing-blob-shape {
    width: 50vw;
    max-width: 700px;
    text-align: center;
    transform: perspective(800px) rotateY(var(--tilt-x)) rotateX(var(--tilt-y));
    transition: transform 200ms ease-out;
    will-change: transform;
}

/* Tilt-3D touch fallback animation */
@media (hover: none) {
    .closing-blob-shape {
        animation: tiltOscillate 8s ease-in-out infinite;
    }

    @keyframes tiltOscillate {
        0%, 100% {
            transform: perspective(800px) rotateY(-2deg) rotateX(-2deg);
        }
        25% {
            transform: perspective(800px) rotateY(2deg) rotateX(-1deg);
        }
        50% {
            transform: perspective(800px) rotateY(1deg) rotateX(2deg);
        }
        75% {
            transform: perspective(800px) rotateY(-1deg) rotateX(1deg);
        }
    }
}

/* ============================
   RESPONSIVE
   ============================ */

@media (max-width: 900px) {
    section {
        padding: 4rem 2rem;
    }

    .grid-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .hero-text,
    .hero-blob,
    .blob-left,
    .blob-right {
        grid-column: 1 / -1;
    }

    .hero-blob-shape {
        max-width: 350px;
    }

    .tall-blob-shape {
        max-width: 300px;
        aspect-ratio: 1 / 1;
    }

    .closing-blob-shape {
        width: 85vw;
    }

    .circuit-motif {
        display: none;
    }
}

@media (max-width: 600px) {
    section {
        padding: 3rem 1.2rem;
        min-height: auto;
        padding-top: 5rem;
        padding-bottom: 5rem;
    }

    h1 {
        font-size: clamp(2rem, 8vw, 3rem);
    }

    .closing-blob-shape {
        width: 92vw;
        padding: 2rem;
    }
}
