/* THE ARCADE — retro-futurista con moderación.
   Paleta: magenta + cian + un toque de amarillo sobre azul casi negro.
   Animaciones solo con transform y opacity. */

:root {
  --ink: #07061a;
  --ink-2: #0d0b26;
  --panel: rgba(16, 13, 44, 0.72);
  --magenta: #ff3ea5;
  --cyan: #28e6ff;
  --yellow: #ffd23f;
  --text: #e9e6ff;
  --muted: #a9a4cf;
  --line: rgba(40, 230, 255, 0.22);
  --f-pixel: 'Press Start 2P', 'Courier New', monospace;
  --f-sans: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --radius: 14px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: hidden; overflow-x: clip; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink);
  color: var(--text);
  font-family: var(--f-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; border-radius: 6px; }

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  padding: 10px 16px; border-radius: 8px;
  background: var(--yellow); color: var(--ink); font-weight: 700; text-decoration: none;
  transition: transform 0.2s var(--ease-out);
}
.skip-link:focus { transform: translateY(76px); }

/* ---------- Fondo synthwave ---------- */
.bg { position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; }
.bg__sky {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 70% at 50% 108%, rgba(255, 62, 165, 0.22), transparent 60%),
    radial-gradient(80% 50% at 50% 0%, rgba(40, 230, 255, 0.08), transparent 70%),
    linear-gradient(180deg, #05040f 0%, #0b0928 52%, #170a2c 64%, #07061a 100%);
}
.bg__sun {
  position: absolute; left: 50%; top: 62%;
  width: min(46vw, 520px); aspect-ratio: 1;
  transform: translate(-50%, -66%);
  border-radius: 50%;
  background: linear-gradient(180deg, var(--yellow) 0%, #ff8f5a 38%, var(--magenta) 78%);
  opacity: 0.16;
  -webkit-mask-image: repeating-linear-gradient(180deg, #000 0 14px, transparent 14px 20px);
  mask-image: repeating-linear-gradient(180deg, #000 0 14px, transparent 14px 20px);
  filter: blur(0.3px);
}
.bg__grid { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* Scanlines y viñeta CRT, muy ligeras */
.crt {
  position: fixed; inset: 0; z-index: 50; pointer-events: none;
  background:
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0) 0 2px, rgba(0, 0, 0, 0.16) 2px 3px),
    radial-gradient(130% 100% at 50% 50%, transparent 62%, rgba(0, 0, 0, 0.45) 100%);
  opacity: 0.55;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 72px 16px 120px;
  text-align: center;
}
.hero__inner { width: 100%; will-change: transform, opacity; }
.hero__eyebrow {
  margin: 0 0 clamp(18px, 3vw, 34px);
  font-family: var(--f-pixel);
  font-size: clamp(0.55rem, 1.1vw, 0.75rem);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--cyan);
  opacity: 0.85;
}
.hero__title {
  position: relative;
  margin: 0 auto;
  font-family: var(--f-pixel);
  font-weight: 400;
  font-size: clamp(1.75rem, 9.2vw, 10.5rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  white-space: nowrap;
  color: #fff3fb;
  text-shadow:
    0 0 2px #fff,
    0 0 10px rgba(255, 62, 165, 0.95),
    0 0 28px rgba(255, 62, 165, 0.65),
    0 0 70px rgba(255, 62, 165, 0.35),
    0.06em 0 0 rgba(40, 230, 255, 0.35);
  animation: crt-on 1.15s var(--ease-out) both, title-flicker 9s 1.6s infinite;
  transform-origin: 50% 50%;
}
.hero__text { display: inline-block; }
.hero__crt-line {
  position: absolute; left: 0; right: 0; top: 50%; height: 3px;
  background: #fff;
  box-shadow: 0 0 18px #fff, 0 0 40px var(--cyan);
  transform: scaleX(0);
  opacity: 0;
  animation: crt-line 1.15s var(--ease-out) both;
}
@keyframes crt-on {
  0% { transform: scale(1.3, 0.006); opacity: 0; }
  12% { transform: scale(1.3, 0.006); opacity: 1; }
  38% { transform: scale(1.02, 0.006); opacity: 1; }
  60% { transform: scale(1, 1.12); opacity: 1; }
  76% { transform: scale(1, 0.96); }
  100% { transform: scale(1, 1); opacity: 1; }
}
@keyframes crt-line {
  0% { transform: scaleX(0); opacity: 0; }
  12% { transform: scaleX(0.15); opacity: 1; }
  40% { transform: scaleX(1); opacity: 1; }
  62% { transform: scaleX(1); opacity: 0; }
  100% { transform: scaleX(1); opacity: 0; }
}
/* Parpadeo CRT: breve y espaciado, solo en el título */
@keyframes title-flicker {
  0%, 93%, 100% { opacity: 1; }
  93.6% { opacity: 0.82; }
  94.2% { opacity: 1; }
  95% { opacity: 0.9; }
  95.4% { opacity: 1; }
}
.press-start {
  position: absolute; left: 50%; bottom: max(32px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: inline-flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 10px 14px;
  font-family: var(--f-pixel);
  font-size: clamp(0.6rem, 1.2vw, 0.8rem);
  letter-spacing: 0.18em;
  color: var(--yellow);
  text-decoration: none;
  text-shadow: 0 0 10px rgba(255, 210, 63, 0.6);
  animation: fade-in 0.6s 1.4s both;
}
.press-start > span:first-child { animation: blink 1.4s linear 1.6s infinite; }
.press-start__arrow { font-family: var(--f-sans); font-size: 1.3rem; animation: nudge 1.6s ease-in-out 1.6s infinite; }
@keyframes blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0.25; } }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Juegos ---------- */
.games {
  position: relative;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(40px, 8vw, 110px) 16px clamp(60px, 9vw, 120px);
  outline: none;
}
.games__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: clamp(24px, 4vw, 44px); }
.games__title {
  margin: 0;
  font-family: var(--f-pixel);
  font-weight: 400;
  font-size: clamp(1rem, 2.4vw, 1.6rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(40, 230, 255, 0.55);
}
.games__count { margin: 0; font-family: var(--f-pixel); font-size: 0.65rem; letter-spacing: 0.2em; color: var(--muted); text-transform: uppercase; }
.games__list { display: grid; gap: clamp(28px, 5vw, 56px); }

.game {
  --accent: var(--magenta);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: stretch;
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(22, 18, 58, 0.9), rgba(10, 8, 30, 0.92));
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  transition: transform 0.35s var(--ease-out), border-color 0.35s ease, box-shadow 0.35s ease;
}
.game::after {
  /* Borde neón que se enciende en hover (solo opacity) */
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  border: 1.5px solid var(--accent);
  box-shadow: 0 0 22px color-mix(in srgb, var(--accent) 55%, transparent), inset 0 0 22px color-mix(in srgb, var(--accent) 18%, transparent);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.game:hover, .game:focus-within { transform: translateY(-6px); }
.game:hover::after, .game:focus-within::after { opacity: 1; }
.game:nth-child(even) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
.game:nth-child(even) .game__media { order: 2; }

.game__media {
  position: relative;
  display: block;
  min-height: 260px;
  background: #000;
  overflow: hidden;
}
.game__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scale(1.02);
  transition: transform 0.6s var(--ease-out);
}
.game:hover .game__media img { transform: scale(1.06); }
.game__media::after {
  /* Scanlines sobre la vista previa para integrarla al estilo */
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(180deg, transparent 0 2px, rgba(0, 0, 0, 0.18) 2px 3px), linear-gradient(90deg, transparent 70%, rgba(10, 8, 30, 0.55));
  pointer-events: none;
}
.game:nth-child(even) .game__media::after { background: repeating-linear-gradient(180deg, transparent 0 2px, rgba(0, 0, 0, 0.18) 2px 3px), linear-gradient(270deg, transparent 70%, rgba(10, 8, 30, 0.55)); }
.game__placeholder {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 24px;
  font-family: var(--f-pixel); font-size: clamp(0.9rem, 2.4vw, 1.4rem); text-align: center; line-height: 1.6;
  color: var(--accent);
  text-shadow: 0 0 14px var(--accent);
  background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%), #07061a;
}

.game__body {
  display: flex; flex-direction: column; justify-content: center; gap: 14px;
  padding: clamp(24px, 4vw, 48px);
  min-width: 0;
}
.game__tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.game__tags li {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--cyan);
  border: 1px solid var(--line);
  background: rgba(40, 230, 255, 0.06);
}
.game__title {
  margin: 4px 0 0;
  font-family: var(--f-pixel);
  font-weight: 400;
  font-size: clamp(1.15rem, 2.6vw, 1.9rem);
  line-height: 1.35;
  color: var(--accent);
  text-shadow: 0 0 16px color-mix(in srgb, var(--accent) 55%, transparent);
  overflow-wrap: anywhere;
}
.game__desc { margin: 0; color: var(--muted); max-width: 42ch; }
.btn-play {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 12px;
  margin-top: 8px;
  padding: 16px 26px;
  border-radius: 10px;
  font-family: var(--f-pixel);
  font-size: clamp(0.85rem, 1.6vw, 1rem);
  letter-spacing: 0.14em;
  text-decoration: none;
  color: var(--ink);
  background: var(--accent);
  box-shadow: 0 0 0 0 transparent, 0 10px 26px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform 0.2s var(--ease-out), box-shadow 0.25s ease;
}
.btn-play:hover { transform: translateY(-2px); box-shadow: 0 0 22px color-mix(in srgb, var(--accent) 70%, transparent), 0 14px 30px color-mix(in srgb, var(--accent) 40%, transparent); }
.btn-play:active { transform: translateY(1px); }
.btn-play:focus-visible { outline-color: #fff; }

.game--soon { grid-template-columns: 1fr; border-style: dashed; background: rgba(10, 8, 30, 0.6); }
.game--soon .game__body { align-items: center; text-align: center; padding: clamp(28px, 5vw, 56px); }
.game--soon .game__title { color: var(--yellow); text-shadow: 0 0 14px rgba(255, 210, 63, 0.45); font-size: clamp(0.9rem, 2vw, 1.2rem); }
.game--soon .game__title span { animation: blink 1.6s linear infinite; }

.noscript-list { display: grid; gap: 12px; padding: 0; list-style: none; font-family: var(--f-pixel); }
.noscript-list a { color: var(--yellow); }

/* ---------- Revelado al hacer scroll ---------- */
.js .reveal {
  opacity: 0;
  transform: translate3d(0, 48px, 0) scale(0.965);
  transition: opacity 0.8s var(--ease-out), transform 0.9s var(--ease-out);
}
.js .reveal.is-visible { opacity: 1; transform: none; }
.js .game.reveal.is-visible:hover, .js .game.reveal.is-visible:focus-within { transform: translateY(-6px); }

/* ---------- Footer ---------- */
.footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 24px;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px 16px max(28px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}
.footer p { margin: 0; }
.footer__brand { font-family: var(--f-pixel); font-size: 0.75rem; letter-spacing: 0.16em; color: var(--magenta); text-shadow: 0 0 10px rgba(255, 62, 165, 0.5); }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .game, .game:nth-child(even) { grid-template-columns: 1fr; }
  .game:nth-child(even) .game__media { order: 0; }
  .game__media { min-height: 0; aspect-ratio: 16 / 10; }
  .game__media::after, .game:nth-child(even) .game__media::after { background: repeating-linear-gradient(180deg, transparent 0 2px, rgba(0, 0, 0, 0.18) 2px 3px), linear-gradient(180deg, transparent 70%, rgba(10, 8, 30, 0.55)); }
  .btn-play { align-self: stretch; justify-content: center; }
}

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .hero__title { animation: none; }
  .hero__crt-line { display: none; }
  .press-start > span:first-child, .press-start__arrow, .game--soon .game__title span { animation: none; }
  .js .reveal { opacity: 1; transform: none; }
  .game:hover, .game:focus-within, .js .game.reveal.is-visible:hover, .js .game.reveal.is-visible:focus-within { transform: none; }
}
