/* The front door. Shares the engine's palette; everything else is its own,
   since a gallery of games has nothing in common with a playing board. */

body.home main {
  /* The engine lays `main` out as a flex row, for the board beside the level
     picker. Left alone, the grid below becomes a flex item and shrinks to its
     contents instead of filling the page. */
  display: block;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.5rem 1.25rem 2rem;
}

/* The mark sits beside the title, and only on the front door — the game page
   shares .brand for the name of the game being played, where a site logo over
   the board would be noise. */
body.home header .brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
body.home .brand-mark {
  /* width alone, with height auto, so the intrinsic ratio is kept whatever
     the artwork is replaced with later. flex: none stops it being squeezed
     when the blurb is long and the window is narrow. */
  width: 50px;
  height: auto;
  flex: none;
}
body.home header .brand p {
  max-width: 52ch;
}

@media (max-width: 30rem) {
  /* On a phone the blurb runs to four or five lines and the mark ends up
     stranded beside a tall block of text, so align it to the title instead of
     to the middle of the paragraph. */
  body.home header .brand { align-items: flex-start; }
  body.home .brand-mark { width: 40px; margin-top: 0.1rem; }
}

.game-grid {
  display: grid;
  /* Cards find their own number of columns, so the page works from a phone up
     to a wide screen without a breakpoint for each size in between. */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: 1.1rem;
  margin-top: 1.25rem;
}

.game-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--felt-deep);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}
.game-card:hover,
.game-card:focus-visible {
  border-color: #ffffff40;
  background: #ffffff0d;
  transform: translateY(-2px);
}
.game-card:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

.game-art {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  background: radial-gradient(ellipse at 50% 20%, #24473b 0%, #16302a 70%);
  border-bottom: 1px solid var(--line);
}
.game-art img { width: 100%; height: 100%; object-fit: contain; display: block; }

.game-body { padding: 0.9rem 1rem 1.1rem; }
.game-body h2 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: var(--brass);
}
.game-blurb { margin: 0.4rem 0 0; color: var(--ink); }
.game-theorem {
  margin: 0.55rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-dim);
  font-style: italic;
}
.game-meta {
  margin: 0.7rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-dim);
}

.game-bar {
  margin-top: 0.4rem;
  height: 4px;
  border-radius: 999px;
  background: #ffffff14;
  overflow: hidden;
}
.game-bar span { display: block; height: 100%; background: var(--good); }

@media (prefers-reduced-motion: reduce) {
  .game-card { transition: none; }
  .game-card:hover, .game-card:focus-visible { transform: none; }
}

/* The second shelf: explorations rather than games. */
.shelf-title {
  margin: 2.2rem 0 0;
  font-size: 1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass);
}
.shelf-note { margin: 0.3rem 0 0; color: var(--ink-dim); max-width: 52ch; }
/* A shelf holding one card should not stretch it across the whole page: with
   auto-fit an only child takes every column. Capping the track keeps it the
   size of the game cards above it. */
#explorations .game-grid {
  margin-top: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 23rem));
}

/* Play count. Deliberately quiet: it is a weathervane, not a score, and the
   number that matters on a card is how much of the game you have solved. */
.game-plays {
  display: block;
  margin-top: 0.15rem;
  color: #ffffff40;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

/* When a game arrived. Shown because it decides ties in the ranking and heads
   its own shelf, so it should not be a hidden rule. */
.game-added {
  display: block;
  margin-top: 0.15rem;
  color: #ffffff33;
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
}
