/* ============================================
   monopole.one - Speculative Botanical Archive
   Deep Burgundy Palette | Layered Depth | Elastic Motion
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    /* Palette - Deep Burgundy Spectrum */
    --midnight-vine: #1A0A10;
    --deep-wine: #4A0E1B;
    --burgundy-heart: #7A1B3A;
    --pressed-petal: #C4667A;
    --parchment-rose: #F2D4C2;
    --faded-rose: #E8C4B8;
    --dried-bloom: #8B4A5E;
    --stem-green: #3A6B4A;
    --warm-ground: #1F0E12;
    --amber-ground: #1A1008;

    /* Typography */
    --font-heading: 'Nunito', sans-serif;
    --font-body: 'Varela Round', sans-serif;
    --font-accent: 'Comfortaa', cursive;

    /* Elastic Easing */
    --elastic-quick: cubic-bezier(0.68, -0.55, 0.27, 1.55);
    --elastic-soft: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Layout */
    --max-measure: 580px;

    /* Scroll-linked background shift */
    --bg-color: var(--midnight-vine);
}

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

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

body {
    background-color: var(--midnight-vine);
    color: var(--faded-rose);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 17px;
    line-height: 1.75;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: var(--burgundy-heart);
    color: var(--parchment-rose);
}

/* --- Background Root Network --- */
.bg-root-network {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.root-svg {
    width: 100%;
    height: 100%;
    opacity: 1;
}

/* --- Progress Stem Indicator --- */
.progress-stem {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 400px;
    z-index: 100;
    pointer-events: none;
    opacity: 0.7;
    transition: opacity 0.6s var(--elastic-soft);
}

.progress-stem:hover {
    opacity: 1;
}

.progress-stem svg {
    width: 100%;
    height: 100%;
}

.stem-line {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 0.1s linear;
}

.thorn {
    transition: opacity 0.4s var(--elastic-quick);
}

.leaf {
    transition: opacity 0.6s var(--elastic-soft), transform 0.6s var(--elastic-soft);
}

.bloom {
    transition: opacity 0.8s var(--elastic-soft), transform 0.8s var(--elastic-soft);
}

/* --- Scroll Container --- */
.scroll-container {
    position: relative;
    z-index: 1;
    perspective: 1200px;
    transform-style: preserve-3d;
}

/* --- Specimen Sections --- */
.specimen-section {
    position: relative;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    transform-style: preserve-3d;
}

/* --- Z-Depth Planes --- */
.bg-plane {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    transform: translateZ(-300px) scale(1.25);
}

.bg-plane .botanical-bg {
    width: 100%;
    height: 100%;
}

.content-panel {
    position: relative;
    z-index: 10;
    transform: translateZ(0);
    background: rgba(26, 10, 16, 0.85);
    padding: 48px 42px;
    border: 1px solid rgba(122, 27, 58, 0.25);
    transition: transform 0.5s var(--elastic-quick),
                box-shadow 0.5s var(--elastic-quick),
                background-color 0.5s var(--elastic-quick);
}

.content-panel:hover {
    transform: translateZ(20px);
    box-shadow: 0 20px 60px rgba(26, 10, 16, 0.6),
                0 8px 25px rgba(74, 14, 27, 0.3);
    background: rgba(26, 10, 16, 0.95);
}

.fg-plane {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    transform: translateZ(50px);
}

/* --- Content Panel Positions (Asymmetric Layout) --- */
.panel-left {
    margin-left: 8%;
    margin-right: auto;
    max-width: var(--max-measure);
    margin-top: 10vh;
}

.panel-right {
    margin-left: auto;
    margin-right: 10%;
    max-width: var(--max-measure);
    margin-top: -5vh;
}

.panel-center-left {
    margin-left: 15%;
    margin-right: auto;
    max-width: var(--max-measure);
    margin-top: 8vh;
}

.panel-left-wide {
    margin-left: 6%;
    margin-right: auto;
    max-width: calc(var(--max-measure) + 40px);
    margin-top: 12vh;
}

.panel-right-narrow {
    margin-left: auto;
    margin-right: 8%;
    max-width: calc(var(--max-measure) - 30px);
    margin-top: 6vh;
}

/* --- Typography --- */
.section-heading {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: clamp(42px, 5vw, 72px);
    color: var(--parchment-rose);
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 28px;
}

.secondary-heading {
    font-weight: 400;
    font-size: clamp(22px, 2.5vw, 32px);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--pressed-petal);
    margin-bottom: 24px;
}

.text-block {
    max-width: var(--max-measure);
}

.text-block p {
    margin-bottom: 21px;
    color: var(--faded-rose);
    font-size: 17px;
    line-height: 1.75;
}

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

/* --- Decorative Numerals --- */
.section-numeral {
    position: absolute;
    font-family: var(--font-accent);
    font-weight: 700;
    font-size: clamp(100px, 15vw, 200px);
    color: var(--deep-wine);
    -webkit-text-stroke: 1px var(--pressed-petal);
    opacity: 0.15;
    z-index: 2;
    pointer-events: none;
    user-select: none;
    line-height: 1;
}

.section-1 .section-numeral {
    top: 8%;
    right: 12%;
}

.section-2 .section-numeral {
    top: 5%;
    left: 8%;
}

.section-3 .section-numeral {
    bottom: 10%;
    right: 15%;
}

.section-4 .section-numeral {
    top: 12%;
    right: 8%;
}

.section-5 .section-numeral {
    top: 6%;
    left: 12%;
}

/* --- Specimen Illustrations --- */
.specimen-illustration {
    width: 100%;
    height: 100%;
    max-width: 500px;
    max-height: 600px;
}

/* Foreground plane positions */
.section-1 .fg-plane {
    right: 5%;
    top: 15%;
    width: 40%;
    max-width: 500px;
}

.section-2 .fg-plane-offset {
    left: 3%;
    top: 10%;
    width: 45%;
    max-width: 550px;
}

.section-3 .fg-plane-right {
    right: 8%;
    top: 12%;
    width: 38%;
    max-width: 480px;
}

.section-4 .fg-plane-center {
    left: 50%;
    top: 8%;
    transform: translateX(-50%) translateZ(50px);
    width: 42%;
    max-width: 520px;
}

.section-5 .fg-plane-left {
    left: 5%;
    top: 8%;
    width: 44%;
    max-width: 540px;
}

/* --- SVG Path Drawing Animation --- */
.draw-path {
    stroke-dasharray: var(--path-length, 1000);
    stroke-dashoffset: var(--path-length, 1000);
    transition: stroke-dashoffset 1.5s var(--elastic-soft);
}

.specimen-section.is-visible .draw-path {
    stroke-dashoffset: 0;
}

/* Stagger the path drawing */
.specimen-section.is-visible .draw-path:nth-child(1) { transition-delay: 0s; }
.specimen-section.is-visible .draw-path:nth-child(2) { transition-delay: 0.05s; }
.specimen-section.is-visible .draw-path:nth-child(3) { transition-delay: 0.1s; }
.specimen-section.is-visible .draw-path:nth-child(4) { transition-delay: 0.15s; }
.specimen-section.is-visible .draw-path:nth-child(5) { transition-delay: 0.2s; }
.specimen-section.is-visible .draw-path:nth-child(6) { transition-delay: 0.25s; }
.specimen-section.is-visible .draw-path:nth-child(7) { transition-delay: 0.3s; }
.specimen-section.is-visible .draw-path:nth-child(8) { transition-delay: 0.35s; }
.specimen-section.is-visible .draw-path:nth-child(9) { transition-delay: 0.4s; }
.specimen-section.is-visible .draw-path:nth-child(10) { transition-delay: 0.45s; }
.specimen-section.is-visible .draw-path:nth-child(11) { transition-delay: 0.5s; }
.specimen-section.is-visible .draw-path:nth-child(12) { transition-delay: 0.55s; }
.specimen-section.is-visible .draw-path:nth-child(13) { transition-delay: 0.6s; }
.specimen-section.is-visible .draw-path:nth-child(14) { transition-delay: 0.65s; }
.specimen-section.is-visible .draw-path:nth-child(15) { transition-delay: 0.7s; }
.specimen-section.is-visible .draw-path:nth-child(n+16) { transition-delay: 0.75s; }

/* Color wash fills appear after line drawing */
.wash-fill {
    transition: opacity 0.6s var(--elastic-soft);
}

.specimen-section.is-visible .wash-fill {
    opacity: 0.15;
    transition-delay: 1.2s;
}

/* Annotation labels appear last */
.annotation {
    transition: opacity 0.5s var(--elastic-soft);
}

.specimen-section.is-visible .annotation {
    opacity: 1;
    transition-delay: 1.8s;
}

.annotation-text {
    font-family: var(--font-body);
    font-size: 12px;
    font-style: oblique;
    fill: var(--dried-bloom);
}

.annotation-subtext {
    font-family: var(--font-body);
    font-size: 11px;
    font-style: oblique;
    fill: var(--dried-bloom);
    opacity: 0.7;
}

/* --- Vine Section Dividers --- */
.vine-divider {
    position: relative;
    width: 100%;
    height: 40px;
    z-index: 10;
    overflow: visible;
}

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

.vine-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 1.8s var(--elastic-soft);
}

.vine-divider.is-visible .vine-path {
    stroke-dashoffset: 0;
}

.vine-curl {
    transition: opacity 0.6s var(--elastic-quick);
}

.vine-divider.is-visible .vine-curl {
    opacity: 0.6;
    transition-delay: 1.2s;
}

/* --- Corner Ornaments --- */
.corner-ornament {
    position: absolute;
    width: 80px;
    height: 80px;
    z-index: 8;
    pointer-events: none;
}

.corner-tl {
    top: 0;
    left: 0;
}

.corner-tr {
    top: 0;
    right: 0;
    transform: scaleX(-1);
}

.corner-bl {
    bottom: 0;
    left: 0;
    transform: scaleY(-1);
}

.corner-br {
    bottom: 0;
    right: 0;
    transform: scale(-1);
}

/* --- Section Transition Opacity --- */
.specimen-section {
    opacity: 0;
    transition: opacity 1s var(--elastic-soft);
}

.specimen-section.is-visible {
    opacity: 1;
}

/* --- Content Panel Reveal Animation --- */
.content-panel {
    opacity: 0;
    transform: translateY(30px) translateZ(0);
}

.specimen-section.is-visible .content-panel {
    opacity: 1;
    transform: translateY(0) translateZ(0);
    transition: opacity 0.8s var(--elastic-soft) 0.3s,
                transform 0.8s var(--elastic-soft) 0.3s;
}

.specimen-section.is-visible .content-panel:hover {
    transform: translateY(0) translateZ(20px);
}

/* --- Heading Character Animation --- */
.animate-heading .char {
    display: inline-block;
    opacity: 0;
    transform: translate(
        calc(var(--char-offset-x, 0) * 1px),
        calc(var(--char-offset-y, 0) * 1px)
    );
    transition: opacity 0.4s var(--elastic-quick),
                transform 0.4s var(--elastic-quick);
}

.animate-heading .char.is-space {
    width: 0.3em;
}

.specimen-section.is-visible .animate-heading .char {
    opacity: 1;
    transform: translate(0, 0);
}

/* --- Archive Closing Text --- */
.archive-closing {
    position: absolute;
    bottom: 8vh;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 10;
    opacity: 0;
    transition: opacity 1.2s var(--elastic-soft);
}

.specimen-section.is-visible .archive-closing {
    opacity: 1;
    transition-delay: 2.2s;
}

.closing-text {
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--dried-bloom);
    font-style: oblique;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.closing-attribution {
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: 13px;
    color: var(--burgundy-heart);
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

/* --- Spore Particle Float Animation --- */
@keyframes sporeFloat {
    0%, 100% {
        transform: translate(0, 0);
    }
    25% {
        transform: translate(3px, -5px);
    }
    50% {
        transform: translate(-2px, -8px);
    }
    75% {
        transform: translate(4px, -3px);
    }
}

.specimen-section.is-visible .spore-particle {
    animation: sporeFloat 4s var(--elastic-soft) infinite;
}

.specimen-section.is-visible .spore-particle:nth-child(odd) {
    animation-duration: 5s;
    animation-delay: 0.5s;
}

/* --- Section-specific Background Tints --- */
.section-1 {
    background: linear-gradient(180deg, var(--midnight-vine) 0%, rgba(26, 10, 16, 0.98) 100%);
}

.section-2 {
    background: linear-gradient(180deg, rgba(26, 10, 16, 0.98) 0%, rgba(28, 12, 17, 0.98) 100%);
}

.section-3 {
    background: linear-gradient(180deg, rgba(28, 12, 17, 0.98) 0%, rgba(31, 14, 18, 0.98) 100%);
}

.section-4 {
    background: linear-gradient(180deg, rgba(31, 14, 18, 0.98) 0%, rgba(28, 13, 15, 0.98) 100%);
}

.section-5 {
    background: linear-gradient(180deg, rgba(28, 13, 15, 0.98) 0%, var(--amber-ground) 100%);
}

/* --- Links (Stem Green for interactive) --- */
a {
    color: var(--stem-green);
    text-decoration: none;
    transition: color 0.3s var(--elastic-quick);
}

a:hover {
    color: #4a8a5c;
}

/* --- Scrollbar Styling --- */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: var(--midnight-vine);
}

::-webkit-scrollbar-thumb {
    background: var(--burgundy-heart);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--pressed-petal);
}

/* --- Responsive Adjustments --- */
@media (max-width: 1200px) {
    .section-1 .fg-plane,
    .section-2 .fg-plane-offset,
    .section-3 .fg-plane-right,
    .section-4 .fg-plane-center,
    .section-5 .fg-plane-left {
        width: 35%;
        opacity: 0.6;
    }
}

@media (max-width: 900px) {
    .specimen-section {
        flex-direction: column;
        justify-content: center;
        padding: 60px 20px;
    }

    .content-panel {
        padding: 32px 28px;
    }

    .panel-left,
    .panel-right,
    .panel-center-left,
    .panel-left-wide,
    .panel-right-narrow {
        margin-left: 5%;
        margin-right: 5%;
        margin-top: 0;
        max-width: 100%;
    }

    .section-1 .fg-plane,
    .section-2 .fg-plane-offset,
    .section-3 .fg-plane-right,
    .section-4 .fg-plane-center,
    .section-5 .fg-plane-left {
        position: relative;
        width: 80%;
        max-width: 400px;
        margin: 30px auto 0;
        left: auto;
        right: auto;
        top: auto;
        transform: none;
        opacity: 0.7;
    }

    .section-numeral {
        font-size: clamp(60px, 12vw, 120px);
    }

    .progress-stem {
        right: 8px;
        width: 18px;
        height: 300px;
        opacity: 0.5;
    }

    .corner-ornament {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 600px) {
    body {
        font-size: 15px;
    }

    .section-heading {
        font-size: clamp(28px, 7vw, 42px);
    }

    .secondary-heading {
        font-size: clamp(16px, 3.5vw, 22px);
        letter-spacing: 0.1em;
    }

    .content-panel {
        padding: 24px 20px;
    }

    .text-block p {
        font-size: 15px;
    }

    .section-numeral {
        display: none;
    }

    .corner-ornament {
        display: none;
    }

    .progress-stem {
        display: none;
    }
}