/* ═══════════════════════════════════════════════════════════════
   shell.css — design tokens + the shared header and footer of
   games.krk.today. Loaded by every studio page AND every game page
   (lovemypet/), so it styles nothing but its own `sh-` classes and
   defines only `--color-*`, `--space-*`, `--radius-*`, `--font-*`,
   `--content-*` tokens (the game pages use other names).
   Design notes: docs/design-system.md.
═══════════════════════════════════════════════════════════════ */
:root {
  --color-bg: #0b0f16;
  --color-bg-deep: #070a0f;
  --color-surface: #111823;
  --color-surface-raised: #182230;
  --color-border: #293444;
  --color-border-soft: #1c2533;
  --color-text: #f4f6fa;
  --color-text-muted: #a5b2c3;     /* 8.9:1 on --color-bg */
  --color-text-faint: #8593a6;     /* 6.0:1 on --color-bg, small print only */
  --color-accent: #a8c0dd;
  --color-accent-strong: #d6e6fa;
  --color-focus: #9bc8ff;
  --color-status-available: #8fd3a6;
  --color-status-soon: #e9c58a;
  --color-status-dev: #a8c0dd;

  --font-display: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --font-ui: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --content-max: 1360px;
  --reading-max: 760px;
  --header-height: 72px;
  --gutter: clamp(20px, 4vw, 56px);
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --space-section: clamp(72px, 9vw, 144px);
  --shadow-panel: 0 22px 70px rgb(0 0 0 / 0.3);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

.sh-wrap { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gutter); box-sizing: border-box; }
.sh-header, .sh-footer { font-family: var(--font-ui); -webkit-font-smoothing: antialiased; color: var(--color-text); }
.sh-header *, .sh-footer * { box-sizing: border-box; }
.sh-header :focus-visible, .sh-footer :focus-visible, .sh-skip:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; border-radius: 4px; }

.sh-skip {
  position: absolute; left: 12px; top: -80px; z-index: 200;
  background: var(--color-text); color: var(--color-bg); padding: 10px 16px; border-radius: var(--radius-xs);
  font: 600 15px/1.2 var(--font-ui); text-decoration: none;
}
.sh-skip:focus { top: 12px; }

/* ─── header ─── */
.sh-header {
  position: sticky; top: 0; z-index: 100;
  background: rgb(11 15 22 / 0.86);
  -webkit-backdrop-filter: saturate(1.3) blur(14px); backdrop-filter: saturate(1.3) blur(14px);
  border-bottom: 1px solid var(--color-border-soft);
}
.sh-header--static { position: relative; background: var(--color-bg); }
.sh-bar { display: flex; align-items: center; gap: 24px; min-height: var(--header-height); }
.sh-brand { display: inline-flex; align-items: center; gap: 12px; color: var(--color-text); text-decoration: none; flex: none; }
.sh-brand img { width: 34px; height: 34px; display: block; }
.sh-word { font: 600 13px/1 var(--font-ui); letter-spacing: .18em; text-transform: uppercase; white-space: nowrap; }
.sh-word b { font-weight: 600; color: var(--color-accent); }
.sh-nav { display: flex; align-items: center; gap: 28px; margin-left: auto; }
.sh-links { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.sh-links a {
  position: relative; display: block; padding: 10px 12px;
  color: var(--color-text-muted); text-decoration: none; font: 500 15px/1.2 var(--font-ui);
  transition: color .2s;
}
.sh-links a:hover { color: var(--color-text); }
.sh-links a[aria-current="page"] { color: var(--color-text); }
.sh-links a[aria-current="page"]::after {
  content: ''; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; border-radius: 2px; background: var(--color-accent);
}

.sh-lang { display: inline-flex; border: 1px solid var(--color-border); border-radius: var(--radius-xs); overflow: hidden; }
.sh-lang a {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px;
  color: var(--color-text-muted); text-decoration: none; font: 600 12px/1 var(--font-ui); letter-spacing: .06em;
}
.sh-lang a + a { border-left: 1px solid var(--color-border); }
.sh-lang a:hover { color: var(--color-text); background: var(--color-surface); }
.sh-lang a[aria-current="true"] { color: var(--color-text); background: var(--color-surface-raised); }
.sh-lang img { width: 20px; height: 10px; border-radius: 1px; display: block; }

.sh-menu-btn {
  display: none; align-items: center; gap: 10px; margin-left: auto; min-height: 44px; padding: 0 14px;
  background: transparent; color: var(--color-text); border: 1px solid var(--color-border); border-radius: var(--radius-xs);
  font: 600 14px/1 var(--font-ui); cursor: pointer;
}
.sh-menu-btn:hover { border-color: var(--color-accent); }
.sh-burger, .sh-burger::before, .sh-burger::after { display: block; width: 16px; height: 1.5px; background: currentColor; border-radius: 1px; transition: transform .25s var(--ease), opacity .2s; }
.sh-burger { position: relative; }
.sh-burger::before, .sh-burger::after { content: ''; position: absolute; left: 0; }
.sh-burger::before { top: -5px; }
.sh-burger::after { top: 5px; }
.sh-menu-btn[aria-expanded="true"] .sh-burger { background: transparent; }
.sh-menu-btn[aria-expanded="true"] .sh-burger::before { transform: translateY(5px) rotate(45deg); }
.sh-menu-btn[aria-expanded="true"] .sh-burger::after { transform: translateY(-5px) rotate(-45deg); }

/* Small screens. Without JavaScript the links simply wrap under the logo;
   with it (html.js) they fold into a menu that the button opens. */
@media (max-width: 860px) {
  .sh-bar { flex-wrap: wrap; gap: 8px 16px; padding-top: 10px; padding-bottom: 10px; }
  .sh-nav { width: 100%; margin-left: 0; flex-wrap: wrap; gap: 8px 16px; }
  .sh-links { flex-wrap: wrap; margin-left: -12px; }
  html.js .sh-bar { flex-wrap: nowrap; padding-top: 0; padding-bottom: 0; }
  html.js .sh-menu-btn { display: inline-flex; }
  html.js .sh-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 8px var(--gutter) 24px; background: var(--color-bg);
    border-bottom: 1px solid var(--color-border); box-shadow: var(--shadow-panel);
    max-height: calc(100vh - var(--header-height)); overflow-y: auto;
  }
  html.js .sh-nav.is-open { display: flex; }
  html.js .sh-links { flex-direction: column; margin: 0 0 16px; }
  html.js .sh-links a { padding: 16px 0; font-size: 18px; border-bottom: 1px solid var(--color-border-soft); }
  html.js .sh-links a[aria-current="page"]::after { left: 0; right: auto; width: 24px; bottom: 10px; }
  html.js .sh-lang { align-self: flex-start; }
  html.js .sh-lang a { padding: 12px 14px; font-size: 14px; }
}
@media (max-width: 380px) {
  .sh-word { font-size: 11px; letter-spacing: .14em; }
  .sh-menu-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ─── footer ─── */
.sh-footer { background: var(--color-bg-deep); border-top: 1px solid var(--color-border-soft); padding: 64px 0 32px; font-size: 15px; line-height: 1.6; }
.sh-foot { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: 40px 32px; }
.sh-foot-brand p { margin: 16px 0 0; color: var(--color-text-muted); max-width: 40ch; }
.sh-foot-col h2 { margin: 6px 0 14px; font: 600 12px/1.2 var(--font-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--color-text-faint); }
.sh-foot-col ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.sh-footer a { color: var(--color-text-muted); text-decoration: none; }
.sh-footer a:hover { color: var(--color-text); text-decoration: underline; text-underline-offset: 3px; }
.sh-footer .sh-brand { color: var(--color-text); }
.sh-footer .sh-mail { color: var(--color-text); }
.sh-foot-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 32px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--color-border-soft); color: var(--color-text-faint); font-size: 13px; }
.sh-foot-base p { margin: 0; }
@media (max-width: 960px) { .sh-foot { grid-template-columns: repeat(3, minmax(0, 1fr)); } .sh-foot-brand { grid-column: 1 / -1; } }
@media (max-width: 560px) { .sh-foot { grid-template-columns: 1fr 1fr; } .sh-foot-col:last-child { grid-column: 1 / -1; } }

/* ─── lightbox (<dialog class="sh-lb">, built by site.js from #sh-lightbox) ─── */
html.sh-lb-open { overflow: hidden; }
.sh-lb {
  box-sizing: border-box; position: fixed; inset: 0; width: 100vw; height: 100vh; max-width: none; max-height: none;
  margin: 0; padding: 64px clamp(12px, 6vw, 96px) 72px; border: 0; background: transparent; color: var(--color-text);
  font-family: var(--font-ui); overflow: hidden;
}
.sh-lb::backdrop { background: rgb(7 10 15 / 0.94); }
.sh-lb[open] { display: flex; animation: sh-lb-in .2s var(--ease); }
@keyframes sh-lb-in { from { opacity: 0; } }
/* The image is sized against the viewport, not the grid cell: a percentage
   max-height on a tall portrait image doesn't resolve in WebKit and the
   image overflowed (only its top showed). 210px = top bar + bottom padding
   + room for a two-line caption. The dialog is a flex box (not a centring
   grid: a content-sized grid cell made max-width: 100% resolve against the
   thumbnail-small image). site.js sets --ar (width / height) so the image
   scales up to fill the screen, not just to its file size. */
.sh-lb-figure { margin: 0; flex: 1 1 auto; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 0; }
.sh-lb-img {
  display: block; flex: none; height: auto; max-width: 100%;
  width: min(100%, calc((100vh - 210px) * var(--ar, 1.5)));
  width: min(100%, calc((100dvh - 210px) * var(--ar, 1.5)));
  max-height: calc(100vh - 210px); max-height: calc(100dvh - 210px);
  object-fit: contain; border-radius: 10px; box-shadow: 0 30px 80px rgb(0 0 0 / 0.6); background: var(--color-surface);
}
.sh-lb-caption { max-width: 70ch; text-align: center; font-size: 15px; line-height: 1.5; color: var(--color-text-muted); }
.sh-lb-bar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 12px clamp(12px, 3vw, 24px); }
.sh-lb-count { margin-right: auto; font-size: 14px; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.sh-lb-download { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border: 1px solid var(--color-border); border-radius: var(--radius-xs); color: var(--color-text); text-decoration: none; font-weight: 600; font-size: 14px; }
.sh-lb-download:hover { border-color: var(--color-accent); }
.sh-lb button { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--color-border); border-radius: var(--radius-xs); background: rgb(17 24 35 / 0.85); color: var(--color-text); font: 400 28px/1 var(--font-ui); cursor: pointer; }
.sh-lb button:hover { border-color: var(--color-accent); }
.sh-lb-nav { position: absolute; top: 50%; transform: translateY(-50%); height: 64px !important; }
.sh-lb-prev { left: clamp(8px, 2vw, 24px); }
.sh-lb-next { right: clamp(8px, 2vw, 24px); }
.sh-lb [hidden] { display: none !important; }
.sh-lb :focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; }
@media (max-width: 700px) {
  .sh-lb { padding: 60px 8px 64px; }
  .sh-lb-nav { top: auto; bottom: 10px; transform: none; height: 44px !important; }
}

@media (prefers-reduced-motion: reduce) {
  .sh-lb[open] { animation: none; }
  .sh-burger, .sh-burger::before, .sh-burger::after, .sh-links a { transition: none; }
}
