:root {
  --ink: #dbe3ee;
  --muted: #d8e1ee;
  --paper: #19191a;
  --card: #242424;
  --line: #222222;

  --gold: #a06e23;
  --blue: #395d8b;
  --purple: #9948a0;

  --heading: "Young Serif", Georgia, "Times New Roman", serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 24px 16px 48px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.55;
}

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

.site-header {
  max-width: 640px;
  margin: 0 auto 24px;
}

.site-header h1 {
  margin: 0 0 4px;
  font-family: var(--heading);
  font-weight: 400;
  font-size: 1.75rem;
  line-height: 1.2;
}

.site-header p {
  margin: 0;
  color: var(--muted);
}

/* ---------- Cards: mobile (stacked, image left) ---------- */

.games {
  display: grid;
  gap: 16px;
  max-width: 640px;
  margin: 0 auto;
}

.game {
  --accent: var(--gold);
  display: grid;
  grid-template-columns: 104px 1fr;
  grid-template-areas:
    "image title"
    "image summary"
    "image play";
  grid-template-rows: auto auto 1fr;
  column-gap: 16px;
  row-gap: 8px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: 8px;
}

.game:nth-child(2) { --accent: var(--blue); }
.game:nth-child(3) { --accent: var(--purple); }

.game--connections { --image-scale: 1.3; }
.game--mapper { --image-scale: .95; }
.game--bizarro { --image-scale: .9; }

.game-title {
  grid-area: title;
  margin: 0;
  font-family: var(--heading);
  font-weight: 400;
  font-size: 1.25rem;
  line-height: 1.25;
}

.game-summary {
  grid-area: summary;
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* Arched image frame */
.thumb {
  grid-area: image;
  align-self: start;
  width: 100px;
  margin: 0;
  aspect-ratio: 5 / 5;
  overflow: hidden;
  border-radius: 10px 10px 10px 10px / 10px 10px 10px 10px;
  background-color: color-mix(in srgb, var(--accent) 14%, white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a96a8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Ccircle cx='9' cy='10' r='1.5'/%3E%3Cpath d='m21 16-5-5-8 8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 32px;
}

.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(var(--image-scale, 1));
}

/* script.js adds this when the image file is missing, so the placeholder shows */
.thumb.no-image img {
  display: none;
}

.play {
  grid-area: play;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 4px;
  padding: 0 20px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
  border-radius: 6px;
  transition: filter 0.15s ease;
}

.play:hover {
  filter: brightness(1.15);
}

.play:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

/* ---------- Cards: desktop (three columns, stacked content) ---------- */

@media (min-width: 860px) {
  body {
    padding: 48px 32px 64px;
  }

  .site-header,
  .games {
    max-width: 1100px;
  }

  .site-header {
    margin-bottom: 32px;
  }

  .site-header h1 {
    font-size: 2.25rem;
  }

  .games {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }

  .game {
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "image"
      "summary"
      "play";
    grid-template-rows: auto auto 1fr auto;
    row-gap: 16px;
    padding: 24px;
  }

  .game-title {
    font-size: 1.5rem;
  }

  .game-summary {
    font-size: 1rem;
  }

  .thumb {
    justify-self: center;
  }

  .play {
    justify-self: stretch;
    margin-top: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .play {
    transition: none;
  }
}
