/* ============================================================
   yongjoon.net — Shadow Box Bento-Box Personal Archive
   Palette: Paper Cream, Linen, Blush, Sage, Sky, Butter,
            Walnut, Reading Brown, Shelf Brown, Ink Blue, Terracotta
   ============================================================ */

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

html, body {
    background-color: #FAF5ED;
    color: #5A4E40;
    font-family: 'Nunito Sans', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    /* subtle paper texture for the page background */
    background-image:
        repeating-linear-gradient(
            0deg,
            rgba(58, 46, 37, 0.02),
            rgba(58, 46, 37, 0.02) 0.5px,
            transparent 0.5px,
            transparent 8px
        );
    min-height: 100vh;
    padding: 16px;
}

/* ============================================================
   Bento-Box Grid — the shadow box
   ============================================================ */

.shadow-box {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    grid-auto-rows: 160px;
    grid-auto-flow: dense;
    gap: 4px;
    max-width: 1440px;
    margin: 0 auto;
}

/* ============================================================
   Compartment base
   ============================================================ */

.compartment {
    position: relative;
    padding: 18px 20px;
    overflow: hidden;
    transition: transform 200ms ease, box-shadow 200ms ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 6px;
    /* paper texture inside compartments */
    background-image:
        repeating-linear-gradient(
            0deg,
            rgba(58, 46, 37, 0.03),
            rgba(58, 46, 37, 0.03) 0.5px,
            transparent 0.5px,
            transparent 8px
        );
}

/* hover-lift — the only hover animation */
.compartment:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(58, 46, 37, 0.12);
    z-index: 2;
}

/* compartments without content are still pleasant on hover */
.compartment[aria-hidden="true"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(58, 46, 37, 0.08);
}

/* compartment sizes */
.compartment--small  { grid-column: span 1; grid-row: span 1; }
.compartment--medium { grid-column: span 2; grid-row: span 1; }
.compartment--large  { grid-column: span 2; grid-row: span 2; }
.compartment--tall   { grid-column: span 1; grid-row: span 2; }

/* deliberate inconsistent border treatment */
.compartment.bordered {
    border: 2px solid rgba(139, 115, 85, 0.30);
}

/* ============================================================
   Background palette — varied per compartment
   ============================================================ */

.bg-paper  { background-color: #FAF5ED; }
.bg-linen  { background-color: #F5EDE0; }
.bg-blush  { background-color: #F0DDD5; }
.bg-sage   { background-color: #D5E5D5; }
.bg-sky    { background-color: #D5DDE8; }
.bg-butter { background-color: #F0E8C8; }

/* keep paper texture readable; layer color first then texture */
.bg-paper, .bg-linen, .bg-blush, .bg-sage, .bg-sky, .bg-butter {
    background-blend-mode: multiply;
}

/* ============================================================
   Typography inside compartments
   ============================================================ */

.compartment-title {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 700;
    color: #3A2E25;
    font-size: 22px;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.compartment-title--small {
    font-size: 18px;
}

.compartment--large .compartment-title {
    font-size: 28px;
}

.compartment--welcome .compartment-title {
    font-size: 32px;
}

.compartment-body {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: 15px;
    line-height: 1.6;
    color: #5A4E40;
}

.compartment-body--small {
    font-size: 13px;
    line-height: 1.5;
}

.compartment-tag {
    font-family: 'Inconsolata', 'Courier New', monospace;
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 0.04em;
    color: #8B7355;
    text-transform: lowercase;
}

.compartment--small .compartment-tag {
    font-size: 11px;
}

.compartment-handwriting {
    font-family: 'Kalam', cursive;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.5;
    color: #2C4A6E;
}

.compartment-handwriting--small {
    font-size: 14px;
}

.compartment-quote {
    font-family: 'Kalam', cursive;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.45;
    color: #2C4A6E;
    margin-top: 4px;
}

.compartment-quote--small {
    font-size: 15px;
}

.compartment-attribution {
    font-family: 'Inconsolata', monospace;
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.04em;
    color: #8B7355;
    margin-top: auto;
    padding-top: 8px;
}

/* link compartments */
.compartment--link {
    cursor: pointer;
}

.compartment-link-title {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 700;
    font-size: 18px;
    color: #3A2E25;
    line-height: 1.25;
}

.compartment-link-title--small {
    font-size: 14px;
}

.compartment--medium .compartment-link-title {
    font-size: 22px;
}

.link-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    box-shadow: inset 0 0 0 1px rgba(58, 46, 37, 0.2);
}

/* ============================================================
   Pinned-marker motif (pushpin)
   ============================================================ */

.pinned-marker {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 8px;
    height: 8px;
    background-color: #C47A5A;
    border-radius: 50%;
    box-shadow:
        0 0 0 1px rgba(58, 46, 37, 0.15),
        0 1px 2px rgba(58, 46, 37, 0.25);
    z-index: 3;
}

.pinned-marker::after {
    content: "";
    position: absolute;
    top: 7px;
    left: 3px;
    width: 2px;
    height: 12px;
    background: linear-gradient(
        to bottom,
        rgba(196, 122, 90, 0.9),
        rgba(196, 122, 90, 0)
    );
}

.pinned {
    padding-top: 28px;
}

/* ============================================================
   Book-stack motif
   ============================================================ */

.motif-books {
    position: absolute;
    bottom: 10px;
    right: 12px;
    width: 70px;
    height: 46px;
    opacity: 0.20;
    pointer-events: none;
}

.motif-books svg {
    width: 100%;
    height: 100%;
}

.motif-books svg rect {
    fill: #5A4E40;
    stroke: #3A2E25;
    stroke-width: 0.6;
}

.motif-books svg line {
    stroke: #3A2E25;
    stroke-width: 0.5;
    opacity: 0.6;
}

/* ============================================================
   Link list (elsewhere compartment)
   ============================================================ */

.link-list {
    list-style: none;
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.link-list li {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: 'Nunito Sans', sans-serif;
    font-size: 14px;
}

.link-list a {
    color: #3A2E25;
    text-decoration: none;
    border-bottom: 1px dotted rgba(58, 46, 37, 0.4);
    transition: border-color 200ms ease, color 200ms ease;
}

.link-list a:hover {
    color: #C47A5A;
    border-bottom-color: #C47A5A;
}

/* ============================================================
   Empty compartments — no padding, color only
   ============================================================ */

.compartment[aria-hidden="true"] {
    padding: 0;
}

/* slightly stronger paper texture in empties to hint a surface */
.compartment[aria-hidden="true"] {
    background-image:
        repeating-linear-gradient(
            0deg,
            rgba(58, 46, 37, 0.05),
            rgba(58, 46, 37, 0.05) 0.5px,
            transparent 0.5px,
            transparent 8px
        );
}

/* ============================================================
   Welcome compartment — subtle accent
   ============================================================ */

.compartment--welcome .compartment-handwriting {
    margin-top: auto;
}

/* ============================================================
   Animation — soft entrance for compartments
   ============================================================ */

@keyframes settle-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.compartment {
    animation: settle-in 600ms ease both;
    animation-delay: var(--settle-delay, 0ms);
}

/* ============================================================
   Reveal class — used by JS for when a compartment is "found"
   ============================================================ */

.compartment--revealed {
    box-shadow: 0 6px 16px rgba(58, 46, 37, 0.15);
}

/* ============================================================
   Responsive — collapse to single column on mobile
   ============================================================ */

@media (max-width: 768px) {
    body {
        padding: 8px;
    }

    .shadow-box {
        grid-template-columns: 1fr;
        grid-auto-rows: minmax(140px, auto);
    }

    .compartment--small,
    .compartment--medium,
    .compartment--large,
    .compartment--tall {
        grid-column: span 1;
        grid-row: span 1;
    }

    .compartment--large {
        grid-row: span 2;
    }

    .compartment-title {
        font-size: 20px;
    }

    .compartment--large .compartment-title,
    .compartment--welcome .compartment-title {
        font-size: 24px;
    }

    .motif-books {
        width: 56px;
        height: 36px;
    }
}

@media (max-width: 480px) {
    .compartment {
        padding: 14px 16px;
    }

    .pinned {
        padding-top: 24px;
    }
}

/* ============================================================
   Print-friendly (the open-web spirit)
   ============================================================ */

@media print {
    body { background: #fff; padding: 0; }
    .compartment { break-inside: avoid; box-shadow: none; }
}
