/* Chuffed to Bits — shared styles for every page.
   Tokens come from the approved mockup and the KINACKATTACK palette. */

/* ---------- Tokens ---------- */

:root {
  --bg: #0a0a0f;
  --panel: #0f0f18;
  --screen: #05050a;
  --bezel: #15151f;
  --text: #e8e8f0;
  --text-dim: #c9cbe0;
  --text-muted: #9aa0b4;
  --line: #2a2a40;
  --cyan: #00ffff;
  --pink: #ff00ff;
  --yellow: #ffff00;
  --green: #00ff66;
  --orange: #ff6600;
  --red: #ff0044;
  --dim-cyan: #006666;

  --font-pixel: "Press Start 2P", ui-monospace, monospace;
  --font-body: "VT323", ui-monospace, monospace;

  --gutter: 16px;
  --max-width: 1120px;
}

/* ---------- Base ---------- */

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

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 24px;
  line-height: 1.25;
}

/* CRT overlay: 1px dark / 2px clear scanlines plus a vignette. Static, so it
   stays on under reduced motion. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, #000 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 55%, #000 100%);
  opacity: 0.35;
}

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

a {
  color: var(--cyan);
}

a:hover {
  color: var(--text);
}

:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

h1,
h2,
h3 {
  font-family: var(--font-pixel);
  font-weight: normal;
  line-height: 1.4;
}

main {
  flex: 1;
  position: relative;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 1001;
  padding: 12px 16px;
  background: var(--yellow);
  color: var(--bg);
  font-family: var(--font-pixel);
  font-size: 12px;
}

.skip-link:focus {
  top: var(--gutter);
}

/* Section colours: set --c on anything that takes its section's colour. */
.c-games { --c: var(--cyan); }
.c-apps { --c: var(--pink); }
.c-lab { --c: var(--yellow); }
.c-about { --c: var(--green); }

/* ---------- Blink ---------- */

@keyframes blink {
  50% { opacity: 0; }
}

.blink {
  animation: blink 1.1s steps(1) infinite;
}

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

.site-header {
  position: relative;
  z-index: 10;
  border-bottom: 2px dashed var(--line);
}

.site-header__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  font-family: var(--font-pixel);
  font-size: 16px;
  line-height: 1.5;
  text-decoration: none;
}

.logo__a {
  color: var(--cyan);
  text-shadow: 0 0 8px var(--cyan);
}

.logo__b {
  color: var(--pink);
  text-shadow: 0 0 8px var(--pink);
}

.nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav a {
  display: inline-block;
  padding: 10px 12px;
  border: 2px solid var(--c);
  color: var(--c);
  font-family: var(--font-pixel);
  font-size: 11px;
  text-decoration: none;
}

.nav a:hover {
  box-shadow: 0 0 12px color-mix(in srgb, var(--c) 60%, transparent);
}

.nav a[aria-current] {
  background: var(--c);
  color: var(--bg);
}

/* ---------- Buttons ---------- */

.btn {
  --c: var(--cyan);
  display: inline-block;
  padding: 12px 16px;
  border: 2px solid var(--c);
  background: var(--c);
  color: var(--bg);
  font-family: var(--font-pixel);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 0 12px color-mix(in srgb, var(--c) 45%, transparent);
}

.btn:hover {
  color: var(--bg);
  box-shadow: 0 0 20px color-mix(in srgb, var(--c) 70%, transparent);
}

.btn--ghost {
  background: transparent;
  color: var(--c);
  box-shadow: none;
}

.btn--ghost:hover {
  color: var(--c);
}

/* Stop the blink while someone is pointing at or focused on the button. */
.btn:hover .blink,
.btn:focus-visible .blink {
  animation: none;
}

/* ---------- Layout helpers ---------- */

.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px var(--gutter);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 32px;
  color: var(--yellow);
  font-size: clamp(14px, 3vw, 20px);
  text-shadow: 0 0 8px var(--yellow);
}

.section-title::after {
  content: "";
  flex: 1;
  border-top: 2px dashed var(--line);
}

.page-head {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px var(--gutter) 0;
}

.page-head h1 {
  margin: 0 0 16px;
  color: var(--c, var(--yellow));
  font-size: clamp(18px, 4.5vw, 32px);
  text-shadow: 0 0 8px var(--c, var(--yellow));
}

.page-head p {
  max-width: 50ch;
  margin: 0;
  color: var(--text-dim);
}

.prose {
  max-width: 60ch;
  color: var(--text-dim);
}

.prose p {
  margin: 0 0 1em;
}

.empty-state {
  padding: 48px var(--gutter);
  border: 2px dashed var(--line);
  text-align: center;
  color: var(--yellow);
  font-family: var(--font-pixel);
  font-size: 14px;
  line-height: 1.6;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 72px var(--gutter) 180px;
  text-align: center;
}

.hero__content {
  position: relative;
  z-index: 1;
}

.hero__ready {
  margin: 0;
  color: var(--yellow);
  font-family: var(--font-pixel);
  font-size: 12px;
  text-shadow: 0 0 8px var(--yellow);
}

.hero__title {
  margin: 28px 0;
  font-size: clamp(22px, 6.5vw, 60px);
  line-height: 1.35;
}

/* Each half wraps as a unit, so small screens get CHUFFED / TO BITS. */
.hero__title span {
  display: inline-block;
}

.hero__tagline {
  max-width: 32ch;
  margin: 0 auto 40px;
  color: var(--text-dim);
  font-size: 28px;
}

.press-start {
  display: inline-block;
  padding: 12px 16px;
  color: var(--yellow);
  font-family: var(--font-pixel);
  font-size: clamp(14px, 3vw, 18px);
  text-decoration: none;
  text-shadow: 0 0 8px var(--yellow);
}

.press-start:hover {
  color: var(--yellow);
}

.press-start:hover .blink,
.press-start:focus-visible .blink {
  animation: none;
}

/* Perspective floor: a pink grid tipped back into the distance. */
.hero__floor {
  position: absolute;
  left: -50%;
  right: -50%;
  bottom: 0;
  height: 240px;
  pointer-events: none;
  background-image:
    linear-gradient(color-mix(in srgb, var(--pink) 45%, transparent) 2px, transparent 2px),
    linear-gradient(90deg, color-mix(in srgb, var(--pink) 45%, transparent) 2px, transparent 2px);
  background-size: 48px 48px;
  background-position: center bottom;
  transform: perspective(320px) rotateX(60deg);
  transform-origin: center bottom;
  -webkit-mask-image: linear-gradient(to top, #000 20%, transparent);
  mask-image: linear-gradient(to top, #000 20%, transparent);
}

/* ---------- Cabinet grid ---------- */

.cabinet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 340px));
  justify-content: center;
  gap: 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---------- Cabinet card ---------- */

.cabinet {
  --accent: var(--cyan);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--panel);
  border: 3px solid var(--accent);
  border-radius: 14px 14px 4px 4px;
  box-shadow: 0 0 22px color-mix(in srgb, var(--accent) 35%, transparent);
}

.cabinet__marquee {
  margin: 0;
  padding: 14px 12px;
  border-bottom: 3px solid var(--accent);
  background: linear-gradient(var(--bezel), var(--panel));
  color: var(--accent);
  font-size: 14px;
  text-align: center;
  text-shadow: 0 0 8px var(--accent);
}

.cabinet__bezel {
  padding: 16px;
  background: var(--bezel);
}

.cabinet__screen {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--screen);
  border-radius: 10px;
  box-shadow: inset 0 0 0 2px #000, inset 0 0 28px #000;
}

/* Sits over the attract-mode stand-in, which stays underneath as a fallback. */
.cabinet__screen img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Attract-mode stand-in until real screenshots exist. */
.attract {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px;
  text-align: center;
  background:
    radial-gradient(1px 1px at 12% 22%, #fff, transparent),
    radial-gradient(1px 1px at 78% 14%, #fff, transparent),
    radial-gradient(1px 1px at 42% 70%, #fff, transparent),
    radial-gradient(1px 1px at 88% 62%, #fff, transparent),
    radial-gradient(1px 1px at 24% 84%, #fff, transparent),
    radial-gradient(1px 1px at 60% 36%, #fff, transparent),
    radial-gradient(circle at 50% 120%, color-mix(in srgb, var(--accent) 25%, transparent), transparent 70%);
}

.attract__score {
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  color: var(--text-muted);
  font-family: var(--font-pixel);
  font-size: 8px;
}

.attract__title {
  color: var(--accent);
  font-family: var(--font-pixel);
  font-size: 18px;
  line-height: 1.5;
  text-shadow: 0 0 10px var(--accent);
}

.cabinet__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 14px 12px 12px;
  background: var(--bezel);
  border-top: 2px solid var(--line);
}

.joystick {
  position: relative;
  width: 20px;
  height: 30px;
}

.joystick::before {
  content: "";
  position: absolute;
  left: 7px;
  bottom: 0;
  width: 6px;
  height: 20px;
  background: #555566;
}

.joystick::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}

.cab-buttons {
  display: flex;
  gap: 10px;
}

.cab-buttons span {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

.cabinet__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
}

.tag {
  margin: 0;
  color: var(--orange);
  font-family: var(--font-pixel);
  font-size: 10px;
  line-height: 1.6;
}

.cabinet__pitch {
  flex: 1;
  margin: 0;
  color: var(--text-dim);
}

.cabinet__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.cabinet__more {
  color: var(--text-muted);
  font-size: 22px;
}

/* Coming soon */

.cabinet--soon {
  --accent: var(--dim-cyan);
  box-shadow: none;
}

.cabinet--soon .cabinet__marquee {
  color: var(--text-muted);
  text-shadow: none;
}

.cabinet--soon .attract__title {
  opacity: 0.35;
}

.cabinet__soon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--cyan);
  font-family: var(--font-pixel);
  font-size: 14px;
  text-shadow: 0 0 8px var(--cyan);
}

.out-of-order {
  padding: 12px 16px;
  border: 2px dashed var(--dim-cyan);
  color: var(--text-muted);
  font-family: var(--font-pixel);
  font-size: 12px;
  line-height: 1.4;
}

/* Empty bay: only shown when it would even up the grid. */
.cabinet--empty {
  min-height: 320px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 3px dashed var(--line);
  box-shadow: none;
  color: var(--text-muted);
  font-family: var(--font-pixel);
  font-size: 10px;
}

.cabinet-grid__bay .cabinet--empty {
  height: 100%;
}

/* ---------- Game detail ---------- */

.game-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 32px;
}

@media (min-width: 860px) {
  .game-detail {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }
}

.game-detail__bezel {
  border: 3px solid var(--accent);
  border-radius: 14px;
  box-shadow: 0 0 22px color-mix(in srgb, var(--accent) 35%, transparent);
}

.game-detail .attract__title {
  font-size: clamp(18px, 4vw, 32px);
}

.game-detail__info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}

.game-detail__title {
  margin: 0;
  color: var(--accent);
  font-size: clamp(18px, 4.5vw, 28px);
  text-shadow: 0 0 8px var(--accent);
}

.game-detail__pitch,
.game-detail__note {
  margin: 0;
  color: var(--text-dim);
}

.game-detail__subhead {
  margin: 8px 0 0;
  color: var(--yellow);
  font-size: 12px;
  text-shadow: 0 0 8px var(--yellow);
}

.controls {
  width: 100%;
  border-collapse: collapse;
}

.controls th,
.controls td {
  padding: 8px 12px 8px 0;
  border-bottom: 2px dashed var(--line);
  text-align: left;
}

.controls th {
  color: var(--text-muted);
  font-family: var(--font-pixel);
  font-size: 10px;
  font-weight: normal;
}

.controls td {
  color: var(--text-dim);
}

kbd {
  display: inline-block;
  padding: 4px 8px;
  border: 2px solid var(--line);
  color: var(--text);
  font-family: var(--font-pixel);
  font-size: 10px;
}

/* ---------- App tiles ---------- */

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.app-tile {
  --accent: var(--pink);
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  border: 2px dashed color-mix(in srgb, var(--accent) 60%, transparent);
}

.app-tile__name {
  margin: 0;
  color: var(--accent);
  font-size: 14px;
  text-shadow: 0 0 8px var(--accent);
}

.app-tile__platform {
  margin: 0;
  color: var(--text-muted);
  font-family: var(--font-pixel);
  font-size: 10px;
}

.app-tile__desc {
  flex: 1;
  margin: 0;
  color: var(--text-dim);
}

.app-tile__link {
  color: var(--accent);
  font-family: var(--font-pixel);
  font-size: 11px;
  line-height: 1.6;
}

/* ---------- Footer ---------- */

.site-footer {
  position: relative;
  border-top: 2px dashed var(--line);
  color: var(--text-muted);
  font-size: 22px;
}

.site-footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px var(--gutter);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--text-muted);
}

.site-footer a:hover {
  color: var(--text);
}

/* ---------- Game over (404) ---------- */

.game-over {
  min-height: 70vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 24px;
  padding: 48px var(--gutter);
  text-align: center;
}

.game-over h1 {
  margin: 0;
  color: var(--red);
  font-size: clamp(28px, 9vw, 72px);
  text-shadow: 0 0 12px var(--red);
}

.game-over p {
  margin: 0;
  color: var(--text-dim);
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .blink {
    animation: none;
  }
}
