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

:root {
    --parchment: #faf7f0;
    --moss: #4a6741;
    --sage: #8a9181;
    --plum: #6b4a6e;
    --ink: #2a2520;
    --cream: #f5f0e6;
    --amber: #c4903d;
    --lavender: #e8e0f0;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--parchment);
    color: var(--ink);
    font-family: 'Crimson Pro', Georgia, serif;
    font-weight: 300;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* Paper texture overlay */
.paper-texture {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1000;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(196, 144, 61, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(107, 74, 110, 0.03) 0%, transparent 50%);
}

/* === Frontispiece === */
.frontispiece {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
}

.frontispiece-border {
    position: relative;
    width: min(90vw, 800px);
    height: min(85vh, 600px);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--sage);
}

.botanical-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.frontispiece-content {
    text-align: center;
    z-index: 1;
    padding: 2rem;
}

.frontispiece-subtitle {
    font-family: 'Crimson Pro', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    color: var(--sage);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    opacity: 0;
    animation: fadeIn 1.5s ease 0.3s forwards;
}

.frontispiece-title {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-style: italic;
    font-size: clamp(4rem, 10vw, 12rem);
    color: var(--ink);
    letter-spacing: -0.02em;
    line-height: 0.9;
    margin-bottom: 0.3em;
    opacity: 0;
    animation: fadeIn 1.5s ease 0.6s forwards;
}

.frontispiece-tagline {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: clamp(0.7rem, 1.5vw, 0.9rem);
    color: var(--plum);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: fadeIn 1.5s ease 0.9s forwards;
}

.frontispiece-ornament {
    margin: 1rem auto;
    opacity: 0;
    animation: fadeIn 1.5s ease 1.2s forwards;
}

.frontispiece-note {
    font-family: 'Caveat', cursive;
    font-size: 1rem;
    color: var(--sage);
    margin-top: 1.5rem;
    opacity: 0;
    animation: fadeIn 1.5s ease 1.5s forwards, gentleBob 3s ease-in-out 2.5s infinite;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes gentleBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Vine drawing animation */
.vine {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    animation: drawVine 3s ease forwards;
}

.vine-right { animation-delay: 0.3s; }
.vine-top { animation-delay: 0.8s; stroke-dasharray: 900; stroke-dashoffset: 900; }
.vine-bottom { animation-delay: 1s; stroke-dasharray: 900; stroke-dashoffset: 900; }

.leaf {
    opacity: 0;
    animation: fadeIn 0.8s ease forwards;
}
.leaf-1 { animation-delay: 1.5s; }
.leaf-2 { animation-delay: 1.8s; }
.leaf-3 { animation-delay: 2s; }
.leaf-4 { animation-delay: 2.2s; }

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

/* === Cabinet Section === */
.cabinet {
    padding: 4rem 2rem 6rem;
    max-width: 1200px;
    margin: 0 auto;
}

.cabinet-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--sage);
}

.annotation {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    color: var(--sage);
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

/* Specimen Grid — asymmetric masonry-like */
.specimen-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    grid-auto-flow: dense;
}

/* Specimen Cards */
.specimen {
    background: var(--cream);
    border: 1px solid rgba(138, 145, 129, 0.3);
    padding: 1.5rem;
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease, box-shadow 0.3s ease;
}

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

.specimen:hover {
    box-shadow: 0 4px 20px rgba(42, 37, 32, 0.08);
}

.specimen-large {
    grid-column: span 2;
    grid-row: span 2;
    padding: 2rem;
}

.specimen-medium {
    grid-column: span 1;
    grid-row: span 2;
}

.specimen-small {
    grid-column: span 1;
    grid-row: span 1;
}

.specimen-annotation {
    grid-column: span 1;
    grid-row: span 1;
    background: var(--lavender);
    border-color: rgba(107, 74, 110, 0.2);
}

/* Pin */
.specimen-pin {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--amber);
    box-shadow: 0 1px 3px rgba(42, 37, 32, 0.2);
}

/* Illustration */
.specimen-illustration {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0;
}

.plant-svg {
    width: 100%;
    max-width: 180px;
    height: auto;
}

.specimen-large .plant-svg {
    max-width: 200px;
}

/* SVG drawing animation on scroll */
.specimen .plant-svg line,
.specimen .plant-svg path {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 1.5s ease;
}

.specimen .plant-svg circle {
    opacity: 0;
    transition: opacity 0.8s ease 0.8s;
}

.specimen .plant-svg ellipse {
    opacity: 0;
    transition: opacity 0.8s ease 0.8s;
}

.specimen.visible .plant-svg line,
.specimen.visible .plant-svg path {
    stroke-dashoffset: 0;
}

.specimen.visible .plant-svg circle,
.specimen.visible .plant-svg ellipse {
    opacity: 1;
}

/* Labels */
.specimen-label {
    margin-top: 0.5rem;
}

.specimen-name {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-style: italic;
    font-size: 1.2rem;
    color: var(--ink);
    margin-bottom: 0.4rem;
}

.specimen-large .specimen-name {
    font-size: 1.5rem;
}

.specimen-desc {
    font-family: 'Crimson Pro', serif;
    font-weight: 300;
    font-size: 0.95rem;
    color: var(--ink);
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.specimen-ref {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    color: var(--sage);
    letter-spacing: 0.05em;
}

.annotation-marker {
    font-family: 'Caveat', cursive;
    font-size: 1.1rem;
    color: var(--plum);
    display: block;
    margin-bottom: 0.5rem;
}

.specimen-annotation .specimen-desc {
    font-style: italic;
    font-size: 0.9rem;
}

.specimen-annotation .specimen-ref {
    display: block;
    margin-top: 0.5rem;
    text-align: right;
}

/* === Colophon === */
.colophon {
    padding: 4rem 2rem;
    text-align: center;
    border-top: 1px solid var(--sage);
    max-width: 600px;
    margin: 0 auto;
}

.colophon-content {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 1s ease, transform 1s ease;
}

.colophon-content.visible {
    opacity: 1;
    transform: translateY(0);
}

.colophon-ornament {
    margin-bottom: 1.5rem;
}

.colophon-text {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-style: italic;
    font-size: 1.3rem;
    color: var(--ink);
    margin-bottom: 0.5rem;
}

.colophon-note {
    font-family: 'Crimson Pro', serif;
    font-weight: 300;
    font-style: italic;
    font-size: 0.9rem;
    color: var(--sage);
    margin-bottom: 0.5rem;
}

.colophon-date {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    color: var(--sage);
    letter-spacing: 0.3em;
    text-transform: uppercase;
}

/* === Responsive === */
@media (max-width: 768px) {
    .specimen-grid {
        grid-template-columns: 1fr 1fr;
    }
    .specimen-large {
        grid-column: span 2;
        grid-row: span 1;
    }
    .specimen-medium {
        grid-row: span 1;
    }
}

@media (max-width: 480px) {
    .specimen-grid {
        grid-template-columns: 1fr;
    }
    .specimen-large {
        grid-column: span 1;
    }
    .frontispiece-border {
        border: none;
    }
    .botanical-frame {
        display: none;
    }
}
