/* the pieces of a scene that move (scene-motion.js): over the bare surface and under the envelope, or over the invitation */
.sm { position: absolute; inset: 0; pointer-events: none; }
.sm--back { z-index: 0; }
/* the surface carried on beyond the picture, under it, out to the edges of the screen */
.sm-ground { position: absolute; z-index: -1; max-width: none; pointer-events: none; user-select: none; }
.sm-ground[hidden] { display: none; }
/* the surface goes on, so the picture's edges no longer fade into a blurred backdrop */
.room.room--ground .room__photo, .room.room--ground .room__fg { -webkit-mask-image: none; mask-image: none; }
.sm--front { z-index: 2; }
.sm__part {
  position: absolute; display: block; max-width: none; user-select: none;
  animation: var(--d, 10s) cubic-bezier(.45, 0, .55, 1) var(--delay, 0s) infinite alternate both;
  animation-play-state: paused;
}
.sm__part[data-kind="sway"] { animation-name: sm-sway; }
.sm__part[data-kind="ripple"] { animation-name: sm-ripple; }
.sm__part[data-kind="bob"] { animation-name: sm-bob; }
.sm__part[data-kind="drift"] { animation-name: sm-drift; }
.sm__part[data-still] { animation: none; }

/* with a mouse the scene follows it a little (scene-motion.js sets --sm-x and --sm-y, -1 to 1): the nearer, the more */
.sm--back { translate: calc(var(--sm-x, 0) * 5px) calc(var(--sm-y, 0) * 3px); }
.room .card, .room #roomEnv { translate: calc(var(--sm-x, 0) * 10px) calc(var(--sm-y, 0) * 7px); }
.sm--front, .room #roomFg { translate: calc(var(--sm-x, 0) * 16px) calc(var(--sm-y, 0) * 12px); }

/* it moves only while the invitation is open, and rests while the tab is hidden */
.guest[data-state="open"] .sm__part { animation-play-state: running; }
.guest[data-state="open"] .sm__part[data-kind]:not([data-still]) { will-change: transform; }
.guest[data-state="open"] .sm-asleep .sm__part { animation-play-state: paused; }

/* a sprig or a leaf sways round the end of its stem */
@keyframes sm-sway {
  from { transform: rotate(calc(var(--a) * -1)); }
  to   { transform: rotate(var(--a)); }
}
/* a ribbon turns a little round its far end and its curls stretch and ease */
@keyframes sm-ripple {
  from { transform: rotate(calc(var(--a) * -1)) skewX(-1deg) scale(1, .99); }
  to   { transform: rotate(var(--a)) skewX(1deg) scale(1, 1.01); }
}
/* a balloon lifts a touch, turns a little and swells */
@keyframes sm-bob {
  from { transform: translate(0, 0) rotate(calc(var(--a) * -.5)) scale(1); }
  to   { transform: translate(var(--tx), var(--ty)) rotate(var(--a)) scale(1.015); }
}
/* a petal drifts a little way and turns */
@keyframes sm-drift {
  from { transform: translate(calc(var(--tx) * -1), 0) rotate(calc(var(--a) * -1)); }
  to   { transform: translate(var(--tx), var(--ty)) rotate(var(--a)); }
}

@media (prefers-reduced-motion: reduce) {
  .sm__part, .sm__part[data-kind], .guest[data-state="open"] .sm__part[data-kind]:not([data-still]) { animation: none; will-change: auto; }
}
