/* Game Library: a wooden shelf of CD-ROM jewel cases (js/games.js).
   Each shelf row is exactly --gl-row tall, so the plank painted by the row's repeating
   background always sits under the cases, however many fit across. */
.games { gap: 4px; }
.gl-cabinet {
    position: relative; flex: 1 1 auto; min-height: 180px; overflow: hidden;
    padding: 2px; background: #2a170b; box-shadow: var(--bevel-in);
}
.gl-shelves {
    height: 100%; overflow-y: auto; padding: 10px 12px 4px;
    background:
        linear-gradient(90deg, rgba(0, 0, 0, 0.45), transparent 4%, transparent 96%, rgba(0, 0, 0, 0.45)),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 3px, rgba(0, 0, 0, 0.05) 3px 7px, transparent 7px 13px),
        linear-gradient(180deg, #3b2210, #4f2e16 60%, #3b2210);
}
.gl-group + .gl-group { margin-top: 14px; }
.gl-plaque {
    display: table; margin: 0 auto 6px; padding: 2px 12px;
    font: bold 11px/14px Georgia, "Times New Roman", serif; -webkit-font-smoothing: auto;
    letter-spacing: 1px; text-transform: uppercase; color: #3a2408;
    background: linear-gradient(180deg, #f6dc8a, #c9a03a 55%, #a87e22);
    box-shadow: inset 0 0 0 1px #6b4a12, 1px 1px 0 rgba(0, 0, 0, 0.5);
}
.gl-row {
    --gl-row: 330px;
    --gl-tall: 300px;
    list-style: none; margin: 0; padding: 0 10px;
    display: flex; flex-wrap: wrap; column-gap: 1px;
    background: repeating-linear-gradient(180deg,
        transparent 0, transparent calc(var(--gl-row) - 18px),
        rgba(0, 0, 0, 0.35) calc(var(--gl-row) - 18px), rgba(0, 0, 0, 0.35) calc(var(--gl-row) - 16px),
        #d39a5c calc(var(--gl-row) - 16px), #d39a5c calc(var(--gl-row) - 14px),
        #a8682f calc(var(--gl-row) - 14px), #8a5222 calc(var(--gl-row) - 4px),
        #4a2810 calc(var(--gl-row) - 4px), #4a2810 var(--gl-row));
    box-shadow: -6px 0 0 #4a2810, 6px 0 0 #4a2810;
}
.gl-row li { height: var(--gl-row); display: flex; align-items: flex-end; justify-content: center; padding-bottom: 15px; }

/* ------------------------------------------------------------ jewel case, end-on */
.gl-case, .gl-case:active {
    --gl-accent: #000080;
    position: relative; display: block; flex: none;
    width: 26px; height: var(--gl-tall); min-width: 0; min-height: 0; padding: 2px; border: 0; border-radius: 1px;
    /* clear plastic edges either side of the printed strip */
    background: linear-gradient(90deg, rgba(235, 242, 250, 0.75), rgba(160, 175, 190, 0.55) 40%, rgba(235, 242, 250, 0.75));
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45), 2px 0 0 rgba(0, 0, 0, 0.35);
    transition: transform 0.15s ease-out;
}
.gl-case:hover, .gl-case:focus-visible { transform: translateY(-8px); }
.gl-case.is-out { transform: translateY(-40px); opacity: 0; transition: transform 0.25s ease-in, opacity 0.25s ease-in; }
.gl-case:focus { outline: none; }
.gl-case:focus-visible { outline: 2px dotted #ff0; outline-offset: 2px; }
/* a scanned spine, at its own aspect ratio */
.gl-case--photo, .gl-case--photo:active { width: auto; height: var(--gl-tall); padding: 0 2px; }
.gl-spine-photo { display: block; height: 100%; width: auto; }
.gl-case--photo::after {
    content: ""; position: absolute; inset: 0 2px; pointer-events: none;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.3), transparent 25%, rgba(255, 255, 255, 0.22) 50%, transparent 70%, rgba(0, 0, 0, 0.3));
}
.gl-spine {
    position: relative; display: flex; flex-direction: column; align-items: center; height: 100%; overflow: hidden;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.25), transparent 30%, rgba(255, 255, 255, 0.18) 55%, rgba(0, 0, 0, 0.25)), var(--gl-accent);
    color: #fff; -webkit-font-smoothing: auto;
}
.gl-spine::after { /* shine on the plastic over the print */
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.3), transparent 12%, transparent 88%, rgba(0, 0, 0, 0.25));
}
.gl-spine-series {
    flex: none; width: 100%; padding: 2px 0; background: #000; color: #ffe08a;
    font: bold 9px/22px Arial, sans-serif; letter-spacing: 1.5px; text-align: center; text-transform: uppercase;
    writing-mode: vertical-rl; height: 84px;
}
.gl-spine-title {
    flex: 1 1 auto; min-height: 0; overflow: hidden; padding: 8px 0; width: 100%;
    writing-mode: vertical-rl; text-align: center; white-space: nowrap; text-overflow: ellipsis;
    font: bold 11px/22px Georgia, "Times New Roman", serif; text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6);
}
.gl-spine-num {
    flex: none; width: 17px; height: 17px; margin-bottom: 4px; border-radius: 50%;
    background: #fff; color: #000; font: bold 8px/17px Arial, sans-serif; text-align: center;
}
.gl-bookend { position: relative; width: 30px; }
.gl-bookend::before, .gl-bookend::after { content: ""; position: absolute; bottom: 15px; background: #2b2b2b; box-shadow: inset 1px 1px rgba(255, 255, 255, 0.25); }
.gl-bookend::before { left: 3px; width: 6px; height: 150px; }
.gl-bookend::after { left: 3px; width: 30px; height: 5px; }

/* ------------------------------------------------------------ opened case */
.gl-open {
    position: absolute; inset: 8px; z-index: 3; overflow: auto;
    display: flex; flex-direction: column; gap: 8px; padding: 8px;
    background: var(--silver); box-shadow: var(--bevel-out), 4px 4px 0 rgba(0, 0, 0, 0.5);
}
.gl-open:focus { outline: none; }
.gl-opencase { flex: 1 1 auto; display: grid; grid-template-columns: 3fr 2fr; gap: 6px; min-height: 260px; }
.gl-booklet {
    --gl-accent: #000080;
    overflow-y: auto; padding: 12px 14px; line-height: 1.45; user-select: text;
    background: #fffdf4; border-top: 6px solid var(--gl-accent); box-shadow: var(--bevel-in);
}
.gl-booklet p { margin: 0 0 8px; }
.gl-kicker { color: #555; letter-spacing: 1px; text-transform: uppercase; }
.gl-booklet h3 {
    margin: 2px 0 10px; color: var(--gl-accent);
    font: bold 20px/1.15 Georgia, "Times New Roman", serif; -webkit-font-smoothing: auto;
}
.gl-facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0 0 10px; }
.gl-facts dt { font-weight: bold; }
.gl-facts dd { margin: 0; }
/* The 3D case: six faces around the centre of .gl-box, sized in JS from the scans. */
.gl-stage {
    position: relative; min-height: 0; overflow: hidden; perspective: 1100px;
    display: grid; place-items: center; touch-action: none; cursor: grab;
    user-select: none; -webkit-user-select: none;
    background:
        radial-gradient(ellipse 60% 12% at 50% 88%, rgba(0, 0, 0, 0.55), transparent 70%),
        linear-gradient(180deg, #2a3248, #141826);
    box-shadow: var(--bevel-in);
}
.gl-stage.is-dragging { cursor: grabbing; }
.gl-stage:focus { outline: none; }
.gl-stage:focus-visible { outline: 2px dotted #ff0; outline-offset: -4px; }
.gl-box { --gl-accent: #000080; position: relative; width: 0; height: 0; transform-style: preserve-3d; }
.gl-box.is-animating { transition: transform 0.7s cubic-bezier(0.2, 0.75, 0.25, 1); }
.gl-face {
    position: absolute; left: 0; top: 0; overflow: hidden;
    backface-visibility: hidden; -webkit-backface-visibility: hidden;
    background: var(--gl-accent);
}
.gl-face img { display: block; width: 100%; height: 100%; object-fit: fill; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.gl-face .gl-spine { height: 100%; }
.gl-face::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.gl-face-front::after { background: linear-gradient(115deg, rgba(255, 255, 255, 0.18), transparent 30%, transparent 75%, rgba(255, 255, 255, 0.08)); }
.gl-face-back::after { background: rgba(0, 0, 0, 0.06); }
.gl-face-spine::after { background: linear-gradient(90deg, rgba(0, 0, 0, 0.35), rgba(255, 255, 255, 0.12) 45%, rgba(0, 0, 0, 0.3)); }
.gl-face-edge, .gl-face-top, .gl-face-bottom { background: linear-gradient(90deg, #111, #2c2c2c 50%, #111); }
.gl-face-edge { background: repeating-linear-gradient(90deg, #1b1b1b 0 2px, #2e2e2e 2px 3px); }
.gl-face-top::after { background: rgba(255, 255, 255, 0.12); }
.gl-face-bottom::after { background: rgba(0, 0, 0, 0.4); }
.gl-face-back p {
    margin: 0; padding: 20px; color: #fff; text-align: center;
    font: bold 16px/1.2 Georgia, "Times New Roman", serif; -webkit-font-smoothing: auto;
}
/* The front cover, hinged on its left (spine) edge. */
.gl-lid {
    position: absolute; left: 0; top: 0; transform-style: preserve-3d; transform-origin: 0 50%;
    transform: translateZ(var(--gl-z));
    transition: transform 0.8s cubic-bezier(0.3, 0.7, 0.25, 1);
}
.gl-box.is-open .gl-lid { transform: translateZ(var(--gl-z)) rotateY(-160deg); }
.gl-lid > .gl-face { margin: 0; width: 100%; height: 100%; }
.gl-lid-inner {
    transform: rotateY(180deg);
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.05), transparent 20%),
        repeating-linear-gradient(0deg, #1c1d22 0 3px, #22232a 3px 4px);
}
.gl-lid-inner::after { /* the little clips that hold a manual */
    background:
        linear-gradient(#0c0c0f, #0c0c0f) 12px 14px / 10px 18px no-repeat,
        linear-gradient(#0c0c0f, #0c0c0f) 12px calc(100% - 14px) / 10px 18px no-repeat;
}
.gl-face-tray {
    display: grid; place-items: center; overflow: visible; transform-style: preserve-3d;
    background:
        radial-gradient(circle, #3a3c44 0 7%, #15161a 7.5% 9%, transparent 9.5%),
        repeating-radial-gradient(circle, #1d1e23 0 2px, #222329 2px 4px);
}
.gl-disc, .gl-disc:active {
    position: relative; min-width: 0; min-height: 0; padding: 0; border: 0; border-radius: 50%;
    background: transparent; box-shadow: none; cursor: pointer;
    transform: translateZ(1px); transition: transform 0.6s cubic-bezier(0.3, 0.7, 0.25, 1);
}
.gl-disc:focus { outline: none; }
.gl-disc:focus-visible { outline: 2px dotted #ff0; outline-offset: 3px; }
.gl-disc.is-out { transform: translateZ(70px) translateY(-6%); }
.gl-disc-spin {
    position: relative; display: block; width: 100%; height: 100%; border-radius: 50%; overflow: hidden;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5), 0 6px 14px rgba(0, 0, 0, 0.6);
    -webkit-mask: radial-gradient(circle, transparent 0 7.5%, #000 8%);
    mask: radial-gradient(circle, transparent 0 7.5%, #000 8%);
}
.gl-disc-spin img { display: block; width: 100%; height: 100%; pointer-events: none; -webkit-user-drag: none; }
.gl-disc-spin::after { /* rainbow sheen off the data side showing through */
    content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
    background: conic-gradient(from 30deg, transparent 0 20deg, rgba(255, 255, 255, 0.18) 45deg, transparent 80deg 200deg, rgba(255, 255, 255, 0.12) 225deg, transparent 260deg);
}
.gl-disc.is-out .gl-disc-spin { animation: gl-disc-spin 2.4s linear infinite; }
@keyframes gl-disc-spin { to { transform: rotate(360deg); } }
.gl-hint { color: #666; }
.gl-views { display: inline-flex; gap: 2px; }
.gl-views button { min-width: 52px; }
.gl-open-buttons { flex: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }

html:not(.js) .games .toolbar, html:not(.js) .gl-shelves { display: none; }
html:not(.js) .gl-cabinet { flex: none; }

@media (max-width: 640px), (max-height: 480px) {
    .gl-row { --gl-row: 290px; --gl-tall: 260px; }
    .gl-spine-title { font-size: 10px; }
    .gl-opencase { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .gl-stage { height: 300px; }
    .gl-booklet { overflow: visible; }
    .gl-open-buttons button { min-height: 34px; }
}
