/* Shared across the landing page and the game pages. */

:root {
  --bg: #f6f5f3;
  --fg: #16150f;
  --muted: #6b6862;
  --rule: #d9d5cd;
  --accent: #b4471f;
  --card: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121110;
    --fg: #ece8e0;
    --muted: #8e8a82;
    --rule: #2e2c28;
    --accent: #e0763f;
    --card: #1a1917;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 3rem 1.25rem;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 ui-sans-serif, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

main { width: 100%; max-width: 52rem; margin: 0 auto; }
.home main { max-width: 62rem; }

.eyebrow {
  font: 600 0.75rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.75rem;
}

h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.9rem, 5vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

h2 {
  margin: 2.5rem 0 1rem;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}

p.lede { margin: 0 0 2rem; color: var(--muted); max-width: 36rem; }

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

/* Game page */

.back {
  display: inline-block;
  margin-bottom: 2rem;
  font: 0.85rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
  text-decoration: none;
}
.back:hover { color: var(--accent); }

/* The stage is the play link. The game gets its own page rather than an
   iframe: embedded it drew 348x195 on a phone against 390x844 standalone, and
   the browser's own Back button is a better exit than anything we could put
   over the canvas. Fullscreen API was the other option and iOS Safari does not
   support it on arbitrary elements. */
.stage {
  display: block;
  position: relative;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
  background: #bfe6fa;
}
.stage img { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage img { object-fit: cover; }

.stage-btn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 26, 0.35);
  color: #fff;
  font: 600 1rem/1 inherit;
}
.stage-btn span {
  padding: 0.85rem 1.75rem;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}
.stage:hover .stage-btn span,
.stage:focus-visible .stage-btn span { filter: brightness(1.1); }

/* Bea Goes Driving is authored portrait — landscape draws the same world box
   with empty field either side, so the stage matches the phone shape. */
.stage.portrait { aspect-ratio: 3 / 5; max-width: 24rem; margin: 0 auto; }
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.gallery figure { margin: 0; }
.gallery img { border: 1px solid var(--rule); border-radius: 10px; }
.gallery figcaption { margin-top: 0.5rem; font-size: 0.8rem; color: var(--muted); }

.gallery.portrait { grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); }

.stage-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 0.85rem 0 0;
  font: 0.8rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
}
.stage-meta a { color: var(--accent); }

footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.8rem;
  color: var(--muted);
}

footer code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  padding: 0.1em 0.35em;
  border: 1px solid var(--rule);
  border-radius: 4px;
}


/* ===========================================================================
   Landing page. Editorial rows rather than a card grid: each game keeps its
   own picture shape (three of the four are authored portrait) and its own
   accent, set per row as --accent so nothing here has to know which game it
   is drawing. No script on this page at all.
   ======================================================================== */

.hero {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 1.75rem;
  align-items: center;
  margin: 0 0 4rem;
}

.hero-face {
  width: 7.5rem;
  height: auto;
  justify-self: start;
}

.home h1 {
  margin: 0 0 0.9rem;
  max-width: 20ch;
  font-size: clamp(2rem, 5.2vw, 3.4rem);
  line-height: 1.04;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.home .lede { margin: 0; max-width: 38rem; font-size: 1.05rem; }

@media (max-width: 40rem) {
  .hero { grid-template-columns: 1fr; gap: 1.25rem; }
  .hero-face { width: 5.5rem; }
}

.saga { margin: 0; padding: 0; list-style: none; }

.entry {
  display: grid;
  gap: 2.5rem;
  align-items: center;
  padding: 3rem 0;
  border-top: 1px solid var(--rule);
}

.entry:first-child { border-top: 0; padding-top: 0; }

/* Sized per picture shape, not per column, so a 16:9 still and a 3:5 still end
   up roughly the same HEIGHT. Matching the widths instead — the obvious move —
   makes the portrait games tower over the landscape one. */
.entry--wide { grid-template-columns: minmax(0, 30rem) 1fr; }
.entry--tall { grid-template-columns: minmax(0, 15rem) 1fr; }

/* Mirrored rows need the TEMPLATE mirrored too, not just the order. Reordering
   alone leaves the picture in the wide column and squeezes the copy into the
   narrow one. */
.entry--wide:nth-child(even) { grid-template-columns: 1fr minmax(0, 30rem); }
.entry--tall:nth-child(even) { grid-template-columns: 1fr minmax(0, 15rem); }

/* Alternate sides so the eye zig-zags down the page instead of scanning one
   dead column. Order only — the DOM stays picture-then-copy for reading. */
.entry:nth-child(even) .entry-shot { order: 2; }

.entry-shot {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--rule);
  /* The accent sits under the picture rather than on it: a coloured edge that
     says which world this is without tinting the art. */
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent),
              0 14px 40px -18px color-mix(in srgb, var(--accent) 70%, transparent);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.entry-shot img { width: 100%; height: auto; display: block; }

.entry-shot:hover, .entry-shot:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 60%, transparent),
              0 20px 48px -18px color-mix(in srgb, var(--accent) 85%, transparent);
}

.entry-kicker {
  margin: 0 0 0.55rem;
  font: 600 0.72rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.entry-copy h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.entry-copy h2 a { color: inherit; text-decoration: none; }
.entry-copy h2 a:hover { color: var(--accent); }

.entry-hook { margin: 0 0 1.1rem; color: var(--muted); max-width: 34rem; }

.entry blockquote {
  margin: 0 0 1.25rem;
  padding-left: 0.9rem;
  border-left: 2px solid var(--accent);
  font-size: 1.02rem;
  font-style: italic;
  color: var(--fg);
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  margin: 0 0 1.25rem;
}

.entry-meta span {
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font: 0.75rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
}

.entry-cta { margin: 0; }

.entry-cta a {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.entry-cta a:hover { filter: brightness(1.08); }

@media (max-width: 46rem) {
  /* Listed explicitly: the mirrored templates above carry higher specificity
     than a bare .entry, so a single-column override has to match it. */
  .entry,
  .entry--wide, .entry--tall,
  .entry--wide:nth-child(even), .entry--tall:nth-child(even) {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 2.5rem 0;
  }
  /* One column: the picture always leads, so drop the alternation. */
  .entry:nth-child(even) .entry-shot { order: 0; }
  .entry-shot.tall { max-width: 17rem; }
}

/* Not a game, so not a .saga row — the saga is an ordered list of Bea's
   adventures and a drawing tool is not one of them. It sits after that list,
   in the same voice, with no picture: a blank sheet of paper photographs as
   nothing at all, and a fake screenshot of one would be worse. */
.aside {
  margin-top: 3rem;
  padding: 2.25rem 0 0;
  border-top: 1px solid var(--rule);
}

.aside h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.aside h2 a { color: inherit; text-decoration: none; }
.aside h2 a:hover { color: var(--accent); }

.home-footer {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
  color: var(--muted);
}

.home-footer p { margin: 0; }

/* Version stamp: small, quiet, and on every page, so a merge is visible
   without opening devtools. */
.version {
  font: 0.75rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  margin-left: 0.35rem;
}
