.is-busy {
  position: relative;
  pointer-events: none;
  user-select: none;

  &.is-busy-opaque {
    .is-busy_overlay-opaque {
      background-color: color(white);
    }
  }

  .is-busy_overlay { // rb-emit-class-as-json
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    display: flex;
    width: 100%;
    height: 100%;
    background-color: rgba(color(white), 0.7);
    content: '';
    font-size: 1rem;
    opacity: 0;
    transition: opacity 200ms linear;
    align-items: center;
    justify-content: center;

    &.is-busy_overlay-opaque {
      opacity: 1;
      transition: opacity 200ms linear;
    }

    .dot {
      $colors: (
        1: color(primary),
        2: color(primary),
        3: color(primary)
      );

      position: absolute;
      top: 50%;
      width: 0.4em;
      height: 0.4em;
      border-radius: 50%;
      transform: translate(-50%, -50%);
      animation: dotBounce 1.4s ease(out-quad) infinite;

      $num-dots: 3;
      $midpoint: ($num-dots + 1) / 2;
      @for $i from 1 through $num-dots {
        $distance-from-mid: $i - $midpoint;

        &:nth-of-type(#{$i}) {
          $left-val: if($i == $midpoint, 50%, calc(50% + (#{$distance-from-mid} * 0.9em)));

          left: $left-val;
          background-color: map-get($colors, $i);
          animation-delay: 0.5s + ($distance-from-mid * 0.125);
        }
      }
    }
  }

  &.is-busy-inverted {
    .is-busy_overlay {
      background-color: color(primary);

      .dot {
        background-color: color(white);
      }
    }
  }
}

@keyframes dotBounce {
  30% {
    opacity: 0.7;
    transform: translate(-50%, 0%);
  }

  50% {
    opacity: 1;
    transform: translate(-50%, -80%);
  }

  75% {
    transform: translate(-50%, -50%);
  }
}
