.community-residents {
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
}

.community-resident {
  position: absolute;
  top: var(--resident-from-y);
  left: var(--resident-from-x);
  display: block;
  width: max(.625rem, calc(var(--resident-width-ratio, .0115) * min(100%, 92rem)));
  padding: 0;
  border: 0;
  border-radius: .2rem;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  transform: translate(-50%, -100%);
  animation: resident-stroll var(--resident-duration) ease-in-out var(--resident-phase) infinite;
}

.community-resident[hidden] { display: none; }

.community-resident::before {
  position: absolute;
  z-index: -1;
  inset: auto 10% 0;
  height: .22rem;
  border-radius: 50%;
  background: #132a3fc9;
  filter: blur(.09rem);
  content: "";
}

.community-resident::after {
  position: absolute;
  inset: -.17rem -.25rem -.15rem;
  content: "";
}

.community-resident[data-venue="pool"]::after { inset-inline: -.08rem; }

.community-resident img {
  display: block;
  width: 100%;
  height: auto;
  scale: var(--resident-facing, 1) 1;
  filter: drop-shadow(.065rem .1rem .12rem #102a43cf);
  pointer-events: none;
  animation: resident-turn var(--resident-duration) step-end var(--resident-phase) infinite,
    resident-step .58s ease-in-out var(--resident-phase) infinite;
}

.community-resident-name {
  position: absolute;
  bottom: 100%;
  left: 50%;
  padding: .06rem .25rem;
  border: 1px solid #dce6d584;
  border-radius: .22rem;
  background: #173f49ec;
  color: #fff9e9;
  font-size: .61rem;
  font-weight: 700;
  line-height: 1.25;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -.12rem);
  white-space: nowrap;
}

.community-resident:is(:hover, :focus-visible) { z-index: 2; }
.community-resident:is(:hover, :focus-visible),
.community-resident:is(:hover, :focus-visible) img { animation-play-state: paused; }
.community-resident:is(:hover, :focus-visible) .community-resident-name { opacity: 1; }
.community-resident:focus-visible { outline: 2px solid #ffe9b8; outline-offset: 3px; }

@keyframes resident-stroll {
  0%, 12%, 100% { left: var(--resident-from-x); top: var(--resident-from-y); }
  50%, 62% { left: var(--resident-to-x); top: var(--resident-to-y); }
}

@keyframes resident-turn {
  0%, 100% { scale: var(--resident-facing, 1) 1; }
  50% { scale: calc(-1 * var(--resident-facing, 1)) 1; }
}

@keyframes resident-step {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-.085rem); }
}

@media (prefers-reduced-motion: reduce) {
  .community-resident,
  .community-resident img { animation: none; }
}
