/* ═══════════════════════════════════════════════════════════════════════════
   AMBIENT BACKGROUND — the room behind the games.

   The cruise site does this and it is the thing that makes it feel like a place
   rather than a page: a fixed photographic backdrop that crossfades as you
   scroll, with a scrim over it so nothing on top gets harder to read. Same idea
   here, using the 28 game photographs the site already ships — as you move down
   the grid the room behind you becomes the game you are looking at.

   The scrim is deliberately heavier than the cruise site's. This audience needs
   contrast more than it needs a pretty picture, so the photograph is a wash you
   notice at the edges, never something text has to compete with. Both themes are
   defined; the light one is the default here, so it is written first and the
   dark one is guarded.
   ═══════════════════════════════════════════════════════════════════════════ */

#ambientBg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

#ambientBg .ab-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1.1s ease;
  will-change: opacity;
  transform: scale(1.04);
}

#ambientBg .ab-layer.ab-on { opacity: 1; }

/* a slow drift, so the room breathes instead of sitting still */
#ambientBg .ab-layer.ab-ken { animation: abKen 26s ease-in-out infinite alternate; }
@keyframes abKen {
  from { transform: scale(1.04) translate3d(0, 0, 0); }
  to   { transform: scale(1.13) translate3d(0, -1.4%, 0); }
}

/* ── the scrim: this is what protects the text ─────────────────────────────
   Light theme is the default on this site, so it is the unguarded rule. */
#ambientBg .ab-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg,
      rgba(242, 245, 250, 0.90) 0%,
      rgba(242, 245, 250, 0.70) 32%,
      rgba(233, 238, 246, 0.76) 68%,
      rgba(224, 232, 242, 0.92) 100%);
}
#ambientBg .ab-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 92% 74% at 50% 38%, transparent 52%, rgba(190, 205, 224, 0.45) 100%);
}

html:not([data-theme="light"]) #ambientBg .ab-scrim {
  background:
    linear-gradient(180deg,
      rgba(6, 12, 26, 0.84) 0%,
      rgba(10, 22, 40, 0.60) 32%,
      rgba(10, 22, 40, 0.68) 68%,
      rgba(6, 12, 26, 0.90) 100%);
}
html:not([data-theme="light"]) #ambientBg .ab-vignette {
  background: radial-gradient(ellipse 92% 74% at 50% 38%, transparent 52%, rgba(2, 6, 16, 0.62) 100%);
}

/* content sits above the backdrop */
nav, main, footer, section, .container { position: relative; z-index: 1; }

@media (prefers-reduced-motion: reduce) {
  #ambientBg .ab-layer.ab-ken { animation: none; }
  #ambientBg .ab-layer { transition: none; }
}

/* On a phone the backdrop costs more than it gives: the grid fills the screen,
   so the picture is barely visible while still being decoded and composited. */
@media (max-width: 640px) {
  #ambientBg .ab-layer.ab-ken { animation: none; }
}
