.spinner {
    --rocket-ui-spinner-color: var(--rocket-color-primary-100);

    @include size(50px);

    position: relative;
    border-radius: 50%;
    animation: rotate-spinner 1s linear infinite;

    &::before {
        position: absolute;
        box-sizing: border-box;
        border: 2px solid var(--rocket-ui-spinner-color);
        border-radius: 50%;
        animation: clip-spinner 2s linear infinite;
        content: "";
        inset: 0;
    }
}

@keyframes rotate-spinner {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes clip-spinner {
    0% {
        clip-path: polygon(50% 50%, 0 0, 0 0, 0 0, 0 0, 0 0);
    }

    25% {
        clip-path: polygon(50% 50%, 0 0, 100% 0, 100% 0, 100% 0, 100% 0);
    }

    50% {
        clip-path: polygon(50% 50%, 0 0, 100% 0, 100% 100%, 100% 100%, 100% 100%);
    }

    75% {
        clip-path: polygon(50% 50%, 0 0, 100% 0, 100% 100%, 0 100%, 0 100%);
    }

    100% {
        clip-path: polygon(50% 50%, 0 0, 100% 0, 100% 100%, 0 100%, 0 0);
    }
}
