/* layer-2.wiki — Cinematic Botanical Horizontal Scroll */

:root {
    --pressed-linen: #F2EDE4;
    --herbarium-green: #6B7F5E;
    --dried-sage: #8B7355;
    --foxed-ivory: #D4C9B5;
    --specimen-ink: #2C2C28;
    --faded-sepia: #A69279;
    --lichen-teal: #5E7E7A;
    --petal-blush: #C4A88C;
    --darkroom-amber: #3D3426;
}

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

html, body {
    overflow-x: auto;
    overflow-y: hidden;
    height: 100vh;
}

body {
    font-family: 'Lora', serif;
    font-weight: 400;
    color: var(--specimen-ink);
    background: var(--pressed-linen);
    line-height: 1.75;
    letter-spacing: 0.005em;
}

/* ---- Paper grain texture ---- */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9000;
    pointer-events: none;
    mix-blend-mode: multiply;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
    background-size: 200px 200px;
}

/* ---- Film strip borders ---- */
.film-border {
    position: fixed;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--faded-sepia);
    opacity: 0.3;
    z-index: 8000;
    display: flex;
    align-items: center;
    justify-content: space-around;
}

.film-border-top { top: 0; }
.film-border-bottom { bottom: 0; }

.sprocket {
    display: block;
    width: 6px;
    height: 4px;
    border-radius: 1px;
    background: var(--pressed-linen);
}

/* ---- Leaf navigation ---- */
.leaf-nav {
    position: fixed;
    top: 1.5rem;
    right: 2rem;
    z-index: 100;
    display: flex;
    gap: 0.5rem;
}

.leaf-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--faded-sepia);
    opacity: 0.5;
    transition: opacity 0.3s ease, color 0.3s ease;
    padding: 2px;
}

.leaf-btn.active {
    color: var(--dried-sage);
    opacity: 1;
}

.leaf-btn:hover {
    opacity: 0.8;
}

/* ---- Progress vine ---- */
.progress-vine {
    position: fixed;
    bottom: 3px;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--herbarium-green), var(--lichen-teal));
    width: 0;
    z-index: 9999;
    transition: width 0.15s linear;
    border-radius: 0 2px 2px 0;
}

/* ---- Scroll track ---- */
.scroll-track {
    display: flex;
    width: 700vw;
    height: 100vh;
}

/* ---- Frames ---- */
.frame {
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    padding: 8vh 6vw;
    position: relative;
    overflow: hidden;
}

/* ---- Reveal animation ---- */
[data-reveal] {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.7s cubic-bezier(0.25, 0.1, 0.25, 1), transform 0.7s cubic-bezier(0.25, 0.1, 0.25, 1);
}

[data-reveal].revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Kinetic typography ---- */
.kinetic-char {
    display: inline-block;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.kinetic-char.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Leaf venation ---- */
.leaf-venation {
    width: 100%;
    height: 100%;
}

.vein {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 3s ease;
}

.vein-secondary {
    stroke-dasharray: 250;
    stroke-dashoffset: 250;
    transition: stroke-dashoffset 2.5s ease 0.5s;
}

.vein-tertiary {
    stroke-dasharray: 150;
    stroke-dashoffset: 150;
    transition: stroke-dashoffset 2s ease 1s;
}

.vein-parallel {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 2s ease;
}

[data-reveal].revealed .vein {
    stroke-dashoffset: 0;
}

/* ---- Body text ---- */
.body-text {
    font-size: 1.05rem;
    line-height: 1.75;
    max-width: 38em;
    margin-bottom: 1.5rem;
    color: var(--specimen-ink);
}

/* ---- Annotation (handwritten) ---- */
.annotation {
    font-family: 'Caveat', cursive;
    font-size: 1.1rem;
    color: var(--dried-sage);
    position: absolute;
}

.margin-annotation {
    font-family: 'Caveat', cursive;
    font-size: 1rem;
    color: var(--dried-sage);
    position: absolute;
    bottom: 12%;
    right: 8%;
}

/* ---- Leaf bullet ---- */
.leaf-bullet {
    display: inline-block;
    width: 12px;
    height: 15px;
    flex-shrink: 0;
    margin-right: 0.6rem;
    margin-top: 4px;
    background: var(--herbarium-green);
    clip-path: polygon(50% 0%, 100% 35%, 85% 100%, 50% 85%, 15% 100%, 0% 35%);
    opacity: 0.6;
}

/* ---- Leaf divider ---- */
.leaf-divider {
    display: flex;
    gap: 0.5rem;
    margin: 2rem 0;
    justify-content: center;
}

.leaf-divider span {
    width: 14px;
    height: 18px;
    background: var(--herbarium-green);
    clip-path: polygon(50% 0%, 100% 35%, 85% 100%, 50% 85%, 15% 100%, 0% 35%);
}

.leaf-divider span:nth-child(1) { opacity: 1; }
.leaf-divider span:nth-child(2) { opacity: 0.75; }
.leaf-divider span:nth-child(3) { opacity: 0.5; }
.leaf-divider span:nth-child(4) { opacity: 0.25; }
.leaf-divider span:nth-child(5) { opacity: 0.1; }

/* ---- Frame headings ---- */
.frame-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    color: var(--specimen-ink);
    letter-spacing: 0.01em;
    line-height: 1.1;
    margin-bottom: 2rem;
}

.frame-heading-light {
    color: var(--pressed-linen);
}

/* ============ FRAME 1: THE SPECIMEN ============ */
.frame-specimen {
    background: var(--pressed-linen);
    display: flex;
    align-items: center;
}

.frame-specimen .frame-content {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 4rem;
}

.specimen-text {
    flex: 1;
}

.hero-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 7rem);
    color: var(--specimen-ink);
    letter-spacing: -0.02em;
    line-height: 0.95;
    margin-bottom: 1rem;
}

.hero-sub {
    font-family: 'Lora', serif;
    font-size: clamp(1rem, 1.2vw + 0.4rem, 1.25rem);
    color: var(--faded-sepia);
}

.specimen-leaf {
    flex: 0 0 35%;
    max-width: 300px;
    position: relative;
}

/* ============ FRAME 2: THE TAXONOMY ============ */
.frame-taxonomy {
    background: var(--foxed-ivory);
    display: flex;
    align-items: center;
    justify-content: center;
}

.taxonomy-card {
    width: 60vw;
    max-width: 700px;
    padding: 3rem;
    border: 1px solid var(--faded-sepia);
    background: var(--pressed-linen);
    box-shadow: 0 4px 30px rgba(44, 44, 40, 0.08);
    transform: rotate(1.5deg);
}

.taxonomy-entry {
    display: flex;
    align-items: flex-start;
    font-size: 1.05rem;
    line-height: 1.75;
    margin-bottom: 0.5rem;
    padding-left: 0;
}

.indent-1 { padding-left: 2rem; }
.indent-2 { padding-left: 4rem; }
.indent-3 { padding-left: 6rem; }

.taxonomy-note {
    font-style: italic;
    font-size: 0.85rem;
    color: var(--faded-sepia);
    text-align: center;
    letter-spacing: 0.03em;
}

/* ============ FRAME 3: THE CROSS-SECTION ============ */
.frame-cross-section {
    background: var(--pressed-linen);
    display: flex;
    align-items: center;
    gap: 4rem;
}

.cross-leaf {
    flex: 0 0 40%;
    max-width: 350px;
}

.cross-text {
    flex: 1;
    max-width: 32ch;
}

.cross-text .body-text {
    line-height: 1.8;
}

/* ============ FRAME 4: THE COLLECTION ============ */
.frame-collection {
    background: var(--darkroom-amber);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 6vh;
}

.specimen-cards {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.specimen-card {
    width: 200px;
    min-height: 260px;
    padding: 1.5rem;
    background: var(--pressed-linen);
    border: 1px solid var(--faded-sepia);
    position: relative;
}

.specimen-card .annotation {
    position: relative;
    display: block;
    margin-bottom: 0.8rem;
    font-size: 0.95rem;
}

.sc-1 { transform: rotate(-2deg); }
.sc-2 { transform: rotate(1.5deg); margin-top: 3rem; }
.sc-3 { transform: rotate(-1deg); margin-top: -1rem; }
.sc-4 { transform: rotate(2.5deg); margin-top: 2rem; }
.sc-5 { transform: rotate(-1.5deg); margin-top: 1rem; }

.card-title {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    font-size: 1.15rem;
    color: var(--specimen-ink);
    margin-bottom: 0.5rem;
}

.card-desc {
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--darkroom-amber);
}

/* ============ FRAME 5: THE FIELD NOTES ============ */
.frame-field-notes {
    background: var(--pressed-linen);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.field-notes-bg {
    position: absolute;
    inset: 0;
    opacity: 0.08;
    padding: 2rem;
}

.field-notes-content {
    position: relative;
    z-index: 2;
    max-width: 40em;
}

.note-entry {
    margin-bottom: 2rem;
    padding-left: 1rem;
    border-left: 2px solid var(--faded-sepia);
}

.note-date {
    font-family: 'Caveat', cursive;
    font-size: 1rem;
    color: var(--dried-sage);
    display: block;
    margin-bottom: 0.3rem;
}

.note-text {
    font-family: 'Caveat', cursive;
    font-size: 1.2rem;
    color: var(--specimen-ink);
    line-height: 1.4;
}

/* Stronger grain for field notes frame */
.frame-field-notes::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    mix-blend-mode: multiply;
    opacity: 0.08;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
    background-size: 200px 200px;
}

/* ============ FRAME 6: THE ARCHIVE ============ */
.frame-archive {
    display: flex;
    align-items: center;
    justify-content: center;
}

.archive-split {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
    width: 80%;
    max-width: 900px;
}

.archive-left {
    flex: 1;
    background: var(--foxed-ivory);
    padding: 2rem;
}

.archive-right {
    flex: 1;
    background: linear-gradient(135deg, rgba(107, 127, 94, 0.08), var(--pressed-linen));
    padding: 2rem;
    padding-top: 4rem;
}

.archive-divider {
    flex: 0 0 4px;
    align-self: stretch;
}

.vine-divider {
    width: 4px;
    height: 100%;
}

.vine-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 3s ease;
}

.archive-split.revealed .vine-path,
.archive-left.revealed ~ .archive-divider .vine-path {
    stroke-dashoffset: 0;
}

.archive-entry {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.entry-title {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--specimen-ink);
}

.entry-desc {
    font-size: 0.9rem;
    color: var(--faded-sepia);
    font-style: italic;
}

/* ============ FRAME 7: THE OVERGROWTH ============ */
.frame-overgrowth {
    background: var(--pressed-linen);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.overgrowth-veins {
    position: absolute;
    inset: 0;
    padding: 5%;
}

.overgrowth-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.overgrowth-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(5rem, 15vw, 12rem);
    color: var(--specimen-ink);
    letter-spacing: -0.02em;
    line-height: 0.95;
    opacity: 0.85;
}

.overgrowth-sub {
    font-family: 'Lora', serif;
    font-size: 1rem;
    color: var(--faded-sepia);
    margin-top: 1rem;
}

/* ---- Underline-draw for links ---- */
a {
    color: var(--lichen-teal);
    text-decoration: none;
    position: relative;
}

a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--lichen-teal);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

a:hover::after {
    transform: scaleX(1);
}

/* ---- Mobile: vertical fallback ---- */
@media (max-width: 767px) {
    html, body {
        overflow-x: auto;
        overflow-y: auto;
        height: auto;
    }

    .scroll-track {
        flex-direction: column;
        width: 100%;
        height: auto;
    }

    .frame {
        width: 100%;
        height: auto;
        min-height: 100vh;
        padding: 6vh 5%;
    }

    .frame-specimen .frame-content {
        flex-direction: column;
        text-align: center;
    }

    .specimen-leaf {
        max-width: 200px;
    }

    .taxonomy-card {
        width: 90vw;
        transform: none;
    }

    .frame-cross-section {
        flex-direction: column;
    }

    .cross-leaf {
        max-width: 200px;
    }

    .cross-text {
        max-width: 100%;
    }

    .specimen-cards {
        flex-direction: column;
        align-items: center;
    }

    .specimen-card {
        width: 100%;
        max-width: 280px;
    }

    .sc-1, .sc-2, .sc-3, .sc-4, .sc-5 {
        margin-top: 0;
    }

    .archive-split {
        flex-direction: column;
        width: 100%;
    }

    .archive-divider {
        display: none;
    }

    .leaf-nav {
        display: none;
    }

    .film-border {
        display: none;
    }

    .hero-title {
        font-size: clamp(2.5rem, 10vw, 4rem);
    }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    [data-reveal] {
        opacity: 1;
        transform: none;
    }

    .kinetic-char {
        opacity: 1;
        transform: none;
    }

    .vein,
    .vein-secondary,
    .vein-tertiary,
    .vein-parallel {
        stroke-dashoffset: 0;
    }

    .vine-path {
        stroke-dashoffset: 0;
    }
}
