/* Each grade's Games page (/arcade?grade=N, web/arcade.html, games/hub.js; docs/grade-games.md), built to the
   owner's design. Uses the grade picker's look (games-grades.css: body.gg page colour, Back, heading sparks, search,
   SHID) and the grade's own accent (grade-colors.css, body[data-grade]). Sizes are the design's own at ~1000px. */
body.ga {
  --ga-acc: var(--grade, var(--grade-0));
  --ga-deep: var(--grade-deep, color-mix(in oklab, var(--ga-acc) 74%, var(--grade-shade)));
  --ga-band: color-mix(in srgb, var(--ga-acc) 17%, var(--gg-card));
  --ga-edge: color-mix(in srgb, var(--ga-acc) 32%, var(--gg-card));
  --ga-tint: color-mix(in srgb, var(--ga-acc) 4%, var(--gg-card));
  --ga-fill: color-mix(in srgb, var(--ga-acc) 30%, var(--gg-card));
}

/* ---- Top: Back, "KG Games" with sparks, "Choose what to play", two pills, SHID ---- */
.ga-top { margin-bottom: 26px; }
.ga .gg-h h1 { font-size: 72px; letter-spacing: -.5px; }
.ga .gg-h h1[data-len="l"] { font-size: 56px; }
.ga .gg-h h1[data-len="xl"] { font-size: 48px; }
.ga-mid { padding-top: 8px; }
.ga-sub { margin: 4px 0 0; font: 600 28px/1.2 var(--gg-font); color: var(--gg-muted); text-align: center; }
.ga-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 22px; margin-top: 26px; }
.ga-pill { display: inline-flex; align-items: center; justify-content: center; gap: 14px; min-height: 56px; padding: 6px 28px;
  border: 3px solid var(--ga-acc); border-radius: 24px; background: var(--gg-card); color: var(--gg-ink); text-decoration: none;
  font: 600 22px/1.1 var(--gg-font); cursor: pointer; transition: transform .12s, background .12s; }
.ga-pill .ico { width: 30px; height: 30px; stroke-width: 2.1; color: var(--ga-deep); }
.ga-pill:hover { text-decoration: none; transform: translateY(-2px); background: var(--ga-tint); }
.ga-pill:focus-visible { outline: 3px solid var(--gg-ink); outline-offset: 3px; }
.ga-pill.is-on { background: var(--ga-band); }

/* ---- Search: its own full row under the top ---- */
.ga #ga-search-slot { display: flex; justify-content: center; scroll-margin-top: 12px; }
.ga .ga-search { max-width: 740px; margin: 0 auto 32px; }
.ga .ga-search .sb-input { min-height: 60px; border-radius: 999px; }
.ga #guest-banner { max-width: 940px; margin: 0 auto 22px; }
.ga #al-sres { max-width: 940px; margin: 0 auto; }
.ga #al-sres:not(:empty) { margin-bottom: 24px; }

/* ---- The card: tinted band with the gamepad, then three tiles ---- */
.ga-card { max-width: 940px; margin: 0 auto; border: 2px solid var(--ga-edge); border-radius: 28px; overflow: hidden;
  background: linear-gradient(180deg, var(--gg-card), var(--ga-tint)); box-shadow: var(--gg-shadow); }
.ga-card[hidden] { display: none; }
.ga-band { display: flex; align-items: center; gap: 16px; min-height: 76px; padding: 8px 34px; background: var(--ga-band);
  border-radius: 0 0 24px 24px / 0 0 10px 10px; }
.ga-band h2 { margin: 0; font: 700 36px/1.1 var(--gg-font); color: var(--gg-ink); min-width: 0; }
.ga-band-i { flex: none; width: 54px; height: 54px; stroke-width: 1.7; color: var(--ga-deep); }
.ga-band-i path { fill: var(--gg-card); }
.ga-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; padding: 34px 20px 24px; }
.ga-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 240px; padding: 18px 10px 20px;
  border: 3.5px solid var(--ga-acc); border-radius: 24px; background: var(--gg-card); color: var(--gg-ink); text-decoration: none; text-align: center;
  box-shadow: 0 3px 0 color-mix(in srgb, var(--ga-acc) 30%, transparent); transition: transform .12s, box-shadow .12s; }
a.ga-tile:hover { text-decoration: none; transform: translateY(-3px); box-shadow: 0 6px 0 color-mix(in srgb, var(--ga-acc) 40%, transparent); }
a.ga-tile:active { transform: translateY(1px); box-shadow: 0 1px 0 color-mix(in srgb, var(--ga-acc) 30%, transparent); }
a.ga-tile:focus-visible { outline: 3px solid var(--gg-ink); outline-offset: 3px; }
.ga-art { display: flex; align-items: center; justify-content: center; gap: 10px; }
.ga-art .gg-spark { width: 30px; height: 40px; }
.ga-i { width: 124px; height: 124px; stroke-width: 1.35; color: var(--ga-deep); }
/* the light accent fill inside each category icon (brain halves, gamepad body, cap top and band) */
.ga-i-brain path:nth-child(-n+2), .ga-i-gamepad path, .ga-i-cap path { fill: var(--ga-fill); }
.ga-name { margin-top: 6px; font: 700 31px/1.15 var(--gg-font); color: var(--gg-ink); }
.ga-count { font: 500 25px/1.2 var(--gg-font); color: var(--gg-muted); font-variant-numeric: tabular-nums; }
/* No games for this grade yet: same place, quiet, "Coming soon" */
.ga-tile.is-empty { border-style: dashed; border-color: var(--ga-edge); box-shadow: none; cursor: default; }
.ga-tile.is-empty .ga-art { opacity: .45; }
.ga-tile.is-empty .ga-name { color: var(--gg-muted); }

/* ---- One category opened: the same card, its games inside ---- */
.ga-album .ga-band { flex-wrap: wrap; row-gap: 6px; padding-block: 10px; }
.ga-album .ga-band h2 { flex: 1; }
.ga-band-n { font: 600 22px/1.2 var(--gg-font); color: var(--gg-muted); }
.ga-pill-sm { min-height: 46px; padding: 4px 18px; gap: 10px; border-width: 2.5px; font-size: 18px; border-radius: 18px; }
.ga-pill-sm .ico { width: 22px; height: 22px; }
.ga-body { padding: 22px 20px 26px; }
.ga-body .al-grid { margin-top: 0; }
.ga-body #al-none:not(:empty) { margin-bottom: 12px; }
.ga-album { animation: al-open .3s ease-out; }

/* ---- Tablets ---- */
@media (max-width: 860px) {
  .ga .gg-h h1 { font-size: 48px; }
  .ga .gg-h h1[data-len="l"] { font-size: 40px; }
  .ga .gg-h h1[data-len="xl"] { font-size: 34px; }
  .ga-sub { font-size: 24px; }
  .ga-pills { gap: 14px; margin-top: 18px; }
  .ga-tile { min-height: 210px; }
  .ga-i { width: 96px; height: 96px; }
  .ga-name { font-size: 25px; }
  .ga-count { font-size: 21px; }
  .ga-art .gg-spark { width: 22px; height: 30px; }
}
/* ---- Phones: Back and SHID on one row, the title under them, tiles stack ---- */
@media (max-width: 640px) {
  .ga-top { margin-bottom: 16px; }
  .ga-mid { margin-top: -30px; padding-top: 0; align-items: flex-start; }
  .ga .gg-h h1 { font-size: 34px; }
  .ga .gg-h h1[data-len="l"] { font-size: 28px; }
  .ga .gg-h h1[data-len="xl"] { font-size: 25px; }
  .ga-sub { font-size: 19px; text-align: start; }
  .ga-pills { justify-content: flex-start; gap: 10px; margin-top: 14px; width: 100%; }
  .ga-pill { flex: 1 1 140px; min-height: 50px; padding: 4px 12px; gap: 8px; font-size: 17px; border-width: 2.5px; border-radius: 18px; }
  .ga-pill .ico { width: 22px; height: 22px; }
  .ga .ga-search { margin-bottom: 20px; }
  .ga .ga-search .sb-input { min-height: 52px; }
  .ga-card { border-radius: 22px; }
  .ga-band { min-height: 58px; padding: 6px 16px; gap: 10px; }
  .ga-band h2 { font-size: 24px; }
  .ga-band-i { width: 38px; height: 38px; }
  .ga-tiles { grid-template-columns: 1fr; gap: 12px; padding: 18px 12px 16px; }
  .ga-tile { min-height: 0; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; row-gap: 0;
    justify-items: start; align-items: center; text-align: start; padding: 12px 16px; border-width: 3px; border-radius: 20px; }
  .ga-art { grid-row: 1 / 3; gap: 4px; }
  .ga-art .gg-spark { width: 14px; height: 22px; }
  .ga-i { width: 66px; height: 66px; stroke-width: 1.6; }
  .ga-name { margin-top: 0; font-size: 23px; align-self: end; }
  .ga-count { font-size: 18px; align-self: start; }
  .ga-band-n { font-size: 17px; }
  .ga-pill-sm { flex: 0 0 auto; min-height: 42px; font-size: 15px; }
  .ga-body { padding: 14px 10px 18px; }
}
@media (max-width: 380px) {
  .ga .gg-h h1 { font-size: 30px; }
  .ga .gg-h h1[data-len="l"] { font-size: 26px; }
  .ga .gg-h h1[data-len="xl"] { font-size: 23px; }
  .ga-pill { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { .ga-tile, .ga-pill, .ga-album { transition: none; animation: none; } }
html.reduce-motion .ga-tile, html.reduce-motion .ga-pill, html.reduce-motion .ga-album { transition: none; animation: none; }

/* ---- SHID look (shid-look.css, docs/design-rules.md): the grade's accent stays (same colour as its picker button),
   but how much of it shows, the picture sizes and the sparks follow the age tier set from this page's grade.
   Display font for the title, band and tile names; the text font for the subtitle, pills, counts and search. ---- */
body.ga {
  --ga-band: color-mix(in srgb, var(--ga-acc) calc(var(--look-tint) + 4%), var(--gg-card));
  --ga-tint: color-mix(in srgb, var(--ga-acc) calc(var(--look-tint) / 4), var(--gg-card));
  --ga-line: color-mix(in srgb, var(--ga-acc) var(--look-accent-line), var(--look-edge));
}
.ga .gg-h h1 { font-size: calc(var(--look-title) * 1.12); letter-spacing: -.3px; }
.ga .gg-h h1[data-len="l"] { font-size: var(--look-title); }
.ga .gg-h h1[data-len="xl"] { font-size: calc(var(--look-title) * .9); }
.ga-sub { font: 500 var(--look-lead)/1.35 var(--look-font-text); }
.ga-pills { gap: 14px; margin-top: 20px; }
.ga-pill { min-height: 48px; padding: 6px 22px; gap: 10px; border-width: var(--look-line-bold); border-color: var(--ga-line); border-radius: 999px;
  font: 600 16px/1.1 var(--look-font-text); }
.ga-pill .ico { width: 22px; height: 22px; stroke-width: 2; }
.ga .ga-search { max-width: 640px; margin-bottom: 26px; }
.ga .ga-search .sb-input { min-height: 52px; }
.ga-card { border-width: var(--look-line); border-radius: var(--look-radius-lg); box-shadow: var(--look-shadow); }
.ga-band { min-height: 64px; padding: 8px 28px; }
.ga-band h2 { font-size: var(--look-h2); }
.ga-band-i { width: calc(44px * var(--look-art)); height: calc(44px * var(--look-art)); }
.ga-tiles { gap: 16px; padding: 26px 20px 22px; }
.ga-tile { min-height: calc(150px + 60px * var(--look-art)); border-width: var(--look-line-bold); border-color: var(--ga-line); border-radius: var(--look-radius-lg);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--ga-acc) calc(var(--look-accent-line) / 3), transparent); }
a.ga-tile:hover { box-shadow: 0 5px 0 color-mix(in srgb, var(--ga-acc) calc(var(--look-accent-line) / 2), transparent); border-color: var(--ga-acc); }
.ga-art .gg-spark { width: calc(24px * var(--look-spark)); height: calc(32px * var(--look-spark)); }
.ga-i { width: calc(100px * var(--look-art)); height: calc(100px * var(--look-art)); stroke-width: 1.5; }
.ga-name { margin-top: 8px; font-size: var(--look-h3); }
.ga-count { margin-top: 2px; font: 500 var(--look-text)/1.3 var(--look-font-text); }
.ga-band-n { font: 500 var(--look-text)/1.3 var(--look-font-text); }
.ga-pill-sm { min-height: 40px; padding: 4px 16px; font-size: 15px; }
.ga-pill-sm .ico { width: 18px; height: 18px; }
@media (max-width: 860px) {
  .ga .gg-h h1 { font-size: var(--look-title); }
  .ga .gg-h h1[data-len="l"] { font-size: calc(var(--look-title) * .85); }
  .ga .gg-h h1[data-len="xl"] { font-size: calc(var(--look-title) * .75); }
  .ga-tile { min-height: calc(130px + 50px * var(--look-art)); }
  .ga-i { width: calc(84px * var(--look-art)); height: calc(84px * var(--look-art)); }
}
@media (max-width: 640px) {
  /* the title tucks up beside SHID; a smaller SHID (older tier) leaves less room above it, so it tucks less */
  .ga-mid { margin-top: calc(10px - 40px * var(--look-art)); }
  .ga .gg-h h1 { font-size: var(--look-title-sm); }
  .ga .gg-h h1[data-len="l"] { font-size: calc(var(--look-title-sm) * .88); }
  .ga .gg-h h1[data-len="xl"] { font-size: calc(var(--look-title-sm) * .8); }
  .ga-sub { font-size: var(--look-lead-sm); }
  .ga-pills { gap: 10px; margin-top: 14px; }
  .ga-pill { min-height: 46px; padding: 4px 12px; font-size: 15px; }
  .ga-pill .ico { width: 20px; height: 20px; }
  .ga .ga-search { margin-bottom: 18px; }
  .ga .ga-search .sb-input { min-height: 48px; }
  .ga-card { border-radius: var(--look-radius); }
  .ga-band { min-height: 52px; padding: 6px 16px; }
  .ga-band h2 { font-size: var(--look-h2-sm); }
  .ga-band-i { width: 34px; height: 34px; }
  .ga-tiles { gap: 10px; padding: 14px 12px; }
  .ga-tile { min-height: 0; padding: 10px 14px; border-radius: var(--look-radius); }
  .ga-art .gg-spark { width: calc(13px * var(--look-spark)); height: calc(20px * var(--look-spark)); }
  .ga-i { width: calc(56px * var(--look-art)); height: calc(56px * var(--look-art)); }
  .ga-name { margin-top: 0; font-size: var(--look-h3-sm); }
  .ga-count { font-size: var(--look-small); }
}
@media (max-width: 380px) {
  .ga .gg-h h1 { font-size: calc(var(--look-title-sm) * .9); }
  .ga-pill { font-size: 14px; }
}
