/* =========================================================
   Games: shared styles for /games.html and every game page.
   ========================================================= */

/* ---------- Wide layout for game pages ----------
   A board plus its controls needs more room than the 46rem
   reading column, and on phones every pixel of width goes to
   the board. Add bodyClass: page-game to a game's front matter. */
.page-game .layout {
  width: min(100% - 1rem, 72rem);
}
.page-game .content .container,
.page-game main .container {
  width: min(100% - 1.5rem, 64rem);
  max-width: none;
}
.page-game .content {
  padding-top: 1rem;
}
@media (min-width: 56rem) {
  .page-game .layout {
    width: min(100% - 2rem, 72rem);
  }
  .page-game .content .container {
    width: min(100% - 4rem, 64rem);
  }
}

/* ---------- Games hub cards ----------
   One link per card (the game's name). The whole card is
   clickable through a stretched ::after, but screen readers
   and Voice Control see a single link: "Click Sudoku". */
.game-list {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1.25rem;
}
.game-list li + li {
  margin-top: 0;
}
.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  overflow: hidden;
}
.game-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  border-bottom: 1px solid var(--border);
}
.game-card-body {
  padding: 1rem 1.25rem 1.25rem;
}
.game-card h2 {
  margin: 0 0 0.4rem;
  font-size: 1.6rem;
}
.game-card h2 a {
  text-decoration: none;
}
.game-card h2 a::after {
  content: "";
  position: absolute;
  inset: 0;
}
.game-card p {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.5;
}
.game-card:hover {
  background: var(--surface-hover);
}
.game-card:hover h2 a,
.game-card h2 a:focus-visible {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}
.game-card:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.game-card h2 a:focus-visible {
  outline: none;
}

.games-coming {
  margin-top: 2rem;
  color: var(--text-muted);
}

@media (forced-colors: active) {
  .game-card {
    border: 1px solid CanvasText;
  }
  .game-card:focus-within {
    outline: 3px solid Highlight;
  }
}
