/* miris.works -- Light-academia bento-box library catalog */
/* Palette: #F5ECD4 (Parchment), #5C3E1E (Library Oak), #C4A050 (Reading Lamp), #6B8B5E (Sage Leaf), #8B7B60 (Dust), #EDE4D0 (Vellum), #2E2316 (Deep Walnut), #D4C4A0 (Foxed Gold) */

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

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

body {
    background-color: #F5ECD4;
    color: #2E2316;
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.8;
    overflow-x: hidden;
}

.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* Bento Grid Base */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Bento Card Base */
.bento-card {
    position: relative;
    background: linear-gradient(135deg, #EDE4D0 0%, #F5ECD4 40%, #EDE4D0 100%);
    border: 1px solid #D4C4A0;
    border-radius: 3px;
    padding: clamp(1.25rem, 2vw, 2rem);
    transition: transform 300ms ease, box-shadow 300ms ease;
    overflow: hidden;
}

.bento-card::before {
    content: '';
    position: absolute;
    inset: 0;
    filter: url(#paperNoise);
    opacity: 0.015;
    pointer-events: none;
}

.bento-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 12px rgba(46, 35, 22, 0.08);
}

/* Catalog Numbers */
.catalog-number {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #8B7B60;
    letter-spacing: 0.05em;
}

/* Shelf Lines */
.shelf-line {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    height: 0.5px;
    background: #D4C4A0;
}

/* Shelf Sections */
.shelf {
    padding: 4vh 0;
}

/* ─── Shelf 1: Hero ─── */
.shelf-hero {
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.hero-grid {
    grid-template-rows: auto auto;
}

.card-main {
    grid-column: 1 / 4;
    grid-row: 1 / 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 50vh;
    text-align: center;
}

.hero-title {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(3rem, 7vw, 6rem);
    letter-spacing: -0.01em;
    color: #5C3E1E;
    line-height: 1.1;
}

.hero-subtitle {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #8B7B60;
    margin-top: 1rem;
}

.card-leaf {
    grid-column: 4;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.leaf-svg {
    width: 50px;
    height: auto;
    opacity: 0.4;
}

.card-circle {
    grid-column: 4;
    grid-row: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-label {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #8B7B60;
    text-align: center;
}

.card-ornament {
    display: none; /* Appears on larger screens as extra detail */
}

.ornament-ampersand {
    font-family: 'Lora', serif;
    font-size: 6rem;
    color: #5C3E1E;
    opacity: 0.08;
    line-height: 1;
}

/* ─── Shelf 2: Featured Works ─── */
.shelf-featured {
    padding-top: 6vh;
    padding-bottom: 6vh;
}

.works-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(180px, auto);
}

.card-2x2 {
    grid-column: span 2;
    grid-row: span 2;
}

.card-1x1 {
    grid-column: span 1;
    grid-row: span 1;
}

.card-3x1 {
    grid-column: span 3;
    grid-row: span 1;
}

.work-title {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.25rem, 2.5vw, 2rem);
    color: #5C3E1E;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.work-desc {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.8;
    color: #2E2316;
}

/* Leaf corner decorations */
.leaf-corner {
    position: absolute;
    width: 40px;
    height: 40px;
    pointer-events: none;
}

.leaf-corner-tr {
    top: 0.5rem;
    right: 2.5rem;
}

/* ─── Shelf 3: The Archive ─── */
.shelf-archive {
    padding-top: 6vh;
    padding-bottom: 6vh;
    background-color: #EDE4D0;
}

.archive-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: auto;
}

.archive-card {
    padding: clamp(0.75rem, 1.5vw, 1.25rem);
    background: linear-gradient(135deg, #E5DCC6 0%, #EDE4D0 50%, #E5DCC6 100%);
}

.archive-title {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 0.875rem;
    color: #5C3E1E;
    line-height: 1.4;
}

/* ─── Shelf 4: The Colophon ─── */
.shelf-colophon {
    padding-top: 8vh;
    padding-bottom: 8vh;
}

.colophon-grid {
    grid-template-columns: 1fr;
}

.colophon-card {
    grid-column: 1 / -1;
    text-align: center;
    padding: clamp(2rem, 4vw, 4rem);
}

.colophon-text {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    color: #5C3E1E;
    line-height: 1.7;
    max-width: 42ch;
    margin: 0 auto 2rem;
}

.colophon-leaf {
    width: 80px;
    height: auto;
    margin: 0 auto;
    display: block;
}

.leaf-draw {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 2s ease;
}

.colophon-card.revealed .leaf-draw {
    stroke-dashoffset: 0;
}

.leaf-vein {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset 2.5s ease 0.5s;
}

.colophon-card.revealed .leaf-vein {
    stroke-dashoffset: 0;
}

/* Fading shelf lines */
.shelf-line-1 {
    opacity: 1;
    margin-top: 2rem;
}

.shelf-line-2 {
    opacity: 0.5;
    margin-top: 1rem;
}

.shelf-line-3 {
    opacity: 0.25;
    margin-top: 1rem;
}

/* Reveal Animation */
.bento-card {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 400ms ease, transform 400ms ease, box-shadow 300ms ease;
}

.bento-card.revealed {
    opacity: 1;
    transform: translateY(0);
}

.bento-card:hover.revealed {
    transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 0 1rem;
    }

    .card-main {
        grid-column: 1 / -1;
        grid-row: auto;
        min-height: 40vh;
    }

    .card-leaf {
        grid-column: 1;
        grid-row: auto;
    }

    .card-circle {
        grid-column: 2;
        grid-row: auto;
    }

    .card-2x2 {
        grid-column: 1 / -1;
        grid-row: span 1;
    }

    .card-3x1 {
        grid-column: 1 / -1;
    }

    .works-grid {
        grid-auto-rows: auto;
    }

    .archive-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .card-ornament {
        display: flex;
        align-items: center;
        justify-content: center;
        grid-column: 4;
        grid-row: 1 / 3;
    }

    .card-leaf {
        grid-column: 4;
        grid-row: 1;
    }

    .card-circle {
        grid-column: 4;
        grid-row: 2;
    }

    .hero-grid {
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: 1fr 1fr;
    }

    .card-main {
        grid-column: 1 / 4;
        grid-row: 1 / 3;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bento-card {
        opacity: 1;
        transform: none;
        transition: box-shadow 300ms ease;
    }

    .leaf-draw,
    .leaf-vein {
        stroke-dashoffset: 0;
        transition: none;
    }
}
