/* penclos.com - Botanical Research Herbarium */
/* Colors from DESIGN.md */
:root {
    --bg-paper: #f4f0e8;
    --bg-alt: #e8e4d8;
    --text-primary: #2c2418;
    --text-secondary: #6b5d4f;
    --accent-leaf: #7a8b6f;
    --accent-hover: #566148;
    --highlight: #c4a265;
    --border-subtle: #d4cdbf;
    --dark-panel: #1e1812;
    --font-heading: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Commissioner', 'Segoe UI', sans-serif;
}

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

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

body {
    font-family: var(--font-body);
    font-weight: 350;
    color: var(--text-primary);
    background-color: var(--bg-paper);
    line-height: 1.72;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Paper texture overlay */
.paper-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    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='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* Section base */
.section {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6rem 2rem;
    transition: background-color 1.2s ease;
}

.section-hero {
    background-color: var(--bg-paper);
}

.section-chapter {
    background-color: var(--bg-paper);
}

.section-specimens {
    background-color: var(--bg-alt);
}

.section-process {
    background-color: var(--bg-paper);
}

.section-dark {
    background-color: var(--dark-panel);
}

.section-philosophy {
    background-color: var(--bg-alt);
}

.section-colophon {
    background-color: var(--bg-paper);
    min-height: 80vh;
}

/* Marginalia */
.marginalia {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    transition: transform 0.1s linear;
}

.marginalia-left {
    left: clamp(1rem, 4vw, 5rem);
    text-align: right;
}

.marginalia-right {
    right: clamp(1rem, 4vw, 5rem);
    text-align: left;
}

.margin-note {
    font-family: var(--font-body);
    font-weight: 300;
    font-style: normal;
    font-size: 0.8rem;
    color: var(--text-secondary);
    letter-spacing: 0.04em;
    display: block;
    opacity: 0.6;
}

.margin-note.italic {
    font-style: italic;
}

.margin-note.light {
    color: var(--bg-alt);
    opacity: 0.4;
}

.margin-leaf {
    display: block;
    margin-top: 0.5rem;
}

.margin-leaf-small {
    width: 16px;
    height: 22px;
    background: radial-gradient(ellipse at 40% 30%, var(--accent-leaf) 0%, var(--accent-hover) 100%);
    border-radius: 50% 70% 55% 45% / 60% 50% 70% 40%;
    opacity: 0.35;
    box-shadow: 0 2px 4px rgba(86, 97, 72, 0.15);
}

.margin-leaf-tiny {
    width: 10px;
    height: 14px;
    background: radial-gradient(ellipse at 40% 30%, var(--accent-leaf) 0%, var(--accent-hover) 100%);
    border-radius: 50% 70% 55% 45% / 60% 50% 70% 40%;
    opacity: 0.25;
    box-shadow: 0 1px 3px rgba(86, 97, 72, 0.1);
}

/* Hero section */
.hero-content {
    text-align: center;
    position: relative;
    z-index: 2;
}

.hero-leaf-container {
    perspective: 800px;
    margin-bottom: 3rem;
}

.inflated-leaf {
    position: relative;
    display: inline-block;
}

.hero-leaf {
    width: 180px;
    height: 240px;
    background: radial-gradient(ellipse at 35% 25%, #9aab8f 0%, var(--accent-leaf) 30%, var(--accent-hover) 70%, #3d4a32 100%);
    border-radius: 40% 60% 55% 45% / 50% 40% 60% 50%;
    box-shadow:
        0 4px 8px rgba(30, 24, 18, 0.1),
        0 8px 20px rgba(86, 97, 72, 0.15),
        0 16px 40px rgba(30, 24, 18, 0.1),
        inset 0 -4px 12px rgba(30, 24, 18, 0.15),
        inset 0 4px 12px rgba(255, 255, 255, 0.1);
    animation: heroLeafFloat 8s ease-in-out infinite, heroLeafRotate 20s linear infinite;
    transform-style: preserve-3d;
}

.leaf-highlight {
    position: absolute;
    top: 15%;
    left: 20%;
    width: 35%;
    height: 25%;
    background: radial-gradient(ellipse, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.leaf-veins {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.vein-line {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: veinDraw 2s ease-out forwards;
    opacity: 0.5;
}

.vein-main {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    animation: veinDrawLong 2.5s ease-out forwards;
}

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

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

@keyframes heroLeafFloat {
    0%, 100% { transform: translateY(0) rotateX(5deg); }
    50% { transform: translateY(-12px) rotateX(-3deg); }
}

@keyframes heroLeafRotate {
    0% { transform: rotateY(0deg) translateY(0); }
    25% { transform: rotateY(8deg) translateY(-8px); }
    50% { transform: rotateY(0deg) translateY(0); }
    75% { transform: rotateY(-8deg) translateY(-8px); }
    100% { transform: rotateY(0deg) translateY(0); }
}

.hero-title {
    font-family: var(--font-heading);
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 300;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.2s ease-out, transform 1.2s ease-out;
}

.hero-title.visible {
    opacity: 1;
    transform: translateY(0);
}

.title-word {
    display: inline-block;
    font-weight: 100;
    transition: font-weight 1.5s ease;
}

.hero-title.visible .title-word {
    font-weight: 600;
}

.hero-subtitle {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 1.1rem;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
    text-transform: lowercase;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 1.5s ease-out 0.4s, transform 1.5s ease-out 0.4s;
}

.hero-subtitle.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Vine dividers */
.vine-divider {
    width: 100%;
    max-width: 800px;
    height: 40px;
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

.vine-path {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 1.8s cubic-bezier(0.65, 0, 0.35, 1);
}

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

.vine-dot {
    opacity: 0;
    transition: opacity 0.6s ease 1.4s;
}

.vine-divider.visible .vine-dot {
    opacity: 1;
}

/* Chapter content */
.chapter-content {
    max-width: 680px;
    width: 100%;
    position: relative;
    z-index: 2;
}

.chapter-heading {
    text-align: center;
    margin-bottom: 2.5rem;
}

.heading-text {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 4.5rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    display: block;
}

.heading-text.light {
    color: var(--bg-paper);
}

.heading-vine {
    display: block;
    width: 100%;
    max-width: 400px;
    height: 16px;
    margin: 0.5rem auto 0;
}

.vine-underline {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 1.2s cubic-bezier(0.65, 0, 0.35, 1);
}

.reveal-element.visible .vine-underline {
    stroke-dashoffset: 0;
}

.chapter-text {
    font-family: var(--font-body);
    font-weight: 350;
    font-size: 1.05rem;
    line-height: 1.72;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.chapter-text.light {
    color: var(--bg-alt);
}

.chapter-text.visible {
    opacity: 1;
    transform: translateY(0);
}

.colophon-footer {
    text-align: center;
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 400;
    font-style: italic;
    color: var(--text-secondary);
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-subtle);
}

/* Specimen gallery */
.specimens-content {
    max-width: 680px;
    width: 100%;
    position: relative;
    z-index: 2;
}

.specimen-item {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 3rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.specimen-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.specimen-leaf {
    width: 80px;
    height: 100px;
    flex-shrink: 0;
    transform: scale3d(0.5, 0.5, 0.5);
    transition: transform 0.6s ease-out, box-shadow 0.6s ease-out;
}

.specimen-item.visible .specimen-leaf {
    transform: scale3d(1, 1, 1);
}

/* Leaf shapes */
.leaf-ovate {
    background: radial-gradient(ellipse at 35% 25%, #9aab8f 0%, var(--accent-leaf) 35%, var(--accent-hover) 100%);
    border-radius: 45% 55% 55% 45% / 40% 40% 60% 60%;
    box-shadow:
        0 3px 6px rgba(30, 24, 18, 0.08),
        0 6px 16px rgba(86, 97, 72, 0.12),
        0 12px 30px rgba(30, 24, 18, 0.08),
        inset 0 -3px 8px rgba(30, 24, 18, 0.12),
        inset 0 3px 8px rgba(255, 255, 255, 0.08);
}

.leaf-palmate {
    background: radial-gradient(ellipse at 40% 30%, #8a9e7d 0%, #6e8060 35%, var(--accent-hover) 100%);
    border-radius: 30% 70% 40% 60% / 45% 35% 65% 55%;
    box-shadow:
        0 3px 6px rgba(30, 24, 18, 0.08),
        0 6px 16px rgba(86, 97, 72, 0.12),
        0 12px 30px rgba(30, 24, 18, 0.08),
        inset 0 -3px 8px rgba(30, 24, 18, 0.12),
        inset 0 3px 8px rgba(255, 255, 255, 0.08);
}

.leaf-lanceolate {
    width: 50px;
    height: 120px;
    background: radial-gradient(ellipse at 35% 25%, #92a686 0%, var(--accent-leaf) 35%, #4d5a3e 100%);
    border-radius: 50% 50% 50% 50% / 20% 20% 80% 80%;
    box-shadow:
        0 3px 6px rgba(30, 24, 18, 0.08),
        0 6px 16px rgba(86, 97, 72, 0.12),
        0 12px 30px rgba(30, 24, 18, 0.08),
        inset 0 -3px 8px rgba(30, 24, 18, 0.12),
        inset 0 3px 8px rgba(255, 255, 255, 0.08);
}

.leaf-pinnate {
    width: 70px;
    height: 110px;
    background: radial-gradient(ellipse at 40% 20%, #8fa382 0%, #6b7d5e 35%, var(--accent-hover) 100%);
    border-radius: 35% 65% 55% 45% / 30% 35% 65% 70%;
    box-shadow:
        0 3px 6px rgba(30, 24, 18, 0.08),
        0 6px 16px rgba(86, 97, 72, 0.12),
        0 12px 30px rgba(30, 24, 18, 0.08),
        inset 0 -3px 8px rgba(30, 24, 18, 0.12),
        inset 0 3px 8px rgba(255, 255, 255, 0.08);
}

.leaf-cordate {
    width: 85px;
    height: 90px;
    background: radial-gradient(ellipse at 35% 25%, #98ac8a 0%, var(--accent-leaf) 35%, #4a5740 100%);
    border-radius: 15% 85% 50% 50% / 50% 50% 50% 50%;
    box-shadow:
        0 3px 6px rgba(30, 24, 18, 0.08),
        0 6px 16px rgba(86, 97, 72, 0.12),
        0 12px 30px rgba(30, 24, 18, 0.08),
        inset 0 -3px 8px rgba(30, 24, 18, 0.12),
        inset 0 3px 8px rgba(255, 255, 255, 0.08);
}

.leaf-oblong {
    width: 60px;
    height: 110px;
    background: radial-gradient(ellipse at 38% 28%, #8fa382 0%, #758868 35%, var(--accent-hover) 100%);
    border-radius: 45% 55% 55% 45% / 35% 35% 65% 65%;
    box-shadow:
        0 3px 6px rgba(30, 24, 18, 0.08),
        0 6px 16px rgba(86, 97, 72, 0.12),
        0 12px 30px rgba(30, 24, 18, 0.08),
        inset 0 -3px 8px rgba(30, 24, 18, 0.12),
        inset 0 3px 8px rgba(255, 255, 255, 0.08);
}

.specimen-label {
    flex: 1;
}

.specimen-type {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.3rem;
}

.specimen-name {
    font-family: var(--font-body);
    font-weight: 300;
    font-style: italic;
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: block;
    min-height: 1.4em;
}

/* Watermark leaf */
.watermark-leaf {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 500px;
    background: radial-gradient(ellipse at 35% 25%, var(--accent-leaf) 0%, var(--accent-hover) 50%, transparent 100%);
    border-radius: 40% 60% 55% 45% / 50% 40% 60% 50%;
    opacity: 0.03;
    pointer-events: none;
}

.watermark-leaf-dark {
    background: radial-gradient(ellipse at 35% 25%, var(--highlight) 0%, var(--accent-leaf) 50%, transparent 100%);
    opacity: 0.03;
}

/* Root ornament */
.root-ornament {
    max-width: 300px;
    margin: 2rem auto;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.root-ornament.visible {
    opacity: 1;
    transform: translateY(0);
}

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

.root-line {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1.5s ease-out;
}

.root-ornament.visible .root-line {
    stroke-dashoffset: 0;
}

/* Mandala */
.mandala-container {
    text-align: center;
    margin: 3rem 0;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.mandala-container.visible {
    opacity: 1;
    transform: scale(1);
}

.seed-mandala {
    width: 200px;
    height: 200px;
}

.mandala-petal {
    opacity: 0;
    transition: opacity 0.6s ease-out;
}

.mandala-container.visible .mandala-petal {
    opacity: 0.7;
}

/* Pollen pattern */
.pollen-pattern {
    width: 200px;
    height: 200px;
    margin: 2rem auto;
    border-radius: 50%;
    background: repeating-radial-gradient(
        circle at center,
        transparent 0px,
        transparent 8px,
        rgba(122, 139, 111, 0.08) 8px,
        rgba(122, 139, 111, 0.08) 10px
    );
    opacity: 0;
    transition: opacity 0.8s ease-out;
}

.pollen-pattern.visible {
    opacity: 1;
}

/* Colophon leaf */
.colophon-leaf-container {
    text-align: center;
    margin-bottom: 2rem;
    opacity: 0;
    transition: opacity 0.8s ease-out;
}

.colophon-leaf-container.visible {
    opacity: 1;
}

.colophon-leaf {
    width: 60px;
    height: 80px;
    background: radial-gradient(ellipse at 35% 25%, #9aab8f 0%, var(--accent-leaf) 30%, var(--accent-hover) 70%, #3d4a32 100%);
    border-radius: 40% 60% 55% 45% / 50% 40% 60% 50%;
    box-shadow:
        0 3px 6px rgba(30, 24, 18, 0.08),
        0 6px 16px rgba(86, 97, 72, 0.12),
        0 12px 30px rgba(30, 24, 18, 0.08),
        inset 0 -3px 8px rgba(30, 24, 18, 0.12),
        inset 0 3px 8px rgba(255, 255, 255, 0.08);
    animation: colophonFloat 6s ease-in-out infinite;
}

@keyframes colophonFloat {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-8px) rotate(5deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .marginalia {
        display: none;
    }

    .section {
        padding: 4rem 1.5rem;
    }

    .specimen-item {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .hero-leaf {
        width: 120px;
        height: 160px;
    }

    .seed-mandala {
        width: 160px;
        height: 160px;
    }
}

/* Reveal animation base */
.reveal-element {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.reveal-element.visible {
    opacity: 1;
    transform: translateY(0);
}
