/* krabsy-game-info.css — the page AROUND a game on the wrapper pages
   /<lang>/<spiele|juegos|games>/<id>/ (markup rendered by
   tools/render_game_info.py): the slim bar under the game, the info section
   and the site footer.

   Light since 2026-11-28 (site review: "game pages look like a different
   site"): cream page, white cards, the site's fonts and footer. Only the game
   itself keeps its dark stage (#game-frame / .kg-stage-spacer).

   Game pages don't load krabsy-ui.css (it would restyle the inlined games), so
   this file is self-contained: scoped to .kg-*, with its own copy of the
   footer rules (.kg-footer + the .k-footer-* parts krabsy-footer.js renders).
   The compact game header is styled in krabsy-nav.js (injectGameNavStyles). */

@import url('/lib/fonts/krabsy-fonts.css?v=2026-11-26f');

:root {
  --kg-hint-h: 36px;
  /* Game pages don't load krabsy-ui.css: the palette's values are repeated here
     (bg #f7f6f2, navy #1d2350, violet #6b5ce7, turquoise #2ee6c0 + tints). */
  --kg-cream: #f7f6f2;
  --kg-white: #ffffff;
  --kg-ink: #1d2350;
  --kg-mute: #5a5e7d;
  --kg-line: #e6e5e5;
  --kg-teal: #2ee6c0;
  --kg-teal-soft: #d7f3ea;
  --kg-teal-deep: #1d2350;   /* text in the turquoise state: navy */
  --kg-amber-soft: #e2dff0;  /* hover tint: violet */
  --kg-link: #4b40a2;        /* violet shade: 8.2:1 on white */
  --kg-link-deep: #1d2350;
  --kg-display: 'Fredoka Display', 'Nunito', sans-serif;
  --kg-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --kg-shadow: 0 2px 8px rgba(29, 35, 80, 0.07);
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* The page is light; the wrappers give the game frame its own dark colour. */
html, body { background: var(--kg-cream); }

/* Inlined (absolutely positioned) games: reserve their height in the flow.
   --kg-stage-h is set by the game's resizeWorld(); fallback = 100vh.
   Dark, so the bars beside a letterboxed game stay a stage. */
.kg-stage-spacer {
  height: var(--kg-stage-h, calc(100vh - var(--kg-hint-h)));
  pointer-events: none;
  background: #1d2350;
}

/* ── Slim bar under the game: leads to the text ─────────────────────────── */
.kg-scroll-hint {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--kg-hint-h);
  box-sizing: border-box;
  padding: 0 12px;
  background: var(--kg-white);
  color: var(--kg-ink);
  font: 800 0.85rem/1.4 var(--kg-body);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  box-shadow: inset 0 -1px 0 var(--kg-line);
  -webkit-user-select: none;
  user-select: none;
}
.kg-scroll-hint > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.kg-scroll-hint:hover { background: var(--kg-teal-soft); color: var(--kg-ink); }
.kg-scroll-hint:focus-visible { outline: 3px solid var(--kg-ink); outline-offset: -3px; }
.kg-chev { width: 14px; height: 14px; flex: 0 0 auto; display: block; }
.kg-chev-up { transform: rotate(180deg); }

/* ── Info section ───────────────────────────────────────────────────────── */
.kg-info {
  position: relative;
  z-index: 2;
  display: block;
  box-sizing: border-box;
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 16px 36px;
  color: var(--kg-ink);
  font: 400 1rem/1.6 var(--kg-body);
  text-align: left;
  scroll-margin-top: 56px; /* clear the fixed 48 px game header */
  -webkit-user-select: text;
  user-select: text;
}
@media (min-width: 720px) { .kg-info { padding: 28px 24px 48px; } }
.kg-info *, .kg-footer * { box-sizing: border-box; }

.kg-info h1,
.kg-info h2,
.kg-info h3 {
  font-family: var(--kg-display);
  font-weight: 400;
  line-height: 1.2;
  color: var(--kg-ink);
}
.kg-info h1 { font-size: 1.7rem; margin: 0 0 10px; }
.kg-info h2 { font-size: 1.3rem; margin: 0 0 10px; }
.kg-info h3 { font-size: 1.05rem; margin: 0 0 4px; }
@media (min-width: 720px) {
  .kg-info h1 { font-size: 2.1rem; }
  .kg-info h2 { font-size: 1.45rem; }
}
.kg-info p { margin: 0 0 12px; }
.kg-info p:last-child { margin-bottom: 0; }
.kg-info a { color: var(--kg-link); font-weight: 800; text-decoration: underline; text-underline-offset: 2px; }
.kg-info a:hover { color: var(--kg-link-deep); }
.kg-info a:focus-visible { outline: 3px solid var(--kg-ink); outline-offset: 2px; border-radius: 6px; }
.kg-info em { font-style: italic; }
.kg-info strong { font-weight: 800; }
.kg-info kbd {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 6px;
  border: 1px solid rgba(29, 35, 80, 0.3);
  border-bottom-width: 2px;
  border-radius: 6px;
  font: 700 0.85em/1.5 ui-monospace, Menlo, Consolas, monospace;
  text-align: center;
  color: var(--kg-ink);
  background: var(--kg-cream);
}

.kg-crumbs { margin: 0 4px 12px; font-size: 0.88rem; color: var(--kg-mute); }
.kg-info .kg-crumbs a { color: var(--kg-mute); font-weight: 700; }
.kg-info .kg-crumbs a:hover { color: var(--kg-ink); }
.kg-crumbs [aria-current] { color: var(--kg-ink); font-weight: 700; }

/* Head card: what the game is (the soft teal-to-amber of the profile card). */
.kg-hero {
  margin: 0 0 16px;
  padding: 20px 20px 22px;
  border-radius: 24px;
  background: linear-gradient(120deg, #d7f3ea 0%, #e9f7f1 46%, #eeecf6 100%);
  box-shadow: 0 4px 0 rgba(29, 35, 80, 0.07), var(--kg-shadow);
}
.kg-hero p { font-size: 1.05rem; }
.kg-info .kg-hero a { color: var(--kg-link-deep); }   /* AA on the tinted card */
@media (min-width: 720px) { .kg-hero { padding: 26px 32px 28px; border-radius: 28px; } }

/* White cards: how to play, what you learn, lessons, questions, links. */
.kg-card {
  margin: 0 0 16px;
  padding: 18px 20px 20px;
  border-radius: 24px;
  background: var(--kg-white);
  box-shadow: var(--kg-shadow);
}
@media (min-width: 720px) { .kg-card { padding: 22px 28px 24px; } }

.kg-info .kg-steps { list-style: none; margin: 0 0 12px; padding: 0; }
.kg-info .kg-steps:last-child { margin-bottom: 0; }
.kg-info .kg-steps li { position: relative; margin: 0 0 8px; padding-left: 22px; }
.kg-info .kg-steps li:last-child { margin-bottom: 0; }
.kg-steps li::before {
  content: ""; position: absolute; left: 2px; top: 0.5em;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--kg-teal); box-shadow: inset 0 0 0 2px var(--kg-ink);
}

.kg-faq-item { padding: 12px 0; border-top: 2px solid var(--kg-line); }
.kg-faq-item:first-child { padding-top: 2px; border-top: 0; }
.kg-faq-item:last-child { padding-bottom: 0; }

.kg-info .kg-links { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 8px 12px; }
@media (min-width: 640px) { .kg-info .kg-links { grid-template-columns: 1fr 1fr; } }
.kg-info .kg-links li { margin: 0; min-width: 0; }
.kg-info .kg-links a {
  display: flex; align-items: center; min-height: 48px; height: 100%; padding: 8px 16px;
  border-radius: 16px; background: var(--kg-cream);
  box-shadow: inset 0 0 0 2px var(--kg-line);
  color: var(--kg-ink); font-weight: 700; line-height: 1.3; text-decoration: none;
}
.kg-info .kg-links a:hover { background: var(--kg-amber-soft); color: var(--kg-ink); }

/* Related games: cards on the page, like the games page. */
.kg-more { margin: 24px 0 0; }
.kg-more h2 { margin: 0 4px 12px; }
.kg-related {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 560px) { .kg-related { grid-template-columns: repeat(3, 1fr); } }
.kg-info a.kg-related-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 20px;
  background: var(--kg-white);
  box-shadow: var(--kg-shadow);
  color: var(--kg-ink);
  text-decoration: none;
  font-weight: 400;
  transition: transform 0.15s ease;
}
.kg-info a.kg-related-card:hover { transform: translateY(-3px); color: var(--kg-ink); }
.kg-info a.kg-related-card:focus-visible { border-radius: 20px; }
.kg-related-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  background: var(--kg-teal-soft);
  overflow: hidden;
}
.kg-related-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.kg-related-ico { width: 44px; height: 44px; }
.kg-related-name {
  padding: 12px 16px 2px;
  font-family: var(--kg-display);
  font-size: 1.1rem;
  line-height: 1.2;
}
.kg-related-tag { padding: 0 16px 14px; font-size: 0.9rem; line-height: 1.4; color: var(--kg-mute); }
/* Phones: thumbnail beside the text, so three cards stay short. */
@media (max-width: 559px) {
  .kg-info a.kg-related-card { display: grid; grid-template-columns: 120px minmax(0, 1fr); align-content: center; }
  .kg-related-thumb { grid-row: 1 / span 2; aspect-ratio: auto; height: 100%; min-height: 84px; }
  .kg-related-name { align-self: end; padding: 10px 14px 2px; }
  .kg-related-tag { align-self: start; padding: 0 14px 10px; }
}

.kg-info .kg-top { margin: 24px 0 0; text-align: center; }
.kg-info .kg-top a {
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 22px;
  border-radius: 999px; background: var(--kg-white); color: var(--kg-ink);
  font-weight: 800; text-decoration: none;
  box-shadow: inset 0 0 0 2px rgba(29, 35, 80, 0.16), 0 3px 0 rgba(29, 35, 80, 0.12);
}
.kg-info .kg-top a:hover { background: var(--kg-amber-soft); color: var(--kg-ink); }

/* Spanish section (/en/spanish/games/<id>/): topic bar under the h1; the page script marks the topic being played */
.kg-info .kg-topics { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; }
.kg-info a.kg-topic,
.kg-info .kg-hero a.kg-topic {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 999px;
  background: var(--kg-white); box-shadow: inset 0 0 0 2px rgba(29, 35, 80, 0.14);
  color: var(--kg-ink); text-decoration: none; font-weight: 800;
}
.kg-info .kg-hero a.kg-topic:hover { background: var(--kg-amber-soft); color: var(--kg-ink); }
.kg-info .kg-topic[aria-current] { background: var(--kg-teal-soft); box-shadow: inset 0 0 0 2px var(--kg-teal); }

/* Teacher practice link: the banner shares the slim bar under the game */
.kg-teacher-set { display: inline-flex; align-items: center; gap: 6px; flex: 0 1 auto; min-width: 0; font-weight: 800; color: var(--kg-teal-deep); }
.kg-teacher-set > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.kg-teacher-ico { width: 18px; height: 18px; flex: 0 0 auto; }
.kg-scroll-hint.has-teacher-set { gap: 6px 14px; }
@media (max-width: 559px) { .kg-scroll-hint.has-teacher-set > :not(.kg-teacher-set) { display: none; } }

/* ── Site footer (same look as .k-footer in krabsy-ui.css) ──────────────── */
.kg-footer {
  position: relative;
  z-index: 2;
  margin: 0;
  padding: 24px 16px;
  text-align: center;
  font: 400 0.75rem/1.5 var(--kg-body);
  color: var(--kg-mute);
  background: var(--kg-line);
  -webkit-user-select: text;
  user-select: text;
}
.kg-footer a { color: var(--kg-mute); text-decoration: none; }
.kg-footer a:hover { color: var(--kg-link); }
.kg-footer a:focus-visible { outline: 3px solid var(--kg-ink); outline-offset: 2px; border-radius: 4px; }
.kg-footer .k-footer-grid {
  max-width: 1100px;
  margin: 0 auto 24px;
  padding: 8px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px 32px;
  text-align: left;
}
@media (min-width: 600px) { .kg-footer .k-footer-grid { grid-template-columns: repeat(3, 1fr); } }
.kg-footer .k-footer-col-heading {
  margin: 0 0 12px;
  font-weight: 700; font-size: 0.72rem; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--kg-ink);
}
.kg-footer .k-footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.kg-footer .k-footer-col li { font-size: 0.85rem; line-height: 1.3; }
.kg-footer .k-footer-col a.is-disabled { opacity: 0.55; cursor: default; pointer-events: none; }
.kg-footer .k-footer-legal-link { font-size: 0.78rem; margin: 0 2px; }
.kg-footer .k-footer-legal-sep { opacity: 0.5; font-size: 0.78rem; margin: 0 4px; }
@media (pointer: coarse) {
  .kg-footer .k-footer-col ul { gap: 0; }
  .kg-footer .k-footer-col a,
  .kg-footer #footer-copyright a,
  .kg-footer .k-footer-legal-link { display: inline-block; padding: 13px 4px; min-height: 44px; }
}

/* Phones in landscape (2026-11-25): the 48 px site header and the hint bar left 3D
   games only ~300 px of height, and Verb Dungeon's menu was cut off. On short
   landscape screens an iframed game hides the header and takes the whole screen
   above the hint bar (the browser's back button leaves the game). */
@media (orientation: landscape) and (max-height: 500px) {
  body:has(#game-frame) .k-game-nav { display: none; }
  body:has(#game-frame) #game-frame {
    margin-top: 0;
    height: calc(100vh - var(--kg-hint-h));
    height: calc(100svh - var(--kg-hint-h));
  }
}

/* Offline games (Crab Slash, Verb Slash: out of games.json, pages kept, noindex)
   still carry the older markup without cards: keep their headings apart. */
.kg-info > h1 { margin-top: 6px; }
.kg-info > h2 { margin: 28px 0 10px; }
.kg-info > .kg-faq h3 { margin-top: 14px; }
.kg-info > .kg-related { margin-top: 8px; }

/* Loading bar over the game frame until the frame has loaded (render_game_info.py, 2026-11-30) */
.kg-frame-load {
  position: absolute; left: 0; width: 100%; z-index: 5; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: #1d2350; transition: opacity 0.4s ease;
}
.kg-frame-load.is-done { opacity: 0; }
.kg-frame-load img { width: 120px; height: auto; animation: kg-frame-bob 1.5s ease-in-out infinite; }
.kg-frame-bar { width: min(260px, 70%); height: 14px; border-radius: 999px; border: 2px solid #fff; overflow: hidden; background: #1d2350; }
.kg-frame-bar i { display: block; height: 100%; width: 100%; background: #2ee6c0; transform-origin: 0 50%;
  animation: kg-frame-creep 25s cubic-bezier(0.1, 0.7, 0.2, 1) forwards; }
@keyframes kg-frame-creep { from { transform: scaleX(0.04); } to { transform: scaleX(0.92); } }
@keyframes kg-frame-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .kg-frame-load img { animation: none; } }

/* Touch screens: 44 px tap targets without changing the look (site review S19).
   The game header's controls (styled in krabsy-nav.js) get the same enlarged hit
   area as the site header in krabsy-ui.css; the slim bar under the game reaches
   44 px into the info section's top padding, so the game keeps its height. */
@media (pointer: coarse) {
  .k-game-nav-logo, .k-game-nav-back, .k-game-nav-lang .k-lang-btn, .k-game-nav-class { position: relative; }
  .k-game-nav-logo::after, .k-game-nav-back::after, .k-game-nav-lang .k-lang-btn::after, .k-game-nav-class::after {
    content: ""; position: absolute; left: 50%; top: 50%; width: max(100%, 44px); height: max(100%, 44px);
    transform: translate(-50%, -50%);
  }
  .k-game-nav-lang { overflow: visible; }
  .kg-scroll-hint { z-index: 3; overflow: visible; }
  .kg-scroll-hint::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 44px; }
  .kg-crumbs { margin-top: -12px; margin-bottom: 0; }
  .kg-info .kg-crumbs a { display: inline-block; padding: 12px 2px; }
}
