/* Site frame shared by every page: design tokens, base styles, header and footer.
   Page-specific styles live next to the page (catalog), in game.css, or in legal.css. */
:root {
  color-scheme: light;
  --page: #f7f7f4;
  --surface: #ffffff;
  --ink: #171a1d;
  --muted: #626b66;
  --soft: #f0f2ee;
  --line: #e0e4de;
  --accent: #176a51;
  --accent-soft: #e4f1ec;
  --amber: #805a12;
  --danger: #b3402e;
  --board: #12392d;
  --shadow: 0 10px 30px rgba(23, 26, 29, 0.06);
  --shadow-hover: 0 20px 48px rgba(23, 26, 29, 0.13);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
}

main.shell {
  flex: 1;
}

/* ---------- Header ---------- */

.site-header {
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: var(--page);
}

/* Pinned on reading pages only: on a game page it would cover the board while scrolling. */
.site-header.sticky {
  position: sticky;
  top: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 1.06rem;
  font-weight: 850;
  letter-spacing: 0;
}

.brand img {
  width: 32px;
  height: 32px;
}

.brand b {
  color: var(--accent);
  font-weight: inherit;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.site-nav a {
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--ink);
  background: var(--soft);
  outline: none;
}

.site-nav a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
}

/* "All games" stands in for the category links where they are hidden (game pages on phones). */
.site-nav a.all {
  display: none;
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.35fr) minmax(0, 0.8fr) minmax(0, 0.6fr);
  gap: 32px;
  padding: 34px 0 28px;
}

.footer-brand p {
  max-width: 300px;
  margin: 12px 0 0;
  line-height: 1.55;
}

.footer-col h2 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.footer-col ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-col.games ul {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 16px;
}

.footer-col a {
  border-bottom: 1px solid transparent;
}

.footer-col a:hover,
.footer-col a:focus-visible {
  color: var(--accent);
  border-color: currentColor;
  outline: none;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 15px 0 20px;
  border-top: 1px solid var(--line);
  font-size: 0.84rem;
}

.footer-bottom a {
  color: var(--ink);
  font-weight: 700;
}

.footer-bottom a:hover,
.footer-bottom a:focus-visible {
  color: var(--accent);
  outline: none;
}

@media (max-width: 720px) {
  .footer-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px;
    padding: 26px 0 22px;
  }

  .footer-brand,
  .footer-col.games {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .shell { width: min(100% - 24px, 1040px); }
  .site-header:not(.sticky) .site-nav a { display: none; }
  .site-header:not(.sticky) .site-nav a.all { display: inline-flex; }
}

/* Accessible focus remains visible even when component hover styles remove outlines. */
:is(.site-nav a, .brand, .footer-col a, .footer-bottom a, .game-card, .featured, .more a, .cat-links a, .more-link, .crumbs a, summary, .clue-button, .skip-link):focus-visible {
  outline: 3px solid var(--accent) !important;
  outline-offset: 3px;
}
main { scroll-margin-top: 120px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link {
  position: fixed;
  top: 8px;
  left: 12px;
  z-index: 100;
  padding: 12px 18px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent);
  font-weight: 750;
  transform: translateY(-160%);
}
.skip-link:focus { transform: none; }
@media (prefers-reduced-motion: reduce) {
  .site-nav a, .more a { transition: none; }
}

img[hidden] { display: none; }
.preview-fallback {
  display: grid; place-items: center; min-height: 70px; aspect-ratio: 16 / 10;
  width: 100%; padding: 12px; background: var(--board); color: #fff;
  font-size: .85rem; text-align: center;
}
.site-header.sticky .site-nav a.all { display: inline-block; }

.footer-col.games a { font-size: .85rem; }
.footer-grid { gap: 24px; }

.site-nav a { display: inline-flex; align-items: center; min-height: 44px; }

.topbar { flex-wrap: wrap; }
.brand { max-width: 100%; }
.brand span { min-width: 0; overflow-wrap: anywhere; }
main h1 { overflow-wrap: anywhere; }

.footer-col a { overflow-wrap: anywhere; }

/* Reading-page navigation uses a native disclosure on smaller screens. */
.site-header.sticky .topbar { min-height: 64px; flex-wrap: nowrap; padding: 10px 0; }
.site-header.sticky .site-nav { gap: 2px; }
.site-header.sticky .site-nav a { border: 0; border-radius: 0; padding: 10px; }
.site-header.sticky .site-nav a[aria-current="page"] { background: transparent; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 7px; }
.browse-menu { display: none; position: relative; flex-shrink: 0; }
.browse-menu summary { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: .875rem; font-weight: 750; cursor: pointer; list-style: none; }
.browse-menu summary::-webkit-details-marker { display: none; }
.browse-menu summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.browse-menu[open] summary::after { transform: translateY(2px) rotate(225deg); }
.browse-menu-panel { position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; width: 224px; max-width: calc(100vw - 24px); padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-hover); }
.browse-menu-panel a { display: flex; align-items: center; min-height: 44px; padding: 10px 12px; border-radius: 8px; font-weight: 650; }
.browse-menu-panel a:hover, .browse-menu-panel a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.browse-menu-panel a:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
@media (max-width: 860px) {
  .site-header.sticky .site-nav { display: none; }
  .browse-menu { display: block; }
}
@media (max-width: 640px) {
  .site-header.sticky { position: static; }
  .site-header.sticky .topbar { flex-wrap: wrap; gap: 8px; }
  .site-header.sticky .brand { gap: 7px; font-size: .95rem; }
  .site-header.sticky .brand img { width: 28px; height: 28px; }
  .browse-menu summary { padding: 10px; }
}
@media (max-width: 340px) { .site-header.sticky .brand { font-size: .85rem; gap: 5px; } }
