/* ==========================================================================
   whitepapers.xyz - Botanical Glassmorphism Design
   Colors: #e8e4df #c9c2b8 #7a8b7a #4a5a4a #a3967e #f5f2ed #3d4a3d
   Fonts: Caveat (headings), Lora (body), Karla (captions)
   ========================================================================== */

/* --- CSS Custom Properties --- */
:root {
    --aged-linen: #e8e4df;
    --dried-sage: #c9c2b8;
    --moss-stone: #7a8b7a;
    --deep-fern: #4a5a4a;
    --weathered-bronze: #a3967e;
    --parchment-mist: #f5f2ed;
    --ink-moss: #3d4a3d;
    --glass-bg: rgba(245, 242, 237, 0.7);
    --glass-border: rgba(122, 139, 122, 0.15);
    --glass-shadow: rgba(61, 74, 61, 0.08);
    --scroll-offset: 0;
    --mouse-x: 50%;
    --mouse-y: 50%;
}

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

html {
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
    overflow-x: hidden;
}

body {
    font-family: 'Lora', Georgia, serif;
    background-color: var(--aged-linen);
    color: var(--deep-fern);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Dot Grid Overlay --- */
.dot-grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background-image: radial-gradient(circle, var(--moss-stone) 0.5px, transparent 0.5px);
    background-size: 24px 24px;
    opacity: 0.03;
}

/* --- Breadcrumb Trail --- */
.breadcrumb-trail {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: flex-end;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex-direction: row-reverse;
}

.breadcrumb-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--moss-stone);
    opacity: 0.35;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    flex-shrink: 0;
}

.breadcrumb-item.active .breadcrumb-dot {
    opacity: 1;
    width: 10px;
    height: 10px;
    box-shadow: 0 0 8px rgba(122, 139, 122, 0.4);
}

.breadcrumb-label {
    font-family: 'Karla', sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--moss-stone);
    opacity: 0;
    filter: blur(4px);
    transition: all 0.4s ease;
    white-space: nowrap;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 4px 10px;
    border-radius: 2px;
    border: 1px solid var(--glass-border);
}

.breadcrumb-item:hover .breadcrumb-label {
    opacity: 1;
    filter: blur(0);
}

/* --- Scroll Container --- */
.scroll-container {
    position: relative;
    z-index: 2;
}

/* --- Chapter Sections --- */
.chapter {
    position: relative;
    min-height: 100vh;
    scroll-snap-align: start;
    padding: 80px 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.chapter-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.chapter-bg.bg-alternate {
    background-color: var(--dried-sage);
}

.chapter-content {
    position: relative;
    z-index: 3;
    max-width: 900px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

/* --- Botanical Watermarks --- */
.botanical-watermark {
    position: absolute;
    width: 50%;
    max-width: 400px;
    height: auto;
    opacity: 1;
    pointer-events: none;
    will-change: transform;
}

.watermark-fern {
    right: 5%;
    top: 10%;
    width: 35%;
}

.watermark-seeds {
    left: 5%;
    bottom: 10%;
    width: 30%;
}

.watermark-leaf-vein {
    right: 8%;
    top: 15%;
    width: 40%;
}

.watermark-root {
    left: 3%;
    top: 5%;
    width: 35%;
}

.watermark-roots-footer {
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    width: 80%;
    max-width: 800px;
}

/* --- Glass Panels --- */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border: 1px solid var(--glass-border);
    border-radius: 2px;
    box-shadow: 0 8px 32px var(--glass-shadow);
    padding: 48px 56px;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px) scale(0.98);
    transition: opacity 0.6s ease, transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    width: 100%;
}

.glass-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        600px circle at var(--mouse-x) var(--mouse-y),
        rgba(122, 139, 122, 0.06),
        transparent 50%
    );
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.glass-panel > * {
    position: relative;
    z-index: 1;
}

.glass-panel.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.glass-panel-hero {
    text-align: center;
    padding: 64px 56px;
}

.glass-panel-offset {
    margin-left: 60px;
    max-width: 500px;
    align-self: flex-end;
}

.glass-panel-wide {
    max-width: 100%;
}

.glass-panel-prose {
    max-width: 750px;
}

.glass-panel-footer {
    text-align: center;
}

/* --- Glass Panels Row --- */
.glass-panels-row {
    display: flex;
    gap: 24px;
    width: 100%;
}

.glass-panel-small {
    flex: 1;
    padding: 32px 28px;
    text-align: center;
}

/* --- Typography --- */
.heading-handwritten {
    font-family: 'Caveat', cursive;
    font-weight: 600;
    color: var(--deep-fern);
    letter-spacing: 0.04em;
    text-shadow: 1px 1px 2px rgba(74, 90, 74, 0.15);
    line-height: 1.2;
}

h1.heading-handwritten {
    font-size: 4rem;
    margin-bottom: 24px;
}

h2.heading-handwritten {
    font-size: 3rem;
    margin-bottom: 20px;
}

h3.heading-handwritten,
.heading-sm {
    font-size: 2rem;
}

.body-text {
    font-family: 'Lora', Georgia, serif;
    font-size: 1.125rem;
    line-height: 1.85;
    color: var(--deep-fern);
    margin-bottom: 16px;
}

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

.body-sm {
    font-size: 0.95rem;
    line-height: 1.7;
}

/* --- Karla Labels --- */
.karla-label {
    font-family: 'Karla', sans-serif;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--weathered-bronze);
    display: block;
    line-height: 1.6;
}

/* --- Herbarium Labels --- */
.herbarium-label {
    border-top: 1px solid var(--glass-border);
    padding-top: 12px;
    margin-top: 20px;
    background: rgba(232, 228, 223, 0.3);
    padding: 10px 16px;
    border-radius: 1px;
}

.label-text {
    font-family: 'Karla', sans-serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--weathered-bronze);
}

/* --- Pull Quote --- */
.pull-quote {
    margin: 32px 0;
    padding: 24px 32px;
    border-left: 2px solid var(--moss-stone);
    background: rgba(122, 139, 122, 0.04);
    border-radius: 0 2px 2px 0;
}

.pull-quote p {
    font-family: 'Lora', Georgia, serif;
    font-style: italic;
    font-size: 1.2rem;
    line-height: 1.8;
    color: var(--ink-moss);
}

/* --- Specimen Card --- */
.specimen-card {
    display: flex;
    align-items: center;
    gap: 24px;
}

.specimen-illustration {
    flex-shrink: 0;
    width: 100px;
}

.specimen-illustration svg {
    width: 100%;
    height: auto;
}

.specimen-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* --- Seed Pod Bullets --- */
.seed-pod-bullet {
    width: 32px;
    height: 32px;
    margin: 0 auto 12px;
}

.seed-pod-bullet svg {
    width: 100%;
    height: 100%;
}

/* --- Archive Grid --- */
.archive-grid {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin-top: 32px;
}

.archive-item {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.archive-item .heading-sm {
    color: var(--moss-stone);
    font-size: 2.5rem;
}

/* --- Floating Botanicals --- */
.floating-botanical {
    position: absolute;
    pointer-events: none;
    will-change: transform;
    z-index: 1;
}

.botanical-eucalyptus {
    right: -40px;
    top: 20%;
    width: 180px;
}

.botanical-eucalyptus svg {
    width: 100%;
    height: auto;
}

.botanical-seedpods {
    left: -20px;
    bottom: 15%;
    width: 140px;
}

.botanical-seedpods svg {
    width: 100%;
    height: auto;
}

/* --- Fern Dividers --- */
.fern-divider {
    position: relative;
    width: 100%;
    height: 80px;
    overflow: hidden;
    z-index: 2;
}

.fern-svg {
    width: 100%;
    height: 100%;
}

.fern-draw {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 2.5s ease;
}

.fern-divider.drawn .fern-draw {
    stroke-dashoffset: 0;
}

/* --- Footer --- */
.site-footer {
    text-align: center;
    margin-top: 20px;
    padding: 24px 0;
}

.footer-label {
    display: inline-block;
    background: rgba(232, 228, 223, 0.5);
}

.footer-text {
    font-family: 'Lora', Georgia, serif;
    font-style: italic;
    font-size: 0.9rem;
    color: var(--weathered-bronze);
    margin-top: 12px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .chapter {
        padding: 60px 20px;
    }

    .glass-panel {
        padding: 32px 24px;
    }

    .glass-panel-hero {
        padding: 40px 24px;
    }

    h1.heading-handwritten {
        font-size: 2.8rem;
    }

    h2.heading-handwritten {
        font-size: 2.2rem;
    }

    .glass-panels-row {
        flex-direction: column;
    }

    .glass-panel-offset {
        margin-left: 0;
        max-width: 100%;
    }

    .breadcrumb-trail {
        right: 12px;
    }

    .breadcrumb-label {
        display: none;
    }

    .archive-grid {
        gap: 30px;
    }

    .floating-botanical {
        display: none;
    }

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

@media (max-width: 480px) {
    h1.heading-handwritten {
        font-size: 2.2rem;
    }

    h2.heading-handwritten {
        font-size: 1.8rem;
    }

    .body-text {
        font-size: 1rem;
    }

    .archive-grid {
        flex-direction: column;
        gap: 20px;
    }
}

/* --- SVG Draw Animation Keyframes --- */
@keyframes fernDraw {
    to {
        stroke-dashoffset: 0;
    }
}

/* --- Elastic Entrance Animations --- */
@keyframes elasticIn {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.96);
    }
    60% {
        opacity: 1;
        transform: translateY(-6px) scale(1.01);
    }
    80% {
        transform: translateY(3px) scale(0.995);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* --- Grain Texture --- */
.chapter-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.025;
    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='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-size: 256px;
    pointer-events: none;
    z-index: 0;
}