.photo-motion {
  position: absolute;
  inset: calc(0px - var(--edge, 0px));
  container-type: size;
  overflow: hidden;
  pointer-events: none;
  /* Fade the last few pixels into the photographic seams. */
  mask-image: linear-gradient(to right, transparent, #000 5px, #000 calc(100% - 5px), transparent),
    linear-gradient(to bottom, transparent, #000 5px, #000 calc(100% - 5px), transparent);
  mask-composite: intersect;
}
.motion-source {
  display: block;
  position: absolute;
  left: var(--motion-x, 50%);
  top: var(--motion-y, 50%);
  width: max(100cqw, calc(100cqh * var(--motion-aspect, 1)));
  aspect-ratio: var(--motion-aspect, 1);
  transform: translate(calc(0% - var(--motion-x, 50%)), calc(0% - var(--motion-y, 50%)));
}
.viewer-image .photo-motion { inset: 0; mask-image: none; }
.viewer-image .motion-source { width: min(100cqw, calc(100cqh * var(--motion-aspect, 1))); }
.photo-motion canvas, .photo-motion i { display: block; position: absolute; pointer-events: none; }
.motion-balloon {
  mask-image: radial-gradient(ellipse closest-side, #000 74%, transparent);
  animation: gallery-balloon-drift 16s ease-in-out infinite;
}
@keyframes gallery-balloon-drift {
  0%, 100% { transform: translate(0,0); }
  32% { transform: translate(4px,-2px); }
  65% { transform: translate(7px,-4px); }
  84% { transform: translate(2px,-2px); }
}
.motion-bubble {
  --rise: clamp(-76px, -17cqh, -19px);
  border-radius: 50%;
  background: radial-gradient(ellipse at 35% 26%, #e4ffff 8%, #b6f5f4 24%, #5e9fa62e 48%, #b4edf2 78%, transparent 95%);
  animation: gallery-bubble-rise var(--time) linear infinite;
}
@keyframes gallery-bubble-rise {
  0% { opacity: 0; transform: translate(0,0) scale(.55); }
  13% { opacity: .72; }
  46% { transform: translate(calc(var(--drift) * .33 - 1px), calc(var(--rise) * .43)) scale(.85); }
  76% { opacity: .62; }
  100% { opacity: 0; transform: translate(var(--drift), var(--rise)) scale(1.18); }
}
.water-mote {
  width: clamp(.75px, .19cqw, 1.8px);
  height: clamp(.75px, .19cqw, 1.8px);
  border-radius: 50%;
  background: #d6f3e7;
  animation: underwater-current 7s linear infinite;
}
@keyframes underwater-current {
  0%, 100% { opacity: 0; }
  20%, 72% { opacity: .34; }
  0% { transform: translate(0, 0); }
  100% { transform: translate(4.7cqw, -2.2cqh); }
}
.photo-motion:not(.is-running) :is(.motion-balloon,.motion-bubble,.water-mote) { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .photo-motion { display: none; } }
