.motion-toggle {
  background: none;
  border: 0;
  align-self: start;
  padding: 0;
  color: var(--muted);
  font: inherit;
  text-align: left;
}

.motion-toggle:hover,
.motion-toggle[aria-pressed="true"] {
  color: var(--accent);
}

.bug {
  position: fixed;
  top: 0;
  left: 0;
  width: 69px;
  height: 90px;
  z-index: 40;
  pointer-events: none;
  will-change: transform, opacity;
  background: transparent url("../images/spider-sprite.png") 0 0 no-repeat;
  transform-origin: 50% 20%;
  filter: drop-shadow(0 0 3px #b7ad8875);
  animation: spider-walk 0.72s steps(7) infinite;
}

.bug::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 84%;
  width: 1px;
  height: 28px;
  background: linear-gradient(180deg, #fff3, #fff0);
  transform: translateX(-50%);
  opacity: 0.55;
}

.bug.is-falling {
  opacity: 0.25;
  transition:
    transform 1.4s cubic-bezier(0.18, 0.78, 0.22, 1),
    opacity 1.4s ease-in;
  animation: none;
}

.bug.is-falling::before {
  opacity: 0.14;
}

.motion-paused .bug {
  display: none;
}

@keyframes spider-walk {
  from {
    background-position: 0 0;
  }
  to {
    background-position: -483px 0;
  }
}

@media (hover: hover) and (pointer: fine) and (min-width: 701px) {
  .bug:not(.is-falling) {
    pointer-events: auto;
    cursor: pointer;
  }
}

@media (max-width: 600px) {
  .motion-toggle {
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bug,
  .motion-toggle {
    display: none;
  }
}
