/* ============================================================
   Ambient background life (mockup): hero pixel sky + margin bits.
   Sprites are tiny inline SVGs (generated). Everything sits behind
   content, ignores the mouse, and stops for reduced motion.
   ============================================================ */

/* stacking: ambient layer first in <body>, content above it */
body { position: relative; }
main, .site-footer { position: relative; z-index: 1; }

.px { position: absolute; display: block; pointer-events: none;
  width: calc(var(--w) * var(--s, 3) * 1px); height: calc(var(--h) * var(--s, 3) * 1px);
  background-size: 100% 100%; background-repeat: no-repeat; image-rendering: pixelated; }

/* ---------- hero sky ---------- */
.sky { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
/* clouds are moved by assets/js/ambient.js (new random speed every pass);
   parked off-screen left until it runs */
.sky .px-cloud, .sky .px-cloud2 { left: 0; top: var(--y); opacity: .95; transform: translateX(-200px); }
.sky .spark { left: var(--x); top: var(--y); --s: 2;
  animation: twinkle var(--t, 3.2s) ease-in-out var(--d, 0s) infinite; opacity: 0; }

@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(.4); } 45%, 55% { opacity: .9; transform: scale(1); } }

/* ---------- margin bits ---------- */
.ambient { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
/* centre of each side strip: strip = (100% - 1000px) / 2, so its middle is 25% - 250px */
.ambient .px { --s: 4; top: var(--y);
  left: calc(25% - 250px - var(--w) * var(--s, 3) * .5px + var(--dx, 0px)); }
.ambient .px.r { left: calc(75% + 250px - var(--w) * var(--s, 3) * .5px + var(--dx, 0px)); }

/* each sprite type has its own life: some float, some just animate pixels (::after strips) */
.ambient .px-star, .ambient .px-gem { animation: bob var(--t, 5s) ease-in-out var(--d, 0s) infinite alternate; }
.ambient .px-coin { animation: bob var(--t, 5s) ease-in-out var(--d, 0s) infinite alternate,
  spin 2.4s steps(6) var(--d, 0s) infinite; }
.ambient .px-heart { animation: beat 3.6s ease-out var(--d, 0s) infinite; }
/* dpad: arms light up in turn; cart: label scanline. No movement. */

@keyframes bob { from { translate: 0 0; rotate: -4deg; } to { translate: 0 -10px; rotate: 4deg; } }
@keyframes spin { 0%, 100% { scale: 1 1; } 50% { scale: .15 1; } }
@keyframes beat { 0%, 30%, 100% { scale: 1; } 8% { scale: 1.18; } 16% { scale: 1; } 23% { scale: 1.1; } }

/* strips get too thin to be worth it below ~1100px */
@media (max-width: 1100px) { .ambient { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .sky .px, .ambient .px, .ambient .px::after { animation: none; }
  .sky .spark { opacity: .6; }
  .sky .px-cloud, .sky .px-cloud2 { left: var(--x, 10%); transform: none; }
}

/* ---------- sprites ---------- */
.px-coin { --w: 8; --h: 8; background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' shape-rendering='crispEdges'><path fill='%23a8661c' d='M2 0h4v1h-4zM1 1h1v1h-1zM6 1h1v1h-1zM0 2h1v1h-1zM7 2h1v1h-1zM0 3h1v1h-1zM3 3h2v1h-2zM7 3h1v1h-1zM0 4h1v1h-1zM3 4h2v1h-2zM7 4h1v1h-1zM0 5h1v1h-1zM7 5h1v1h-1zM1 6h1v1h-1zM6 6h1v1h-1zM2 7h4v1h-4z'/><path fill='%23ffd98a' d='M2 1h2v1h-2zM1 2h2v1h-2zM1 3h1v1h-1zM1 4h1v1h-1z'/><path fill='%23f0a23e' d='M4 1h2v1h-2zM3 2h3v1h-3zM2 3h1v1h-1zM5 3h1v1h-1zM2 4h1v1h-1zM5 4h1v1h-1zM1 5h5v1h-5z'/><path fill='%23c9832e' d='M6 2h1v1h-1zM6 3h1v1h-1zM6 4h1v1h-1zM6 5h1v1h-1zM2 6h4v1h-4z'/></svg>"); }
.px-heart { --w: 7; --h: 7; background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 7' shape-rendering='crispEdges'><path fill='%23a8322a' d='M1 0h2v1h-2zM4 0h2v1h-2zM0 1h1v1h-1zM3 1h1v1h-1zM6 1h1v1h-1zM0 2h1v1h-1zM6 2h1v1h-1zM0 3h1v1h-1zM6 3h1v1h-1zM1 4h1v1h-1zM5 4h1v1h-1zM2 5h1v1h-1zM4 5h1v1h-1zM3 6h1v1h-1z'/><path fill='%23f0795a' d='M1 1h1v1h-1zM4 1h1v1h-1z'/><path fill='%23d83a2f' d='M2 1h1v1h-1zM5 1h1v1h-1zM1 2h5v1h-5zM1 3h5v1h-5zM2 4h3v1h-3zM3 5h1v1h-1z'/></svg>"); }
.px-heart::after { content: ''; position: absolute; inset: 0; image-rendering: pixelated; background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 84 7' shape-rendering='crispEdges'><path fill='%23ffffff' d='M1 1h1v1h-1z'/><path fill='%23ffffff' d='M8 1h1v1h-1z'/><path fill='%23f0795a' d='M9 2h1v1h-1z'/><path fill='%23ffffff' d='M15 1h1v1h-1z'/></svg>") 0 0 / 1200% 100% no-repeat; animation: fr-heart 3.6s steps(12) var(--d, 0s) infinite; }
@keyframes fr-heart { to { background-position-x: 109.0909%; } }
.px-star { --w: 9; --h: 9; background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 9' shape-rendering='crispEdges'><path fill='%23c07a22' d='M4 0h1v1h-1zM3 1h1v1h-1zM5 1h1v1h-1zM0 2h4v1h-4zM5 2h4v1h-4zM0 3h1v1h-1zM8 3h1v1h-1zM1 4h1v1h-1zM7 4h1v1h-1zM2 5h1v1h-1zM6 5h1v1h-1zM1 6h1v1h-1zM4 6h1v1h-1zM7 6h1v1h-1zM1 7h1v1h-1zM3 7h1v1h-1zM5 7h1v1h-1zM7 7h1v1h-1zM1 8h2v1h-2zM6 8h2v1h-2z'/><path fill='%23ffd98a' d='M4 1h1v1h-1zM4 2h1v1h-1zM1 3h4v1h-4zM2 4h3v1h-3zM3 5h1v1h-1zM2 6h1v1h-1z'/><path fill='%23f0a23e' d='M5 3h3v1h-3zM5 4h2v1h-2zM4 5h2v1h-2zM3 6h1v1h-1zM5 6h2v1h-2zM2 7h1v1h-1zM6 7h1v1h-1z'/></svg>"); }
.px-star::after { content: ''; position: absolute; inset: 0; image-rendering: pixelated; background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 198 9' shape-rendering='crispEdges'><path fill='%23ffffff' d='M4 1h1v1h-1zM1 3h2v1h-2z'/><path fill='%23ffffff' d='M13 1h1v1h-1zM13 2h1v1h-1zM11 3h2v1h-2zM11 4h1v1h-1z'/><path fill='%23ffffff' d='M22 2h1v1h-1zM21 3h2v1h-2zM20 4h2v1h-2z'/><path fill='%23ffffff' d='M31 3h2v1h-2zM30 4h2v1h-2zM30 5h1v1h-1zM29 6h1v1h-1z'/><path fill='%23ffffff' d='M41 3h2v1h-2zM40 4h2v1h-2zM39 5h2v1h-2zM38 6h2v1h-2zM38 7h1v1h-1z'/><path fill='%23ffffff' d='M51 3h2v1h-2zM50 4h2v1h-2zM49 5h2v1h-2zM48 6h1v1h-1zM47 7h1v1h-1z'/><path fill='%23ffffff' d='M61 3h1v1h-1zM60 4h1v1h-1zM59 5h1v1h-1zM59 6h1v1h-1z'/><path fill='%23ffffff' d='M68 6h2v1h-2z'/><path fill='%23ffffff' d='M78 6h1v1h-1zM78 7h1v1h-1z'/><path fill='%23ffffff' d='M87 7h1v1h-1z'/></svg>") 0 0 / 2200% 100% no-repeat; animation: fr-star 4.2s steps(22) var(--d, 0s) infinite; }
@keyframes fr-star { to { background-position-x: 104.7619%; } }
.px-gem { --w: 7; --h: 6; background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 6' shape-rendering='crispEdges'><path fill='%23147068' d='M1 0h5v1h-5zM0 1h1v1h-1zM6 1h1v1h-1zM0 2h1v1h-1zM6 2h1v1h-1zM1 3h1v1h-1zM5 3h1v1h-1zM2 4h1v1h-1zM4 4h1v1h-1zM3 5h1v1h-1z'/><path fill='%235cc2b8' d='M1 1h1v1h-1zM3 1h2v1h-2zM1 2h2v1h-2zM2 3h1v1h-1z'/><path fill='%23ffffff' d='M2 1h1v1h-1z'/><path fill='%231f9b91' d='M5 1h1v1h-1zM3 2h3v1h-3zM3 3h2v1h-2zM3 4h1v1h-1z'/></svg>"); }
.px-gem::after { content: ''; position: absolute; inset: 0; image-rendering: pixelated; background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 112 6' shape-rendering='crispEdges'><path fill='%23ffffff' d='M1 1h2v1h-2zM1 2h1v1h-1z'/><path fill='%23ffffff' d='M9 1h2v1h-2zM8 2h2v1h-2z'/><path fill='%23ffffff' d='M17 1h2v1h-2zM16 2h2v1h-2zM16 3h1v1h-1z'/><path fill='%23ffffff' d='M25 1h2v1h-2zM24 2h2v1h-2zM23 3h2v1h-2z'/><path fill='%23ffffff' d='M33 1h1v1h-1zM32 2h2v1h-2zM31 3h2v1h-2zM31 4h1v1h-1z'/><path fill='%23ffffff' d='M40 2h1v1h-1zM39 3h1v1h-1zM38 4h1v1h-1z'/></svg>") 0 0 / 1600% 100% no-repeat; animation: fr-gem 3.4s steps(16) var(--d, 0s) infinite; }
@keyframes fr-gem { to { background-position-x: 106.6667%; } }
.px-dpad { --w: 7; --h: 7; background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 7' shape-rendering='crispEdges'><path fill='%237d6656' d='M2 0h3v1h-3zM2 1h1v1h-1zM4 1h1v1h-1zM0 2h3v1h-3zM4 2h3v1h-3zM0 3h1v1h-1zM6 3h1v1h-1zM0 4h3v1h-3zM4 4h3v1h-3zM2 5h1v1h-1zM4 5h1v1h-1zM2 6h3v1h-3z'/><path fill='%23a8917f' d='M3 1h1v1h-1zM3 2h1v1h-1zM1 3h5v1h-5zM3 4h1v1h-1zM3 5h1v1h-1z'/></svg>"); }
.px-dpad::after { content: ''; position: absolute; inset: 0; image-rendering: pixelated; background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 7' shape-rendering='crispEdges'><path fill='%23e6d8c8' d='M3 1h1v1h-1zM3 2h1v1h-1z'/><path fill='%23e6d8c8' d='M11 3h2v1h-2z'/><path fill='%23e6d8c8' d='M17 4h1v1h-1zM17 5h1v1h-1z'/><path fill='%23e6d8c8' d='M22 3h2v1h-2z'/></svg>") 0 0 / 800% 100% no-repeat; animation: fr-dpad 3.2s steps(8) var(--d, 0s) infinite; }
@keyframes fr-dpad { to { background-position-x: 114.2857%; } }
.px-cart { --w: 8; --h: 8; background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' shape-rendering='crispEdges'><path fill='%237d6656' d='M0 0h8v1h-8zM0 1h1v1h-1zM7 1h1v1h-1zM0 2h1v1h-1zM7 2h1v1h-1zM0 3h1v1h-1zM7 3h1v1h-1zM0 4h1v1h-1zM7 4h1v1h-1zM0 5h1v1h-1zM7 5h1v1h-1zM0 6h1v1h-1zM2 6h1v1h-1zM4 6h1v1h-1zM6 6h2v1h-2zM1 7h1v1h-1zM3 7h1v1h-1zM5 7h1v1h-1z'/><path fill='%23a8917f' d='M1 1h6v1h-6zM1 2h1v1h-1zM6 2h1v1h-1zM1 3h1v1h-1zM6 3h1v1h-1zM1 4h1v1h-1zM6 4h1v1h-1zM1 5h6v1h-6zM1 6h1v1h-1zM3 6h1v1h-1zM5 6h1v1h-1z'/><path fill='%231f9b91' d='M2 2h4v1h-4zM2 3h1v1h-1zM4 3h2v1h-2zM2 4h4v1h-4z'/><path fill='%235cc2b8' d='M3 3h1v1h-1z'/></svg>"); }
.px-cart::after { content: ''; position: absolute; inset: 0; image-rendering: pixelated; background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 72 8' shape-rendering='crispEdges'><path fill='%235cc2b8' d='M2 2h4v1h-4z'/><path fill='%235cc2b8' d='M10 3h4v1h-4z'/><path fill='%235cc2b8' d='M18 4h4v1h-4z'/></svg>") 0 0 / 900% 100% no-repeat; animation: fr-cart 2.7s steps(9) var(--d, 0s) infinite; }
@keyframes fr-cart { to { background-position-x: 112.5000%; } }
.px-cloud { --w: 16; --h: 7; background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 7' shape-rendering='crispEdges'><path fill='%23efd3a6' d='M5 0h4v1h-4zM3 1h2v1h-2zM9 1h2v1h-2zM2 2h1v1h-1zM11 2h3v1h-3zM0 3h2v1h-2zM14 3h2v1h-2zM0 4h1v1h-1zM15 4h1v1h-1zM1 5h1v1h-1zM14 5h1v1h-1zM2 6h12v1h-12z'/><path fill='%23ffffff' d='M5 1h4v1h-4zM3 2h8v1h-8zM2 3h12v1h-12zM2 4h12v1h-12z'/><path fill='%23f6e6c8' d='M1 4h1v1h-1zM14 4h1v1h-1zM2 5h12v1h-12z'/></svg>"); }
.px-cloud2 { --w: 20; --h: 7; background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 7' shape-rendering='crispEdges'><path fill='%23efd3a6' d='M6 0h4v1h-4zM3 1h3v1h-3zM10 1h2v1h-2zM13 1h3v1h-3zM1 2h2v1h-2zM12 2h1v1h-1zM16 2h2v1h-2zM0 3h1v1h-1zM18 3h1v1h-1zM0 4h1v1h-1zM18 4h1v1h-1zM1 5h1v1h-1zM17 5h1v1h-1zM2 6h15v1h-15z'/><path fill='%23ffffff' d='M6 1h4v1h-4zM3 2h9v1h-9zM13 2h3v1h-3zM1 3h17v1h-17zM2 4h15v1h-15z'/><path fill='%23f6e6c8' d='M1 4h1v1h-1zM17 4h1v1h-1zM2 5h15v1h-15z'/></svg>"); }
.px-spark { --w: 5; --h: 5; background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 5 5' shape-rendering='crispEdges'><path fill='%23ffd98a' d='M2 0h1v1h-1zM2 1h1v1h-1zM0 2h2v1h-2zM3 2h2v1h-2zM2 3h1v1h-1zM2 4h1v1h-1z'/><path fill='%23ffffff' d='M2 2h1v1h-1z'/></svg>"); }
