/* =============================================
   footprint.markets - Styles
   Botanical / Naturalist Field Journal Aesthetic
   18th-century herbarium meets digital mindfulness
   ============================================= */

/* --- CSS Custom Properties --- */
:root {
    --parchment-mist: #F6F3EC;
    --pressed-linen: #EDE8DD;
    --bark-charcoal: #2C3029;
    --lichen-grey: #6B7264;
    --deep-fern: #3A6B4C;
    --spring-moss: #7FA56E;
    --golden-sap: #C4A34D;
    --sage-whisper: #B8C4AC;
    --woodland-shadow: #1A2E1F;

    --font-display: 'Cormorant Garamond', serif;
    --font-secondary: 'Lora', serif;
    --font-body: 'Source Sans 3', sans-serif;

    --ease-organic: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--parchment-mist);
    color: var(--bark-charcoal);
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(1rem, 1.2vw + 0.4rem, 1.15rem);
    line-height: 1.85;
    letter-spacing: 0.005em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Paper grain texture overlay -- subtle noise for tactile warmth */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23noise)' opacity='0.5'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* --- Vine Progress Indicator (left edge) --- */
#vine-progress {
    position: fixed;
    left: 16px;
    top: 0;
    width: 20px;
    height: 100vh;
    z-index: 100;
    pointer-events: none;
}

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

#vine-path {
    stroke-dasharray: 1100;
    stroke-dashoffset: 1100;
    transition: stroke-dashoffset 0.3s ease-out;
}

#vine-leaves {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.vine-leaf-node {
    position: absolute;
    left: 4px;
    width: 12px;
    height: 12px;
    opacity: 0;
    transition: opacity 0.6s var(--ease-organic);
}

.vine-leaf-node.visible {
    opacity: 1;
}

.vine-leaf-node svg {
    width: 100%;
    height: 100%;
}

/* --- Header (minimal wordmark + thin line) --- */
#site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 50;
    padding: 20px 32px;
}

.wordmark {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: 1rem;
    letter-spacing: 0.04em;
    color: var(--bark-charcoal);
    opacity: 0;
    transition: opacity 1.2s var(--ease-organic);
}

.wordmark.visible {
    opacity: 0.7;
}

.header-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: var(--bark-charcoal);
    opacity: 0.15;
}

/* --- CANOPY LAYER (Hero / Opening Sequence) --- */
.section-canopy {
    min-height: 200vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 30vh;
    position: relative;
}

.canopy-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    margin-left: -8vw;
}

/* Fern Hero Illustration */
.fern-illustration {
    width: clamp(240px, 35vw, 420px);
    height: auto;
    opacity: 0;
    transition: opacity 0.8s var(--ease-organic);
}

.fern-illustration.visible {
    opacity: 1;
}

/* SVG path animation for fern (stroke-dasharray / stroke-dashoffset technique) */
.fern-stem,
.fern-frond,
.fern-pinna {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
}

.fern-illustration.animate .fern-stem {
    animation: drawPath 1.8s var(--ease-organic) forwards;
}

.fern-illustration.animate .fern-frond {
    animation: drawPath 1.2s var(--ease-organic) forwards;
}

/* Staggered frond animation delays (bottom to top) */
.fern-illustration.animate .frond-l1,
.fern-illustration.animate .frond-r1 { animation-delay: 0.8s; }
.fern-illustration.animate .frond-l2,
.fern-illustration.animate .frond-r2 { animation-delay: 1.0s; }
.fern-illustration.animate .frond-l3,
.fern-illustration.animate .frond-r3 { animation-delay: 1.2s; }
.fern-illustration.animate .frond-l4,
.fern-illustration.animate .frond-r4 { animation-delay: 1.4s; }
.fern-illustration.animate .frond-l5,
.fern-illustration.animate .frond-r5 { animation-delay: 1.6s; }
.fern-illustration.animate .frond-l6,
.fern-illustration.animate .frond-r6 { animation-delay: 1.8s; }
.fern-illustration.animate .frond-l7,
.fern-illustration.animate .frond-r7 { animation-delay: 2.0s; }
.fern-illustration.animate .frond-tip { animation-delay: 2.2s; }

.fern-illustration.animate .fern-pinna {
    animation: drawPath 0.8s var(--ease-organic) forwards;
}

/* Staggered pinnae animation delays */
.fern-illustration.animate .pinna-l1a,
.fern-illustration.animate .pinna-r1a { animation-delay: 1.2s; }
.fern-illustration.animate .pinna-l1b,
.fern-illustration.animate .pinna-r1b { animation-delay: 1.4s; }
.fern-illustration.animate .pinna-l2a,
.fern-illustration.animate .pinna-r2a { animation-delay: 1.6s; }
.fern-illustration.animate .pinna-l2b,
.fern-illustration.animate .pinna-r2b { animation-delay: 1.8s; }
.fern-illustration.animate .pinna-l3a,
.fern-illustration.animate .pinna-r3a { animation-delay: 2.0s; }
.fern-illustration.animate .pinna-l3b,
.fern-illustration.animate .pinna-r3b { animation-delay: 2.2s; }
.fern-illustration.animate .pinna-l4a,
.fern-illustration.animate .pinna-r4a { animation-delay: 1.6s; }
.fern-illustration.animate .pinna-l5a,
.fern-illustration.animate .pinna-r5a { animation-delay: 1.8s; }

@keyframes drawPath {
    to {
        stroke-dashoffset: 0;
    }
}

/* Site Title - Cormorant Garamond Light */
.site-title {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(2.2rem, 5vw + 0.8rem, 4.8rem);
    letter-spacing: 0.02em;
    line-height: 1.15;
    color: var(--bark-charcoal);
    margin-top: 3rem;
    opacity: 0;
    transition: opacity 1.8s var(--ease-organic);
}

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

/* Canopy Subtitle - Cormorant italic */
.canopy-subtitle {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 300;
    font-size: clamp(0.9rem, 1.5vw + 0.3rem, 1.2rem);
    color: var(--lichen-grey);
    letter-spacing: 0.02em;
    margin-top: 1rem;
    opacity: 0;
    transition: opacity 2s var(--ease-organic) 0.6s;
}

.canopy-subtitle.visible {
    opacity: 0.65;
}

/* --- Botanical Dividers --- */
.botanical-divider {
    display: flex;
    justify-content: center;
    padding: 6vh 0;
    opacity: 0;
    transition: opacity 0.8s var(--ease-organic);
}

.botanical-divider.visible {
    opacity: 1;
}

.divider-svg {
    width: clamp(280px, 50vw, 500px);
    height: auto;
}

.divider-path,
.divider-leaf-1,
.divider-leaf-2,
.divider-leaf-3 {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
}

.botanical-divider.animate .divider-path {
    animation: drawPath 1.5s var(--ease-organic) forwards;
}

.botanical-divider.animate .divider-leaf-1 {
    animation: drawPath 0.6s var(--ease-organic) 0.8s forwards;
}

.botanical-divider.animate .divider-leaf-2 {
    animation: drawPath 0.6s var(--ease-organic) 1.0s forwards;
}

.botanical-divider.animate .divider-leaf-3 {
    animation: drawPath 0.6s var(--ease-organic) 1.2s forwards;
}

/* --- UNDERSTORY SECTIONS --- */
.section-understory {
    min-height: 100vh;
    padding: 8vh 5vw 12vh;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: clamp(2rem, 5vw, 5rem);
    position: relative;
}

/* Content Pods (asymmetric border-radius like river stones) */
.content-pod {
    background-color: var(--pressed-linen);
    border: 1px solid var(--sage-whisper);
    border-radius: 40px 12px 36px 8px;
    padding: clamp(2rem, 4vw, 3.5rem);
    max-width: 680px;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 600ms var(--ease-organic), transform 600ms var(--ease-organic);
}

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

/* Organic drift positioning -- serpentine reading path */
.pod-drift-left {
    margin-inline: auto 8vw;
}

.pod-drift-right {
    margin-inline: 6vw auto;
}

.pod-drift-center {
    margin-inline: 12vw auto;
}

/* Section Headings - Lora */
.section-heading {
    font-family: var(--font-secondary);
    font-weight: 400;
    font-size: clamp(1.1rem, 2vw + 0.4rem, 1.6rem);
    letter-spacing: 0.01em;
    line-height: 1.35;
    color: var(--bark-charcoal);
    margin-bottom: 1.5rem;
}

/* Character-by-character reveal for headings */
.section-heading .char {
    display: inline-block;
    opacity: 0;
    transition: opacity 0.3s var(--ease-organic);
}

.section-heading .char.visible {
    opacity: 1;
}

/* Body Text - Source Sans 3 Light */
.body-text {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(1rem, 1.2vw + 0.4rem, 1.15rem);
    line-height: 1.85;
    letter-spacing: 0.005em;
    color: var(--bark-charcoal);
    max-width: 62ch;
    margin-bottom: 1.2rem;
}

.body-text:last-child {
    margin-bottom: 0;
}

/* --- Illustration Floats --- */
.illustration-float {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 600ms var(--ease-organic) 200ms, transform 600ms var(--ease-organic) 200ms;
}

.illustration-float.visible {
    opacity: 1;
    transform: translateY(0);
}

.illustration-right {
    margin-inline: auto 10vw;
}

.illustration-left {
    margin-inline: 8vw auto;
}

.illustration-center {
    margin-inline: auto;
}

.botanical-svg {
    width: clamp(180px, 25vw, 300px);
    height: auto;
}

/* Breathing hover animation -- photosynthesis metaphor */
.breathe-on-hover:hover .botanical-svg {
    animation: breathe 3s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { transform: scale(1.0); }
    50% { transform: scale(1.02); }
}

/* Illustration Captions - Cormorant Italic */
.illustration-caption {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 300;
    font-size: 0.8rem;
    color: var(--lichen-grey);
    opacity: 0.65;
    letter-spacing: 0.01em;
}

/* --- SVG Line Animations for Botanical Illustrations --- */
.root-line,
.leaf-vein,
.leaf-outline,
.leaf-fenestration,
.seed-layer,
.seed-cotyledon,
.seed-embryo,
.seed-radicle,
.flower-stem,
.flower-leaf,
.flower-petal,
.flower-leaf-vein,
.ginkgo-stem,
.ginkgo-fan,
.ginkgo-cleft,
.ginkgo-vein {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
}

.illustration-float.animate .root-line,
.illustration-float.animate .leaf-vein,
.illustration-float.animate .leaf-outline,
.illustration-float.animate .leaf-fenestration,
.illustration-float.animate .seed-layer,
.illustration-float.animate .seed-cotyledon,
.illustration-float.animate .seed-embryo,
.illustration-float.animate .seed-radicle,
.illustration-float.animate .flower-stem,
.illustration-float.animate .flower-leaf,
.illustration-float.animate .flower-petal,
.illustration-float.animate .flower-leaf-vein {
    animation: drawPath 1.8s var(--ease-organic) forwards;
}

/* Root network animation delays */
.illustration-float.animate .root-main { animation-delay: 0s; }
.illustration-float.animate .root-branch { animation-delay: 0.4s; }
.illustration-float.animate .root-hair { animation-delay: 0.8s; }

/* Leaf venation animation delays */
.illustration-float.animate .leaf-outline { animation-delay: 0s; }
.illustration-float.animate .vein-main { animation-delay: 0.3s; }
.illustration-float.animate .vein-secondary { animation-delay: 0.6s; }
.illustration-float.animate .vein-tertiary { animation-delay: 1.0s; }
.illustration-float.animate .leaf-fenestration { animation-delay: 0.8s; }

/* Seed cross-section animation delays */
.illustration-float.animate .seed-layer { animation-delay: 0.2s; }
.illustration-float.animate .seed-cotyledon { animation-delay: 0.5s; }
.illustration-float.animate .seed-embryo { animation-delay: 0.8s; }
.illustration-float.animate .seed-radicle { animation-delay: 1.0s; }

/* Pressed flower animation delays */
.illustration-float.animate .flower-stem { animation-delay: 0s; }
.illustration-float.animate .flower-leaf { animation-delay: 0.4s; }
.illustration-float.animate .flower-petal { animation-delay: 0.8s; }
.illustration-float.animate .flower-leaf-vein { animation-delay: 1.0s; }

/* Myco nodes fade in with delay */
.myco-node {
    opacity: 0;
    transition: opacity 1.2s var(--ease-organic) 1.5s;
}

.illustration-float.animate .myco-node {
    opacity: 0.6;
}

/* --- FOREST FLOOR SECTION (dense clustering) --- */
.section-floor {
    padding: 8vh 5vw 12vh;
    position: relative;
}

.floor-heading {
    text-align: center;
    margin-bottom: 6vh;
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(2.2rem, 5vw + 0.8rem, 4.8rem);
    letter-spacing: 0.02em;
    line-height: 1.15;
    color: var(--bark-charcoal);
}

.floor-cluster {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: clamp(1rem, 3vw, 2.5rem);
    max-width: 1100px;
    margin: 0 auto;
}

.floor-pod {
    background-color: var(--pressed-linen);
    border: 1px solid var(--sage-whisper);
    border-radius: 40px 12px 36px 8px;
    padding: clamp(1.5rem, 3vw, 2.5rem);
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 600ms var(--ease-organic), transform 600ms var(--ease-organic);
}

.floor-pod.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered reveal for floor pods */
.floor-pod:nth-child(1) { transition-delay: 0ms; }
.floor-pod:nth-child(2) { transition-delay: 100ms; }
.floor-pod:nth-child(3) { transition-delay: 200ms; }
.floor-pod:nth-child(4) { transition-delay: 300ms; }
.floor-pod:nth-child(5) { transition-delay: 400ms; }
.floor-pod:nth-child(6) { transition-delay: 500ms; }

.pod-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 1rem;
    display: block;
}

.pod-title {
    font-family: var(--font-secondary);
    font-weight: 500;
    font-size: clamp(1rem, 1.5vw + 0.3rem, 1.25rem);
    letter-spacing: 0.01em;
    line-height: 1.35;
    color: var(--bark-charcoal);
    margin-bottom: 0.75rem;
}

.pod-text {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 0.95rem;
    line-height: 1.75;
    color: var(--lichen-grey);
    max-width: 42ch;
}

/* --- CLOSING SECTION --- */
.section-closing {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12vh 5vw;
    text-align: center;
    position: relative;
}

.closing-pod {
    margin-bottom: 4rem;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 600ms var(--ease-organic), transform 600ms var(--ease-organic);
}

.closing-pod.visible {
    opacity: 1;
    transform: translateY(0);
}

.closing-text {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(1.8rem, 4vw + 0.5rem, 3.2rem);
    letter-spacing: 0.02em;
    line-height: 1.3;
    color: var(--bark-charcoal);
    margin-bottom: 0.5rem;
}

.closing-text-secondary {
    font-size: clamp(1.2rem, 2.5vw + 0.3rem, 2rem);
    color: var(--lichen-grey);
    font-style: italic;
}

/* Closing illustration */
.closing-illustration {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s var(--ease-organic) 0.4s, transform 1s var(--ease-organic) 0.4s;
}

.closing-illustration.visible {
    opacity: 1;
    transform: translateY(0);
}

.ginkgo-leaf {
    width: clamp(120px, 15vw, 180px);
    height: auto;
}

/* Ginkgo closing animation delays */
.closing-illustration.animate .ginkgo-stem,
.closing-illustration.animate .ginkgo-fan,
.closing-illustration.animate .ginkgo-cleft,
.closing-illustration.animate .ginkgo-vein {
    animation: drawPath 2s var(--ease-organic) forwards;
}

.closing-illustration.animate .ginkgo-stem { animation-delay: 0s; }
.closing-illustration.animate .ginkgo-fan { animation-delay: 0.5s; }
.closing-illustration.animate .ginkgo-cleft { animation-delay: 1.0s; }
.closing-illustration.animate .ginkgo-vein { animation-delay: 1.2s; }

/* Breathing hover for closing illustration */
.closing-illustration:hover .ginkgo-leaf {
    animation: breathe 3s ease-in-out infinite;
}

/* --- Footer --- */
#site-footer {
    margin-top: 6rem;
    padding: 2rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.footer-text {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    color: var(--lichen-grey);
    opacity: 0.5;
}

.footer-separator {
    font-family: var(--font-body);
    font-size: 0.75rem;
    color: var(--sage-whisper);
    opacity: 0.5;
}

.footer-year {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    color: var(--lichen-grey);
    opacity: 0.4;
}

/* --- Leaf Venation Background Watermark --- */
#leaf-watermark {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80vw;
    height: 80vh;
    pointer-events: none;
    z-index: -1;
    opacity: 0.5;
}

#leaf-watermark svg {
    width: 100%;
    height: 100%;
}

/* --- Ambient Idle Animations (reward stillness) --- */
@keyframes idlePetalDrift {
    0% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(2px, -3px) rotate(2deg); }
    50% { transform: translate(-1px, -5px) rotate(-1deg); }
    75% { transform: translate(3px, -2px) rotate(3deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

.idle-animate .flower-petal:first-of-type {
    animation: idlePetalDrift 4s ease-in-out;
    transform-origin: center bottom;
}

@keyframes idleTendrilCurl {
    0% { stroke-dashoffset: 0; }
    50% { stroke-dashoffset: 8; }
    100% { stroke-dashoffset: 0; }
}

.idle-animate .root-hair:first-of-type {
    animation: idleTendrilCurl 3s ease-in-out;
}

@keyframes idleLeafSway {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(1.5deg); }
    50% { transform: rotate(-1deg); }
    75% { transform: rotate(0.5deg); }
    100% { transform: rotate(0deg); }
}

.idle-animate .leaf-outline:first-of-type {
    animation: idleLeafSway 5s ease-in-out;
    transform-origin: center bottom;
}

@keyframes idleNodePulse {
    0%, 100% { opacity: 0.6; r: 3; }
    50% { opacity: 0.9; r: 4.5; }
}

.idle-animate .myco-node:first-of-type {
    animation: idleNodePulse 3s ease-in-out;
}

@keyframes idleSeedGlow {
    0%, 100% { stroke-opacity: 1; }
    50% { stroke-opacity: 0.4; }
}

.idle-animate .seed-embryo {
    animation: idleSeedGlow 4s ease-in-out;
}

@keyframes idleGinkgoSway {
    0% { transform: rotate(0deg); }
    33% { transform: rotate(1deg); }
    66% { transform: rotate(-0.5deg); }
    100% { transform: rotate(0deg); }
}

.idle-animate .ginkgo-fan:first-of-type {
    animation: idleGinkgoSway 5s ease-in-out;
    transform-origin: 100px 150px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .section-understory {
        flex-direction: column;
        padding: 6vh 4vw 8vh;
    }

    .pod-drift-left,
    .pod-drift-right,
    .pod-drift-center {
        margin-inline: auto;
    }

    .illustration-right,
    .illustration-left,
    .illustration-center {
        margin-inline: auto;
    }

    .canopy-inner {
        margin-left: 0;
    }

    #vine-progress {
        display: none;
    }

    .floor-cluster {
        grid-template-columns: 1fr;
    }

    #site-header {
        padding: 16px 20px;
    }

    .section-canopy {
        min-height: 150vh;
        padding-top: 20vh;
    }
}

@media (max-width: 480px) {
    .content-pod {
        border-radius: 24px 8px 20px 6px;
        padding: 1.5rem;
    }

    .floor-pod {
        border-radius: 24px 8px 20px 6px;
        padding: 1.25rem;
    }

    .botanical-divider {
        padding: 4vh 0;
    }

    .section-understory {
        gap: clamp(1.5rem, 4vw, 3rem);
    }
}

/* --- Selection Color --- */
::selection {
    background-color: var(--sage-whisper);
    color: var(--woodland-shadow);
}
