/* HTML: <div class="swirl"></div> */
:root {
    --animation-speed: 0s; /* Define a variable for animation duration */
}

body, html {
    overflow-x: hidden;
    overflow-y: hidden;
}

body {
    background-color: #000;
    margin: 0;
}

#swirl-container{
    position: relative;
    --top: 0px;
    --left: 0px;
    --radius: 150px;
    height: calc(2 * var(--radius));
    aspect-ratio: 1;
    top: var(--top);
    left: var(--left);
}

#swirl {
    height: 100%;
    width: 100%;
    top: 0;
    left: 0;
    --color1: #75cbd1;
    --color2: #d175cb;
    /* --speed: 0s; */
    --speed: 1s;
    aspect-ratio: 1;
    display: flex;
    position: absolute;
    
}

#swirl-overlay {
    visibility: hidden;
    --top: 0px;
    --left: 0px;
    --radius: 150px;
    height: calc(2 * var(--radius));
    aspect-ratio: 1;
    z-index: 10;
    position: relative;
    top: var(--top);
    left: var(--left);
    background: radial-gradient(50% 50%, #000f 0%, #000a 10%, #0007 30%, #0000 100%);
}

/* https://css-tricks.com/radial-gradient-recipes/ */

@property --rotation {
    syntax: "<angle>";
    inherits: false;
    initial-value: 0deg;
}

@keyframes rotateSwirl {
    0% {
        --rotation: 0deg;
    }
    50% {
        --rotation: 30deg;
    } 
    100% {
        --rotation: 60deg;
    }
}

#swirl:before, #swirl:after {
    content: "";
    flex: 1;
    --gradient1: radial-gradient(50% 50%, var(--color1) 97%, #000 98%, #0000 99%) no-repeat;
    --gradient2: radial-gradient(50% 50%, var(--color2) 97%, #000 98%, #0000 99%) no-repeat;
    --extraRotation: calc(clamp(30deg, var(--rotation), 60deg) - 30deg); /* calculate */
    background: 
        var(--gradient2) calc(var(--radius) * cos(var(--extraRotation))) calc(var(--radius) * sin(var(--extraRotation))),
        var(--gradient1) calc(var(--radius) * cos(var(--rotation) + 0deg)) calc(var(--radius) * sin(var(--rotation) + 0deg)),
        var(--gradient2) calc(var(--radius) * cos(var(--rotation) + 30deg)) calc(var(--radius) * sin(var(--rotation) + 30deg)),
        var(--gradient1) calc(var(--radius) * cos(var(--rotation) + 60deg)) calc(var(--radius) * sin(var(--rotation) + 60deg)),
        var(--gradient2) calc(var(--radius) * cos(var(--rotation) + 90deg)) calc(var(--radius) * sin(var(--rotation) + 90deg)),
        var(--gradient1) calc(var(--radius) * cos(var(--rotation) + 120deg)) calc(var(--radius) * sin(var(--rotation) + 120deg)),
        var(--gradient2) calc(var(--radius) * cos(var(--rotation) + 150deg)) calc(var(--radius) * sin(var(--rotation) + 150deg)),
        var(--gradient1) calc(var(--radius) * cos(var(--rotation) + 180deg)) calc(var(--radius) * sin(var(--rotation) + 180deg)),
        var(--gradient2) calc(var(--radius) * cos(var(--rotation) + 210deg)) calc(var(--radius) * sin(var(--rotation) + 210deg));
        /* var(--gradient1) calc(var(--radius) * cos(var(--rotation) + 240deg)) calc(var(--radius) * sin(var(--rotation) + 240deg)), */
        /* var(--gradient2) calc(var(--radius) * cos(var(--rotation) + 270deg)) calc(var(--radius) * sin(var(--rotation) + 270deg)); */
    background-size: 200%;
    animation: rotateSwirl var(--speed) linear 0s infinite normal;
}

#swirl:after {
     rotate: 180deg;
}