/* ============================================================
   Zamborin · shared page chrome
   Header, footer, splash, focus button, canvas layout, mobile
   auto-focus. Game-specific styles live in each game's play.css.
   Imports tokens.css for design variables.
   ============================================================ */

/* ---------- HEADER ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  width: 100%;
  height: 100px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 14px; }
a.brand { text-decoration: none; color: inherit; }
a.brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }

.header-right { display: flex; align-items: center; gap: 12px; }
.back-link {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--text);
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 999px;
  /* AA 3:1 border vs #0E1726 bg (computed 4.6:1) */
  border: 1px solid rgba(255, 255, 255, 0.45);
  transition: background .15s ease, color .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.back-link:hover {
  border-color: rgba(255, 255, 255, 0.70);
  background: rgba(255, 255, 255, 0.06);
}
.back-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.brand-mark {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--brand);
  line-height: 1;
}
.brand-sub {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: var(--accent);
  text-transform: uppercase;
}
.brand-logo {
  height: 36px;
  width: auto;
  display: block;
}

/* ---------- PAGE ---------- */
.page {
  max-width: 1100px;
  margin: 28px auto 0;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---------- AD SLOTS — hidden V1 ---------- */
.ad-slot {
  display: none;
  background: var(--bg-card);
  border: 1px dashed rgba(255, 255, 255, 0.18);
  place-items: center;
  color: var(--text-mute);
  font-weight: 700;
  letter-spacing: 2px;
  font-size: 11px;
  border-radius: 10px;
}
.ad-leaderboard { width: 728px; height: 90px; margin: 0 auto; }
.ad-medrec      { width: 300px; height: 250px; }

/* ---------- PLAY ROW + GAME CARD ---------- */
.play-row {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: flex-start;
}
.game-wrap {
  /* Canvas dimensions are mode-driven (set on body by play.js). */
  width:  var(--canvas-w);
  height: var(--canvas-h);
  background:
    radial-gradient(at 30% 0%, #1B2A47 0%, #131F36 60%, #0E1726 100%);
  border-radius: 16px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 1px 0 rgba(0,0,0,0.4),
    0 24px 48px -16px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(255, 107, 92, 0.06);
  overflow: hidden;
  position: relative;
}
body.mode-desktop { --canvas-w: 760px; --canvas-h: 570px; }
body.mode-mobile  { --canvas-w: 393px; --canvas-h: 852px; }
#game {
  display: block;
  width:  var(--canvas-w);
  height: var(--canvas-h);
  cursor: pointer;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.sidebar { display: flex; flex-direction: column; gap: 20px; }

/* ---------- FOOTER ---------- */
.site-footer {
  margin: 40px auto 28px;
  text-align: center;
  font-size: 11px;
  color: var(--text-mute);
  font-weight: 700;
  letter-spacing: 1.4px;
}

/* ---------- SPLASH ----------
   Splash images are declared by each game's own play.css —
   .splash structure / fade / scope live here. */
.splash {
  position: absolute;
  inset: 0;
  z-index: 10;
  background-color: var(--bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: opacity 0.6s ease-out;
  pointer-events: auto;
}
.splash.fading { opacity: 0; pointer-events: none; }

/* ---------- FOCUS / PHONE-VIEW BUTTON ---------- */
.focus-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  /* AA 3:1 border vs #0E1726 bg (computed 4.6:1) */
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: color .15s ease, background .15s ease, transform .12s ease;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}
.focus-btn:hover { color: var(--text); background: var(--bg-panel); }
.focus-btn:active { transform: scale(0.94); }
.focus-btn:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
  color: var(--text);
}
.focus-btn .icon-exit { display: none; }
body.focus-mode .focus-btn .icon-enter { display: none; }
body.focus-mode .focus-btn .icon-exit  { display: block; }
body.focus-mode .focus-btn {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 200;
  background: rgba(14, 23, 38, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-color: rgba(255, 255, 255, 0.45);
}

/* ---------- FOCUS-MODE LAYOUT (manual toggle, desktop) ---------- */
body.focus-mode .site-footer,
body.focus-mode .ad-slot { display: none; }
/* Header collapses to zero so the game can use the full viewport,
   but stays renderable so the position:fixed focus-btn inside still paints. */
body.focus-mode .site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 0;
  padding: 0;
  background: transparent;
  border-bottom: none;
  overflow: visible;
  pointer-events: none;
}
body.focus-mode .site-header .brand,
body.focus-mode .site-header .back-link { display: none; }
body.focus-mode .site-header .focus-btn { pointer-events: auto; }
body.focus-mode .page {
  margin: 0; padding: 0; gap: 0; max-width: none;
}
body.focus-mode .play-row {
  width: 100vw; height: 100dvh;
  align-items: center; justify-content: center; gap: 0;
}
body.focus-mode .game-wrap {
  width:  min(100vw, calc(100dvh * var(--canvas-w) / var(--canvas-h)));
  height: min(100dvh, calc(100vw * var(--canvas-h) / var(--canvas-w)));
  border-radius: 0;
  box-shadow: none;
}
body.focus-mode #game { width: 100%; height: 100%; }

/* ---------- MOBILE: auto-focus layout below 1100 px ---------- */
@media (max-width: 1099px) {
  .site-footer,
  .ad-slot { display: none; }
  .site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 0;
    padding: 0;
    background: transparent;
    border-bottom: none;
    overflow: visible;
    pointer-events: none;
  }
  .site-header .brand,
  .site-header .back-link { display: none; }
  .site-header .focus-btn { display: none; }
  .page { margin: 0; padding: 0; gap: 0; max-width: none; }
  .play-row {
    width: 100vw; height: 100dvh;
    align-items: center; justify-content: center; gap: 0;
  }
  .game-wrap {
    width:  min(100vw, calc(100dvh * var(--canvas-w) / var(--canvas-h)));
    height: min(100dvh, calc(100vw * var(--canvas-h) / var(--canvas-w)));
    border-radius: 0;
    box-shadow: none;
  }
  #game { width: 100%; height: 100%; }
}
