/* The page is a pinball table: yellow playfield, red and teal art, thick ink outlines, round inserts for tags. */
@font-face { font-family: Shrikhand; src: url(fonts/shrikhand.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: Figtree; src: url(fonts/figtree.woff2) format("woff2"); font-weight: 400 800; font-display: swap; }

:root {
  color-scheme: light;
  --yellow: #ffc22e;
  --red: #d9291c;
  --teal: #0b7a83;
  --sky: #9fdcdc;
  --ink: #1c1633;
  --soft: #4b4462;
  --apron: #fff6dc;
  --white: #fff;
  --gutter: max(5vw, 16px);
}
* { box-sizing: border-box; min-width: 0; }
html { background: var(--ink); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100svh; display: flex; flex-direction: column;
  background: var(--teal); color: var(--ink); font: 400 1rem/1.5 Figtree, system-ui, sans-serif;
}
h1, h2, h3, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
img { display: block; max-width: 100%; }
h1, h2, h3 { font-family: Shrikhand, "Cooper Black", Georgia, serif; font-weight: 400; line-height: 1.08; overflow-wrap: anywhere; text-wrap: balance; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip { position: absolute; left: 12px; top: -80px; z-index: 5; padding: 10px 16px; background: var(--ink); color: var(--white); border-radius: 0 0 10px 10px; }
.skip:focus { top: 0; }
:focus-visible { outline: 4px solid var(--ink); outline-offset: 3px; }

/* Header: the sign sits on the quiet left of the playfield picture */
.table { position: relative; background: var(--yellow); border-bottom: 5px solid var(--ink); overflow: hidden; }
.playfield { width: 100%; height: clamp(250px, 25vw, 400px); object-fit: cover; object-position: 100% 50%; }
.sign { position: absolute; z-index: 1; inset: 0 auto 0 0; width: min(44%, 620px); padding-left: max(var(--gutter), (100vw - 1240px) / 2, env(safe-area-inset-left)); display: flex; flex-direction: column; justify-content: center; gap: 12px; }
.sign h1 { font-size: clamp(2.6rem, 5.4vw, 5rem); color: var(--red); line-height: .98; }
.sign p { font-size: 1.0625rem; font-weight: 600; line-height: 1.4; max-width: 25em; text-wrap: balance; }

main { flex: 1; width: 100%; max-width: calc(1240px + 2 * var(--gutter)); margin: 0 auto; padding: clamp(24px, 3.2vw, 44px) var(--gutter) clamp(40px, 5vw, 72px); }

.filters { margin-bottom: 24px; }
.filters ul { display: flex; flex-wrap: wrap; gap: 8px; }
.filters a { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 3px solid var(--ink); border-radius: 99px; background: var(--apron); color: var(--ink); font-weight: 700; text-decoration: none; }
.filters span { font-weight: 500; font-size: .875rem; }
.filters a:hover { background: var(--sky); }
.filters [aria-current] { background: var(--yellow); }

/* Games. The grid changes with how many there are, so one game fills the table as well as twenty do. */
.games { display: grid; gap: clamp(20px, 2.4vw, 32px); grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.n2, .n4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.n1, .n3 { grid-template-columns: minmax(0, 1fr); }
.card { position: relative; display: flex; flex-direction: column; background: var(--apron); border: 4px solid var(--ink); border-radius: 22px; overflow: hidden; box-shadow: 0 7px 0 var(--ink); transition: transform .12s, box-shadow .12s; }
.cover { background: var(--ink); border-bottom: 4px solid var(--ink); overflow: hidden; }
.cover img { width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; }
.info { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 20px 22px 22px; }
.card h3 { font-size: 1.75rem; }
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.about { color: var(--ink); text-wrap: pretty; overflow-wrap: anywhere; }
.controls { font-size: .9375rem; color: var(--soft); overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { padding: 2px 11px; border: 2px solid var(--ink); border-radius: 99px; background: var(--sky); font-size: .875rem; font-weight: 600; overflow-wrap: anywhere; }
.play, .button { display: inline-block; padding: 9px 24px 10px; border: 3px solid var(--ink); border-radius: 99px; background: var(--red); color: var(--white); font-weight: 800; font-size: 1.0625rem; line-height: 1.4; text-decoration: none; }
.play { margin-top: auto; }
.card:hover, .card:focus-within { transform: translateY(-3px); box-shadow: 0 10px 0 var(--ink); }
.card:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--ink); }
.card:hover .play, .button:hover { background: var(--yellow); color: var(--ink); }
.card:has(a:focus-visible) { outline: 5px solid var(--yellow); outline-offset: 5px; }
.card a:focus-visible { outline: none; }

@media (min-width: 1020px) { .n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Three games on a tablet: two side by side, the third across */
@media (min-width: 700px) and (max-width: 1019.9px) {
  .n3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .n3 .card:last-child { grid-column: 1 / -1; flex-direction: row; }
  .n3 .card:last-child .cover { flex: 1 1 50%; border-bottom: 0; border-right: 4px solid var(--ink); }
  .n3 .card:last-child .cover img { height: 100%; }
  .n3 .card:last-child .info { flex: 1 1 50%; }
}
@media (min-width: 700px) {
  .n1 .card { flex-direction: row; min-height: min(440px, 52vh); }
  .n1 .cover { flex: 1 1 60%; border-bottom: 0; border-right: 4px solid var(--ink); }
  .n1 .cover img { height: 100%; }
  .n1 .info { flex: 1 1 40%; justify-content: center; gap: 18px; padding: 36px 40px; }
  .n1 .card h3 { font-size: clamp(2.2rem, 3.6vw, 3.25rem); }
  .n1 .about { font-size: 1.125rem; }
  .n1 .play { margin-top: 8px; }
}

.empty { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: center; background: var(--apron); border: 4px solid var(--ink); border-radius: 22px; overflow: hidden; box-shadow: 0 7px 0 var(--ink); }
.empty img { width: 100%; height: 100%; object-fit: cover; border-right: 4px solid var(--ink); }
.empty div { padding: clamp(24px, 4vw, 56px); display: grid; gap: 14px; }
.empty h2 { font-size: clamp(1.9rem, 3.6vw, 3rem); }
.empty p { font-size: 1.125rem; max-width: 30em; text-wrap: pretty; }

footer { background: var(--ink); color: var(--apron); padding: 18px var(--gutter) max(18px, env(safe-area-inset-bottom)); font-size: .9375rem; }
footer p { max-width: 1240px; margin: 0 auto; }

/* 404 and friends */
.message { background: var(--red); }
.message main { display: grid; place-items: center; }
.plate { width: min(100%, 560px); padding: clamp(28px, 6vw, 52px); background: var(--yellow); border: 5px solid var(--ink); border-radius: 28px; box-shadow: 0 10px 0 var(--ink); transform: rotate(-3deg); display: grid; gap: 14px; }
.plate h1 { font-size: clamp(3.4rem, 15vw, 6.5rem); color: var(--red); line-height: .95; }
.plate .code { font-weight: 800; font-size: 1.25rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }

@media (max-width: 900px) {
  .sign { position: static; width: auto; padding: 26px var(--gutter) 4px; gap: 8px; }
  .sign h1 { font-size: clamp(2.8rem, 14vw, 4.2rem); }
  .playfield { height: clamp(150px, 25vw, 220px); }
}
@media (max-width: 720px) {
  .empty { grid-template-columns: 1fr; }
  .empty img { height: 210px; border-right: 0; border-bottom: 4px solid var(--ink); }
}
@media (prefers-reduced-motion: reduce) {
  .card, .card:hover, .card:focus-within, .card:active { transition: none; transform: none; }
}
