/* ============================================
   p9r.xyz - Chrome Greenhouse
   Botanical + Full-Bleed + Kinetic-Animated
   Palette: Chrome-Metallic
   ============================================ */

/* --- Palette Reference ---
   #d4d4d8 Liquid Mirror (base)
   #27272a Obsidian Plate (dark)
   #fafafa White Steel (highlight)
   #a1a1aa Brushed Nickel (mid)
   #22633a Terrarium Green (botanical primary)
   #2d8a4e Moss Breath (botanical whisper)
   #14432a Deep Fern (botanical shadow)
   #b87333 Oxidized Copper (warm accent)
   #c0c0c0 (zone 3 chrome base)
   #1a3a2a (zone 3 green tint)
   --- */

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

html {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    color: #27272a;
    background-color: #d4d4d8;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Page Container --- */
#page-container {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 100vh auto auto 100vh;
    width: 100%;
}

/* --- Zone Base --- */
.zone {
    position: relative;
    width: 100%;
    scroll-snap-align: start;
    overflow: hidden;
}

/* ============================================
   ZONE 1: The Still Surface
   ============================================ */
#zone-1 {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #d4d4d8 0%, #fafafa 40%, #a1a1aa 70%, #d4d4d8 100%);
}

/* Chrome Sheen Effect */
.chrome-sheen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.08) 45%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.08) 55%, transparent 60%);
    background-size: 200% 100%;
    animation: sheen 12s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes sheen {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Wave SVG in Zone 1 */
#wave-a {
    position: absolute;
    bottom: 30%;
    left: 0;
    width: 100%;
    height: 100px;
    z-index: 1;
    opacity: 0;
}

.wave-path {
    stroke-linecap: round;
}

.wave-path-a {
    stroke-dasharray: 1800;
    stroke-dashoffset: 1800;
}

/* Hero Text */
.hero-domain {
    position: relative;
    z-index: 2;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: -0.01em;
    color: #fafafa;
    opacity: 0;
    display: flex;
    gap: 0;
}

.hero-domain .char {
    display: inline-block;
    animation: breathe 6s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% {
        letter-spacing: -0.03em;
        opacity: 0.85;
    }
    50% {
        letter-spacing: 0.02em;
        opacity: 1;
    }
}

/* Hero scroll transition */
.hero-domain.scrolled {
    transform: scale(0.92) translateY(-2vh);
    opacity: 0;
    transition: all 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================
   ZONE 2: The Emergence
   ============================================ */
#zone-2 {
    min-height: 80vh;
    padding: 8vh 0;
    position: relative;
    background: linear-gradient(135deg, #d4d4d8 0%, #fafafa 40%, #a1a1aa 70%, #d4d4d8 100%);
}

.text-block {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 800ms cubic-bezier(0.16, 1, 0.3, 1), transform 800ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

.text-block-1 {
    padding: 12vh 8vw;
    max-width: 42ch;
}

.text-block-2 {
    padding: 4vh 6vw;
    margin-left: 55vw;
    max-width: 38ch;
}

.text-block-3 {
    padding: 8vh 20vw;
    max-width: 48ch;
}

.contemplative-text {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(0.95rem, 1.8vw, 1.2rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    color: #27272a;
}

/* Botanical SVGs */
.botanical-svg {
    position: absolute;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
}

.botanical-fern {
    left: 30%;
    width: 120px;
    height: 300px;
}

.botanical-leaf {
    right: 15%;
    width: 160px;
    height: 280px;
}

.botanical-path {
    stroke: #14432a;
    stroke-dasharray: var(--path-length, 600);
    stroke-dashoffset: var(--path-length, 600);
    transition: stroke-dashoffset 2000ms ease-out;
}

.botanical-path.drawn {
    stroke-dashoffset: 0;
}

/* ============================================
   ZONE 3: The Garden
   ============================================ */
#zone-3 {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-color: #c0c0c0;
    background-image: linear-gradient(135deg, #d4d4d8 0%, #fafafa 40%, #a1a1aa 70%, #d4d4d8 100%);
}

.botanical-bleed-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at 50% 100%, rgba(34,99,58,0.06) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 1200ms ease;
    pointer-events: none;
    z-index: 0;
}

.botanical-bleed-overlay.visible {
    opacity: 1;
}

/* Voronoi Cracks */
.voronoi-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.crack-line {
    stroke: rgba(45,138,78,0.15); /* #2d8a4e at 15% */
    stroke-width: 0.5;
    stroke-dasharray: var(--crack-length, 200);
    stroke-dashoffset: var(--crack-length, 200);
    transition: stroke-dashoffset 800ms ease-out;
}

.crack-line.glow {
    stroke: #2d8a4e;
}

.zone-3-tint {
    background-color: #1a3a2a;
}

.crack-line.drawn {
    stroke-dashoffset: 0;
}

/* Garden Navigation */
.garden-nav {
    display: flex;
    flex-direction: column;
    gap: 4rem;
    position: relative;
    z-index: 2;
    padding: 6vh 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: #27272a;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.7rem, 1vw, 0.85rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 400ms ease, transform 400ms ease;
    position: relative;
}

.nav-link.visible {
    opacity: 1;
    transform: scale(1);
}

.nav-link span {
    position: relative;
}

.nav-link span::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: #b87333;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 400ms ease;
}

.nav-link:hover span::after {
    transform: scaleX(1);
}

/* Leaf Icon */
.leaf-icon {
    transition: transform 300ms ease, filter 300ms ease;
    will-change: transform;
}

.nav-link:hover .leaf-icon path {
    stroke: #22633a;
    transition: stroke 300ms ease;
}

.nav-link:hover .leaf-icon {
    filter: drop-shadow(0 2px 4px rgba(34,99,58,0.3));
}

/* ============================================
   ZONE 4: The Return to Stillness
   ============================================ */
#zone-4 {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-color: #d4d4d8;
    transition: background-color 1500ms ease;
}

#zone-4.dark {
    background-color: #27272a;
}

/* Wave Trio */
.wave-trio-svg {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 100px;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 1000ms ease;
    z-index: 1;
}

.wave-trio-svg.visible {
    opacity: 1;
}

.wave-path-a-z4 {
    stroke-dasharray: 1800;
    stroke-dashoffset: 1800;
}

.wave-path-b {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
}

.wave-path-c {
    stroke-dasharray: 2200;
    stroke-dashoffset: 2200;
}

/* Center Rule */
.center-rule {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    border: none;
    background-color: rgba(255,255,255,0.08);
    transform: translateY(-50%);
    clip-path: inset(0 50%);
    transition: clip-path 1800ms ease;
    z-index: 2;
}

.center-rule.expanded {
    clip-path: inset(0 0);
}

/* Zone 4 Domain */
.zone-4-domain {
    position: absolute;
    bottom: 8vh;
    right: 6vw;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: clamp(1.8rem, 4.8vw, 4.2rem);
    letter-spacing: -0.01em;
    color: #fafafa;
    opacity: 0;
    transition: opacity 1000ms ease;
    z-index: 3;
}

.zone-4-domain.visible {
    opacity: 1;
}

/* ============================================
   WAVE ANIMATIONS
   ============================================ */
@keyframes waveFlowA {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -1800; }
}

@keyframes waveFlowB {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -2000; }
}

@keyframes waveFlowC {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -2200; }
}

.wave-path-a.flowing {
    stroke-dashoffset: 0;
    animation: waveFlowA 2400ms linear infinite;
}

.wave-path-a-z4.flowing {
    stroke-dashoffset: 0;
    animation: waveFlowA 2400ms linear infinite;
}

.wave-path-b.flowing {
    stroke-dashoffset: 0;
    animation: waveFlowB 3600ms linear infinite;
}

.wave-path-c.flowing {
    stroke-dashoffset: 0;
    animation: waveFlowC 5200ms linear infinite;
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .chrome-sheen {
        animation: none;
    }

    .hero-domain .char {
        animation: none;
        opacity: 1;
    }

    .wave-path-a.flowing,
    .wave-path-a-z4.flowing,
    .wave-path-b.flowing,
    .wave-path-c.flowing {
        animation: none;
        stroke-dashoffset: 0;
    }

    .botanical-path {
        transition: none;
        stroke-dashoffset: 0;
    }

    .crack-line {
        transition: none;
        stroke-dashoffset: 0;
    }

    .text-block {
        transition: none;
        opacity: 1;
        transform: none;
    }

    .nav-link {
        transition: none;
        opacity: 1;
        transform: none;
    }
}

/* ============================================
   MOBILE (under 768px)
   ============================================ */
@media (max-width: 768px) {
    .hero-domain .char {
        animation: breatheMobile 6s ease-in-out infinite;
    }

    @keyframes breatheMobile {
        0%, 100% { opacity: 0.85; }
        50% { opacity: 1; }
    }

    .text-block-1 {
        padding: 6vh 6vw;
    }

    .text-block-2 {
        margin-left: 15vw;
        padding: 4vh 6vw;
    }

    .text-block-3 {
        padding: 6vh 8vw;
    }

    .garden-nav {
        gap: 3rem;
    }

    .nav-link:active .leaf-icon {
        transform: rotate(8deg);
    }

    .botanical-fern {
        left: 5%;
        width: 80px;
        height: 200px;
    }

    .botanical-leaf {
        right: 5%;
        width: 100px;
        height: 180px;
    }
}
