/* ============================================
   eesugi.com - The Great Cedar
   ============================================ */

:root {
    --bg-root: #0B0F0A;
    --bg-trunk: #1A2618;
    --bg-canopy: #2D4A2A;
    --accent-green: #4A7C59;
    --accent-violet: #7B5EA7;
    --accent-gold: #C4A248;
    --text-primary: #D4DDD6;
    --text-muted: #8FA89B;
    --text-heading-trunk: #4A7C59;
}

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

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

body {
    background-color: var(--bg-root);
    color: var(--text-primary);
    font-family: 'Karla', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.75;
    letter-spacing: 0.02em;
    overflow-x: hidden;
    min-height: 500vh;
}

/* ============================================
   Bark Texture (fixed SVG background)
   ============================================ */
.bark-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    opacity: 0.05;
    transition: opacity 2000ms ease;
}

body.trunk-active .bark-texture {
    opacity: 0.15;
}

body.canopy-active .bark-texture {
    opacity: 0.08;
}

/* ============================================
   Growth-Line Progress Indicator
   ============================================ */
.growth-line {
    position: fixed;
    left: 20px;
    top: 0;
    width: 2px;
    height: 100vh;
    z-index: 100;
    pointer-events: none;
}

.growth-line-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 1px;
    height: 0%;
    background: var(--accent-gold);
    transition: height 100ms linear;
}

.growth-line-branches {
    position: absolute;
    top: 0;
    left: 0;
    width: 40px;
    height: 100%;
    opacity: 0;
    transition: opacity 1500ms ease;
}

body.crown-active .growth-line-branches {
    opacity: 1;
}

.branch {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 100%;
    background: var(--accent-gold);
    opacity: 0.3;
    transform-origin: bottom center;
}

.branch-1 {
    transform: rotate(-3deg) translateX(-5px);
    height: 60%;
    top: 0;
}

.branch-2 {
    transform: rotate(4deg) translateX(8px);
    height: 50%;
    top: 5%;
}

.branch-3 {
    transform: rotate(-6deg) translateX(-12px);
    height: 40%;
    top: 10%;
}

.branch-4 {
    transform: rotate(8deg) translateX(15px);
    height: 35%;
    top: 8%;
}

.branch-5 {
    transform: rotate(-2deg) translateX(-3px);
    height: 70%;
    top: 0;
}

/* ============================================
   Seed Line (Loading Animation)
   ============================================ */
.seed-line {
    position: fixed;
    bottom: 50vh;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 0;
    background: var(--accent-gold);
    z-index: 200;
    opacity: 1;
    transition: opacity 1000ms ease;
}

.seed-line.growing {
    animation: seedGrow 1.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.seed-line.pulse {
    animation: seedGrow 1.5s cubic-bezier(0.16, 1, 0.3, 1) forwards, seedPulse 800ms ease-in-out 1.5s 1;
}

.seed-line.fade-out {
    opacity: 0;
}

@keyframes seedGrow {
    from {
        height: 0;
    }
    to {
        height: 30vh;
    }
}

@keyframes seedPulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* ============================================
   Bioluminescent Spores
   ============================================ */
.spores {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    transition: opacity 2000ms ease;
}

body.trunk-active .spores,
body.canopy-active .spores {
    opacity: 1;
}

body.crown-active .spores {
    opacity: 1;
}

.spore {
    position: absolute;
    display: block;
    border-radius: 50%;
    background: var(--accent-violet);
    animation-name: sporeFloat;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

@keyframes sporeFloat {
    0% {
        transform: translateY(0) translateX(0);
    }
    25% {
        transform: translateY(-30vh) translateX(10px);
    }
    50% {
        transform: translateY(-60vh) translateX(-8px);
    }
    75% {
        transform: translateY(-90vh) translateX(12px);
    }
    100% {
        transform: translateY(-120vh) translateX(0);
    }
}

/* ============================================
   Zones - General
   ============================================ */
.zone {
    position: relative;
    z-index: 5;
}

/* ============================================
   ROOT ZONE (0-100vh)
   ============================================ */
.zone-root {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 10vh;
    background: var(--bg-root);
}

.root-network {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80vw;
    max-width: 800px;
    height: 40vh;
    z-index: 1;
    pointer-events: none;
}

.root-line {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 2000ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

.root-content {
    position: relative;
    z-index: 2;
    width: 40%;
    max-width: 500px;
    text-align: center;
    opacity: 0;
    transition: opacity 1000ms ease;
}

.root-content.visible {
    opacity: 1;
}

.root-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(3rem, 8vw, 6rem);
    color: var(--text-muted);
    opacity: 0.6;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.0;
    margin-bottom: 3rem;
}

.root-passage {
    color: var(--text-primary);
    font-family: 'Karla', sans-serif;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.75;
}

/* ============================================
   TRANSITION 1 - Growth Ring
   ============================================ */
.zone-transition-1 {
    min-height: 50vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(to bottom, var(--bg-root), var(--bg-trunk));
    overflow: hidden;
}

.growth-ring {
    width: 70vw;
    max-width: 900px;
    height: auto;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 1500ms ease, transform 2000ms cubic-bezier(0.16, 1, 0.3, 1);
}

.growth-ring.visible {
    opacity: 1;
    transform: scale(1);
}

.growth-ring circle {
    animation: ringPulse 6s ease-in-out infinite;
}

.growth-ring circle:nth-child(1) { animation-delay: 0s; }
.growth-ring circle:nth-child(2) { animation-delay: 0.3s; }
.growth-ring circle:nth-child(3) { animation-delay: 0.6s; }
.growth-ring circle:nth-child(4) { animation-delay: 0.9s; }
.growth-ring circle:nth-child(5) { animation-delay: 1.2s; }
.growth-ring circle:nth-child(6) { animation-delay: 1.5s; }
.growth-ring circle:nth-child(7) { animation-delay: 1.8s; }
.growth-ring circle:nth-child(8) { animation-delay: 2.1s; }
.growth-ring circle:nth-child(9) { animation-delay: 2.4s; }
.growth-ring circle:nth-child(10) { animation-delay: 2.7s; }
.growth-ring circle:nth-child(11) { animation-delay: 3.0s; }

@keyframes ringPulse {
    0%, 100% { opacity: inherit; }
    50% { opacity: 0.02; }
}

/* ============================================
   TRUNK ZONE (100vh-300vh)
   ============================================ */
.zone-trunk {
    min-height: 200vh;
    background: var(--bg-trunk);
    padding: 15vh 0;
    position: relative;
}

.branch-block {
    width: 55%;
    max-width: 650px;
    margin: 0 auto;
    padding: 4rem 0;
    position: relative;
}

.branch-block + .branch-block {
    margin-top: 15vh;
}

.branch-left {
    margin-left: 10vw;
    margin-right: auto;
}

.branch-right {
    margin-right: 10vw;
    margin-left: auto;
}

.trunk-heading {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(2.8rem, 6vw, 5.5rem);
    color: var(--text-heading-trunk);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.0;
    margin-bottom: 2rem;
}

.trunk-text {
    color: var(--text-primary);
    font-family: 'Karla', sans-serif;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.75;
}

.annotation {
    font-family: 'IM Fell English', serif;
    font-style: italic;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    opacity: 0.7;
    position: absolute;
    top: 1rem;
    right: -3rem;
    transform: rotate(-2deg);
    white-space: nowrap;
}

.branch-right .annotation {
    right: auto;
    left: -3rem;
}

/* Growth Ring 2 (in trunk) */
.growth-ring-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 10vh 0;
    min-height: 50vh;
}

.growth-ring-2 {
    width: 80vw;
    max-width: 1000px;
}

/* ============================================
   TRANSITION 2 - Trunk to Canopy
   ============================================ */
.zone-transition-2 {
    min-height: 30vh;
    background: linear-gradient(to bottom, var(--bg-trunk), var(--bg-canopy));
    position: relative;
}

.canopy-light {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120vw;
    height: 100%;
    background: radial-gradient(ellipse at 50% 0%, rgba(74, 124, 89, 0.10) 0%, transparent 70%);
    pointer-events: none;
}

/* ============================================
   CANOPY ZONE (300vh-450vh)
   ============================================ */
.zone-canopy {
    min-height: 150vh;
    background: var(--bg-canopy);
    padding: 15vh 5vw;
    position: relative;
    overflow: hidden;
}

.canopy-block {
    width: 70%;
    max-width: 800px;
    margin: 0 auto;
    padding: 4rem 0;
}

.canopy-block + .canopy-block {
    margin-top: 12vh;
}

.canopy-offset-right {
    margin-left: auto;
    margin-right: 5vw;
}

.canopy-offset-left {
    margin-left: 5vw;
    margin-right: auto;
}

.canopy-heading {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(2.8rem, 6vw, 5.5rem);
    color: var(--accent-gold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.0;
    margin-bottom: 2rem;
}

.canopy-text {
    color: var(--text-primary);
    font-family: 'Karla', sans-serif;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.75;
}

/* Leaf Motifs */
.leaf-motif {
    position: absolute;
    width: 60px;
    height: 120px;
    z-index: 1;
    pointer-events: none;
    transition: transform 500ms ease;
}

.leaf-1 {
    top: 10%;
    right: 8%;
    transform: rotate(15deg);
}

.leaf-2 {
    top: 35%;
    left: 5%;
    transform: rotate(-20deg);
}

.leaf-3 {
    top: 60%;
    right: 12%;
    transform: rotate(8deg);
}

.leaf-4 {
    top: 80%;
    left: 10%;
    transform: rotate(-12deg);
}

/* ============================================
   CROWN ZONE (450vh-500vh)
   ============================================ */
.zone-crown {
    min-height: 60vh;
    background: var(--bg-canopy);
    background-image: radial-gradient(ellipse at 50% 30%, rgba(74, 124, 89, 0.20) 0%, transparent 60%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10vh 5vw;
    position: relative;
    overflow: hidden;
}

.growth-ring-crown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.6);
    width: 90vw;
    max-width: 1200px;
    z-index: 1;
}

.growth-ring-crown.visible {
    transform: translate(-50%, -50%) scale(1);
}

.crown-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 600px;
}

.crown-heading {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(2.8rem, 6vw, 5.5rem);
    color: var(--accent-gold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.0;
    margin-bottom: 2rem;
}

.crown-text {
    color: var(--text-primary);
    font-family: 'Karla', sans-serif;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.75;
}

/* ============================================
   Fade Reveal Animation
   ============================================ */
.fade-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 600ms cubic-bezier(0.16, 1, 0.3, 1),
                transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

.fade-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .root-content {
        width: 80%;
    }

    .branch-block {
        width: 85%;
    }

    .branch-left {
        margin-left: 5vw;
    }

    .branch-right {
        margin-right: 5vw;
    }

    .annotation {
        position: relative;
        top: 0;
        right: 0;
        left: 0;
        display: block;
        margin-bottom: 1rem;
        transform: none;
    }

    .branch-right .annotation {
        left: 0;
    }

    .canopy-block {
        width: 90%;
    }

    .canopy-offset-right,
    .canopy-offset-left {
        margin-left: auto;
        margin-right: auto;
    }

    .leaf-motif {
        display: none;
    }

    .growth-line {
        left: 10px;
    }
}
