/* namu.quest — A thousand-year tree journey */
/* Immersive scroll, five-era color system, Libre Baskerville + Space Grotesk */

:root {
    --scroll-progress: 0;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Libre Baskerville', serif;
    color: #C8B8A0;
    background: #12100E;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Scroll container */
.scroll-container {
    position: relative;
}

/* Each era section */
.era {
    position: relative;
    min-height: 200vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10vh 5vw;
    overflow: hidden;
}

.era-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    transition: opacity 0.5s ease;
}

/* Era 1: Seed — Dark earth */
.era-seed {
    background: linear-gradient(180deg, #12100E 0%, #1A1610 50%, #1E1A12 100%);
}

/* Era 2: Sapling — Dawn warmth */
.era-sapling {
    background: linear-gradient(180deg, #1E1A12 0%, #2A2018 30%, #3A2E20 60%, #2A2018 100%);
}

/* Era 3: Mature — Forest green */
.era-mature {
    background: linear-gradient(180deg, #2A2018 0%, #1A2A18 30%, #1E3020 60%, #1A2818 100%);
}

/* Era 4: Ancient — Twilight blue-gray */
.era-ancient {
    background: linear-gradient(180deg, #1A2818 0%, #1A1E28 30%, #1E2230 60%, #1A1E28 100%);
}

/* Era 5: Winter — Pale frost */
.era-winter {
    background: linear-gradient(180deg, #1A1E28 0%, #2A2A28 30%, #3A3A34 60%, #2A2A28 100%);
}

/* Century markers — large ghostly numbers */
.century-marker {
    position: absolute;
    top: 15vh;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: 80px;
    color: transparent;
    -webkit-text-stroke: 1px rgba(168, 184, 154, 0.15);
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.century-marker.visible {
    opacity: 1;
}

/* Tree containers */
.tree-container {
    position: relative;
    z-index: 2;
    margin-bottom: 48px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.tree-container.visible {
    opacity: 1;
    transform: translateY(0);
}

.tree-svg {
    display: block;
    overflow: visible;
}

.tree-svg-1 {
    width: 40px;
    height: 120px;
}

.tree-svg-2 {
    width: 80px;
    height: 180px;
}

.tree-svg-3 {
    width: 200px;
    height: 320px;
}

.tree-svg-4 {
    width: 280px;
    height: 400px;
}

.tree-svg-5 {
    width: 300px;
    height: 400px;
}

/* Tree line drawing animation */
.tree-line {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 2s ease;
}

.tree-container.visible .tree-line {
    stroke-dashoffset: 0;
}

.leaf, .canopy {
    opacity: 0;
    transition: opacity 1.5s ease 0.8s;
}

.tree-container.visible .leaf,
.tree-container.visible .canopy {
    opacity: 0.5;
}

/* Falling leaves animation */
@keyframes leafFall {
    0% { transform: translate(0, 0); opacity: 0.4; }
    50% { transform: translate(10px, 40px); opacity: 0.3; }
    100% { transform: translate(-5px, 80px); opacity: 0; }
}

.falling-leaf {
    animation: leafFall 4s ease infinite;
}

.falling-leaf:nth-child(2) {
    animation-delay: 1.2s;
}

.falling-leaf:nth-child(3) {
    animation-delay: 2.5s;
}

/* Era content */
.era-content {
    position: relative;
    z-index: 2;
    max-width: 560px;
    text-align: center;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.era-content.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Site title (only in first era) */
.site-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 36px;
    letter-spacing: 0.02em;
    color: #E8DCC0;
    margin-bottom: 48px;
    opacity: 0;
    transition: opacity 0.6s ease 2s;
}

.era-seed .era-content.visible .site-title {
    opacity: 1;
}

.title-dot {
    color: #6A9A5A;
}

/* Era titles */
.era-title {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 32px;
    margin-bottom: 24px;
    line-height: 1.3;
}

/* Era-specific title colors */
.era-seed .era-title { color: #8A7A5A; }
.era-sapling .era-title { color: #C8956A; }
.era-mature .era-title { color: #6A9A5A; }
.era-ancient .era-title { color: #B8C0D4; }
.era-winter .era-title { color: #A8B89A; }

/* Narrative text */
.era-narrative {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.9;
    margin-bottom: 16px;
}

/* Era-specific narrative colors */
.era-seed .era-narrative { color: #C8B8A0; }
.era-sapling .era-narrative { color: #E0D0B8; }
.era-mature .era-narrative { color: #C8D8BC; }
.era-ancient .era-narrative { color: #B8C0D4; }
.era-winter .era-narrative { color: #A8B89A; }

/* Final coda */
.era-coda {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 17px;
    line-height: 1.9;
    color: #E8DCC0;
    margin-top: 32px;
    opacity: 0.8;
}

/* Scroll progress indicator */
.scroll-indicator {
    position: fixed;
    top: 0;
    right: 12px;
    width: 2px;
    height: 100vh;
    background: rgba(168, 184, 154, 0.1);
    z-index: 100;
}

.scroll-indicator-fill {
    width: 100%;
    height: 0%;
    background: #A8B89A;
    transition: height 100ms linear;
}

/* Responsive */
@media (max-width: 768px) {
    .era {
        min-height: 150vh;
        padding: 8vh 6vw;
    }

    .century-marker {
        font-size: 50px;
    }

    .site-title {
        font-size: 28px;
    }

    .era-title {
        font-size: 24px;
    }

    .era-narrative {
        font-size: 15px;
    }

    .tree-svg-3 {
        width: 140px;
        height: 224px;
    }

    .tree-svg-4 {
        width: 200px;
        height: 286px;
    }

    .tree-svg-5 {
        width: 220px;
        height: 293px;
    }
}
