/* Gallery view: every game on one scrolling page, in the lobby's own art.
   The page shares hub-chrome.css (tokens, loader, card, rail) and only lays the
   pieces out differently: a shorter brand plaque, a wide Continue frame, a grid of
   the carousel's game frames, and a solid deck dock that the grid never runs under.
   This is the lobby (index.html). */
.gallery {
  --brand-height: max(104px, min(calc(var(--stage-width) * .24), calc(var(--app-height) * .11)));
  /* The props take the Profile page's rail size; the dock is one prop tall plus a lip. */
  --nav-size: min(124px, calc(var(--stage-width) * .26), calc(var(--app-height) * .16));
  --dock-height: calc(var(--nav-size) + var(--stage-width) * .035);
  /* Tile size as a share of the stage width; the tile-size buttons step it (hub-gallery.js). */
  --tile-scale: .2467;
  --tile: calc(var(--stage-width) * var(--tile-scale));
  --gutter: calc(var(--stage-width) * .07);
  --gap: calc(var(--stage-width) * .06);
  /* The search and category row under the brand: one control tall plus the space above the catalog. */
  --tools-height: 48px;
  background-color: #7ca7bd;
}
.gallery .lobby-scenery { object-position: center top; }
/* The harbor scene is dimmed under the catalog so the cards and the section headings read; the sky stays bright behind the brand plaque. */
.gallery::after { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; background: linear-gradient(#0b1a2200 6%, #0b1a2280 24%, #16262fb3 50%, #16262fb3 78%, #16262f66); }
.gallery .masthead { height: var(--brand-height); }
.gallery .brand { width: 56%; margin-left: var(--gutter); background-position: left center; filter: drop-shadow(0 4px 2px #37261766); }
/* The catalog scrolls between the plaque and the dock. The dock is a reserved safe zone. */
.g-catalog { position: absolute; left: 0; right: 0; top: calc(var(--brand-height) + var(--tools-height)); bottom: var(--dock-height); z-index: 3; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; padding: calc(var(--stage-width) * .025) var(--gutter) calc(var(--stage-width) * .08); }
.g-catalog::-webkit-scrollbar { display: none; }

/* Search and categories: one row that does not scroll, in the view switch's dark glass. The box
   holds its share of the row and the chips scroll sideways beside it; in use (focused, or holding
   text) the box takes the row and the chips step aside. */
.g-tools { position: absolute; z-index: 4; left: var(--gutter); right: var(--gutter); top: var(--brand-height); height: 40px; display: flex; align-items: center; gap: 8px; }
.g-search { position: relative; flex: 0 0 34%; min-width: 108px; height: 38px; display: flex; align-items: center; border: 2px solid #d9b27c; border-radius: 999px; background: #0b1a22c8; box-shadow: 0 3px 0 #5a3a1c, 0 6px 8px #00000080; transition: flex-basis .18s ease; }
.g-search:focus-within { border-color: #fff0b6; }
.g-search > svg { position: absolute; left: 10px; top: 50%; width: 17px; height: 17px; margin-top: -8.5px; fill: none; stroke: #d9b27c; stroke-width: 2.6; stroke-linecap: round; pointer-events: none; }
/* The field is the whole box, and 48px tall to the finger though the box is drawn at 38: it runs
   past the box above and below (a height, because a field does not stretch between insets). At least 16px (and the player's own text size when larger):
   a smaller field makes iOS zoom the page when it takes focus. */
.g-search-input { position: absolute; left: 0; top: -7px; width: 100%; height: calc(100% + 14px); padding: 0 6px 1px 32px; border: 0; border-radius: 999px; outline: 0; background: none; color: #fff0ce; font-size: max(1rem, 16px); letter-spacing: .02em; -webkit-appearance: none; appearance: none; touch-action: manipulation; }
.g-search-input::placeholder { color: #f3e3c3; opacity: .72; }
.g-search-input::-webkit-search-cancel-button, .g-search-input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
/* The box's border is the focus mark; forced colours drop it, so they get an outline. */
@media (forced-colors: active) { .g-search:focus-within { outline: 2px solid Highlight; outline-offset: 2px; } }
.g-search-clear { position: absolute; z-index: 1; right: 0; top: 0; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: none; color: #f3e3c3; cursor: pointer; }
.g-search-clear::before { content: ""; position: absolute; inset: -7px 0; }
/* Measured from inside the chip's border, to the edges of the row. */
.g-chip::before { content: ""; position: absolute; inset: -7px -2px -11px; }
.g-search-clear svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.g-tools.is-searching .g-search { flex-basis: 100%; }
.g-tools.is-searching .g-search-input { padding-right: 36px; }
.g-tools.is-searching .g-chips { display: none; }
/* The chips run off the right edge and fade there, which is the cue that the row scrolls. */
.g-chips { flex: 1; min-width: 0; align-self: stretch; display: flex; align-items: center; gap: 6px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; margin: -4px calc(var(--gutter) * -1) -4px 0; padding: 4px var(--gutter) 8px 1px; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - var(--gutter) * 1.6), #0000); mask-image: linear-gradient(90deg, #000 calc(100% - var(--gutter) * 1.6), #0000); }
.g-chips::-webkit-scrollbar { display: none; }
/* A chip is drawn 34px tall and takes touches over 48 (the ::before above). */
.g-chip { position: relative; flex: none; height: 34px; padding: 0 13px 1px; border: 2px solid #d9b27c; border-radius: 999px; background: #0b1a22c8; color: #f3e3c3; font-size: 14px; letter-spacing: .03em; white-space: nowrap; text-shadow: 0 1px 0 #3a2616; box-shadow: 0 3px 0 #5a3a1c; cursor: pointer; }
.g-chip[aria-pressed="true"] { background: linear-gradient(#4a86c9, #2b5a93 60%, #1f4574); border-color: #f2d7a6; color: #fff; box-shadow: inset 0 1px 0 #bcd8ff, 0 3px 0 #112c46; }
.g-chip:focus-visible { outline: 3px solid #fff0b6; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .g-search { transition: none; } }
/* A narrowed page is about the games that match: the Continue banner steps aside. */
.g-catalog.is-filtered .g-continue { display: none; }
/* Without the banner the first heading sits right under the row. */
.g-catalog.is-filtered > .g-section:not([hidden]) .g-section-head, .g-continue[hidden] ~ .g-section:not([hidden]) .g-section-head { margin-top: calc(var(--stage-width) * .015); }
.g-catalog.is-filtered > .g-section:not([hidden]) ~ .g-section .g-section-head, .g-continue[hidden] ~ .g-section:not([hidden]) ~ .g-section .g-section-head { margin-top: calc(var(--stage-width) * .055); }

/* Continue: a wide cover with the same rim as the tiles. The name and PLAY sit on a dark fade
   along its lower edge, so the cover keeps the whole banner. */
.g-continue { position: relative; display: block; height: calc(var(--stage-width) * .37); border-radius: calc(var(--stage-width) * .045); overflow: hidden; color: inherit; text-decoration: none; box-shadow: 0 0 0 2.5px #e2bd86, 0 0 0 4px #7a4e26, 0 5px 0 4px #5a3a1c, 0 10px 12px #0b1a22aa; -webkit-user-drag: none; user-select: none; }
.g-continue-art { position: absolute; inset: 0; background: linear-gradient(#0b1a2200 45%, #0b1a22d9), #7ca7bd var(--game-art, url("assets/lobby/lobby-scene.webp?v=e77a4c9026a2")) center 30% / cover no-repeat; }
.g-continue-kicker { position: absolute; left: calc(var(--stage-width) * .025); top: calc(var(--stage-width) * .022); z-index: 1; padding: calc(var(--stage-width) * .012) calc(var(--stage-width) * .026); border-radius: calc(var(--stage-width) * .016); background: #0b1a22b8; color: #f2c46d; font-size: calc(var(--stage-width) * .029); letter-spacing: .14em; text-transform: uppercase; }
/* The plaque face is rows 657-774 of the 900 px source: 0.2k to 1.07k below the art. */
.g-continue-title { position: absolute; left: calc(var(--stage-width) * .035); right: calc(var(--stage-width) * .31); bottom: calc(var(--stage-width) * .03); min-height: calc(var(--stage-width) * .085); display: flex; align-items: center; color: #fff0ce; text-shadow: 0 2px 0 #3a2616, 0 0 8px #0b1a22; text-transform: uppercase; font-size: calc(var(--stage-width) * .047); line-height: .95; text-wrap: balance; overflow-wrap: anywhere; }
.g-continue-play { position: absolute; right: calc(var(--stage-width) * .012); bottom: calc(var(--stage-width) * .012); z-index: 2; width: calc(var(--stage-width) * .27); height: auto; filter: drop-shadow(0 4px 0 #112c46) drop-shadow(0 8px 6px #00000070); clip-path: polygon(14.2% 14%, 85.6% 14%, 96.4% 35%, 96.8% 71%, 86.8% 94%, 13.6% 94%, 3% 71%, 3.6% 35%); }
/* Press feedback, as on the lobby's PLAY plaque: the plaque sinks and the banner settles with it. */
.g-continue-play, .g-continue { transition: transform .08s ease, filter .08s ease; }
.g-continue:active { transform: translateY(2px); }
.g-continue:active .g-continue-play { transform: translateY(3px) scale(.96); filter: drop-shadow(0 1px 0 #112c46) drop-shadow(0 4px 3px #00000070) brightness(.92); }
@media (prefers-reduced-motion: reduce) { .g-continue-play, .g-continue { transition: none; } }

.g-section-head { display: flex; align-items: center; gap: calc(var(--stage-width) * .025); margin: calc(var(--stage-width) * .055) calc(var(--stage-width) * .01) calc(var(--stage-width) * .022); }
/* Section headings: the name in the tile titles' lettering, then a thin brass rule that runs to
   the count. No plaque: six of them down the page took too much of its height. */
.g-heading { margin: 0; display: flex; align-items: center; gap: calc(var(--stage-width) * .012); white-space: nowrap; color: #ffe2a6; font-size: calc(var(--stage-width) * .042); line-height: 1.1; letter-spacing: .02em; text-shadow: 0 2px 0 #3a2616, 0 0 8px #0b1a22, 0 3px 4px #0b1a22; }
.g-heading svg { width: calc(var(--stage-width) * .04); height: calc(var(--stage-width) * .04); filter: drop-shadow(0 1px 0 #3a2616); }
.g-section-head::after { content: ""; order: 1; flex: 1; min-width: calc(var(--stage-width) * .04); height: 2px; border-radius: 2px; background: linear-gradient(90deg, #e2bd86cc, #e2bd8622); box-shadow: 0 1px 0 #3a261688; }
.g-count { order: 2; }
.g-count { color: #fff0ce; font-size: calc(var(--stage-width) * .03); opacity: .9; text-shadow: 0 1px 2px #0b1a22, 0 0 6px #0b1a22; }

/* Tiles: the cover fills the tile. No carousel frame here: at three across the frame took a
   third of each tile, so the cover is a square with a thin bevelled rim instead, and the title
   sits under it as live text (the 1000-games catalogue pattern, in the lobby's materials). */
/* The tile has a size and the row takes as many as fit; what is left over becomes the gaps. */
.gallery .grid { display: grid; grid-template-columns: repeat(auto-fill, var(--tile)); justify-content: space-between; gap: calc(var(--tile) * .15) calc(var(--stage-width) * .02); width: auto; margin: 0; }
.g-tile { position: relative; container-type: inline-size; }
.gallery .card { width: 100%; aspect-ratio: auto; }
.gallery .card .art { position: relative; left: auto; top: auto; width: 100%; height: auto; aspect-ratio: 1; border-radius: 9cqi; background-size: cover; background-position: center 38%; box-shadow: 0 0 0 2.5px #e2bd86, 0 0 0 4px #7a4e26, 0 5px 0 4px #5a3a1c, 0 10px 12px #0b1a22aa, inset 0 1px 0 #ffffff66; }
.gallery .card .card-sculpt { display: none; }
.gallery .card .title { position: static; display: block; width: auto; height: auto; margin-top: calc(9px + 2.5cqi); padding: 0; font-size: 12.5cqi; line-height: 1.05; color: #fff0ce; text-shadow: 0 2px 0 #3a2616, 0 0 8px #0b1a22, 0 3px 4px #0b1a22; }
.gallery .card-beta { top: -6%; right: -5%; width: 38%; }
/* Staging playtest serial: the lobby's red tag, on the cover's upper left corner. */
.gallery .card-serial { top: -5%; left: -4%; min-width: 0; padding: 1px 7px 2px; font-size: max(11px, 11cqi); }
.gallery .card:active .art { transform: translateY(2px); box-shadow: 0 0 0 2.5px #e2bd86, 0 0 0 4px #7a4e26, 0 3px 0 4px #5a3a1c, 0 5px 6px #0b1a22aa; }
@media (hover: hover) { .gallery .card:hover .art { transform: translateY(-2px); } .gallery .card .art { transition: transform .15s ease, box-shadow .15s ease; } }
/* Star: on the cover's lower right corner (the look is .fav-btn in hub-chrome.css). Starred
   games move up into Favorites. */
.card-fav { right: -4%; top: calc(100cqi - 24px); width: 24%; min-width: 28px; max-width: 34px; }
.gallery .shelf-empty { margin-top: calc(var(--stage-width) * .06); }
.g-no-match { margin: calc(var(--stage-width) * .12) auto 0; width: 82%; text-align: center; color: #fff0ce; font-size: clamp(15px, calc(var(--stage-width) * .042), 19px); line-height: 1.35; text-shadow: 0 2px 3px #10202c; text-wrap: balance; overflow-wrap: anywhere; }

/* Dock: the reserved safe zone for the two props. The catalog stops at its top edge, so no
   card ever runs under them; the scene's own deck shows through and the catalog fades out above it. */
.gallery .rail { bottom: 0; height: var(--dock-height); align-items: center; padding-inline: 16px; padding-bottom: 0; pointer-events: auto; }
/* No divider line: the tiles fade out over the last stretch above the dock. */
.gallery .g-catalog { -webkit-mask-image: linear-gradient(#000 calc(100% - var(--stage-width) * .14), #0000); mask-image: linear-gradient(#000 calc(100% - var(--stage-width) * .14), #0000); }
.gallery .item { transform: translateY(calc(var(--stage-width) * -.01)); }
.gallery .item[aria-current="page"] { transform: translateY(calc(var(--stage-width) * -.01)); }
@media (hover: hover) { .gallery .item:hover { transform: translateY(calc(var(--stage-width) * -.025)); } }
.gallery .view-switch { right: var(--gutter); top: 20px; }
/* Tile size: two buttons under the view switch step the tile size; the rows reflow to fit. */
.g-zoom { position: absolute; z-index: 40; right: var(--gutter); top: 65px; display: flex; gap: 2px; padding: 2px; border: 2px solid #d9b27c; border-radius: 999px; background: #0b1a22c8; box-shadow: 0 3px 0 #5a3a1c, 0 6px 8px #00000080; }
.g-zoom button { display: grid; place-items: center; width: 44px; height: 28px; padding: 0; border: 0; border-radius: 999px; background: none; color: #f3e3c3; cursor: pointer; }
.g-zoom button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.g-zoom button:active:not(:disabled) { background: linear-gradient(#4a86c9, #2b5a93 60%, #1f4574); }
.g-zoom button:disabled { opacity: .35; cursor: default; }
.g-zoom button:focus-visible { outline: 3px solid #fff0b6; outline-offset: 2px; }
/* Offline (see hub-chrome.css). In a tile the cover is the square at the top of the card, so
   the mark sits at its centre, and the star dims with the card. One line above the games
   says what the grey means. */
.gallery .card[data-away]::after { top: 50cqi; }
.g-tile.is-away .card-fav { opacity: .4; }
.g-offline { display: flex; align-items: center; gap: 8px; margin: 0 2px 10px; padding: 7px 12px; border-radius: 12px; background: #12242ee6; box-shadow: 0 0 0 2px #7a4e26, 0 0 0 3.5px #f3e3c3; color: #f3e3c3; font-size: 14px; line-height: 1.3; }
.g-offline::before { content: ""; flex: none; width: 18px; height: 18px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f3e3c3' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M2 8.5a15 15 0 0 1 5-3M22 8.5a15 15 0 0 0-9.500-3.900M5.500 12.500a10 10 0 0 1 4-2.400M18.500 12.500a10 10 0 0 0-3-2M9 16.200a5 5 0 0 1 6 0M12 19.500h.01M3 3l18 18'/%3E%3C/svg%3E") center / contain no-repeat; }
.g-offline[hidden] { display: none; }
