/* Ambient motion: a slow shaft of window light, a few drifting wool motes, and loose bits that sway.
   Everything animates transform / opacity (or the individual `rotate` / `translate` properties, so the inline
   transforms the game sets are never touched), sits behind the screen's content, and never takes a tap. js/ambient.js */
#ambient { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
#screen { z-index: 1; }

#ambient .amb-light {
  position: absolute; left: -30%; top: -20%; width: 90%; height: 80%; border-radius: 50%; opacity: .55;
  background: radial-gradient(closest-side, rgba(255, 236, 190, .34), rgba(255, 236, 190, .12) 55%, rgba(255, 236, 190, 0));
  animation: ambLight 48s ease-in-out infinite alternate;
}
#ambient .amb-light.b {
  left: auto; right: -40%; top: 30%; width: 80%; height: 70%; opacity: .4; animation-duration: 62s; animation-delay: -20s;
}
@keyframes ambLight {
  from { transform: translate3d(0, 0, 0) scale(1); opacity: .25; }
  50%  { opacity: .6; }
  to   { transform: translate3d(45%, 22%, 0) scale(1.15); opacity: .3; }
}

#ambient .amb-mote {
  position: absolute; left: var(--x); top: 0; width: var(--s); height: auto; opacity: 0;
  animation: ambDrift var(--d) linear var(--dl) infinite, ambSpin var(--d) ease-in-out var(--dl) infinite alternate;
}
@keyframes ambDrift {
  0%   { translate: 0 108vh; opacity: 0; }
  12%  { opacity: var(--o); }
  30%  { translate: 18px 74vh; }
  55%  { translate: -10px 42vh; }
  80%  { translate: 14px 12vh; opacity: var(--o); }
  100% { translate: 4px -10vh; opacity: 0; }
}
@keyframes ambSpin { from { rotate: -35deg; } to { rotate: 40deg; } }

/* loose bits on the furniture: the title's laurels and the bag's hanging leather tab */
.wm .laurel, .brand .laurel, .tagrow .laurel { transform-origin: 50% 90%; animation: ambSwayA 7s ease-in-out infinite alternate; }
.wm .laurel:last-child, .brand .laurel:last-child, .tagrow .laurel:last-child { animation-name: ambSwayB; animation-delay: -3s; }
@keyframes ambSwayA { from { rotate: -1.6deg; } to { rotate: 1.6deg; } }
@keyframes ambSwayB { from { rotate: 1.4deg; } to { rotate: -1.8deg; } }
svg image[href*="trim/ring-tab"] { transform-box: fill-box; transform-origin: 50% 6%; animation: ambDangle 5.5s ease-in-out infinite alternate; }
@keyframes ambDangle { from { rotate: -2.6deg; } to { rotate: 2.6deg; } }

#ambient.paused *, html.amb-paused .laurel, html.amb-paused svg image[href*="trim/ring-tab"] { animation-play-state: paused; }

@media (prefers-reduced-motion: reduce) {
  #ambient { display: none; }
  .laurel, svg image[href*="trim/ring-tab"] { animation: none; }
}
