/* The shelf (/games): a wooden bookcase of game boxes with a spotlight panel.
   Loaded after landing.css and leans on its theme variables. Wood tones are
   deliberately literal (it's furniture) and shared across both themes. */

.shelf-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
}

.shelf-head h1 {
    margin: 0;
    font-family: Fraunces, Georgia, serif;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.05;
    font-size: clamp(48px, 6vw, 72px);
}

.shelf-head p {
    max-width: 640px;
    margin: 0;
    color: var(--ink-dim);
    font-size: 18px;
}

/* The shelf earns more room than the text column. */
.container-wide {
    width: min(100% - 32px, 1400px);
    margin: 0 auto;
}

.shelf-count-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    border-radius: 12px;
    background: #07383d;
    color: #fff1dc;
    padding: 18px 24px;
}

.shelf-count-badge b {
    font: 700 40px/1 "JetBrains Mono", monospace;
    color: #a6e3c0;
}

.shelf-count-badge span {
    max-width: 110px;
    font: 400 11px/1.5 "JetBrains Mono", monospace;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 241, 220, 0.6);
}

.games-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px 20px;
    margin-bottom: 28px;
}

.games-toolbar .games-count {
    margin-left: 0;
}

.shelf-weight-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.games-count {
    margin: 0 0 0 auto;
    font: 400 12px/1.4 "JetBrains Mono", monospace;
    color: var(--ink-mute);
}

/* The bookcase */

.bookcase {
    border-radius: 18px;
    padding: 22px 22px 26px;
    background: linear-gradient(175deg, #a56a35 0%, #8f5527 55%, #7c4820 100%);
    box-shadow:
        inset 0 2px 0 rgba(255, 241, 220, 0.25),
        inset 0 -3px 0 rgba(0, 0, 0, 0.25),
        0 36px 70px -30px rgba(7, 56, 61, 0.55);
}

.case-back {
    border-radius: 8px;
    background:
        radial-gradient(120% 90% at 50% 0%, rgba(255, 241, 220, 0.1) 0%, transparent 55%),
        linear-gradient(180deg, #5e3a1b 0%, #4c2e14 100%);
    padding: 26px 18px 12px;
    box-shadow: inset 0 10px 26px rgba(0, 0, 0, 0.45);
}

/* No-JS fallback: boxes wrap directly on the case back. */
.case-back {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 18px;
}

.shelf-row {
    display: flex;
    align-items: flex-end;
    gap: 18px;
    padding: 12px 14px 0;
    width: 100%;
}

.plank {
    height: 16px;
    width: calc(100% + 36px);
    margin: 0 -18px;
    border-radius: 2px;
    background: linear-gradient(180deg, #c08a4c 0%, #9c6430 45%, #7c4820 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 241, 220, 0.35),
        0 6px 12px rgba(0, 0, 0, 0.38);
}

/* A game box */

.shelf-box {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    width: 170px;
    flex-shrink: 0;
    overflow: hidden;
    border: 0;
    border-radius: 7px 7px 3px 3px;
    padding: 14px 14px 12px;
    cursor: pointer;
    text-align: left;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    background: linear-gradient(165deg, #0f6b58 0%, #07383d 100%);
    box-shadow:
        inset 0 2px 0 rgba(255, 241, 220, 0.28),
        inset -4px 0 8px rgba(0, 0, 0, 0.22),
        6px 10px 18px rgba(0, 0, 0, 0.38);
    transition: transform 0.45s cubic-bezier(0.3, 0, 0.2, 1), box-shadow 0.35s ease;
}

.shelf-box.is-tilted {
    transform: rotate(-1deg);
}

.shelf-box:hover {
    transform: translateY(-10px);
}

.shelf-box:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.shelf-box.is-picked {
    transform: translateY(-16px) scale(1.05);
    box-shadow:
        inset 0 2px 0 rgba(255, 241, 220, 0.28),
        6px 22px 30px rgba(0, 0, 0, 0.45),
        0 0 0 3px #a6e3c0;
    z-index: 2;
}

.box-art {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Legibility over cover art: darken the label zone. */
.box-art + .box-title,
.box-art ~ .box-label {
    position: relative;
}

.box-art + .box-title {
    background: rgba(7, 24, 20, 0.55);
    border-radius: 5px;
    padding: 4px 7px;
    backdrop-filter: blur(2px);
}

.box-title {
    font-family: Fraunces, Georgia, serif;
    font-weight: 700;
    font-size: 16px;
    line-height: 1.15;
    color: #fff1dc;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.box-label {
    margin-top: 10px;
    background: #fff1dc;
    border-radius: 5px;
    padding: 7px 9px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.28);
}

.box-facts {
    font: 400 10px/1.4 "JetBrains Mono", monospace;
    color: rgba(7, 56, 61, 0.68);
}

.pip-row {
    display: flex;
    align-items: center;
    gap: 3px;
}

.pip {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    display: inline-block;
    background: rgba(7, 56, 61, 0.16);
}

.pip.is-filled {
    background: #0f6b58;
}

.pip-value {
    margin-left: 4px;
    font: 400 9px/1 "JetBrains Mono", monospace;
    color: rgba(7, 56, 61, 0.42);
}

.shelf-bare {
    display: grid;
    justify-items: center;
    gap: 8px;
    width: 100%;
    padding: 64px 48px;
    text-align: center;
    color: #fff1dc;
}

.shelf-bare b {
    font-family: Fraunces, Georgia, serif;
    font-size: 24px;
}

.shelf-bare span {
    font-size: 14px;
    color: rgba(255, 241, 220, 0.68);
}

.shelf-hint {
    margin: 14px 0 0;
    text-align: center;
    font: 400 12px/1.5 "JetBrains Mono", monospace;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-mute);
}

/* The spotlight ("off the shelf") — a dark teal panel, so remap the theme
   variables the shared .game-detail-block styles read. */

.shelf-spotlight {
    --ink: #fff1dc;
    --ink-dim: rgba(255, 241, 220, 0.78);
    --ink-mute: rgba(255, 241, 220, 0.55);
    --line: rgba(255, 241, 220, 0.14);
    border-radius: 18px;
    background:
        radial-gradient(rgba(255, 241, 220, 0.06) 1.5px, transparent 1.5px) 0 0 / 26px 26px,
        linear-gradient(180deg, #07383d 0%, #04262a 100%);
    color: #fff1dc;
    padding: 48px;
    box-shadow: 0 32px 72px -28px rgba(7, 56, 61, 0.5);
}

/* The pull-off-the-shelf flight (a fixed clone of the clicked box). */

.box-flight {
    position: fixed;
    z-index: 60;
    margin: 0;
    pointer-events: none;
    will-change: transform, opacity;
    animation: box-pull 0.9s cubic-bezier(0.45, 0, 0.15, 1) forwards;
    transition: opacity 0.35s ease;
}

.box-flight.is-fading {
    opacity: 0;
}

/* Two beats, one continuous motion: a controlled lift off the plank (the box
   eases up and tips slightly, the way a hand rocks it free), then a smooth
   glide to center that decelerates into the landing. */
@keyframes box-pull {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
        box-shadow: 6px 10px 18px rgba(0, 0, 0, 0.38);
    }
    38% {
        transform: translate(0, -34px) scale(1.04) rotate(-3.5deg);
        box-shadow: 8px 30px 40px rgba(0, 0, 0, 0.42);
        animation-timing-function: cubic-bezier(0.3, 0, 0.2, 1);
    }
    100% {
        transform: translate(var(--fly-x, 0), var(--fly-y, 0)) scale(var(--fly-scale, 1.6)) rotate(1deg);
        box-shadow: 0 44px 80px rgba(0, 0, 0, 0.55);
    }
}

/* The modal */

.shelf-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(4, 24, 22, 0.55);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.shelf-modal-overlay[hidden] {
    display: none;
}

.shelf-modal-overlay.is-open {
    opacity: 1;
}

.shelf-modal {
    position: relative;
    width: min(880px, 100%);
    max-height: min(85vh, 100%);
    overflow-y: auto;
    transform: translateY(14px) scale(0.96);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
}

.shelf-modal-overlay.is-open .shelf-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.shelf-modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 241, 220, 0.25);
    border-radius: 999px;
    background: rgba(255, 241, 220, 0.08);
    color: #fff1dc;
    cursor: pointer;
}

.shelf-modal-close:hover {
    background: rgba(255, 241, 220, 0.18);
}

@media (prefers-reduced-motion: reduce) {
    .box-flight { animation: none; opacity: 0; }
    .shelf-modal,
    .shelf-modal-overlay { transition: none; }
    .shelf-box { transition: none; }
}

.spotlight-head {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 28px;
}

.spotlight-cover {
    width: 84px;
    height: 84px;
    flex-shrink: 0;
    border-radius: 12px;
    object-fit: cover;
    transform: rotate(-3deg);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
}

.spotlight-cover-fallback {
    display: grid;
    place-items: center;
    background: #0f6b58;
    color: #fff1dc;
    font-family: Fraunces, Georgia, serif;
    font-size: 38px;
    font-weight: 700;
}

.spotlight-title {
    display: grid;
    gap: 4px;
}

.spotlight-kicker {
    font: 700 11px/1.4 "JetBrains Mono", monospace;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #a6e3c0;
}

.spotlight-title b {
    font-family: Fraunces, Georgia, serif;
    font-size: 32px;
    line-height: 1.1;
}

.spotlight-title small {
    font: 400 12px/1.5 "JetBrains Mono", monospace;
    color: rgba(255, 241, 220, 0.6);
}

.spotlight-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.shelf-spotlight .game-detail-block {
    background: rgba(255, 241, 220, 0.06);
    border: 1px solid rgba(255, 241, 220, 0.14);
    border-radius: 12px;
    padding: 22px;
}

.shelf-spotlight .game-detail-block h3 {
    font: 700 11px/1.4 "JetBrains Mono", monospace;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #a6e3c0;
    margin: 0 0 10px;
}

@media (max-width: 920px) {
    .shelf-head {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .shelf-spotlight {
        padding: 28px 20px;
    }

    .shelf-row {
        gap: 12px;
    }
}
