/* stylelint-disable */
@import "../../settings/includes/colors";

.c-spinner {
  position: relative;

  > svg {
    position: absolute;
  }

  &--s {
    width: 16px;
    height: 16px;
  }

  &--m {
    width: 32px;
    height: 32px;
  }

  &--l {
    width: 64px;
    height: 64px;
  }

  &--xl {
    width: 128px;
    height: 128px;
  }

  &__icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    &--s {
      width: 8px;
      height: 8px;
    }

    &--m {
      width: 16px;
      height: 16px;
    }

    &--l {
      width: 32px;
      height: 32px;
    }

    &--xl {
      width: 64px;
      height: 64px;
    }
  }

  &__circle {
    fill: none;
    transform: rotate(-90deg);
    transform-origin: 50%;
    position: relative;

    &-inner {
      fill: none;
      transform: rotate(-90deg);
      transform-origin: 50%;
      position: relative;

      &--s {
        stroke-width: 2px;
      }

      &--m {
        stroke-width: 4px;
      }

      &--l {
        stroke-width: 8px;
      }

      &--xl {
        stroke-width: 11px;
      }
    }

    &--s {
      stroke-width: 2px;
      animation: spinner-animation-s 3s cubic-bezier(0.42, 0, 0.29, 1) infinite;
      stroke-dashoffset: -(3.14 * 2 * 16px);
      stroke-dasharray: (3.14 * 2 * 16px);
    }

    &--m {
      stroke-width: 4px;
      animation: spinner-animation-m 3s cubic-bezier(0.42, 0, 0.29, 1) infinite;
      stroke-dashoffset: -(3.14 * 2 * 32px);
      stroke-dasharray: (3.14 * 2 * 32px);
    }

    &--l {
      stroke-width: 8px;
      animation: spinner-animation-l 3s cubic-bezier(0.42, 0, 0.29, 1) infinite;
      stroke-dashoffset: -(3.14 * 2 * 64px);
      stroke-dasharray: (3.14 * 2 * 64px);
    }

    &--xl {
      stroke-width: 11px;
      animation: spinner-animation-xl 3s cubic-bezier(0.42, 0, 0.29, 1) infinite;
      stroke-dashoffset: -(3.14 * 2 * 128px);
      stroke-dasharray: (3.14 * 2 * 128px);
    }
  }
}

@keyframes spinner-animation-s {
  0% {
    stroke-dashoffset: (3.14 * 2 * 16px);
  }

  50% {
    stroke-dashoffset: 0;
  }

  100% {
    stroke-dashoffset: -(3.14 * 2 * 16px);
  }
}

@keyframes spinner-animation-m {
  0% {
    stroke-dashoffset: (3.14 * 2 * 32px);
  }

  50% {
    stroke-dashoffset: 0;
  }

  100% {
    stroke-dashoffset: -(3.14 * 2 * 32px);
  }
}

@keyframes spinner-animation-l {
  0% {
    stroke-dashoffset: (3.14 * 2 * 64px);
  }

  50% {
    stroke-dashoffset: 0;
  }

  100% {
    stroke-dashoffset: -(3.14 * 2 * 64px);
  }
}

@keyframes spinner-animation-xl {
  0% {
    stroke-dashoffset: (3.14 * 2 * 128px);
  }

  50% {
    stroke-dashoffset: 0;
  }

  100% {
    stroke-dashoffset: -(3.14 * 2 * 128px);
  }
}
