/* ppuzzl.in — Bauhaus Herbarium */

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

:root {
    --ruby: #9b2335;
    --teal: #1a5276;
    --gold: #d4a017;
    --emerald: #2d5a3d;
    --plum: #6b3a5c;
    --parchment: #f5e6c8;
    --vellum: #e8d5a3;
    --umber: #3d2b1f;
    --walnut: #8b7355;
    --card-1: #faf3e0;
    --card-2: #f0e4cc;
    --card-3: #ede0c8;
    --caramel: #c4a882;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Libre Baskerville', serif;
    color: var(--umber);
    background: var(--parchment);
    overflow-x: hidden;
}

/* Paper Ground */
.paper-ground {
    position: fixed;
    inset: 0;
    z-index: -10;
    background: radial-gradient(ellipse at 30% 20%, #f5e6c8 0%, #e8d5a3 100%);
}
.paper-ground::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
    opacity: 0.5;
}

/* Leaf Fall Container */
#leaf-fall-container {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    height: 100vh;
    z-index: 1000;
    pointer-events: none;
}

/* Folio Sections */
.folio {
    position: relative;
    min-height: 100dvh;
    padding: 4rem 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.folio-grid {
    position: relative;
    width: 100%;
    max-width: 1200px;
    min-height: 80vh;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 1.5rem;
}

/* Folio Label */
.folio-label {
    position: absolute;
    top: -2rem;
    left: 0;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--walnut);
    z-index: 10;
}

/* Grid Lines (Geometric Scaffolding) */
.grid-lines {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    pointer-events: none;
    z-index: 0;
}
.grid-lines::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid rgba(139, 115, 85, 0.2);
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent calc(33.33% - 0.5px),
        rgba(139, 115, 85, 0.12) calc(33.33%),
        transparent calc(33.33% + 0.5px)
    ),
    repeating-linear-gradient(
        0deg,
        transparent,
        transparent calc(33.33% - 0.5px),
        rgba(139, 115, 85, 0.12) calc(33.33%),
        transparent calc(33.33% + 0.5px)
    );
}

/* Content Cards */
.card {
    position: relative;
    padding: 2rem 2.2rem;
    border-radius: 2px;
    z-index: 2;
    opacity: 0;
    transform: translateY(20px) rotate(0deg);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transition-delay: calc(var(--card-index) * 150ms);
}

.card.visible {
    opacity: 1;
}

.card-large {
    background: var(--card-1);
    box-shadow: 4px 4px 0px rgba(90, 70, 40, 0.15), 8px 8px 20px rgba(90, 70, 40, 0.08);
    box-shadow: 4px 4px 0px rgba(90, 70, 40, 0.15), 8px 8px 20px rgba(90, 70, 40, 0.08), inset 0 0 40px rgba(90, 70, 40, 0.12);
}
.card-large.visible { transform: rotate(-0.5deg); }

.card-medium {
    background: var(--card-2);
    box-shadow: 3px 3px 0px rgba(90, 70, 40, 0.12), 6px 6px 16px rgba(90, 70, 40, 0.06), inset 0 0 40px rgba(90, 70, 40, 0.1);
}
.card-medium.visible { transform: rotate(0.7deg); }

.card-small {
    background: var(--card-3);
    box-shadow: 2px 2px 0px rgba(90, 70, 40, 0.1), 4px 4px 12px rgba(90, 70, 40, 0.05), inset 0 0 40px rgba(90, 70, 40, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}
.card-small.visible { transform: rotate(1.2deg); }

/* Foxing spots */
.card::before {
    content: '';
    position: absolute;
    top: 15%;
    left: 20%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--caramel) 0%, transparent 70%);
    opacity: 0.2;
}
.card-large::before { top: 10%; left: 75%; width: 12px; height: 12px; }
.card-medium::before { top: 80%; left: 60%; width: 6px; height: 6px; }

/* Fold crease */
.card-large::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 45%, rgba(139,115,85,0.06) 50%, transparent 55%);
    pointer-events: none;
}

/* Typography */
.heading-display {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 5rem);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ruby);
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.heading-sub {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--walnut);
    margin-bottom: 1rem;
}

.body-text {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    color: var(--umber);
    margin-bottom: 1rem;
}
.body-text:last-child { margin-bottom: 0; }

.annotation {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: rgba(139, 115, 85, 0.6);
    display: block;
    margin-top: 1rem;
}

/* Fern List */
.fern-list {
    list-style: none;
    padding: 0;
}
.fern-list li {
    font-family: 'Libre Baskerville', serif;
    font-size: clamp(0.9rem, 1.5vw, 1.05rem);
    line-height: 2;
    color: var(--umber);
    padding-left: 1.5rem;
    position: relative;
}
.fern-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 14 Q8 8 4 4' stroke='%232d5a3d' stroke-width='1' fill='none' stroke-linecap='round'/%3E%3Cpath d='M8 14 Q8 8 12 4' stroke='%232d5a3d' stroke-width='1' fill='none' stroke-linecap='round'/%3E%3Cpath d='M8 10 Q5 8 3 7' stroke='%232d5a3d' stroke-width='0.8' fill='none' stroke-linecap='round'/%3E%3Cpath d='M8 10 Q11 8 13 7' stroke='%232d5a3d' stroke-width='0.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    opacity: 0.6;
}

/* Shape Trio */
.shape-trio {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
    align-items: center;
}
.shape-trio svg {
    width: 60px;
    height: 60px;
}

/* Geometric Stamps */
.geo-stamp {
    position: absolute;
    z-index: 5;
    opacity: 0.35;
    pointer-events: none;
}
.stamp-circle {
    width: 120px;
    height: 120px;
    top: -20px;
    right: 10%;
    transform: rotate(0deg);
}
.stamp-triangle {
    width: 80px;
    height: 80px;
    bottom: 5%;
    left: 5%;
    transform: rotate(12deg);
}
.stamp-square {
    width: 100px;
    height: 100px;
    top: 15%;
    right: -20px;
    transform: rotate(-8deg);
}
.geo-large {
    width: 140px;
    height: 140px;
}
.geo-small {
    width: 70px;
    height: 70px;
    bottom: 10%;
    right: 15%;
    top: auto;
}
.geo-final { top: 20%; left: -30px; width: 100px; height: 100px; }
.geo-final-2 { bottom: 10%; right: 5%; top: auto; width: 90px; height: 90px; transform: rotate(15deg); }
.geo-final-3 { top: 50%; right: -15px; width: 80px; height: 80px; transform: rotate(-5deg); }

/* Leaf SVGs */
.leaf-ginkgo { width: 100%; max-width: 120px; }
.leaf-ginkgo-small { max-width: 80px; }
.leaf-oak { width: 100%; max-width: 180px; mix-blend-mode: multiply; }
.leaf-fern-large { width: 60px; opacity: 0.8; }

/* Folio Divider */
.folio-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 3rem;
    position: relative;
}
.folio-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 2px;
    background: var(--walnut);
    opacity: 0.4;
}
.colophon {
    width: 40px;
    height: 40px;
    position: relative;
    z-index: 1;
    background: var(--parchment);
    padding: 4px;
}

/* Geo Assembly Container */
#geo-assembly-container {
    width: 100%;
    height: 200px;
    position: relative;
}

/* Responsive */
@media (max-width: 768px) {
    .folio { padding: 3rem 1.5rem; }
    .folio-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        min-height: auto;
    }
    .card {
        grid-column: 1 !important;
        grid-row: auto !important;
    }
    .geo-stamp { display: none; }
    .heading-display { font-size: clamp(2rem, 8vw, 3rem); }
}
