:root {
  color-scheme: light dark;
  --bg: #fbfbf9;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --rule: #dcdcd6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131313;
    --fg: #ededed;
    --muted: #8e8e8e;
    --rule: #2c2c2c;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 3rem 2rem;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 36rem;
  width: 100%;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

p {
  margin: 1rem 0 0;
  font-size: 1.0625rem;
  line-height: 1.65;
}

hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

a {
  color: inherit;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.2em;
}

a:hover { text-decoration-color: currentColor; }

a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Pill rows: tags are plain text, links are anchors with an icon. */
ul.links,
ul.tags {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

ul.links a,
ul.tags li {
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--muted);
  border-radius: 999px;
  font-size: 0.9375rem;
}

ul.tags li { color: var(--muted); }

ul.links a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

ul.links a:hover { border-color: currentColor; }

ul.links svg {
  width: 1.125rem;
  height: 1.125rem;
  fill: currentColor;
  flex: none;
}

/* Single-message pages: 404 and anything else that is one centered line. */
body.centered main {
  max-width: 32rem;
  text-align: center;
}

body.centered p { color: var(--muted); }

body.centered hr {
  width: 3rem;
  margin: 2rem auto;
}

/* Arcade: a lit-up cabinet panel. Deliberately louder than the rest of the
   page. Its palette is fixed rather than themed — a real cabinet is dark in a
   dark room and dark in a lit one — so the contrast ratios below hold in both
   the light and dark :root palettes. All values are against --arc-bg:
   yellow 12.9:1, cyan 13.5:1, pink 7.4:1, dim 9.5:1, ink 15.8:1.
   CSP forbids remote fonts, so the retro face is the system monospace stack. */
.arcade {
  --arc-bg: #12102a;
  --arc-ink: #efe9ff;
  --arc-dim: #b9b4e0;
  --arc-yellow: #ffd23f;
  --arc-cyan: #4ff0ff;
  --arc-pink: #ff6ec7;
  --arc-edge: #6f66d8;

  position: relative;
  padding: 1.75rem 1.5rem 1.5rem;
  border: 1px solid var(--arc-edge);
  border-radius: 14px;
  background: var(--arc-bg);
  color: var(--arc-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
}

/* Marquee bulbs across the top of the cabinet. Decorative only. */
.arcade::before {
  content: "";
  position: absolute;
  top: 0.6rem;
  left: 1.5rem;
  right: 1.5rem;
  height: 6px;
  background: radial-gradient(circle, var(--arc-yellow) 0 2px, transparent 2px) 0 0 / 14px 6px repeat-x;
  opacity: 0.75;
}

.arcade h2 {
  margin: 0.75rem 0 0;
  font-size: 1.25rem;
  letter-spacing: 0.22em;
  color: var(--arc-yellow);
  text-shadow: 0 0 12px rgba(255, 210, 63, 0.55);
}

.cabinets {
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
}

.cabinet {
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid var(--arc-edge);
  border-radius: 10px;
  background: #1a1740;
  text-decoration: none;
  color: var(--arc-ink);
}

.cabinet:hover,
.cabinet:focus-visible {
  border-color: var(--arc-cyan);
  box-shadow: 0 0 0 1px var(--arc-cyan), 0 0 18px rgba(79, 240, 255, 0.35);
}

/* The screen: black, scanlined, and the only place motion happens. */
.cabinet-screen {
  display: block;
  padding: 0.5rem 0.25rem;
  border-radius: 6px;
  background:
    repeating-linear-gradient(rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 3px),
    #05040f;
}

.cabinet-screen svg {
  display: block;
  width: 100%;
  height: 4.5rem;
}

.cabinet-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--arc-yellow);
}

/* Paired with the title, never the only label. The arrow is a second cue so
   the call to action does not depend on its colour. */
.cabinet-cta {
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--arc-cyan);
}

.cabinet-cta::after {
  content: " \25B6";
}

.pac { fill: var(--arc-yellow); }
.pellets circle { fill: var(--arc-dim); }
.ghost-body { fill: var(--arc-pink); }
.ghost-eye { fill: #ffffff; }
.ghost-pupil { fill: #12102a; }

.pac-shut { opacity: 0; }

/* Motion is user-initiated: nothing moves until the cabinet is hovered or
   focused, so there is no auto-playing animation to pause (WCAG 2.2.2). */
.cabinet:hover .pac,
.cabinet:focus-visible .pac {
  animation: pac-run 2.4s linear infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.cabinet:hover .pac-open,
.cabinet:focus-visible .pac-open {
  animation: chomp 0.32s steps(1, end) infinite;
}

.cabinet:hover .pac-shut,
.cabinet:focus-visible .pac-shut {
  animation: chomp 0.32s steps(1, end) infinite reverse;
}

.cabinet:hover .pellets circle,
.cabinet:focus-visible .pellets circle {
  animation: pellet 2.4s linear infinite;
}

.cabinet:hover .pellets circle:nth-child(2) { animation-delay: 0.22s; }
.cabinet:hover .pellets circle:nth-child(3) { animation-delay: 0.44s; }
.cabinet:hover .pellets circle:nth-child(4) { animation-delay: 0.66s; }
.cabinet:focus-visible .pellets circle:nth-child(2) { animation-delay: 0.22s; }
.cabinet:focus-visible .pellets circle:nth-child(3) { animation-delay: 0.44s; }
.cabinet:focus-visible .pellets circle:nth-child(4) { animation-delay: 0.66s; }

.cabinet:hover .ghost,
.cabinet:focus-visible .ghost {
  animation: bob 0.9s ease-in-out infinite alternate;
}

@keyframes pac-run {
  0%   { transform: translateX(0) scaleX(1); }
  42%  { transform: translateX(44px) scaleX(1); }
  50%  { transform: translateX(44px) scaleX(-1); }
  92%  { transform: translateX(0) scaleX(-1); }
  100% { transform: translateX(0) scaleX(1); }
}

@keyframes chomp {
  0%, 50%   { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

@keyframes pellet {
  0%, 12%  { opacity: 1; }
  16%, 58% { opacity: 0; }
  62%, 100% { opacity: 1; }
}

@keyframes bob {
  from { transform: translateY(0); }
  to   { transform: translateY(-2px); }
}

@media (prefers-reduced-motion: reduce) {
  .cabinet:hover .pac,
  .cabinet:focus-visible .pac,
  .cabinet:hover .pac-open,
  .cabinet:focus-visible .pac-open,
  .cabinet:hover .pac-shut,
  .cabinet:focus-visible .pac-shut,
  .cabinet:hover .pellets circle,
  .cabinet:focus-visible .pellets circle,
  .cabinet:hover .ghost,
  .cabinet:focus-visible .ghost {
    animation: none;
  }
}
