/* Close-up of the bookcase or the game shelf: the wall, wood, and font of the room. One art pixel is 2 CSS pixels, so sizes are even. */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* The space for the scrollbar is always kept, so the page does not move sideways when its length changes. */
html { background: #0a0806; scrollbar-gutter: stable; }

body {
    zoom: var(--s, 1);
    font-family: 'Jersey 10', monospace;
    -webkit-font-smoothing: none;
}

.closeup {
    --px: 2px; /* one art pixel */
    --plank: 12px;
    --ink: #120a06;
    --row: 158px;
    min-height: calc(100vh / var(--s, 1));
    overflow-x: clip;
    display: flex;
    flex-direction: column;
    background: url(/images/room/rail.svg) 0 0 / 16px 8px repeat-x, url(/images/room/wall.svg) 0 0 / 48px 48px;
    image-rendering: pixelated;
    color: var(--ink);
    font-size: 20px;
    line-height: 20px;
}

/* The column overlaps the ground, so the case stands 2px into the floor like the furniture in the room. */
.col {
    position: relative;
    z-index: 1;
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 960px;
    margin: 0 auto -14px;
    padding: 0 20px;
}

.ground {
    height: 172px;
    background: url(/images/room/skirting.svg) 0 0 / 96px 12px repeat-x, url(/images/room/floor.svg) 0 12px / 960px 126px repeat;
}

[data-title]:hover, [data-title]:focus-visible, .touring {
    outline: 2px solid #ffdf7f;
    outline-offset: 2px;
    z-index: 5;
}

/* Top row: a wood plate in each corner goes back to the room or across to the other shelf; the page text sits between them on the wall. */
.ways {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 14px;
}

.way { flex: none; width: 128px; height: 28px; display: flex; align-items: center; justify-content: center; color: #fde9cb; text-decoration: none; letter-spacing: 2px; background: url(/images/room/plate.svg) center / 100% 100% no-repeat; }
.way:hover, .way:focus-visible { outline: 2px solid #ffdf7f; outline-offset: 2px; }
.intro { flex: 1; max-width: 560px; margin: 4px auto 0; text-align: center; color: #e8dcc0; }
.intro a { color: #9fd0e6; text-decoration-thickness: 2px; text-underline-offset: 2px; }

/* Paper tags pinned to the wall. Jersey 10 has one weight and no italic, so emphasis is a colour. */
.paper {
    position: relative;
    flex: 1;
    padding: 14px 12px 8px;
    background: #f3ead2;
    border: 2px solid var(--ink);
    box-shadow: 4px 4px 0 #00000040;
}

.paper::before { content: ''; position: absolute; left: calc(50% - 4px); top: 4px; width: 6px; height: 6px; background: var(--pin, #c0392b); box-shadow: 2px 2px 0 var(--pin-dark, #7d1f16); }
.paper p + p { margin-top: 10px; }
.paper em { font-style: normal; color: #7a6a55; }
.paper strong { font-weight: 400; color: #a33b3b; }
.paper a { color: #2f5d8c; text-decoration-thickness: 2px; text-underline-offset: 2px; }

/* The sign stands on the case. The tags are pinned to the wall beside it and are as wide as their text. */
.top {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: end;
    gap: 0 12px;
    margin-top: auto;
    padding-top: 6px;
}

.tags { display: flex; gap: 8px; margin-bottom: 6px; }
.tags:last-child { justify-content: flex-end; }
.paper.tag { flex: none; padding: 12px 10px 4px; white-space: nowrap; }

.sign {
    width: 160px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fde9cb;
    font-size: 40px;
    font-weight: 400;
    letter-spacing: 2px;
    background: url(/images/room/sign.svg) center / 100% 100% no-repeat;
}

/* The case frame is a border-image: top board, side panels, and plinth around the shelves. */
.case {
    position: relative;
    border-style: solid;
    border-width: 14px 18px 20px;
    border-image: url(/images/room/case-frame.svg) 7 9 10 9 / 14px 18px 20px repeat;
    background: var(--ink);
    background-clip: padding-box;
}

.tier {
    display: grid;
    grid-template-columns: 56px 1fr;
}

.tier + .tier { margin-top: var(--px); }

.tier-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    font-weight: 400;
    color: var(--ink);
    background: var(--tier);
    border-right: var(--px) solid var(--ink);
    box-shadow: inset var(--px) var(--px) 0 #ffffff80, inset calc(var(--px) * -1) calc(var(--px) * -1) 0 #00000050;
}

.tier:is([data-tier="DNF"], [data-tier="WANT"]) .tier-label { font-size: 20px; }

.tier[data-tier="S"] { --tier: #ff7f7f; }
.tier[data-tier="A"] { --tier: #ffbf7f; }
.tier[data-tier="B"] { --tier: #ffdf7f; }
.tier[data-tier="C"] { --tier: #ffff7f; }
.tier[data-tier="D"] { --tier: #bfff7f; }
.tier[data-tier="E"] { --tier: #7fffff; }
.tier[data-tier="?"] { --tier: #b0b0b0; }
.tier[data-tier="DNF"] { --tier: #777; }
.tier[data-tier="WANT"] { --tier: #b0b0b0; }
.tier[data-tier="NF"] { --tier: #9f9fff; }

/* Each flex line is exactly --row tall, so the repeating row art puts one plank under each line. */
.shelf {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    padding: 0 10px;
    min-height: var(--row);
    background: url(/images/room/shelf-row-books.svg) 0 0 / 476px var(--row);
}

.book,
.game {
    position: relative;
    color: var(--text);
    background: var(--c);
    border: var(--px) solid var(--ink);
    cursor: pointer;
}

.shelf .c0 { --c: #a33b3b; --c-light: #cf5f55; --c-dark: #6e2430; --text: #ffe9c4; }
.shelf .c1 { --c: #2f5d8c; --c-light: #4f86b8; --c-dark: #1d3a5f; --text: #e6f1ff; }
.shelf .c2 { --c: #3f7a4a; --c-light: #62a05c; --c-dark: #25503a; --text: #f0ffd9; }
.shelf .c3 { --c: #c9a13c; --c-light: #ecc965; --c-dark: #8f6b25; --text: #2a1a08; }
.shelf .c4 { --c: #6b4a8c; --c-light: #9070b3; --c-dark: #432d5e; --text: #f3e6ff; }
.shelf .c5 { --c: #5fa3c7; --c-light: #8cc6e0; --c-dark: #3c7494; --text: #0e2433; }
.shelf .c6 { --c: #2f7f80; --c-light: #4fa9a3; --c-dark: #1c5058; --text: #e0fffa; }
.shelf .c7 { --c: #b8612e; --c-light: #dc8a4c; --c-dark: #7d3d20; --text: #fff0d6; }
.shelf .c8 { --c: #3a3f52; --c-light: #5c6480; --c-dark: #232638; --text: #dfe6ff; }
.shelf .c9 { --c: #8c3a5e; --c-light: #b85c80; --c-dark: #5c2440; --text: #ffe3ee; }
.shelf .c10 { --c: #7a7f3a; --c-light: #a3a85a; --c-dark: #4f5324; --text: #f6f7d8; }
.shelf .c11 { --c: #a8825a; --c-light: #cba77c; --c-dark: #73563a; --text: #24160a; }

/* Books face forward. Each book in a series is one banded spine on the left of the cover; unread books are grey. */
.book {
    --h: 132px;
    --vol: 10px;
    width: 120px;
    height: var(--h);
    margin: calc(var(--row) - var(--plank) - var(--h)) 8px var(--plank) calc(6px + var(--n) * var(--vol));
    padding: 8px 4px 6px;
    display: flex;
    flex-direction: column;
    text-align: center;
    box-shadow: inset 0 var(--px) 0 var(--c-light);
}

/* The hover box goes around the cover and all its spines, so it is a frame element, not an outline of the cover. */
.book[data-title]:hover, .book[data-title]:focus-visible, .book.touring { outline: 0; }
.book:hover::after, .book:focus-visible::after, .book.touring::after {
    content: '';
    position: absolute;
    inset: -6px -6px -6px calc(-6px - var(--n) * var(--vol));
    border: 2px solid #ffdf7f;
    pointer-events: none;
}

/* --lit and --shade are overlay colors, so they work on both colored and grey spines. */
.book::before {
    --unread: calc((var(--n) - var(--f)) * var(--vol));
    --lit: #ffffff40;
    --shade: #00000059;
    content: '';
    position: absolute;
    right: 100%;
    top: calc(var(--px) * -1);
    bottom: calc(var(--px) * -1);
    width: calc(var(--n) * var(--vol));
    border-top: var(--px) solid var(--ink);
    border-bottom: var(--px) solid var(--ink);
    background:
        repeating-linear-gradient(to right, var(--ink) 0, var(--ink) 2px, transparent 2px, transparent 10px),
        linear-gradient(to bottom, transparent 10px, var(--lit) 10px, var(--lit) 14px, transparent 14px, transparent calc(100% - 22px), var(--lit) calc(100% - 22px), var(--lit) calc(100% - 18px), transparent calc(100% - 18px), transparent calc(100% - 14px), var(--lit) calc(100% - 14px), var(--lit) calc(100% - 10px), transparent calc(100% - 10px)),
        repeating-linear-gradient(to right, transparent 0, transparent 8px, var(--shade) 8px, var(--shade) 10px),
        linear-gradient(to right, #6f675f 0, #6f675f var(--unread), var(--c) var(--unread));
}

.book-title {
    flex: 1;
    overflow-wrap: break-word;
}

.book-author {
    padding-top: 4px;
    border-top: var(--px) solid var(--c-light);
    opacity: 0.85;
}

/* Game boxes face forward. The cover art is 52 art pixels wide: a 104px area inside the 2px border. */
.case.games { --row: 136px; }
.case.games .shelf { background-image: url(/images/room/shelf-row-games.svg); }

.case a.game {
    --h: 108px;
    width: 108px;
    height: var(--h);
    margin: calc(var(--row) - var(--plank) - var(--h)) 10px var(--plank) 6px;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: var(--text);
    box-shadow: inset 0 0 0 4px var(--c), inset 0 0 0 6px var(--c-light);
}

.game-title {
    font-size: 18px;
    line-height: 1;
    overflow-wrap: break-word;
}

.case a.game.has-art {
    background-size: 100% 100%;
    image-rendering: pixelated;
    box-shadow: none;
}

.case a.game.art-azul {
    justify-content: center;
    color: #12305a;
}

.game.art-azul .game-title {
    font-size: 28px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.case a.game.art-terraforming-mars {
    padding: 8px 2px;
    color: #f7d9a8;
    text-transform: uppercase;
}

.game.art-terraforming-mars .game-title {
    font-size: 16px;
}

.case a.game.art-dominion {
    padding-top: 12px;
    color: #216a9f;
}

.case a.game.art-brass-birmingham {
    padding-top: 16px;
    color: #1c1c1c;
    text-transform: uppercase;
}

.game.art-brass-birmingham .game-title {
    font-size: 14px;
    letter-spacing: 1px;
}

.game.art-brass-birmingham .game-title::first-line {
    font-size: 28px;
    letter-spacing: 4px;
}

.case a.game.art-scythe {
    padding-top: 6px;
    color: #e8eaea;
    text-transform: uppercase;
}

.game.art-scythe .game-title {
    font-size: 24px;
    letter-spacing: 3px;
}

.case a.game.art-spirit-island {
    padding: 11px 0 0;
    color: #e6dfd0;
    text-transform: uppercase;
    white-space: nowrap;
}

.game.art-spirit-island .game-title {
    font-size: 16px;
}

.case a.game.art-7-wonders {
    padding-top: 6px;
    color: #f2ba4b;
    text-transform: uppercase;
    white-space: nowrap;
}

.game.art-7-wonders .game-title {
    font-size: 20px;
    text-shadow: 2px 2px 0 #1d4f6e;
}

.case a.game.art-dune-imperium { padding: 4px 20px 0; color: #c6a58e; text-transform: uppercase; }
.game.art-dune-imperium .game-title { font-size: 14px; letter-spacing: 2px; }
.game.art-dune-imperium .game-title::first-line { font-size: 26px; letter-spacing: 6px; }

.case a.game.art-tyrants-of-the-underdark { padding: 4px 22px 0 30px; align-items: flex-end; text-align: right; color: #4f2f6e; text-transform: uppercase; }
.game.art-tyrants-of-the-underdark .game-title { font-size: 14px; line-height: 0.85; }

.case a.game.art-container { padding-top: 3px; color: #d81336; text-transform: uppercase; }
.game.art-container .game-title { letter-spacing: 1px; }

.case a.game.art-decorum { padding-top: 38px; color: #1e1a1b; text-transform: lowercase; }
.game.art-decorum .game-title { font-size: 20px; }

.case a.game.art-5-minute-dungeon { padding: 39px 26px 0; color: #e4b960; }
.game.art-5-minute-dungeon .game-title { font-size: 14px; line-height: 0.85; }
.game.art-5-minute-dungeon .game-title::first-line { color: #f8f9fd; text-transform: uppercase; }

.case a.game.art-blood-rage { padding: 8px 30px 0; color: #dcd8d1; text-transform: lowercase; }
.game.art-blood-rage .game-title { line-height: 0.75; }

.case a.game.art-viticulture { padding-top: 8px; color: #7b1315; text-transform: uppercase; }
.game.art-viticulture .game-title { font-size: 16px; }

.case a.game.art-eschaton { padding-top: 16px; color: #000; }
.game.art-eschaton .game-title { font-size: 22px; }

.case a.game.art-oath { padding-top: 20px; color: #fff; }
.game.art-oath .game-title { font-size: 40px; text-shadow: 2px 2px 0 #6b5a2c; }

.case a.game.art-gizmos { padding-top: 36px; color: #f7f7f7; text-transform: uppercase; }
.game.art-gizmos .game-title { font-size: 24px; letter-spacing: 1px; text-shadow: 2px 0 0 #222738, -2px 0 0 #222738, 0 2px 0 #222738, 0 -2px 0 #222738, 2px 2px 0 #222738; }

.case a.game.art-sigil { padding-top: 26px; color: #f1eee8; text-transform: uppercase; }
.game.art-sigil .game-title { font-size: 32px; font-style: italic; letter-spacing: 3px; }

.case a.game.art-race-for-the-galaxy { padding: 9px 16px 0; color: #b2c3e3; text-transform: uppercase; }
.game.art-race-for-the-galaxy .game-title { font-size: 22px; line-height: 0.8; }
.game.art-race-for-the-galaxy .game-title::first-line { font-size: 13px; }

.case a.game.art-hegemony { padding-top: 2px; color: #fbfdfe; text-transform: uppercase; }
.game.art-hegemony .game-title { font-size: 16px; letter-spacing: 1px; }

.case a.game.art-age-of-steam { padding-top: 3px; color: #654233; text-transform: uppercase; }
.game.art-age-of-steam .game-title { font-size: 16px; }

.case a.game.art-greylune { padding: 0 0 0 4px; align-items: flex-start; color: #4a608a; text-transform: uppercase; }
.game.art-greylune .game-title { text-shadow: 1px 1px 0 #d4b77d; }
.game.art-greylune .game-title::first-letter { font-size: 38px; }

.case a.game.art-gudnak { padding-top: 43px; color: #f3d77a; text-transform: uppercase; }
.game.art-gudnak .game-title { font-size: 22px; text-shadow: 2px 2px 0 #6e1420, -2px 0 0 #6e1420, 0 -2px 0 #6e1420; }

.case a.game.art-agricola { padding-top: 4px; color: #e2dc9a; text-transform: uppercase; }
.game.art-agricola .game-title { font-size: 20px; text-shadow: 2px 2px 0 #4c442f; }

.case a.game.art-el-grande { padding-top: 2px; color: #3f1020; }
.game.art-el-grande .game-title { font-size: 22px; font-style: italic; }

.case a.game.art-the-old-king-s-crown { padding: 15px 34px 0; color: #e1c678; text-transform: uppercase; }
.game.art-the-old-king-s-crown .game-title { font-size: 12px; line-height: 0.9; }

.case a.game.art-crew-mission-deep-sea { padding: 2px 0 0; color: #fff; text-transform: uppercase; }
.game.art-crew-mission-deep-sea .game-title { font-size: 13px; line-height: 0.9; }
.game.art-crew-mission-deep-sea .game-title::first-line { font-size: 26px; }

.case a.game.art-pax-pamir { padding: 22px 20px 0; color: #ecd9d4; text-transform: uppercase; }
.game.art-pax-pamir .game-title { font-size: 26px; line-height: 0.8; text-shadow: 2px 2px 0 #8b7087; }

.case a.game.art-diplomacy { padding-top: 4px; color: #e9c66b; text-transform: uppercase; }
.game.art-diplomacy .game-title { font-size: 20px; letter-spacing: 1px; }

.case a.game.art-wroth { padding-top: 60px; color: #f9e4f0; text-transform: uppercase; }
.game.art-wroth .game-title { letter-spacing: 6px; margin-right: -6px; }

.case a.game.art-aegis { padding-top: 36px; }
.game.art-aegis .game-title { font-size: 30px; color: transparent; background: linear-gradient(to right, #d85563 0, #d85563 22%, #07b8e1 22%, #07b8e1 43%, #3fb984 43%, #3fb984 66%, #b361a6 66%, #b361a6 76%, #f3db75 76%); -webkit-background-clip: text; background-clip: text; }

/* A gold token on the corner of the box shows the number of plays. */
.game-plays {
    position: absolute;
    top: -10px;
    right: -10px;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    color: #2a1a08;
    background: #ecc965;
    box-shadow: inset 0 0 0 2px #120a06, inset 4px 4px 0 #fff3b0, inset -4px -4px 0 #a8802c;
    clip-path: polygon(4px 0, calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px), 0 4px, 4px 4px);
}

/* Arrow of the room tour. */
.pointer { position: fixed; left: 0; top: 0; z-index: 30; width: 18px; height: 26px; pointer-events: none; background: url(/images/room/cursor.svg) 0 0 / 100% 100% no-repeat; }

/* Dialog box: the same box as in the room, fixed to the bottom of the window. */
.dialog {
    position: fixed;
    left: max(0px, 50% - 480px);
    bottom: 0;
    z-index: 10;
    width: min(960px, 100%);
    height: 100px;
    padding: 8px 20px;
    color: #f3ead2;
    font-size: 20px;
    line-height: 20px;
    background: #1b2430;
    border: 2px solid #000;
    border-bottom: 0;
    box-shadow: inset 0 0 0 2px #f3ead2, inset 0 0 0 4px #0d131b;
}

.dialog b { display: block; font-weight: 400; font-size: 40px; line-height: 0.9; color: #ffdf7f; text-transform: uppercase; }

/* The page opens toward the camera after a move in from the room, and moves away before the next page opens. */
@media (prefers-reduced-motion: no-preference) {
    .enter .closeup { transform-origin: 50% calc(50vh / var(--s, 1)); animation: enter 400ms cubic-bezier(0.2, 0.6, 0.4, 1) backwards; }
    .enter .dialog { animation: fade 400ms backwards; }
    .leave .closeup { animation: leave 300ms cubic-bezier(0.6, 0, 0.8, 0.4) forwards; }
    .leave .dialog { animation: fade 300ms reverse forwards; }
}

@keyframes enter { from { transform: scale(0.8); opacity: 0; } }
@keyframes leave { to { transform: scale(0.8); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

@media (max-width: 700px) {
    .col { padding: 0 4px; }
    .tier { grid-template-columns: 36px 1fr; }
    .shelf { padding: 0 4px; }
    .ways { flex-wrap: wrap; justify-content: space-between; }
    .intro { order: 1; flex-basis: 100%; }
    .top { grid-template-columns: 1fr; justify-items: center; }
    .tags, .tags:last-child { flex-wrap: wrap; justify-content: center; }
}
