/* ============================================
   scire.bar — Isometric Apothecary Cabinet
   ============================================ */

:root {
    --sage: #7BA88E;
    --ink: #3D2B1F;
    --brass: #B8945A;
    --parchment: #F5EDE0;
    --terra: #A85239;
    --copper: #C4684A;
    --gold: #D4B87A;
    --peach: #E8A87C;
    --deep-sage: #4A7C6B;
    --burnt-orange: #D4774A;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--parchment);
    color: var(--ink);
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    line-height: 1.7;
    overflow-x: hidden;
}

/* 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: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(61, 43, 31, 0.1) 2px,
            rgba(61, 43, 31, 0.1) 3px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 3px,
            rgba(61, 43, 31, 0.05) 3px,
            rgba(61, 43, 31, 0.05) 4px
        );
}

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

.chapter-inner {
    max-width: 900px;
    width: 100%;
    text-align: center;
}

/* ---- Typography ---- */
.hero-title {
    font-family: 'Fraunces', serif;
    font-weight: 700;
    font-size: clamp(3rem, 9vw, 7rem);
    letter-spacing: 0.02em;
    line-height: 1.05;
    color: var(--ink);
    margin-bottom: 0.5rem;
}

.hero-dot {
    color: var(--terra);
}

.hero-subtitle {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--brass);
    margin-bottom: 3rem;
}

.chapter-heading {
    font-family: 'Fraunces', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3rem);
    color: var(--ink);
    margin-bottom: 1.5rem;
}

.chapter-num {
    color: var(--terra);
    font-style: italic;
    margin-right: 0.3em;
}

.chapter-text {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.5vw, 1.1rem);
    line-height: 1.8;
    color: var(--ink);
    opacity: 0.8;
    max-width: 600px;
    margin: 0 auto 3rem;
}

/* ---- Isometric Cabinet (Hero) ---- */
.cabinet-door {
    position: relative;
    width: 220px;
    height: 280px;
    margin: 0 auto 3rem;
    transform-style: preserve-3d;
}

.cabinet-face {
    position: absolute;
}

.cabinet-front {
    width: 220px;
    height: 280px;
    background: linear-gradient(135deg, var(--brass) 0%, var(--gold) 50%, var(--brass) 100%);
    border: 2px solid var(--ink);
    border-radius: 4px;
    transform: skewY(-2deg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    box-shadow: 
        8px 8px 0 rgba(61, 43, 31, 0.15),
        inset 0 0 40px rgba(61, 43, 31, 0.1);
}

.cabinet-top {
    width: 220px;
    height: 40px;
    background: var(--gold);
    border: 2px solid var(--ink);
    border-bottom: none;
    transform: skewX(-45deg) translateY(-20px) translateX(20px);
    top: -20px;
    left: 0;
    opacity: 0.7;
}

.cabinet-side {
    width: 40px;
    height: 280px;
    background: linear-gradient(to right, var(--brass), rgba(184, 148, 90, 0.5));
    border: 2px solid var(--ink);
    border-left: none;
    transform: skewY(-45deg) translateX(110px) translateY(-20px);
    right: -40px;
    top: 0;
    opacity: 0.6;
}

.cabinet-label {
    width: 100px;
    height: 36px;
    background: var(--parchment);
    border: 1.5px solid var(--ink);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 3px rgba(61, 43, 31, 0.1);
}

.cabinet-label-num {
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-size: 0.9rem;
    color: var(--ink);
}

.cabinet-keyhole {
    width: 12px;
    height: 20px;
    border: 1.5px solid var(--ink);
    border-radius: 50% 50% 2px 2px;
    position: relative;
}

.cabinet-keyhole::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 8px;
    background: var(--ink);
    border-radius: 1px;
}

/* Scroll hint */
.scroll-hint {
    animation: bobDown 2s ease-in-out infinite;
}

@keyframes bobDown {
    0%, 100% { transform: translateY(0); opacity: 0.6; }
    50% { transform: translateY(10px); opacity: 1; }
}

/* ---- Specimen Drawers (Chapter II) ---- */
.chapter-index {
    background: linear-gradient(180deg, var(--parchment) 0%, #EDE5D5 100%);
}

.specimen-grid {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.specimen-drawer {
    position: relative;
    cursor: pointer;
    transition: transform 0.4s ease;
}

.specimen-drawer:hover {
    transform: translateY(-8px);
}

.drawer-iso {
    position: relative;
    width: 180px;
    height: 60px;
    margin-bottom: 1.5rem;
}

.drawer-front {
    width: 180px;
    height: 60px;
    background: linear-gradient(135deg, var(--gold) 0%, var(--brass) 100%);
    border: 1.5px solid var(--ink);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 4px 4px 0 rgba(61, 43, 31, 0.12);
    position: absolute;
}

.drawer-top {
    width: 180px;
    height: 20px;
    background: var(--gold);
    border: 1.5px solid var(--ink);
    border-bottom: none;
    transform: skewX(-45deg) translateY(-10px) translateX(10px);
    position: absolute;
    top: -10px;
    opacity: 0.6;
}

.drawer-side {
    width: 20px;
    height: 60px;
    background: rgba(184, 148, 90, 0.5);
    border: 1.5px solid var(--ink);
    border-left: none;
    transform: skewY(-45deg) translateX(90px) translateY(-10px);
    position: absolute;
    right: -20px;
    opacity: 0.5;
}

.drawer-label {
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-size: 0.85rem;
    color: var(--ink);
    letter-spacing: 0.05em;
}

.specimen-illustration {
    opacity: 0;
    transition: opacity 0.6s ease;
    display: flex;
    justify-content: center;
}

.specimen-drawer.revealed .specimen-illustration {
    opacity: 1;
}

/* SVG draw animation */
.draw-path {
    stroke-dasharray: var(--path-length, 500);
    stroke-dashoffset: var(--path-length, 500);
    transition: stroke-dashoffset 1.5s ease;
}

.draw-active .draw-path {
    stroke-dashoffset: 0;
}

/* ---- Field Journal (Chapter III) ---- */
.chapter-notes {
    background: var(--parchment);
}

.field-journal {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.journal-page {
    background: #FAF6EE;
    border: 1px solid rgba(61, 43, 31, 0.15);
    padding: 2.5rem 2rem;
    max-width: 400px;
    width: 100%;
    position: relative;
    box-shadow: 
        3px 3px 0 rgba(61, 43, 31, 0.08),
        inset 0 0 30px rgba(61, 43, 31, 0.03);
    transform: rotate(-1deg);
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.journal-page.visible {
    opacity: 1;
}

.journal-right {
    transform: rotate(1deg);
}

.journal-right.visible {
    transform: rotate(1deg);
}

.journal-left.visible {
    transform: rotate(-1deg);
}

.journal-page::before {
    content: '';
    position: absolute;
    left: 2rem;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(168, 82, 57, 0.2);
}

.journal-date {
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-size: 0.85rem;
    color: var(--terra);
    margin-bottom: 1rem;
    padding-left: 1rem;
}

.journal-entry {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--ink);
    opacity: 0.85;
    margin-bottom: 1.5rem;
    padding-left: 1rem;
}

.journal-sketch {
    display: flex;
    justify-content: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(61, 43, 31, 0.08);
}

/* ---- Seed Vault (Chapter IV) ---- */
.chapter-vault {
    background: linear-gradient(180deg, #EDE5D5 0%, var(--parchment) 100%);
}

.seed-grid {
    display: flex;
    justify-content: center;
    gap: 4rem;
    flex-wrap: wrap;
}

.seed-pod {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.seed-pod.visible {
    opacity: 1;
    transform: translateY(0);
}

.seed-label {
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-size: 0.9rem;
    color: var(--brass);
    letter-spacing: 0.1em;
}

.seed-svg {
    transition: transform 0.3s ease;
}

.seed-pod:hover .seed-svg {
    transform: scale(1.05);
}

/* ---- Closing (Chapter V) ---- */
.chapter-closing {
    background: var(--ink);
    min-height: 80vh;
}

.chapter-closing .chapter-inner {
    color: var(--parchment);
}

.closing-illustration {
    margin-bottom: 3rem;
    display: flex;
    justify-content: center;
}

.closing-text {
    font-family: 'Fraunces', serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    color: var(--parchment);
    line-height: 1.5;
    margin-bottom: 2rem;
}

.closing-line {
    width: 60px;
    height: 1px;
    background: var(--brass);
    margin: 0 auto;
    opacity: 0.6;
}

.closing-svg {
    opacity: 0;
    transition: opacity 1s ease;
}

.closing-svg.visible {
    opacity: 1;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .specimen-grid {
        flex-direction: column;
        align-items: center;
    }

    .field-journal {
        flex-direction: column;
        align-items: center;
    }

    .journal-page {
        transform: rotate(0deg) !important;
    }

    .seed-grid {
        gap: 2rem;
    }

    .chapter {
        padding: 3rem 1.5rem;
    }
}
