/* CardCMD coming-soon page */

@font-face {
  font-family: "Press Start 2P";
  src: url("/fonts/PressStart2P-Regular.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "VT323";
  src: url("/fonts/VT323-Regular.woff2") format("woff2");
  font-display: swap;
}

/* Metric-matched fallbacks: the web font swap does not move the layout */
@font-face {
  font-family: "PS2P Fallback";
  src: local("Courier New"), local("Liberation Mono"), local("Droid Sans Mono");
  size-adjust: 166.6%;
  ascent-override: 60%;
  descent-override: 0%;
}

@font-face {
  font-family: "VT323 Fallback";
  src: local("Courier New"), local("Liberation Mono"), local("Droid Sans Mono");
  size-adjust: 66.7%;
  ascent-override: 120%;
  descent-override: 30%;
}

:root {
  --bg: #140c04;
  --bg-deep: #0e0904;
  --bg-lift: #22150a;
  --panel: #1c1005;
  --line: #5a3a12;
  --ink: #ffe9c7;
  --muted: #d9c2a0;
  --grey: #a08c6c; /* art only */
  --amber: #ffb000; /* fills and small text: AA under scanlines */
  --art-a: var(--ink);
  --art-c: var(--amber);
  --px: 4px;
  --loop: 8s;
  --glow: 1; /* 1 on, 0 off */
  --pixel: "Press Start 2P", "PS2P Fallback", ui-monospace, monospace;
  --term: "VT323", "VT323 Fallback", ui-monospace, monospace;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg);
  background-image: radial-gradient(ellipse at 50% 30%, var(--bg-lift) 0%, var(--bg) 55%, var(--bg-deep) 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--term);
  font-size: 1.375rem;
  line-height: 1.3;
}

/* Atmosphere: static scanlines + vignette, never animated */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0, 0, 0, 0.16) 2px 4px),
    radial-gradient(ellipse at 50% 45%, transparent 65%, rgba(0, 0, 0, 0.12) 100%);
}

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

h1, h2, h3, p, ul, ol, figure { margin: 0; }

ul, ol { padding: 0; list-style: none; }

a { color: var(--amber); text-underline-offset: 0.2em; }

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

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

[id] { scroll-margin-top: 1.5rem; }

.sprite { position: absolute; }

.f-n { fill: var(--bg); }
.f-d { fill: var(--bg-deep); }
.f-p { fill: var(--panel); }
.f-l { fill: var(--line); }
.f-i { fill: var(--ink); }
.f-m { fill: var(--muted); }
.f-a { fill: var(--art-a); }
.f-c { fill: var(--art-c); }

.screen, main, .masthead, .hero, .demo, .levels-wrap, .venues, .faq, .status, .lost {
  display: flex;
  flex-direction: column;
}

.screen {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0.75rem 1rem 2rem;
  gap: 1rem;
  min-height: 100vh;
  min-height: 100dvh;
}

main { gap: 3rem; flex: 1; }

.masthead { gap: 1rem; text-align: center; }

.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 2.75rem;
  text-align: left;
}

.say { color: var(--muted); font-size: 1.25rem; }

/* CRT FX toggle: native checkbox, shown only where :has() works */
.fx {
  display: none;
  position: relative;
  align-items: center;
  gap: 0.625rem;
  min-height: 2.75rem;
  padding: 0 0.25rem;
  font-family: var(--pixel);
  font-size: 0.75rem;
  white-space: nowrap;
  cursor: pointer;
}

@supports selector(:has(*)) {
  .fx { display: inline-flex; }
}

.fx input {
  appearance: none;
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  margin: 0;
  background: var(--panel);
  border: 2px solid var(--amber);
  border-radius: 0;
  cursor: pointer;
}

.fx-tick {
  position: absolute;
  left: calc(0.25rem + 4px);
  top: 50%;
  margin-top: -8px;
  pointer-events: none;
}

.fx input:not(:checked) + .fx-tick { visibility: hidden; }

/* Wordmark: 62 art px wide, so widths step by 62px */
.wordmark { line-height: 0; }

.wordmark:only-child { margin-top: 2rem; }

.wordmark img {
  display: inline-block;
  width: 248px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 0 10px rgba(255, 176, 0, calc(0.24 * var(--glow))));
}

/* Hero / title screen */
.hero { align-items: center; gap: 1.25rem; text-align: center; }

.tagline {
  font-family: var(--pixel);
  font-size: clamp(1rem, 5vw, 2.25rem);
  line-height: 1.5;
  text-shadow: 0 0 12px rgba(255, 233, 199, calc(0.25 * var(--glow)));
}

.tagline span { display: inline-block; }

.demo { align-items: center; gap: 0.75rem; max-width: 100%; }

.scene {
  --edge: var(--line);
  display: block;
  width: 320px;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

.steps {
  display: flex;
  gap: 1.25rem;
  font-family: var(--pixel);
  font-size: 0.75rem;
  line-height: 1.5;
  text-transform: uppercase;
}

.steps li { position: relative; padding-bottom: 0.5rem; }

.steps span { color: var(--amber); }

.steps li::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: var(--px);
  background: var(--amber);
}

/* PRESS START: steady box, blinking label */
.cta {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding: 0.75rem 1.25rem;
  --edge: var(--amber);
  font-family: var(--pixel);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--amber);
  text-decoration: none;
  text-transform: uppercase;
}

.cta:hover, .cta:focus-visible { --edge: currentColor; color: var(--ink); }

.cta-label { display: inline-flex; align-items: center; }

/* Stepped pixel arrow */
.cta-label::before {
  content: "";
  flex: none;
  width: 8px;
  height: 14px;
  margin-right: 0.75rem;
  background: currentColor;
  clip-path: polygon(0 0, 2px 0, 2px 2px, 4px 2px, 4px 4px, 6px 4px, 6px 6px, 8px 6px, 8px 8px, 6px 8px, 6px 10px, 4px 10px, 4px 12px, 2px 12px, 2px 14px, 0 14px);
}

.cta-back .cta-label::before { transform: scaleX(-1); }

.soon {
  font-family: var(--pixel);
  font-size: clamp(0.75rem, 3vw, 1rem);
  line-height: 1.6;
  color: var(--ink);
  text-shadow: 0 0 10px rgba(255, 176, 0, calc(0.45 * var(--glow)));
}

.intro { max-width: 34rem; font-size: 1.5rem; }

/* Headings */
h2, h3 { font-family: var(--pixel); font-weight: 400; color: var(--ink); }

h2 {
  font-size: 0.875rem;
  line-height: 1.5;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h2::before { content: "> "; color: var(--amber); }

h3 { font-size: 0.8125rem; line-height: 1.6; margin-bottom: 0.6rem; }

/* Pixel panel: notched border from box-shadows */
.panel { --edge: var(--line); position: relative; }

.panel, .cta, .scene {
  background: var(--panel);
  margin: var(--px);
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--edge),
    0 var(--px) 0 0 var(--edge),
    calc(var(--px) * -1) 0 0 0 var(--edge),
    var(--px) 0 0 0 var(--edge);
}

.levels-wrap, .venues, .faq { gap: 1.25rem; }

.levels, .faq-list, .venue-grid { display: grid; gap: 1.25rem; }

/* Level select */
.level {
  display: grid;
  grid-template-columns: 1fr auto;
  align-content: start;
  padding: 1.25rem 1.25rem 1.4rem;
}

.level h3, .level p { grid-column: 1 / -1; }

.level-tag {
  margin-bottom: 0.75rem;
  font-family: var(--pixel);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--amber);
  text-transform: uppercase;
}

.icon { display: block; width: 32px; height: 32px; shape-rendering: crispEdges; }

.level p, .venue li, .qa p { color: var(--muted); }

/* Built for shops and shows */
.venue-art { display: block; justify-self: center; width: 96px; height: 60px; }

.bob, .mascot { --art-a: var(--grey); }

.venue { padding: 1.25rem 1.25rem 1.4rem; }

.venue li { position: relative; padding-left: 1.25rem; }

.venue li + li { margin-top: 0.4rem; }

.venue li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 6px;
  height: 6px;
  background: var(--amber);
}

.qa { padding: 1.25rem; }

.qa h3 { margin-bottom: 0.4rem; }

/* Status */
.status { gap: 0.75rem; padding: 1.25rem; }

.led {
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  margin-right: 0.5em;
  background: var(--amber);
  box-shadow: 0 0 8px rgba(255, 176, 0, calc(0.7 * var(--glow)));
  vertical-align: 0.05em;
}

/* Footer */
.site-footer {
  padding-top: 1rem;
  text-align: center;
  font-family: var(--pixel);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--muted);
}

/* Footer links: 44px-tall targets that wrap on narrow screens */
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 0.25rem;
  margin-bottom: 0.5rem;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 0.5rem;
}

.footer-links a[aria-current="page"] { color: var(--ink); text-decoration: none; }

/* Legal and support pages */
.wordmark a { display: inline-block; }

.doc, .doc section, .doc-head { display: flex; flex-direction: column; }

.doc, .doc-faq { align-self: center; max-width: 46rem; }

.doc {
  width: calc(100% - var(--px) * 2);
  gap: 2rem;
  padding: 1.5rem 1.25rem 1.75rem;
  font-size: 1.5rem;
  line-height: 1.35;
}

.doc-head { gap: 0.75rem; text-align: center; }

.doc-meta {
  font-family: var(--pixel);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--muted);
}

.doc section { gap: 0.75rem; }

.doc a { overflow-wrap: anywhere; }

.doc-list li { position: relative; padding-left: 1.25rem; }

.doc-list li + li { margin-top: 0.4rem; }

.doc-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 6px;
  height: 6px;
  background: var(--amber);
}

.doc-faq { width: 100%; }

.doc-back { text-align: center; }

/* 404 */
.lost {
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem 1.25rem;
  text-align: center;
}

.lost h2 { font-size: clamp(0.875rem, 4vw, 1.25rem); }

.lost h2::before { content: none; }

.mascot { display: block; width: 64px; height: 64px; }

/* Larger screens */
@media (min-width: 380px) { .wordmark img { width: 310px; } }

@media (min-width: 440px) { .wordmark img { width: 372px; } }

@media (min-width: 40rem) {
  .screen { padding: 1rem 2rem 2.5rem; gap: 1.5rem; }
  main { gap: 3.5rem; }
  .wordmark img { width: 558px; }
  .scene { width: 480px; }
  .levels, .faq-list, .venue-grid { grid-template-columns: 1fr 1fr; }
  .venue-art { grid-column: 1 / -1; }
  .status { flex-direction: row; align-items: baseline; gap: 1.25rem; }
  .doc { padding: 2rem 2.25rem 2.25rem; }
}

@media (min-width: 50rem) {
  .wordmark img { width: 620px; }
}

@media (min-width: 60rem) {
  .wordmark img { width: 682px; }
  .levels { grid-template-columns: repeat(3, 1fr); }
  .venue-grid { grid-template-columns: 1fr auto 1fr; align-items: center; }
  .venue-art { grid-column: 2; grid-row: 1; }
}

/* Demo loop: one 8s clock, whole-step jumps; each part names its keyframes in --a */
.scene g, .steps li::after { animation: none var(--loop) steps(1, end) infinite; }
.scene :where(g) { --a: none; }
.cta-label { animation: none 1.2s steps(1, end) infinite; }
.bob { animation: none 1s steps(1, end) infinite; }

.stage { --a: sc-stage; }
.card { --a: sc-card; }
.scanline { --a: sc-scan; }
.brackets { --a: sc-brackets; }
.flash { --a: sc-flash; }
.tick { --a: sc-tick; }
.r1 { --a: sc-r1; }
.r2 { --a: sc-r2; }
.r3 { --a: sc-r3; }
.r4 { --a: sc-r4; }
.packets { --a: sc-packets; }
.led-on { --a: sc-led; }
.label { --a: sc-label; }
.s1::after { --a: step-1; }
.s2::after { --a: step-2; }
.s3::after { --a: step-3; }
.cta-label { --a: blink; }
.bob { --a: bob; }

@keyframes sc-stage { 92.5% { opacity: 0.5; } 96.25%, 100% { opacity: 0; } }

@keyframes sc-card {
  0% { transform: translateY(56px); }
  3.125% { transform: translateY(42px); }
  6.25% { transform: translateY(28px); }
  9.375% { transform: translateY(14px); }
  12.5%, 100% { transform: none; }
}

@keyframes sc-scan {
  0% { opacity: 0; }
  12.5%, 22.5% { opacity: 1; transform: translateY(-12px); }
  13.929%, 23.929% { transform: translateY(-8px); }
  15.357%, 25.357% { transform: translateY(-4px); }
  16.786%, 26.786% { transform: none; }
  18.214%, 28.214% { transform: translateY(4px); }
  19.643%, 29.643% { transform: translateY(8px); }
  21.071%, 31.071% { transform: translateY(12px); }
  32.5%, 100% { transform: none; }
}

@keyframes sc-brackets { 12.5%, 22.5% { opacity: 0.35; } 17.5%, 27.5%, 32.5% { opacity: 1; } }

@keyframes sc-flash { 0% { opacity: 0; } 32.5%, 37.5% { opacity: 1; } 35%, 40%, 100% { opacity: 0; } }

@keyframes sc-tick { 0% { opacity: 0; } 37.5%, 100% { opacity: 1; } }
@keyframes sc-r1 { 0% { opacity: 0; } 40%, 100% { opacity: 1; } }
@keyframes sc-r2 { 0% { opacity: 0; } 45%, 100% { opacity: 1; } }
@keyframes sc-r3 { 0% { opacity: 0; } 50%, 100% { opacity: 1; } }
@keyframes sc-r4 { 0% { opacity: 0; } 55%, 100% { opacity: 1; } }
@keyframes sc-led { 0% { opacity: 0; } 71.875%, 100% { opacity: 1; } }

@keyframes sc-packets {
  0% { opacity: 0; }
  62.5% { opacity: 1; transform: translate(-24px, 0); }
  64.375% { transform: translate(-16px, -2px); }
  66.25% { transform: translate(-8px, 0); }
  68.125% { transform: translate(0, -2px); }
  70% { transform: translate(8px, 0); }
  71.875% { transform: translate(16px, -2px); }
  73.75% { opacity: 1; transform: translate(24px, 0); }
  75.625% { opacity: 0; }
  85%, 100% { opacity: 1; transform: none; }
}

@keyframes sc-label {
  0% { transform: translateY(24px); }
  73.75% { transform: translateY(20px); }
  75.625% { transform: translateY(16px); }
  77.5% { transform: translateY(12px); }
  79.375% { transform: translateY(8px); }
  81.25% { transform: translateY(4px); }
  83.125%, 100% { transform: none; }
}

@keyframes step-1 { 0% { opacity: 1; } 40% { opacity: 0; } 85%, 100% { opacity: 1; } }
@keyframes step-2 { 0% { opacity: 0; } 40% { opacity: 1; } 62.5% { opacity: 0; } 85%, 100% { opacity: 1; } }
@keyframes step-3 { 0% { opacity: 0; } 62.5%, 100% { opacity: 1; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes bob { 50% { transform: translateY(-1px); } }

/* Loops run only when motion is welcome and CRT FX is ticked */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  :root:has(#fx:checked) .scene g,
  :root:has(#fx:checked) .steps li::after,
  :root:has(#fx:checked) .cta-label,
  :root:has(#fx:checked) .bob {
    animation-name: var(--a, none);
  }

  :root:has(#fx:checked) .cta:hover .cta-label,
  :root:has(#fx:checked) .cta:focus-visible .cta-label {
    animation-name: none;
  }
}

/* Atmosphere off: CRT FX unticked */
:root:has(#fx:not(:checked)) { --glow: 0; }
:root:has(#fx:not(:checked)) body::after { display: none; }

/* Comfort and accessibility: atmosphere off */
@media (prefers-reduced-motion: reduce) {
  :root { --glow: 0; }

  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }

  body::after, .fx { display: none; }
}

@media (prefers-contrast: more) {
  :root { --glow: 0; }
  body::after { display: none; }
  .level p, .venue li, .qa p, .say, .site-footer, .doc-meta { color: var(--ink); }
  .panel { --edge: var(--muted); }
}

@media (forced-colors: active) {
  body::after, .fx-tick, .steps li::after { display: none; }
  .panel, .cta, .scene { border: 2px solid CanvasText; }
  .cta { border-color: LinkText; }
  .fx input { appearance: auto; }
  .scene, .icon, .venue-art, .mascot, .led, .venue li::before, .doc-list li::before { forced-color-adjust: none; }
  .cta-label::before { forced-color-adjust: none; background: LinkText; }
}
