/* Little birds, dogs and deer for Little Outings Australia.
   Only when <html> has both motion and critters.
   Remove the critters class to keep the current motion look without animals.
   Each sprite has a right-facing (-r) and left-facing (-l) file.
   Travel uses translateX on .critter only, so it never overrides facing. */

html.motion.critters .critters-layer {
  display: block;
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.critter {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
  pointer-events: none;
}

/* Two-frame wing flap for the illustrated birds. */
.flap-sheet {
  display: block;
  background-repeat: no-repeat;
  image-rendering: auto;
  width: 40px;
  height: 29px;
}
.flap-teal-r {
  background-image: url('images/bird-teal-r.webp');
  background-size: 80px 29px;
  animation: flap-teal-r 0.38s steps(2) infinite;
}
.flap-teal-l {
  background-image: url('images/bird-teal-l.webp');
  background-size: 80px 29px;
  animation: flap-teal-l 0.38s steps(2) infinite;
}
.flap-sage-r {
  background-image: url('images/bird-sage-r.webp');
  background-size: 80px 29px;
  animation: flap-sage-r 0.38s steps(2) infinite;
}
.flap-sage-l {
  background-image: url('images/bird-sage-l.webp');
  background-size: 80px 29px;
  animation: flap-sage-l 0.38s steps(2) infinite;
}
@keyframes flap-teal-r { to { background-position: -80px 0; } }
@keyframes flap-teal-l { to { background-position: -80px 0; } }
@keyframes flap-sage-r { to { background-position: -80px 0; } }
@keyframes flap-sage-l { to { background-position: -80px 0; } }

/* Four-frame run cycle for the illustrated dogs. */
.trot-sheet, .run-sheet {
  display: block;
  background-repeat: no-repeat;
  image-rendering: auto;
}
.trot-fluffy-r, .trot-fluffy-l {
  width: 56px;
  height: 48px;
  background-size: 224px 48px;
}
.trot-fluffy-r {
  background-image: url('images/dog-fluffy-r.webp');
  animation: trot-fluffy-r 0.48s steps(4) infinite;
}
.trot-fluffy-l {
  background-image: url('images/dog-fluffy-l.webp');
  animation: trot-fluffy-l 0.48s steps(4) infinite;
}
.trot-beagle-r, .trot-beagle-l {
  width: 56px;
  height: 41px;
  background-size: 224px 41px;
}
.trot-beagle-r {
  background-image: url('images/dog-beagle-r.webp');
  animation: trot-beagle-r 0.50s steps(4) infinite;
}
.trot-beagle-l {
  background-image: url('images/dog-beagle-l.webp');
  animation: trot-beagle-l 0.50s steps(4) infinite;
}
@keyframes trot-fluffy-r { to { background-position: -224px 0; } }
@keyframes trot-fluffy-l { to { background-position: -224px 0; } }
@keyframes trot-beagle-r { to { background-position: -224px 0; } }
@keyframes trot-beagle-l { to { background-position: -224px 0; } }

/* Four-frame run cycle for deer and ground reindeer. */
.run-deer-r, .run-deer-l, .run-reindeer-r, .run-reindeer-l {
  width: 52px;
  height: 60px;
  background-size: 208px 60px;
}
.run-deer-r {
  background-image: url('images/deer-r.webp');
  animation: run-deer-r 0.50s steps(4) infinite;
}
.run-deer-l {
  background-image: url('images/deer-l.webp');
  animation: run-deer-l 0.50s steps(4) infinite;
}
.run-reindeer-r {
  background-image: url('images/reindeer-r.webp');
  animation: run-reindeer-r 0.46s steps(4) infinite;
}
.run-reindeer-l {
  background-image: url('images/reindeer-l.webp');
  animation: run-reindeer-l 0.46s steps(4) infinite;
}
@keyframes run-deer-r { to { background-position: -208px 0; } }
@keyframes run-deer-l { to { background-position: -208px 0; } }
@keyframes run-reindeer-r { to { background-position: -208px 0; } }
@keyframes run-reindeer-l { to { background-position: -208px 0; } }

/* Santa and sleigh: a soft flying bob. Left-facing uses the opposite tilt. */
.sleigh-img {
  display: block;
  width: 192px;
  height: 91px;
}
.sleigh-bob {
  animation: sleigh-fly-right 1.4s ease-in-out infinite;
}
.sleigh-bob-left {
  animation-name: sleigh-fly-left;
}
@keyframes sleigh-fly-right {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-8px) rotate(1deg); }
}
@keyframes sleigh-fly-left {
  0%, 100% { transform: translateY(0) rotate(1.5deg); }
  50% { transform: translateY(-8px) rotate(-1deg); }
}

@media (min-width: 700px) {
  .sleigh-img { width: 200px; height: 95px; }
}

@media (prefers-reduced-motion: reduce) {
  html.motion.critters .critters-layer { display: none; }
  .flap-sheet, .trot-sheet, .run-sheet, .sleigh-bob { animation: none !important; }
}
