:root {
    --background-color: #684595;
    --ring-size: 100px;
    --ring-animation-duration: 2s;
    --ring-animation-separation: 0.2s;
    --dot-size: 8px;
    --dot-separation: 15px;
    --wobble-duration: 0.5s;
    --wobble-amplitude: 5px;
    --wobble-animation-direction: 0.2s;
    --transition-delay: 0.4s
}

.container {
    width: 400px;
    height: 400px;
    background: var(--background-color);

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    cursor: pointer;
}

.container-center {
    position: absolute;
    height: var(--ring-size);
    width: var(--ring-size);
}

/* Mic */
.mic {
    position: relative;
    left: 50%;
    bottom: 50%;

    opacity: 1;
    transform: scale(1);
    transform-origin: 0;
    /* https://easings.net/#easeInBack */
    transition: all 0.75s cubic-bezier(0.36, 0, 0.66, -0.56) var(--transition-delay);
}

.container.active .mic {
    opacity: 0;
    transform: scale(0);
    transition-delay: 0s;
}

.mic div {
    position: absolute;
    background-color: white;
}

.mic-base {
    width: 24px;
    height: 4px;
    border-radius: 2px;

    left: -12px;
    bottom: -32px;
}

.mic-stand {
    width: 4px;
    height: 20px;
    border-radius: 2px;

    left: -2px;
    bottom: -32px;
}

.mic-phone {
    width: 24px;
    height: 55px;
    border-radius: 15px;

    left: -12px;
    bottom: -18px;
}

.mic-phone::before {
    content: "";
    position: absolute;
    background-color: var(--background-color);
    width: 6px;
    height: 16px;
    border-radius: 4px;

    left: calc(12px - 3px);
    bottom: 30px;
}

/* Rings */
.rings {
    height: 100%;
    width: 100%;
    color: white;
}

.ring {
    position: absolute;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
    border: 3px solid currentColor;
    border-radius: 50%;
    left: 0%;

    border-color: currentColor transparent transparent transparent;
    /* timing function from https://easings.net/#easeInOutSine */
    animation: ring-rotation var(--ring-animation-duration) cubic-bezier(0.37, 0, 0.63, 1) infinite;
}

.ring:nth-of-type(1) {
    animation-delay: var(--ring-animation-separation)
}

.ring:nth-of-type(2) {
    animation-delay: calc(2 * var(--ring-animation-separation))
}

.ring:nth-of-type(3) {
    animation-delay: calc(3 * var(--ring-animation-separation))
}

.container:not(.active) .ring {
    border-color: currentColor;
    animation: none;
}

@keyframes ring-rotation {
    0% {
      transform: rotate(0deg);
    }
    100% {
      transform: rotate(360deg);
    }
  }

/* Dots */
.dots {
    --centered-position: calc(-1 * var(--dot-size)/2);
    position: relative;
    left: 50%;
    bottom: 50%;

    opacity: 0;
    transform: scale(0);
    transform-origin: 0;
    /* https://easings.net/#easeInBack */
    transition: all 0.75s cubic-bezier(0.36, 0, 0.66, -0.56) 0s;
}

.container.active .dots {
    opacity: 1;
    transform: scale(1);
    transition-delay: var(--transition-delay);
}

.dot {
    position: absolute;
    background: white;
    height: var(--dot-size);
    width: var(--dot-size);
    border-radius: 50%;

    top: var(--centered-position);
    left: var(--centered-position);

    animation: wobble var(--wobble-duration) alternate ease-in-out infinite;
}

.dot:nth-of-type(1) {
    left: calc(var(--centered-position) - var(--dot-separation));
}

.dot:nth-of-type(2) {
    animation-delay: calc(-1 * var(--wobble-animation-direction))
}

.dot:nth-of-type(3) {
    left: calc(var(--centered-position) + var(--dot-separation));
    animation-delay: calc(-2 * var(--wobble-animation-direction))
}

@keyframes wobble {
    from {
        transform: translateY(var(--wobble-amplitude));
    }
    to {
        transform: translateY(calc(-1 * var(--wobble-amplitude)));
    }
}
