/* ==========================================================================
   Geeks Mexico — shared site chrome
   Used by index.html, privacy/index.html and 404.html. Games never load
   this file: each game owns its vibe and stays a single self-contained
   HTML file (see README.md).
   Page sections are scoped under body classes:
     .page-home     — homepage hero + catalog
     .page-privacy  — privacy policy prose/tables
     .page-error    — 404 game-over screen
   ========================================================================== */

/* ============ Design tokens (all pairs WCAG-AA verified) ================= */
:root {
  --bg:          #0b0e14;
  --panel:       #131a28;
  --panel-2:     #0e1420;
  --line:        #2b3a57;   /* decorative card edges */
  --line-strong: #54749c;   /* interactive-element borders (≥3:1 on bg) */
  --ink:         #e8ecf2;   /* body text on bg/panel */
  --muted:       #aab8ca;   /* secondary text on bg/panel */
  --gold:        #ffd23f;   /* accents, primary button */
  --gold-ink:    #191300;   /* text on gold */
  --cyan:        #7cd6ff;   /* links */
  --red:         #ff6a55;   /* decorative only */
  --green:       #0b752a;   /* flag green — sampled from the logo */
  --flag-red:    #c00d15;   /* flag red — sampled from the logo */
  --shadow:      #05070c;   /* hard retro drop shadows */
}

/* ================================= Base ================================== */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
/* CRT scanlines over the whole page — same trick the game cabinets use */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 90; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.13) 0 1px, transparent 1px 3px);
}
h1, h2, h3, .logo {
  font-family: "Courier New", ui-monospace, monospace; letter-spacing: .5px;
  font-weight: 800; text-shadow: 3px 3px 0 rgba(0,0,0,.9);
}
a { color: var(--cyan); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--green); color: #fff; }

.wrap { max-width: 1060px; margin-inline: auto; padding-inline: clamp(16px, 4vw, 32px); width: 100%; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

/* Skip link — first focusable element on the page */
.skip {
  position: absolute; left: -9999px; top: 10px;
  background: var(--gold); color: var(--gold-ink);
  padding: 12px 18px; border-radius: 6px;
  font-weight: 700; text-decoration: none; z-index: 100;
}
.skip:focus { left: 10px; }

/* Pixel sparkles — borrowed from the logo's starfield */
.spark {
  position: absolute; width: 15px; height: 15px; pointer-events: none;
  background: currentColor;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}

/* Kicker label above titles (the 404 page recolors it below) */
.kicker {
  color: var(--gold); font-weight: 700; letter-spacing: 3px;
  font-size: .8rem; margin: 0 0 10px; font-family: "Courier New", monospace;
}

.cta-row { display: flex; gap: 14px; flex-wrap: wrap; }

/* ============================ Header / nav =============================== */
.site-head { background: var(--panel); border-bottom: 2px solid var(--line-strong); }
.head-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; padding-block: 10px;
}
.logo { text-decoration: none; padding: 6px 0; line-height: 0; }
.logo img { display: block; height: clamp(30px, 5vw, 38px); width: auto; }
nav ul { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; flex-wrap: wrap; }
nav a {
  display: inline-block; padding: 12px 14px;   /* ≥44px touch target with line-height */
  color: var(--ink); text-decoration: none; font-weight: 600; border-radius: 6px;
}
nav a:hover { background: var(--panel); color: var(--gold); }

/* ================================ Buttons ================================ */
.btn {
  display: inline-block; min-height: 48px; line-height: 1;
  padding: 16px 22px; border-radius: 4px;
  font-family: "Courier New", monospace; font-weight: 800; letter-spacing: 1px;
  text-decoration: none; border: 2px solid transparent;
  box-shadow: 4px 4px 0 var(--shadow);
}
.btn-gold { background: var(--gold); color: var(--gold-ink); }
.btn-gold:hover { background: #ffe173; }
.btn-line { color: var(--cyan); border-color: var(--line-strong); background: var(--panel-2); }
.btn-line:hover { border-color: var(--cyan); }
.btn:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--shadow); }

/* ================================ Footer ================================= */
footer { border-top: 4px double var(--line-strong); background: #0d1119; }
.foot-row {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding-block: 22px; color: var(--muted); font-size: .92rem;
}

/* ==========================================================================
   Homepage (.page-home)
   ========================================================================== */
.page-home footer { margin-top: 24px; }

.page-home section { padding-block: clamp(36px, 6vw, 64px); }
.page-home #games { border-top: 4px double var(--line-strong); }

/* Hero */
.page-home .hero {
  position: relative; display: grid; grid-template-columns: 1.1fr .9fr;
  gap: clamp(24px, 5vw, 56px); align-items: center;
  padding-block: clamp(40px, 7vw, 84px) clamp(28px, 5vw, 56px);
}
@media (max-width: 720px) { .page-home .hero { grid-template-columns: 1fr; } }
.hero-logo { display: block; width: min(430px, 100%); height: auto; margin: 0 0 24px; }
.page-home h1 { font-size: clamp(1.7rem, 4.5vw, 2.7rem); line-height: 1.15; margin: 0 0 14px; }
.lede { color: var(--muted); font-size: 1.06rem; max-width: 46ch; margin: 0 0 24px; }
.hero-art {
  border: 3px solid var(--line-strong); border-radius: 8px;
  box-shadow: 8px 8px 0 var(--shadow); overflow: hidden; position: relative;
  background: #0a2f52;
}
.hero-art::after {   /* cabinet screen glass */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.16) 0 1px, transparent 1px 3px),
    radial-gradient(120% 90% at 50% 8%, rgba(255,255,255,.07), transparent 55%);
}
.hero-art svg { width: 100%; height: auto; display: block; }
.section-sub { color: var(--muted); max-width: 60ch; }

/* Catalog grid */
.grid {
  list-style: none; margin: 28px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 20px;
}
.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--panel); border: 2px solid var(--line-strong); border-radius: 4px;
  box-shadow: 6px 6px 0 var(--shadow); overflow: hidden;
}
.thumb svg { display: block; width: 100%; height: auto; }
.card-body { display: flex; flex-direction: column; gap: 8px; padding: 18px 18px 20px; }
.badges { margin: 0; display: flex; gap: 8px; }
.badge-new, .badge-soon {
  font-family: "Courier New", monospace; font-weight: 800; font-size: .72rem; letter-spacing: 2px;
  padding: 5px 10px; border-radius: 2px;
}
.badge-new { background: var(--gold); color: var(--gold-ink); border: 2px solid #000; }
.badge-soon { background: var(--panel-2); color: var(--muted); border: 2px dashed var(--line); }
.card h3 { margin: 0; font-size: 1.35rem; }
.stretched { color: var(--ink); text-decoration: none; }
.stretched::after { content: ""; position: absolute; inset: 0; }  /* whole card clickable */
.card:focus-within { outline: 3px solid var(--cyan); outline-offset: 2px; }
.meta { margin: 0; color: var(--muted); font-size: .85rem; letter-spacing: .4px; }
.desc { margin: 0; color: var(--ink); }
.play {
  margin: auto 0 0; padding-top: 10px;
  font-family: "Courier New", monospace; font-weight: 800; letter-spacing: 2px;
  color: var(--gold); font-size: .85rem;
}
/* Coming-soon placeholders are NOT links and must not look clickable */
.card.soon { border-style: dashed; background: var(--panel-2); }
.card.soon .thumb-mystery {
  display: grid; place-items: center; aspect-ratio: 320 / 140;
  font-family: "Courier New", monospace; font-size: 3rem; font-weight: 800;
  color: var(--muted); background: repeating-linear-gradient(45deg, #101623 0 12px, #0d1220 12px 24px);
}
.card.soon .desc, .card.soon h3 { color: var(--muted); }

/* ==========================================================================
   Privacy policy (.page-privacy)
   ========================================================================== */
.page-privacy main { padding-block: clamp(36px, 6vw, 64px) clamp(48px, 7vw, 80px); }
.page-privacy h1 { font-size: clamp(1.7rem, 4.5vw, 2.4rem); line-height: 1.15; margin: 0 0 8px; }
.updated { color: var(--muted); font-size: .9rem; margin: 0 0 34px; }

/* Tricolor nod to the logo's flag wordmark */
.flag-bar {
  width: 84px; height: 5px; border-radius: 2px; margin: 6px 0 14px;
  background: linear-gradient(90deg,
    var(--green) 0 33%, #e8ecf2 33% 66%, var(--flag-red) 66% 100%);
}

.prose { max-width: 72ch; }
.prose h2 { color: var(--ink); margin: 38px 0 10px; font-size: 1.25rem; }
.prose p, .prose li { color: var(--muted); }
.prose strong, .prose th { color: var(--ink); }
.prose ul { padding-left: 22px; }
.prose li { margin-block: 6px; }
.page-privacy code {
  font-family: ui-monospace, "Courier New", monospace; font-size: .88em;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 2px; padding: 1px 6px; white-space: nowrap;
}

table.storage {
  width: 100%; border-collapse: collapse; margin: 18px 0 8px; font-size: .95rem;
}
table.storage th, table.storage td {
  border: 2px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top;
}
table.storage th { background: var(--panel-2); letter-spacing: .5px; font-size: .85rem; }
table.storage td:first-child code { color: var(--gold); }
@media (max-width: 640px) {
  table.storage { font-size: .85rem; }
  table.storage th, table.storage td { padding: 8px; }
}

/* ==========================================================================
   404 — game over screen (.page-error)
   ========================================================================== */
.page-error { min-height: 100vh; display: flex; flex-direction: column; }
.page-error main {
  flex: 1; position: relative; display: grid; place-items: center;
  text-align: center; padding-block: clamp(48px, 9vw, 96px);
}
.mascot {
  display: block; margin: 0 auto -6px;
  width: clamp(100px, 18vw, 150px); height: auto;
}
.code404 {
  margin: 0; font-family: "Courier New", ui-monospace, monospace;
  font-size: clamp(5rem, 22vw, 11rem); font-weight: 800; line-height: 1;
  letter-spacing: .04em; color: var(--gold);
  /* layered print offsets — no neon glow */
  text-shadow: 4px 4px 0 #7a5a00, 8px 8px 0 rgba(0,0,0,.55);
}
.page-error .kicker {
  color: var(--red); font-weight: 800;
  letter-spacing: 4px; font-size: clamp(.85rem, 2.6vw, 1.05rem); margin: 18px 0 10px;
}
.page-error h1 { font-size: clamp(1.3rem, 4vw, 1.8rem); margin: 0 0 12px; }
.blurb { color: var(--muted); max-width: 46ch; margin: 0 auto 30px; }
.page-error .cta-row { justify-content: center; }

/* ==========================================================================
   Motion is opt-in for users who haven't asked for reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
  /* Catalog cards */
  .card { transition: transform .08s ease, box-shadow .08s ease; }
  .card-game:has(.stretched:hover) { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--shadow); }
  @keyframes floaty { from { transform: translateY(0); } to { transform: translateY(-10px); } }
  .floaty { animation: floaty 4s ease-in-out infinite alternate; }
  /* Sparkles */
  @keyframes twinkle { from { opacity: .25; } to { opacity: .9; } }
  .spark { animation: twinkle 2.8s ease-in-out infinite alternate; }
  .spark:nth-of-type(2n) { animation-delay: -1.1s; }
  .spark:nth-of-type(3n) { animation-delay: -2s; }
  /* 404 mascot + cursor */
  @keyframes bob { from { transform: translateY(0); } to { transform: translateY(-8px); } }
  .mascot { animation: bob 3.2s ease-in-out infinite alternate; }
  @keyframes blink { 50% { opacity: 0; } }
  .blink { animation: blink 1.4s step-end infinite; }
}
