/* Rehat v3.6.5 — fuller game pages: preview art + tagline above the setup card, "About" and a
   "More to play" grid below the rules, and the site footer. Unhashed and outside the Vite bundles on
   purpose: tools/game-intro.mjs writes the markup into built pages. Uses the shared tokens.css. */

/* --- intro (setup screen only) --- */
.intro {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: var(--space-4);
  align-items: center;
  margin: 0 0 var(--space-4);
}
.intro__art {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 160 / 72;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-bg-2);
  box-shadow: var(--shadow-card);
}
.intro__lede {
  margin: 0 0 var(--space-2);
  font-family: var(--font-heading);
  font-size: 1.2rem;
  line-height: 1.35;
  color: var(--color-text);
}
.intro__facts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.intro__facts li {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
}
/* Once a game is on the table the intro goes, so the board sits exactly where it always has. */
body:has(#game:not([hidden])) .intro { display: none; }

@media (max-width: 719px) {
  .intro { grid-template-columns: 1fr; gap: var(--space-3); }
  .intro__art { max-height: 120px; object-fit: cover; }
  .intro__lede { font-size: 1.05rem; }
}
@media (max-width: 360px) {
  .intro__art { max-height: 96px; }
}
@media (orientation: landscape) and (max-height: 480px) {
  .intro { grid-template-columns: 180px minmax(0, 1fr); gap: var(--space-3); }
  .intro__lede { font-size: 1rem; }
}
/* Phones and short landscape screens: the setup card comes first and the intro follows it. Above it,
   the intro pushed the start button off the first screen on 18 of 28 games at 375×667. Order:
   header, #setup, intro, then everything else (game, rules, about, more). Only while the setup screen
   is up: during play .page stays a plain block, so the board sits to the pixel where it always has. */
@media (max-width: 719px), (orientation: landscape) and (max-height: 480px) {
  .page:has(> .intro):has(> #game[hidden]) { display: flex; flex-direction: column; }
  .page > .intro { order: 1; margin: var(--space-4) 0 0; }
  .page > .intro ~ :not(#setup) { order: 2; }
}

/* --- one page width everywhere ---
   Every game page is 720 px wide except Minesweeper, whose own stylesheet widens .page to 1000 px from
   900 px up so the 30-column Expert board fits. Keep the setup screen at the common width (this
   selector outranks its `.page.page`), and keep About / More to play at the common width while it plays. */
.page:has(> #game[hidden]) { max-width: 720px; }
.about, .more { max-width: calc(720px - 2 * var(--space-3)); margin-left: auto; margin-right: auto; }

/* --- below the rules --- */
.about, .more { margin-top: var(--space-6); }
.extra-title {
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: 1.35rem;
  margin: 0 0 var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}
.about p { margin: 0 0 var(--space-3); color: var(--color-text); line-height: 1.6; }

.more-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}
.more-grid > :nth-child(n+7) { display: none; }
@media (max-width: 600px) {
  .more-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
}
.more-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  text-decoration: none;
  color: var(--color-text);
  transition: transform 160ms var(--ease), box-shadow 160ms var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  .more-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }
}
.more-card:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }
.more-card:active { transform: scale(0.985); }
.more-card__art {
  display: block;
  aspect-ratio: 160 / 72;
  background: var(--color-bg-2);
  border-bottom: 1px solid var(--color-border);
}
.more-card__art img { display: block; width: 100%; height: 100%; }
.more-card__body { display: grid; gap: 2px; padding: 10px 12px 12px; min-height: 44px; }
.more-card__title { font-family: var(--font-heading); font-size: 1.05rem; line-height: 1.2; }
.more-card__meta {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.more-card.in-progress { border-color: var(--color-accent); }
.more-card.in-progress .more-card__meta { color: var(--color-accent); font-weight: 600; }
@media (max-width: 360px) {
  .more-card__meta { display: none; }
  .more-card.in-progress .more-card__meta { display: block; }
}
.more__all { display: flex; width: 100%; justify-content: center; margin-top: var(--space-4); text-decoration: none; }

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

/* --- footer (same as the landing's) --- */
.site-footer {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  padding: var(--space-5) var(--space-3);
  border-top: 1px solid var(--color-border);
}
.site-footer a { display: inline-block; padding: 12px 6px; color: inherit; }
