/* ================================================
   LLITTL.com v2 — Fairycore Light-Academia
   A cabinet of small wonders
   ================================================ */

/* --- CSS Custom Properties --- */
:root {
    --ivory-vellum: #FAF6F0;
    --deep-walnut: #2E1F14;
    --brass-divider: #BFA76A;
    --amethyst-dusk: #6B4C7D;
    --emerald-lichen: #3D7A5F;
    --moss-ink: #4A6741;
    --specimen-black: #1A1510;
    --honeyed-amber: #D4A84B;
    --dried-rose: #C47D7D;
    --lichen-gray: #A8AFA4;

    --font-display: 'Fraunces', serif;
    --font-body: 'Libre Caslon Text', serif;
    --font-accent: 'Caveat', cursive;

    --page-max-width: 1100px;
    --page-inset: 2vw;
    --cell-padding: 3rem;
    --cell-border: 2px solid var(--brass-divider);
}

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

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

body {
    background-color: var(--ivory-vellum);
    color: var(--deep-walnut);
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.8;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    overflow-x: hidden;
}

/* --- Opening Viewport --- */
.opening-viewport {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-color: var(--ivory-vellum);
    overflow: hidden;
}

.opening-content {
    text-align: center;
    position: relative;
    z-index: 2;
}

.title-word {
    font-family: var(--font-display);
    font-weight: 100;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: 0.04em;
    color: var(--deep-walnut);
    font-variation-settings: 'WONK' 1, 'opsz' 144;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.title-word.visible {
    opacity: 1;
}

.title-word.animating {
    animation: titleBreathe 2.5s ease-in-out forwards;
}

@keyframes titleBreathe {
    0% { font-weight: 100; }
    100% { font-weight: 600; }
}

.vine-line {
    width: 60vw;
    max-width: 800px;
    height: 40px;
    display: block;
    margin: 1rem auto 0;
    overflow: visible;
}

.vine-main {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    opacity: 0;
}

.vine-main.drawing {
    opacity: 1;
    animation: vineGrow 2s ease-in-out forwards;
}

@keyframes vineGrow {
    0% { stroke-dashoffset: 400; }
    100% { stroke-dashoffset: 0; }
}

.vine-leaf {
    transition: opacity 1s ease-in-out;
}

.vine-leaf.visible {
    opacity: 0.7;
}

/* --- Fireflies --- */
.firefly {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--honeyed-amber);
    box-shadow: 0 0 8px rgba(212, 168, 75, 0.6), 0 0 16px rgba(212, 168, 75, 0.3);
    opacity: 0;
    pointer-events: none;
    z-index: 5;
}

.firefly-opening {
    opacity: 0;
}

.firefly-opening.active {
    animation: fireflyPulse 3.5s ease-in-out infinite, fireflyDrift1 12s ease-in-out infinite;
}

.firefly-1 { top: 35%; left: 45%; animation-delay: 0s; }
.firefly-2 { top: 28%; left: 55%; animation-delay: 0.8s; }
.firefly-3 { top: 40%; left: 50%; animation-delay: 1.6s; }

.firefly-drift {
    animation: fireflyPulse 4s ease-in-out infinite, fireflyDrift2 15s ease-in-out infinite;
}

.firefly-4 { top: 30%; left: 20%; animation-delay: 0s; }
.firefly-5 { top: 50%; left: 60%; animation-delay: 1.2s; }
.firefly-6 { top: 40%; left: 80%; animation-delay: 2.4s; }
.firefly-7 { top: 35%; left: 30%; animation-delay: 0.5s; }
.firefly-8 { top: 55%; left: 70%; animation-delay: 1.8s; }
.firefly-9 { top: 25%; left: 40%; animation-delay: 0.3s; }
.firefly-10 { top: 60%; left: 55%; animation-delay: 1.5s; }
.firefly-11 { top: 45%; left: 25%; animation-delay: 2.2s; }

@keyframes fireflyPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

@keyframes fireflyDrift1 {
    0% { transform: translate(0, 0); }
    25% { transform: translate(15px, -20px); }
    50% { transform: translate(-10px, -35px); }
    75% { transform: translate(20px, -15px); }
    100% { transform: translate(0, 0); }
}

@keyframes fireflyDrift2 {
    0% { transform: translate(0, 0); }
    20% { transform: translate(30px, -15px); }
    40% { transform: translate(-20px, -30px); }
    60% { transform: translate(25px, 10px); }
    80% { transform: translate(-15px, -20px); }
    100% { transform: translate(0, 0); }
}

/* --- Navigation --- */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 1.2rem 2rem;
    background: rgba(250, 246, 240, 0.92);
    backdrop-filter: blur(8px);
    opacity: 0;
    transform: translateY(-100%);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.main-nav.visible {
    opacity: 1;
    transform: translateY(0);
}

.main-nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 3rem;
}

.main-nav a {
    font-family: var(--font-body);
    font-variant: small-caps;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    color: var(--brass-divider);
    text-decoration: none;
    transition: color 0.3s ease;
}

.main-nav a:hover {
    color: var(--honeyed-amber);
}

/* --- Drawer Sections --- */
.drawer-section {
    position: relative;
    max-width: var(--page-max-width);
    margin: 0 auto;
    padding: 4rem var(--page-inset);
}

.drawer-grid {
    display: grid;
    gap: 0;
}

.drawer-grid-1 {
    grid-template-columns: 2fr 1.5fr 0.8fr;
}

.drawer-grid-2 {
    grid-template-columns: 1fr 2fr 0.6fr;
}

.drawer-grid-3 {
    grid-template-columns: 1fr;
}

.drawer-grid-4 {
    grid-template-columns: 2fr 1.2fr;
}

/* --- Cells --- */
.cell {
    border: var(--cell-border);
    position: relative;
    overflow: hidden;
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
    border-radius: 2px;
}

.cell:hover {
    border-color: var(--honeyed-amber);
    box-shadow: inset 0 0 12px rgba(212, 168, 75, 0.15);
}

.cell-inner {
    padding: var(--cell-padding);
}

.cell-animate {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.cell-animate.in-view {
    opacity: 1;
    transform: translateY(0);
}

.cell-wide { min-height: 280px; }
.cell-tall { min-height: 360px; }
.cell-narrow { min-height: 200px; display: flex; align-items: center; justify-content: center; }
.cell-medium { min-height: 260px; }
.cell-large { min-height: 320px; }
.cell-full { grid-column: 1 / -1; min-height: 200px; }

/* --- Typography --- */
h2 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.8rem, 4vw, 3.6rem);
    letter-spacing: 0.02em;
    color: var(--deep-walnut);
    margin-bottom: 1.5rem;
    font-variation-settings: 'WONK' 1, 'opsz' 48;
    transition: font-weight 0.3s ease;
}

h2:hover {
    font-weight: 700;
}

h3 {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.3rem, 2.5vw, 2rem);
    letter-spacing: 0.02em;
    color: var(--amethyst-dusk);
    margin-bottom: 1rem;
    font-variation-settings: 'WONK' 1, 'opsz' 36;
    transition: font-weight 0.3s ease;
}

h3:hover {
    font-weight: 600;
}

p {
    margin-bottom: 1rem;
}

a {
    color: var(--amethyst-dusk);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--emerald-lichen);
}

/* --- Drop Caps --- */
.drop-cap {
    float: left;
    font-family: var(--font-display);
    font-size: 3.5em;
    line-height: 0.8;
    padding-right: 0.08em;
    padding-top: 0.06em;
    color: var(--honeyed-amber);
    font-weight: 600;
    font-variation-settings: 'WONK' 1;
}

.drop-cap-dark {
    color: var(--honeyed-amber);
}

/* --- Caveat Labels --- */
.caveat-label {
    font-family: var(--font-accent);
    font-weight: 400;
    font-size: clamp(0.85rem, 1vw, 1.05rem);
    color: var(--moss-ink);
    margin-bottom: 0.5rem;
}

.caveat-text {
    font-family: var(--font-accent);
    font-size: clamp(1.1rem, 1.5vw, 1.4rem);
    color: var(--moss-ink);
}

/* --- Pull Quotes --- */
.pull-quote {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 300;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    color: var(--amethyst-dusk);
    border-left: 2px solid var(--brass-divider);
    padding-left: 1.5rem;
    margin: 2rem 0;
    line-height: 1.7;
}

/* --- Marginalia --- */
.marginalia {
    position: absolute;
    font-family: var(--font-accent);
    font-size: 0.9rem;
    color: var(--lichen-gray);
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 1.2s ease;
    z-index: 3;
}

.marginalia.in-view {
    opacity: 0.6;
}

.marginalia-left {
    left: -6rem;
}

.marginalia-right {
    right: -6rem;
}

.marginalia-dark {
    color: var(--lichen-gray);
}

/* --- Botanical SVGs --- */
.botanical-svg {
    width: 80px;
    height: auto;
    display: block;
    margin-bottom: 1.5rem;
    opacity: 0.7;
}

.botanical-fern { width: 70px; }
.botanical-mushroom { width: 50px; }
.botanical-clover { width: 45px; }
.botanical-pressed-flower { width: 120px; margin: 0 auto 1.5rem; }
.botanical-lichen { width: 40px; }
.botanical-branch { width: 90px; }

.svg-draw {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 2.5s ease-in-out;
}

.in-view .svg-draw {
    stroke-dashoffset: 0;
}

/* --- Breathing Rooms --- */
.breathing-room {
    height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.breathing-text {
    text-align: center;
    max-width: 500px;
    padding: 0 2rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1.5s ease, transform 1.5s ease;
}

.breathing-text.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* --- Dark Drawer --- */
.drawer-dark {
    background-color: var(--specimen-black);
    color: var(--ivory-vellum);
    max-width: 100%;
    padding: 6rem var(--page-inset);
    margin: 0;
}

.drawer-dark .drawer-grid {
    max-width: var(--page-max-width);
    margin: 0 auto;
}

.drawer-dark h2 {
    color: var(--ivory-vellum);
}

.drawer-dark .cell {
    border-color: rgba(191, 167, 106, 0.4);
}

.drawer-dark .cell:hover {
    border-color: var(--honeyed-amber);
    box-shadow: inset 0 0 16px rgba(212, 168, 75, 0.2);
}

.drawer-dark .caveat-label {
    color: var(--honeyed-amber);
}

/* --- Horizontal Scroll Strip --- */
.horizontal-scroll-strip {
    max-width: var(--page-max-width);
    margin: 3rem auto 0;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 1rem;
}

.horizontal-scroll-strip::-webkit-scrollbar {
    height: 4px;
}

.horizontal-scroll-strip::-webkit-scrollbar-track {
    background: rgba(191, 167, 106, 0.15);
    border-radius: 2px;
}

.horizontal-scroll-strip::-webkit-scrollbar-thumb {
    background: var(--brass-divider);
    border-radius: 2px;
}

.scroll-container {
    display: flex;
    gap: 0;
    width: max-content;
}

/* --- Specimen Cards --- */
.specimen-card {
    width: 220px;
    min-height: 260px;
    flex-shrink: 0;
    scroll-snap-align: start;
    border: 1px solid rgba(191, 167, 106, 0.4);
    border-radius: 2px;
    padding: 2rem 1.5rem;
    text-align: center;
    position: relative;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    background: rgba(26, 21, 16, 0.6);
}

.specimen-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.pin-shadow {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.15);
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    transition: width 0.3s ease, height 0.3s ease, filter 0.3s ease;
}

.specimen-card:hover .pin-shadow {
    width: 10px;
    height: 10px;
    filter: blur(2px);
}

.specimen-svg {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    display: block;
}

.specimen-meta {
    font-family: var(--font-body);
    font-size: 0.75rem;
    color: var(--lichen-gray);
    font-variant: small-caps;
    letter-spacing: 0.08em;
}

/* --- Transition to Light --- */
.transition-to-light {
    background: linear-gradient(to bottom, var(--specimen-black), var(--ivory-vellum));
}

.transition-to-light .breathing-text {
    color: var(--ivory-vellum);
}

.transition-to-light .firefly {
    z-index: 10;
}

/* --- Return Section --- */
.drawer-return {
    padding-top: 6rem;
}

/* --- Colophon Footer --- */
.colophon {
    text-align: center;
    padding: 6rem 2rem 4rem;
    max-width: 600px;
    margin: 0 auto;
}

.colophon-fleuron {
    width: 40px;
    height: 40px;
    margin: 0 auto 2rem;
    display: block;
}

.colophon-title {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 500;
    font-size: 2rem;
    letter-spacing: 0.06em;
    color: var(--deep-walnut);
    margin-bottom: 0.3rem;
    font-variation-settings: 'WONK' 1;
}

.colophon-subtitle {
    font-family: var(--font-body);
    font-variant: small-caps;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    color: var(--lichen-gray);
    margin-bottom: 3rem;
}

.colophon-toc {
    margin: 2rem auto;
    max-width: 300px;
}

.toc-heading {
    font-family: var(--font-body);
    font-variant: small-caps;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    color: var(--brass-divider);
    margin-bottom: 1rem;
    text-align: center;
}

.colophon-toc ul {
    list-style: none;
}

.colophon-toc li {
    margin-bottom: 0.5rem;
}

.colophon-toc a {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    color: var(--deep-walnut);
    text-decoration: none;
    transition: color 0.3s ease;
    padding: 0.2rem 0;
    border-bottom: 1px dotted var(--lichen-gray);
}

.colophon-toc a:hover {
    color: var(--amethyst-dusk);
}

.toc-label {
    font-family: var(--font-body);
    font-variant: small-caps;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
}

.toc-num {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 0.85rem;
    color: var(--brass-divider);
}

.colophon-note {
    font-family: var(--font-accent);
    font-size: 0.9rem;
    color: var(--lichen-gray);
    margin-top: 2rem;
}

.colophon-year {
    font-family: var(--font-body);
    font-variant: small-caps;
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    color: var(--brass-divider);
    margin-top: 1.5rem;
}

/* --- Corner Ornaments --- */
.cell::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    width: 10px;
    height: 10px;
    border-top: 1.5px solid var(--brass-divider);
    border-left: 1.5px solid var(--brass-divider);
    opacity: 0.5;
    pointer-events: none;
}

.cell::after {
    content: '';
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 10px;
    height: 10px;
    border-bottom: 1.5px solid var(--brass-divider);
    border-right: 1.5px solid var(--brass-divider);
    opacity: 0.5;
    pointer-events: none;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .drawer-grid-1,
    .drawer-grid-2,
    .drawer-grid-4 {
        grid-template-columns: 1fr;
    }

    .marginalia {
        display: none;
    }

    .cell-inner {
        padding: 2rem;
    }

    .main-nav ul {
        gap: 1.5rem;
    }

    .main-nav a {
        font-size: 0.75rem;
    }

    .breathing-room {
        height: 40vh;
    }

    .opening-viewport {
        height: 100svh;
    }
}

@media (max-width: 480px) {
    .vine-line {
        width: 85vw;
    }

    .title-word {
        font-size: clamp(2.5rem, 12vw, 4rem);
    }

    .specimen-card {
        width: 180px;
        min-height: 220px;
        padding: 1.5rem 1rem;
    }
}
