/* The games hub (/games/), Version 2. Shared parts live in site.css; this is only what the hub adds.
   The game pages themselves use /games/games.css. */

/* ── Hero ───────────────────────────────────────────────────────── */
.gh-hero { padding-top: clamp(48px, 6.4vw, 92px); overflow: clip; }
.gh-head { text-align: center; }
.gh-line { display: inline-block; }
@media (min-width: 735px) { .gh-line { display: block; } }
.gh-soft { color: var(--fg-3); }
.gh-head .t-lead { max-width: 620px; margin: 22px auto 0; }
.gh-head .btns { justify-content: center; margin-top: 34px; }
.gh-surprise svg { width: 20px; height: 20px; transition: transform .5s var(--ease-out); }
.gh-surprise:hover svg { transform: rotate(-90deg); }
.gh-surprise.is-rolling svg { animation: gh-roll .5s linear infinite; }
@keyframes gh-roll { to { transform: rotate(360deg); } }
.gh-in { animation: gh-rise 1.1s var(--ease-out) var(--d, 0s) both; }
@keyframes gh-rise { from { opacity: 0; transform: translateY(24px); } }

/* The deck: real game screens, one in front and two waiting behind it */
.gh-deck { margin-top: clamp(52px, 6vw, 88px); }
.gh-deck-scrub { perspective: 1800px; }
.gh-deck-stage {
    display: grid; align-items: end;
    width: min(100% - 2 * var(--gutter), 940px); margin-inline: auto;
    padding-top: 64px;
}
.gh-slide {
    grid-area: 1 / 1; position: relative; display: block; overflow: hidden;
    border-radius: 24px; background: var(--bg-2); color: var(--fg);
    box-shadow: 0 0 0 1px var(--line), var(--shadow);
    transform-origin: 50% 0;
    visibility: hidden; opacity: 0;
    transform: translateY(-84px) scale(0.84);
    transition: transform .9s var(--ease-out), opacity .6s var(--ease), filter .6s var(--ease), box-shadow .3s var(--ease), visibility 0s linear .9s;
}
.gh-slide:hover { text-decoration: none; }
.gh-slide img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; }
.gh-slide[data-pos] { visibility: visible; transition-delay: 0s; }
.gh-slide[data-pos="0"] { opacity: 1; z-index: 4; transform: none; }
.gh-slide[data-pos="1"] { opacity: 1; z-index: 3; transform: translateY(-30px) scale(0.95); filter: brightness(0.66); }
.gh-slide[data-pos="2"] { opacity: 1; z-index: 2; transform: translateY(-56px) scale(0.9); filter: brightness(0.45); }
.gh-slide[data-pos="out"] { opacity: 0; z-index: 5; transform: translate(-12%, 36px) scale(0.98); transition: transform .9s var(--ease-out), opacity .3s var(--ease), visibility 0s linear .9s; }
:root[data-palette="snowy-owl"] .gh-slide[data-pos="1"] { filter: brightness(0.9) saturate(0.8); }
:root[data-palette="snowy-owl"] .gh-slide[data-pos="2"] { filter: brightness(0.8) saturate(0.7); }
.gh-slide[data-pos="0"]:hover, .gh-slide[data-pos="0"]:focus-visible { transform: translateY(-4px); }
.gh-slide.is-chosen { box-shadow: 0 0 0 3px var(--g), var(--shadow); }
.gh-slide-cap {
    display: flex; align-items: baseline; gap: 12px; min-width: 0;
    padding: 18px 24px 20px;
}
.gh-slide-cap::before { content: ""; align-self: center; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--g); }
.gh-slide-cap b { font-size: 19px; font-weight: 600; letter-spacing: -0.014em; white-space: nowrap; }
.gh-slide-cap span { font-size: 15px; color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.gh-deck-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 28px; }
.gh-deck-nav[hidden] { display: none; }
.gh-dots { display: flex; align-items: center; gap: 0; padding: 0 4px; min-height: 44px; border-radius: 980px; background: var(--bg-2); }
.gh-dots button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; background: none; border-radius: 980px; }
.gh-dots button::before {
    content: ""; width: 8px; height: 8px; border-radius: 980px; background: var(--fg-3); opacity: 0.55;
    transition: width .4s var(--ease-out), background-color .25s var(--ease);
}
.gh-dots button:hover::before { opacity: 1; }
.gh-dots button[aria-current="true"]::before { width: 26px; background: var(--fg-2); opacity: 1; }
.gh-pause[hidden] { display: none; }
.gh-pause svg { width: 15px; height: 15px; }
.gh-pause .gh-i-play, .gh-pause[aria-pressed="true"] .gh-i-pause { display: none; }
.gh-pause[aria-pressed="true"] .gh-i-play { display: block; }

.gh-stats {
    --cols: 3;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: clamp(56px, 7vw, 104px); max-width: 760px; text-align: center;
}
.gh-stats .stat-label { margin-inline: auto; }

/* ── Records to beat ────────────────────────────────────────────── */
.gh-ticker { margin-top: clamp(64px, 8vw, 112px); padding: 20px 0 22px; border-block: 1px solid var(--line); }
.gh-ticker[hidden] { display: none; }
.gh-ticker-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.gh-ticker-title { font-size: 17px; letter-spacing: -0.012em; }
.gh-ticker-note { font-size: 15px; color: var(--fg-3); }
.gh-ticker-head .gh-pause { margin-left: auto; width: 36px; height: 36px; }
.gh-band {
    overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.gh-track { display: flex; width: max-content; animation: gh-marquee var(--dur, 60s) linear infinite; }
.gh-band:hover .gh-track, .gh-band:focus-within .gh-track, .gh-band.is-paused .gh-track { animation-play-state: paused; }
@keyframes gh-marquee { to { transform: translateX(calc(-1 * var(--set, 50%))); } }
.gh-set { display: flex; }
.gh-tick {
    display: inline-flex; align-items: baseline; gap: 10px; white-space: nowrap;
    padding: 6px 36px 6px 0; color: var(--fg);
}
.gh-tick:hover { text-decoration: none; }
.gh-tick:hover b { color: var(--accent); }
.gh-tick::before { content: ""; align-self: center; width: 8px; height: 8px; border-radius: 50%; background: var(--g); }
.gh-tick b { font-size: 15px; font-weight: 600; transition: color .2s var(--ease); }
.gh-tick-score { font-size: 15px; font-variant-numeric: tabular-nums; color: var(--fg-2); }
.gh-tick-by { font-size: 14px; color: var(--fg-3); }

/* ── The games ──────────────────────────────────────────────────── */
.gh-games { --tile-pad: clamp(24px, 3.4vw, 48px); --grid-w: min(100% - 24px, 1440px); }
.gh-games-head {
    display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px 40px;
    width: var(--grid-w); margin: 0 auto clamp(36px, 4vw, 60px); padding-inline: var(--tile-pad);
}
.gh-filters { display: inline-flex; flex-wrap: wrap; padding: 3px; border-radius: 12px; background: var(--bg-2); }
.gh-filters[hidden] { display: none; }
.gh-filters button {
    display: inline-flex; align-items: center; gap: 7px;
    min-height: 36px; padding: 0 15px; border: 0; border-radius: 9px;
    background: transparent; color: var(--fg-2); font-size: 14px; font-weight: 500;
    transition: background-color .25s var(--ease), color .25s var(--ease), box-shadow .25s var(--ease);
}
.gh-filters button:hover { color: var(--fg); }
.gh-filters button span { font-size: 13px; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.gh-filters button[aria-pressed="true"] { background: var(--bg-4); color: var(--fg); }
:root[data-palette="snowy-owl"] .gh-filters button[aria-pressed="true"] { background: #FFFFFF; box-shadow: 0 1px 3px rgba(0,0,0,0.12); }

.gh-grid { display: grid; gap: 12px; width: var(--grid-w); margin-inline: auto; }
@media (min-width: 900px) {
    .gh-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .gh-game--full  { grid-column: span 6; }
    .gh-game--half  { grid-column: span 3; }
    .gh-game--third { grid-column: span 2; }
    .gh-grid.is-filtered .gh-game { grid-column: span 3; }
    /* filtered down to an odd number: the last card takes the whole row, words left and screen right */
    .gh-grid.is-filtered .gh-game.is-wide {
        grid-column: span 6;
        display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: center; column-gap: clamp(32px, 4vw, 72px);
        padding: 0 0 0 var(--tile-pad);
    }
    .gh-grid.is-filtered .gh-game.is-wide .gh-game-text { padding-block: clamp(40px, 4vw, 64px); }
    .gh-grid.is-filtered .gh-game.is-wide .gh-game-shot { align-self: end; padding-top: clamp(40px, 4vw, 64px); }
    .gh-grid.is-filtered .gh-game.is-wide .gh-screen { border-radius: 18px 0 0 0; }
}
/* one headline size while filtered */
.gh-grid.is-filtered .gh-game h3 { font-size: clamp(28px, 3.3vw, 40px); line-height: 1.1; letter-spacing: -0.02em; }

.gh-game {
    position: relative; overflow: hidden; isolation: isolate;
    display: flex; flex-direction: column;
    padding: clamp(32px, 3.6vw, 52px) var(--tile-pad) 0;
    border-radius: var(--radius-lg);
    background: var(--bg-2); color: var(--fg);
}
.gh-game:hover { text-decoration: none; }
.gh-game[hidden] { display: none; }
.gh-game:focus-visible { outline-offset: 4px; border-radius: var(--radius-lg); }
.gh-game-text { display: flex; flex-direction: column; align-items: flex-start; }
.gh-meta { display: flex; flex-wrap: wrap; align-items: center; row-gap: 4px; font-size: 14px; color: var(--fg-3); }
.gh-meta > span + span::before {
    content: ""; display: inline-block; width: 3px; height: 3px; margin: 0 9px; border-radius: 50%;
    background: currentColor; vertical-align: middle; opacity: 0.7;
}
.gh-meta .st--new { color: var(--fg-2); font-weight: 600; }
.gh-game h3 { margin-top: 10px; }
.gh-desc { margin-top: 12px; max-width: 46ch; font-size: 17px; line-height: 1.47; color: var(--fg-2); }
.gh-tags { display: flex; flex-wrap: wrap; list-style: none; margin-top: 14px; font-size: 14px; color: var(--fg-3); }
.gh-tags li + li::before {
    content: ""; display: inline-block; width: 3px; height: 3px; margin: 0 9px; border-radius: 50%;
    background: currentColor; vertical-align: middle; opacity: 0.7;
}
.gh-game .more { margin-top: 18px; color: var(--g); }
:root[data-palette="snowy-owl"] .gh-game .more { color: color-mix(in srgb, var(--g) 52%, #000); }
:root[data-palette="snowy-owl"] .gh-game--tanks.band-ink .more { color: var(--g); }
.gh-game:hover .more::after { transform: translateX(2px) rotate(45deg); }

/* a real screen from the game, rising out of the bottom of the tile */
.gh-game-shot { margin-top: auto; padding-top: clamp(32px, 4vw, 52px); }
.gh-screen {
    display: block; overflow: hidden;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 0 0 1px var(--line), 0 -10px 40px -18px rgba(0,0,0,0.4);
    background: #0B1726;
}
.gh-screen img { display: block; width: 100%; height: auto; transform: translateY(10px); transition: transform .8s var(--ease-out); }
.gh-game:hover .gh-screen img { transform: translateY(0) scale(1.02); }
.gh-game--half, .gh-game--third { transition: transform .5s var(--ease-out); }
.gh-game--half:hover, .gh-game--third:hover { transform: scale(1.012); }
.gh-game--third .gh-desc { font-size: 16px; }
/* each small tile shows its own moment, not the whole screen */
.gh-crop--xo { --zoom: 1.9; }
@media (max-width: 734px) { .gh-crop--xo { --zoom: 2.1; } }
.gh-crop .gh-screen img { transform-origin: var(--fx, 50%) var(--fy, 50%); transform: translateY(10px) scale(var(--zoom, 1)); }
.gh-game.gh-crop:hover .gh-screen img { transform: translateY(0) scale(calc(var(--zoom, 1) * 1.02)); }

/* Spellbound: the featured tile, words on the left and the screen on the right */
@media (min-width: 900px) {
    .gh-grid:not(.is-filtered) .gh-game--spell {
        display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: center; column-gap: clamp(32px, 4vw, 72px);
        min-height: clamp(520px, 44vw, 640px);
        padding: 0 0 0 var(--tile-pad);
    }
    .gh-grid:not(.is-filtered) .gh-game--spell .gh-game-text { align-self: center; padding-block: clamp(48px, 5vw, 80px); }
    .gh-grid:not(.is-filtered) .gh-game--spell .gh-game-shot { align-self: end; padding-top: clamp(48px, 5vw, 80px); }
    .gh-grid:not(.is-filtered) .gh-game--spell .gh-screen { border-radius: 18px 0 0 0; }
}

/* Tanks Defense: the closing tile, dark in every theme, its battlefield opening to the edges */
.gh-grid:not(.is-filtered) .gh-game--tanks { background: var(--bg); }
:root[data-palette="snowy-owl"] .gh-game--tanks.band-ink { --bg: #0E2841; --bg-2: #15324F; --bg-3: #1C3C5C; }
/* Midnight: the band gets its own surface, a shade off the black page, so the tile keeps its edge */
:root[data-palette="midnight"] .gh-game--tanks.band-ink { --bg: #0B0D12; --bg-2: #15181F; --bg-3: #1E222B; }
.gh-grid:not(.is-filtered) .gh-game--tanks { align-items: center; text-align: center; padding: clamp(56px, 6vw, 96px) 0 0; }
.gh-grid:not(.is-filtered) .gh-game--tanks .gh-game-text { align-items: center; max-width: 720px; padding-inline: 24px; }
.gh-grid:not(.is-filtered) .gh-game--tanks .gh-meta,
.gh-grid:not(.is-filtered) .gh-game--tanks .gh-tags { justify-content: center; }
.gh-grid:not(.is-filtered) .gh-game--tanks .gh-game-shot { width: 100%; padding-top: clamp(40px, 5vw, 72px); }
.gh-grid:not(.is-filtered) .gh-game--tanks .gh-screen {
    width: min(100% - 2 * var(--tile-pad), 1040px); margin-inline: auto;
    aspect-ratio: 16 / 10; border-radius: 20px 20px 0 0; box-shadow: none; background: #1A1F17;
}
/* the playfield is the middle 73% of the screenshot: scale it to the frame and keep the base in view */
.gh-game--tanks .gh-screen img {
    width: 136.4%; max-width: none; height: auto; margin: -17.6% 0 0 -18.2%;
    transform: none;
}
/* as you scroll past, the battlefield draws back from a close view of the base:
   the scale follows the scroll, and the gold star (at 50% 88% of the shot) stays where it is */
.gh-grid:not(.is-filtered) .gh-game--tanks .gh-screen img[data-scrub] {
    transform-origin: 50% 88%;
    transform: scale(calc(1.35 - 0.35 * var(--p, 1)));
    transition: transform .15s linear;
}
.gh-grid.is-filtered .gh-game--tanks .gh-screen { aspect-ratio: 16 / 10; }

/* a card that comes back when a filter changes */
.gh-game.is-pop { animation: gh-pop .55s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes gh-pop { from { opacity: 0; transform: translateY(18px) scale(0.98); } }

/* ── The leaderboards, in a line ────────────────────────────────── */
.gh-games { padding-bottom: clamp(24px, 3vw, 40px); }
.gh-note-text { font-size: clamp(19px, 2vw, 24px); line-height: 1.38; letter-spacing: -0.014em; font-weight: 600; color: var(--fg-3); }
.gh-note-text strong { color: var(--fg); }
.gh-note .btns { justify-content: center; margin-top: 28px; }

/* ── Phones ─────────────────────────────────────────────────────── */
@media (max-width: 734px) {
    .gh-deck-stage { padding-top: 36px; }
    .gh-slide { border-radius: 18px; }
    .gh-slide[data-pos="1"] { transform: translateY(-18px) scale(0.95); }
    .gh-slide[data-pos="2"] { transform: translateY(-34px) scale(0.9); }
    .gh-slide-cap { padding: 14px 18px 16px; gap: 10px; }
    .gh-slide-cap b { font-size: 17px; }
    .gh-slide-cap span { font-size: 14px; }
    .gh-deck-nav { gap: 10px; }
    .gh-dots { display: none; }
    .gh-stats .stat-num { font-size: 40px; }
    .gh-stats .stat-label { font-size: 13px; }
    .gh-ticker-note { display: none; }
    .gh-games-head .gh-filters { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
    .gh-filters::-webkit-scrollbar { display: none; }
    .gh-filters button { flex: none; gap: 5px; padding: 0 10px; font-size: 13px; white-space: nowrap; }
    .gh-filters button span { font-size: 12px; }
    .gh-game { padding: 32px 24px 0; }
    .gh-desc { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .gh-in, .gh-game.is-pop, .gh-surprise.is-rolling svg { animation: none; }
    .gh-track { animation: none; }
    .gh-band { overflow-x: auto; scrollbar-width: thin; padding-bottom: 6px; }
    .gh-screen img { transform: none; }
}
