/* sustaining.quest — Parallax Storytelling
   Typography: Cormorant | Lora** italic 400 | Work Sans** at 400/500 weight
   Font stack: Cormorant 600, Lora** 400i, Work Sans** 400-500
   Pull-quote blocks styled as handwritten field notes on torn paper edges.
   Interactive data callouts that animate counters on scroll-into-view.
   Interactive quest paths branching into water themes.
   IntersectionObserver` with threshold arrays for progressive content reveal animations.
*/

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

/* Palette from DESIGN.md:
   #1B3A2D — Deep Canopy (primary text, dark sections)
   #4A7C59 — Living Green (headings, active elements)
   #8FBC8F — Meadow Sage (secondary accents, muted details)
   #C17F3E — Amber Earth (interactive highlights, pledge accents)
   #FDF8F0 — Warm Parchment (background)
   #F5F0E8 — Soft Linen (card surfaces)
   #5B8BA0 — Still Water (links, subtle cool accents)
   #2D2D2D — Charcoal (pledge section background)
*/

body {
    background: #FDF8F0;
    color: #1B3A2D;
    font-family: 'Work Sans', sans-serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.75;
    overflow-x: hidden;
}

/* ============================================================
   VINE PROGRESS INDICATOR
   SVG vine with stroke-dasharray animation tied to scroll %
   ============================================================ */
.vine-progress {
    position: fixed;
    top: 0;
    left: 16px;
    width: 12px;
    height: 100vh;
    z-index: 100;
    pointer-events: none;
}
.vine-progress svg {
    width: 100%;
    height: 100%;
}
.vine-path {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 0.1s linear;
}
.vine-path-bg {
    stroke-dasharray: none;
}
.vine-leaf {
    transition: opacity 0.4s ease;
}

/* ============================================================
   PARALLAX HERO
   Layered landscape with perspective-based depth
   ============================================================ */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    background: linear-gradient(180deg, #4A7C59 0%, #8FBC8F 40%, #FDF8F0 100%);
}
.parallax-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
    perspective: 1px;
    transform-style: preserve-3d;
}
.parallax-layer {
    position: absolute;
    inset: 0;
    will-change: transform;
}
.parallax-sky {
    background: linear-gradient(180deg, #1B3A2D 0%, #4A7C59 50%, #8FBC8F 100%);
    opacity: 0.3;
}
.parallax-mountains {
    bottom: 0;
    top: auto;
    height: 50%;
    display: flex;
    align-items: flex-end;
}
.mountain-svg {
    width: 100%;
    height: 100%;
}
.parallax-foreground {
    bottom: 0;
    top: auto;
    height: 35%;
    display: flex;
    align-items: flex-end;
}
.foliage-svg {
    width: 100%;
    height: 100%;
}
.hero-content {
    position: relative;
    z-index: 10;
    padding: 2rem;
}
.hero-question {
    font-family: 'Cormorant', serif;
    font-weight: 600;
    font-size: clamp(2.4rem, 5vw, 3.6rem);
    letter-spacing: 0.01em;
    color: #FDF8F0;
    text-shadow: 0 2px 20px rgba(27, 58, 45, 0.3);
    margin-bottom: 1rem;
}
.scroll-indicator {
    margin-top: 2rem;
    animation: bob 2.5s ease-in-out infinite;
    opacity: 0.8;
}
.scroll-indicator svg {
    display: inline-block;
}
@keyframes bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(10px); }
}

/* ============================================================
   TOPOGRAPHIC CONTOUR DIVIDERS
   Repeating SVG paths with #8FBC8F at 15% opacity
   ============================================================ */
.topo-divider {
    width: 100%;
    height: 60px;
    overflow: hidden;
    pointer-events: none;
}
.topo-divider svg {
    width: 100%;
    height: 100%;
}

/* ============================================================
   CHAPTERS — Narrative sections
   ============================================================ */
.chapter {
    max-width: 860px;
    margin: 0 auto;
    padding: 5rem 2rem;
}
.chapter-inner {
    position: relative;
}
.chapter-label {
    font-family: 'Work Sans', sans-serif;
    font-weight: 500;
    font-size: 0.8rem;
    color: #8FBC8F;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: block;
    margin-bottom: 0.5rem;
}
.chapter-title {
    font-family: 'Cormorant', serif;
    font-weight: 600;
    font-size: clamp(1.6rem, 3vw, 2.5rem);
    letter-spacing: 0.01em;
    color: #1B3A2D;
    margin-bottom: 1.5rem;
}

/* Content Card */
.content-card {
    background: #F5F0E8;
    border-radius: 8px;
    padding: 2.5rem;
    box-shadow: 0 2px 12px rgba(27, 58, 45, 0.06);
}
.chapter-text {
    font-size: 1rem;
    color: #1B3A2D;
    margin-bottom: 2rem;
    line-height: 1.8;
}

/* Animated Data Counters */
.data-callouts {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}
.data-item {
    text-align: center;
    flex: 1;
    min-width: 120px;
}
.data-number {
    font-family: 'Cormorant', serif;
    font-weight: 600;
    font-size: clamp(2rem, 4vw, 2.8rem);
    color: #4A7C59;
    display: block;
    line-height: 1.2;
}
.data-number.animated {
    transition: color 0.3s ease;
}
.data-label {
    font-size: 0.8rem;
    color: #1B3A2D;
    opacity: 0.8;
    margin-top: 0.25rem;
    display: block;
}

/* ============================================================
   QUEST PATHS — Interactive branching cards
   ============================================================ */
.quest-paths {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.quest-path {
    background: #F5F0E8;
    border-radius: 10px;
    padding: 2rem;
    cursor: pointer;
    transition: transform 0.35s ease, box-shadow 0.35s ease, background-color 0.35s ease;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}
.quest-path:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(27, 58, 45, 0.1);
    border-color: #4A7C59;
}
.quest-path.active {
    background: #1B3A2D;
    border-color: #4A7C59;
}
.quest-path.active .path-name {
    color: #8FBC8F;
}
.quest-path.active .path-desc {
    color: #F5F0E8;
}
.quest-path.active .path-expanded {
    color: #8FBC8F;
}
.path-icon {
    margin-bottom: 0.75rem;
}
.path-name {
    font-family: 'Cormorant', serif;
    font-weight: 600;
    font-size: 1.4rem;
    color: #4A7C59;
    margin-bottom: 0.5rem;
    transition: color 0.35s ease;
}
.path-desc {
    font-size: 0.9rem;
    color: #1B3A2D;
    transition: color 0.35s ease;
}
.path-expanded {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease, opacity 0.4s ease, margin-top 0.4s ease;
    opacity: 0;
    margin-top: 0;
}
.quest-path.active .path-expanded {
    max-height: 200px;
    opacity: 1;
    margin-top: 1rem;
}
.path-detail {
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ============================================================
   FIELD NOTES — Torn paper handwritten journal style
   ============================================================ */
.field-note {
    position: relative;
    margin-bottom: 2rem;
}
.torn-edge-top {
    height: 12px;
    background: #F5F0E8;
    clip-path: polygon(
        0% 40%, 3% 70%, 6% 30%, 9% 60%, 12% 20%, 15% 50%, 18% 35%, 21% 65%, 24% 25%,
        27% 55%, 30% 40%, 33% 70%, 36% 30%, 39% 55%, 42% 20%, 45% 60%, 48% 35%,
        51% 65%, 54% 25%, 57% 55%, 60% 40%, 63% 70%, 66% 30%, 69% 55%, 72% 20%,
        75% 50%, 78% 35%, 81% 65%, 84% 25%, 87% 55%, 90% 40%, 93% 60%, 96% 30%,
        100% 50%, 100% 100%, 0% 100%
    );
}
.note-content {
    background: #F5F0E8;
    padding: 2rem 2rem 1.5rem;
    position: relative;
}
.note-content::before {
    content: '';
    position: absolute;
    left: 2rem;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #C17F3E;
    opacity: 0.2;
}
.torn-edge-bottom {
    height: 12px;
    background: #F5F0E8;
    clip-path: polygon(
        0% 0%, 100% 0%, 100% 50%,
        97% 30%, 94% 60%, 91% 25%, 88% 55%, 85% 35%, 82% 65%, 79% 25%,
        76% 50%, 73% 30%, 70% 60%, 67% 35%, 64% 55%, 61% 25%, 58% 50%,
        55% 35%, 52% 60%, 49% 30%, 46% 55%, 43% 25%, 40% 60%, 37% 35%,
        34% 55%, 31% 30%, 28% 60%, 25% 35%, 22% 55%, 19% 30%, 16% 60%,
        13% 35%, 10% 55%, 7% 30%, 4% 60%, 0% 40%
    );
}
.note-quote {
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: 1.15rem;
    color: #1B3A2D;
    line-height: 1.7;
    margin-bottom: 0.75rem;
    padding-left: 1rem;
}
.note-attribution {
    font-family: 'Work Sans', sans-serif;
    font-size: 0.85rem;
    color: #4A7C59;
    display: block;
    padding-left: 1rem;
}

/* ============================================================
   PARALLAX TRANSITION ZONE
   ============================================================ */
.parallax-transition {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: linear-gradient(180deg, #FDF8F0 0%, #1B3A2D 100%);
}
.parallax-transition-layer {
    position: absolute;
    inset: 0;
    will-change: transform;
}
.transition-bg {
    background: linear-gradient(180deg, transparent 0%, rgba(27, 58, 45, 0.4) 100%);
}
.transition-fg {
    display: flex;
    align-items: center;
}
.transition-leaves {
    width: 100%;
    height: 80px;
}

/* Root decoration */
.root-decoration {
    width: 100%;
    height: 80px;
    overflow: hidden;
    pointer-events: none;
    background: #FDF8F0;
}
.root-decoration svg {
    width: 100%;
    height: 100%;
}

/* ============================================================
   PLEDGE SECTION — Dark mode commitment area
   ============================================================ */
.pledge {
    background: #2D2D2D;
    padding: 5rem 2rem;
    position: relative;
}
.pledge-inner {
    max-width: 860px;
    margin: 0 auto;
    text-align: center;
}
.pledge-title {
    font-family: 'Cormorant', serif;
    font-weight: 600;
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    letter-spacing: 0.01em;
    color: #F5F0E8;
    margin-bottom: 1rem;
}
.pledge-text {
    font-size: 1rem;
    color: #8FBC8F;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}
.pledge-options {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}
.pledge-option {
    background: rgba(79, 124, 89, 0.15);
    color: #C17F3E;
    border: 1px solid rgba(74, 124, 89, 0.4);
    border-radius: 8px;
    padding: 0.65rem 1.25rem;
    font-family: 'Work Sans', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.35s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.pledge-option:hover {
    background: rgba(79, 124, 89, 0.3);
    border-color: #4A7C59;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(74, 124, 89, 0.2);
}
.pledge-option.selected {
    background: #4A7C59;
    color: #FDF8F0;
    border-color: #8FBC8F;
    transform: scale(1.05);
}
.pledge-option.selected .pledge-icon path,
.pledge-option.selected .pledge-icon circle,
.pledge-option.selected .pledge-icon line {
    stroke: #FDF8F0;
}
.pledge-icon {
    flex-shrink: 0;
}
.pledge-confirmation {
    margin-top: 2rem;
    transition: opacity 0.5s ease;
}
.pledge-confirmation[hidden] {
    display: none;
}
.pledge-confirmation .pledge-message {
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: 1.1rem;
    color: #8FBC8F;
    line-height: 1.6;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
    max-width: 860px;
    margin: 0 auto;
    padding: 3rem 2rem;
    text-align: center;
    border-top: 1px solid rgba(143, 188, 143, 0.3);
}
.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
}
.flink {
    font-size: 0.85rem;
    color: #5B8BA0;
    text-decoration: none;
    transition: color 0.3s ease;
}
.flink:hover {
    color: #4A7C59;
}
.footer-copy {
    font-size: 0.75rem;
    color: #1B3A2D;
    opacity: 0.6;
}

/* ============================================================
   FADE-IN ANIMATIONS (scroll-triggered via IntersectionObserver)
   ============================================================ */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}
.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Progressive reveal with stagger */
.fade-in-stagger > * {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.fade-in-stagger.visible > *:nth-child(1) { transition-delay: 0s; opacity: 1; transform: translateY(0); }
.fade-in-stagger.visible > *:nth-child(2) { transition-delay: 0.1s; opacity: 1; transform: translateY(0); }
.fade-in-stagger.visible > *:nth-child(3) { transition-delay: 0.2s; opacity: 1; transform: translateY(0); }
.fade-in-stagger.visible > *:nth-child(4) { transition-delay: 0.3s; opacity: 1; transform: translateY(0); }

/* Counter animation flash */
@keyframes counterPulse {
    0% { color: #4A7C59; }
    50% { color: #C17F3E; }
    100% { color: #4A7C59; }
}

/* Vine leaf bloom */
@keyframes leafBloom {
    0% { r: 0; opacity: 0; }
    100% { r: 3; opacity: 0.8; }
}

/* Parallax float for hero layers */
@keyframes heroFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.parallax-foreground {
    animation: heroFloat 6s ease-in-out infinite;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .quest-paths {
        grid-template-columns: 1fr;
    }
    .vine-progress {
        display: none;
    }
    .chapter {
        padding: 3rem 1.5rem;
    }
    .content-card {
        padding: 1.5rem;
    }
    .pledge {
        padding: 3rem 1.5rem;
    }
    .data-callouts {
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .data-callouts {
        flex-direction: column;
        gap: 1.5rem;
    }
    .pledge-options {
        flex-direction: column;
        align-items: center;
    }
    .pledge-option {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }
}
