/* ============================================
   footprint.market - Styles
   Earth-tones, botanical illustration, wabi-sabi
   ============================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
    --canopy-green: #2d5a27;
    --lichen: #c8d5b9;
    --bark-deep: #3b2f2f;
    --loam: #4a3f35;
    --topsoil: #8b6f47;
    --sunlight-filter: #e8d5a3;
    --mycelium-white: #f4f0e8;
    --chlorophyll-bright: #6fbf4a;
    --twilight-indigo: #1e2a38;
    --decay-amber: #c49a3c;
    --fern-ink: #5b7553;

    --font-heading: 'Playfair Display', Georgia, serif;
    --font-body: 'Nunito Sans', 'Segoe UI', sans-serif;
    --font-annotation: 'Caveat', cursive;
    --font-accent: 'Abril Fatface', 'Playfair Display', serif;

    --ease-organic: cubic-bezier(0.25, 0.8, 0.25, 1.0);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1.0);
}

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

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

body {
    background-color: var(--mycelium-white);
    color: var(--loam);
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.75;
    overflow-x: hidden;
}

.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ---------- Sections (shared) ---------- */
.section {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

.section-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.section-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--bark-deep);
    letter-spacing: 0.02em;
    margin-bottom: 0.5em;
}

.section-intro {
    font-family: var(--font-body);
    color: var(--loam);
    max-width: 600px;
    margin-bottom: 2em;
}

/* ---------- Animate-in base ---------- */
.animate-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s var(--ease-organic), transform 0.8s var(--ease-spring);
}

.animate-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Section 1: The Canopy
   ============================================ */
#canopy {
    background-color: var(--twilight-indigo);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    min-height: 100vh;
}

.canopy-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 70% 30%, rgba(232, 213, 163, 0.06) 0%, transparent 60%),
                radial-gradient(ellipse at 30% 70%, rgba(45, 90, 39, 0.08) 0%, transparent 50%);
    z-index: 0;
}

/* Canopy leaves */
.canopy-leaves {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.canopy-leaf {
    position: absolute;
    opacity: 0;
    transition: opacity 0.6s var(--ease-organic);
}

.canopy-leaf.visible {
    opacity: var(--leaf-opacity, 0.5);
}

/* Sunlight shaft */
.sunlight-shaft {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(232, 213, 163, 0.15) 0%, transparent 50%);
    opacity: 0;
    z-index: 2;
    pointer-events: none;
    transition: opacity 3s var(--ease-organic);
}

.sunlight-shaft.visible {
    opacity: 1;
}

/* Canopy title */
.canopy-title {
    position: relative;
    z-index: 3;
    text-align: center;
    opacity: 0;
    transition: opacity 1.2s var(--ease-organic);
}

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

.logo-stamp {
    font-family: var(--font-accent);
    font-size: clamp(3rem, 8vw, 7rem);
    font-weight: 400;
    color: var(--bark-deep);
    background: linear-gradient(180deg, #5a4a3a, #3b2f2f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    filter: url(#emboss);
    letter-spacing: 0.02em;
    line-height: 1.1;
}

.canopy-subtitle {
    font-family: var(--font-annotation);
    font-size: 1.2rem;
    color: var(--lichen);
    opacity: 0.7;
    margin-top: 0.8em;
    letter-spacing: 0.05em;
}

/* Scroll vine hint */
.scroll-vine-hint {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    opacity: 0;
    animation: vine-pulse 2s var(--ease-organic) infinite;
    animation-delay: 4s;
    animation-fill-mode: backwards;
}

@keyframes vine-pulse {
    0%, 100% { opacity: 0.4; transform: translateX(-50%) translateY(0); }
    50% { opacity: 0.8; transform: translateX(-50%) translateY(8px); }
}

/* ============================================
   Section 2-3: The Understory
   ============================================ */
#understory {
    background-color: var(--mycelium-white);
    padding: 8vh 5vw;
    min-height: 200vh;
}

.understory-bg {
    background:
        linear-gradient(180deg, var(--twilight-indigo) 0%, transparent 15%),
        radial-gradient(ellipse at 50% 30%, rgba(45, 90, 39, 0.04) 0%, transparent 60%);
    filter: url(#paper-grain);
}

.leaf-vein-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.vein-path {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 2s var(--ease-organic);
}

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

.understory-content {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding-top: 10vh;
}

.understory-content .section-title {
    text-align: center;
}

.understory-content .section-intro {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 4em;
}

/* Leaf cards */
.leaf-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 3rem;
    position: relative;
}

.leaf-card {
    position: relative;
    background: linear-gradient(135deg, rgba(200, 213, 185, 0.4), rgba(244, 240, 232, 0.8));
    padding: 2.5rem 2rem;
    clip-path: polygon(10% 0%, 95% 2%, 100% 15%, 98% 85%, 90% 100%, 5% 98%, 0% 88%, 2% 12%);
    transition: transform 0.4s var(--ease-spring), box-shadow 0.4s var(--ease-organic), filter 0.4s var(--ease-organic);
    cursor: default;
}

.leaf-card:hover {
    transform: translateY(-4px) rotate(0deg) !important;
    box-shadow: 0 8px 30px rgba(196, 154, 60, 0.15);
    filter: drop-shadow(0 0 15px rgba(232, 213, 163, 0.2));
}

.leaf-card-veins {
    position: absolute;
    inset: 0;
    opacity: 0.15;
    background:
        linear-gradient(180deg, transparent 49%, var(--chlorophyll-bright) 49%, var(--chlorophyll-bright) 51%, transparent 51%),
        linear-gradient(135deg, transparent 49%, var(--chlorophyll-bright) 49%, var(--chlorophyll-bright) 50.5%, transparent 50.5%),
        linear-gradient(45deg, transparent 49%, var(--chlorophyll-bright) 49%, var(--chlorophyll-bright) 50.5%, transparent 50.5%);
    background-size: 100% 40px, 60px 60px, 60px 60px;
    transition: opacity 0.4s var(--ease-organic);
    pointer-events: none;
    clip-path: inherit;
}

.leaf-card:hover .leaf-card-veins {
    opacity: 0.5;
}

.leaf-card-content {
    position: relative;
    z-index: 1;
}

.data-label {
    font-family: var(--font-annotation);
    font-size: 0.875rem;
    color: var(--fern-ink);
    display: block;
    margin-bottom: 0.3em;
}

.data-value {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    font-weight: 700;
    color: var(--bark-deep);
    display: block;
    margin-bottom: 0.3em;
}

.data-desc {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--loam);
    line-height: 1.6;
}

/* Stem connections */
.stem-connections {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.3;
}

/* ============================================
   Section 4-5: The Forest Floor
   ============================================ */
#forest-floor {
    min-height: 250vh;
    display: flex;
    flex-direction: column;
}

.strata-layer {
    position: relative;
    flex: 1;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6vh 5vw;
    overflow: hidden;
}

.strata-texture {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.topsoil-layer {
    background: linear-gradient(180deg, var(--mycelium-white) 0%, #d4c4a0 20%, var(--topsoil) 100%);
}

.topsoil-layer .strata-texture {
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(139, 111, 71, 0.1) 3px, rgba(139, 111, 71, 0.1) 4px);
    opacity: 0.6;
}

.subsoil-layer {
    background: linear-gradient(180deg, var(--topsoil) 0%, #6b5335 50%, var(--loam) 100%);
}

.subsoil-layer .strata-texture {
    background-image:
        repeating-linear-gradient(2deg, transparent, transparent 5px, rgba(74, 63, 53, 0.15) 5px, rgba(74, 63, 53, 0.15) 6px),
        repeating-linear-gradient(-1deg, transparent, transparent 8px, rgba(59, 47, 47, 0.08) 8px, rgba(59, 47, 47, 0.08) 9px);
    opacity: 0.7;
}

.bedrock-layer {
    background: linear-gradient(180deg, var(--loam) 0%, var(--bark-deep) 60%, var(--twilight-indigo) 100%);
}

.bedrock-layer .strata-texture {
    background-image:
        repeating-linear-gradient(1deg, transparent, transparent 10px, rgba(30, 42, 56, 0.12) 10px, rgba(30, 42, 56, 0.12) 12px),
        repeating-linear-gradient(-2deg, transparent, transparent 15px, rgba(59, 47, 47, 0.1) 15px, rgba(59, 47, 47, 0.1) 16px);
    opacity: 0.5;
}

.strata-content {
    position: relative;
    z-index: 1;
    max-width: 700px;
    text-align: center;
}

.fossilized-text {
    text-shadow: 1px 1px 0 rgba(232, 213, 163, 0.3), -1px -1px 0 rgba(0, 0, 0, 0.15);
}

.topsoil-layer .fossilized-text {
    color: var(--bark-deep);
}

.subsoil-layer .fossilized-text {
    color: var(--sunlight-filter);
}

.subsoil-layer .section-title {
    color: var(--sunlight-filter);
}

.bedrock-layer .fossilized-text {
    color: var(--lichen);
}

.bedrock-layer .section-title {
    color: var(--lichen);
}

/* Root network */
.root-network {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.root-path {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 2.5s var(--ease-organic);
}

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

/* Footprint divider */
.footprint-divider {
    display: flex;
    justify-content: center;
    padding: 4vh 0;
    background: linear-gradient(180deg, var(--bark-deep) 0%, var(--twilight-indigo) 100%);
}

.footprint-svg {
    opacity: 0.6;
    animation: footprint-rotate 90s linear infinite;
}

@keyframes footprint-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============================================
   Section 6-7: The Mycelium Network
   ============================================ */
#mycelium {
    background-color: var(--twilight-indigo);
    min-height: 200vh;
    padding: 10vh 5vw;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mycelium-bg {
    background:
        radial-gradient(ellipse at 30% 40%, rgba(45, 90, 39, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(196, 154, 60, 0.05) 0%, transparent 40%);
}

.mycelium-title {
    color: var(--lichen) !important;
    text-align: center;
}

.mycelium-intro {
    color: var(--lichen);
    text-align: center;
    margin-left: auto;
    margin-right: auto;
    opacity: 0.8;
}

.mycelium-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1100px;
}

/* Hex grid */
.hex-grid {
    position: relative;
    width: 100%;
    min-height: 70vh;
    margin-top: 4vh;
}

.filament-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.filament {
    stroke-dasharray: 8 4;
    transition: opacity 0.4s var(--ease-organic), stroke 0.4s var(--ease-organic);
}

.filament.pulse {
    opacity: 0.8;
    stroke: var(--chlorophyll-bright);
    stroke-width: 2;
    animation: filament-pulse 0.8s var(--ease-organic);
}

@keyframes filament-pulse {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -50; }
}

/* Hex nodes */
.hex-node {
    position: absolute;
    left: var(--hex-x);
    top: var(--hex-y);
    transform: translate(-50%, -50%);
    z-index: 1;
    cursor: default;
}

.hex-shape {
    width: 180px;
    height: 180px;
    background: linear-gradient(135deg, rgba(200, 213, 185, 0.12), rgba(244, 240, 232, 0.08));
    backdrop-filter: blur(5px);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.2rem;
    text-align: center;
    transition: background 0.4s var(--ease-organic), transform 0.3s var(--ease-spring);
    border: none;
}

.hex-node:hover .hex-shape {
    background: linear-gradient(135deg, rgba(200, 213, 185, 0.25), rgba(244, 240, 232, 0.15));
    transform: scale(1.05);
}

.hex-value {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    color: var(--sunlight-filter);
    display: block;
    margin-bottom: 0.3em;
}

.hex-label {
    font-family: var(--font-annotation);
    font-size: 0.8rem;
    color: var(--lichen);
    line-height: 1.4;
    opacity: 0.8;
}

/* ============================================
   Section 8: The Seed
   ============================================ */
#seed {
    background-color: var(--twilight-indigo);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8vh 5vw;
}

.seed-bg {
    background: radial-gradient(ellipse at 50% 50%, rgba(45, 90, 39, 0.06) 0%, transparent 60%);
}

.seed-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4vh;
}

/* Seed circle with growth rings */
.seed-circle {
    position: relative;
    width: clamp(180px, 30vw, 280px);
    height: clamp(180px, 30vw, 280px);
    border-radius: 50%;
    animation: seed-rotate 90s linear infinite;
}

@keyframes seed-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.growth-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid transparent;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: box-shadow 0.4s var(--ease-organic);
}

.ring-1 {
    width: 100%;
    height: 100%;
    border-color: rgba(139, 111, 71, 0.3);
    box-shadow: inset 0 0 20px rgba(139, 111, 71, 0.1);
}

.ring-2 {
    width: 82%;
    height: 82%;
    border-color: rgba(139, 111, 71, 0.35);
    box-shadow: inset 0 0 15px rgba(139, 111, 71, 0.12);
}

.ring-3 {
    width: 62%;
    height: 62%;
    border-color: rgba(196, 154, 60, 0.3);
    box-shadow: inset 0 0 12px rgba(196, 154, 60, 0.1);
}

.ring-4 {
    width: 42%;
    height: 42%;
    border-color: rgba(196, 154, 60, 0.35);
    box-shadow: inset 0 0 10px rgba(196, 154, 60, 0.12);
}

.ring-5 {
    width: 24%;
    height: 24%;
    border-color: rgba(232, 213, 163, 0.4);
    box-shadow: inset 0 0 8px rgba(232, 213, 163, 0.15);
}

.seed-core {
    position: absolute;
    width: 10%;
    height: 10%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, var(--canopy-green) 30%, var(--bark-deep) 100%);
}

.seed-circle:hover .ring-1 {
    box-shadow: inset 0 0 20px rgba(139, 111, 71, 0.1), 0 0 20px rgba(196, 154, 60, 0.25);
}

/* Seed text */
.seed-text {
    text-align: center;
    max-width: 600px;
}

.spiral-line {
    font-family: var(--font-body);
    color: var(--lichen);
    font-size: clamp(0.95rem, 1.5vw, 1.1rem);
    line-height: 2;
    opacity: 0.85;
    transition-delay: var(--delay, 0s);
}

/* Footer */
.site-footer {
    position: relative;
    z-index: 1;
    margin-top: auto;
    padding-top: 6vh;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}

.footer-domain {
    font-family: var(--font-accent);
    font-size: 1.4rem;
    color: var(--bark-deep);
    opacity: 0.5;
}

.footer-line {
    font-family: var(--font-annotation);
    font-size: 0.9rem;
    color: var(--lichen);
    opacity: 0.4;
}

/* ============================================
   Vine Progress Indicator
   ============================================ */
#vine-progress {
    position: fixed;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    width: 40px;
    height: 400px;
    opacity: 0;
    transition: opacity 1s var(--ease-organic);
    pointer-events: auto;
}

#vine-progress.visible {
    opacity: 1;
}

#vine-svg {
    width: 100%;
    height: 100%;
}

#vine-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 0.6s var(--ease-organic);
}

.vine-leaf {
    cursor: pointer;
    transition: transform 0.3s var(--ease-spring);
}

.vine-leaf:hover {
    transform: scale(1.4);
}

.vine-leaf circle {
    transition: opacity 0.4s var(--ease-organic), fill 0.3s var(--ease-organic);
}

.vine-leaf.active circle {
    opacity: 1 !important;
    fill: var(--chlorophyll-bright);
}

#vine-tooltip {
    position: absolute;
    right: 45px;
    background: var(--bark-deep);
    color: var(--lichen);
    font-family: var(--font-annotation);
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 3px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s var(--ease-organic);
}

#vine-tooltip.visible {
    opacity: 1;
}

/* ============================================
   Spore Particles
   ============================================ */
#spore-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}

.spore {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--sunlight-filter);
    opacity: 0;
    animation: spore-drift var(--spore-duration, 12s) var(--spore-delay, 0s) infinite linear;
}

@keyframes spore-drift {
    0% {
        opacity: 0;
        transform: translate(var(--spore-x, 0px), 0);
    }
    10% {
        opacity: 0.4;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        opacity: 0;
        transform: translate(calc(var(--spore-x, 0px) + var(--spore-drift-x, 20px)), calc(-100vh - 50px));
    }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .leaf-cards {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .hex-shape {
        width: 140px;
        height: 140px;
        padding: 1.5rem 1rem;
    }

    .hex-value {
        font-size: 1.1rem;
    }

    .hex-label {
        font-size: 0.7rem;
    }

    #vine-progress {
        display: none;
    }

    .hex-node {
        position: relative;
        left: auto;
        top: auto;
        transform: none;
        margin: 1rem auto;
    }

    .hex-grid {
        display: flex;
        flex-direction: column;
        align-items: center;
        min-height: auto;
    }

    .filament-svg {
        display: none;
    }

    .strata-layer {
        min-height: 50vh;
    }
}

@media (max-width: 480px) {
    .logo-stamp {
        font-size: clamp(2.2rem, 12vw, 3.5rem);
    }

    .leaf-card {
        padding: 2rem 1.5rem;
    }
}
