:root{
    --footer-bubbles-height: 15rem;
}

.footer-bubbles{
    position: relative;
    width: 100%;
    max-width: 100%;
    z-index: 1;
}

.footer-bubbles::after{
    content: '';
    display: block;
    position: absolute;
    bottom: -0.1rem;
    left: 0;
    width: 100%;
    height: 1rem;
    background-color: var(--background-color);
    background-repeat: repeat;
    background-position: center;
    background-size: 17.8rem auto;
}

.footer-bubbles[data-color-scheme="dark"]::after{
    background-image: url('img/footer-bg.png');
}   

.footer-bubbles-container{
    position: absolute;
    bottom: 100%;
    width: 100%;
    height: var(--footer-bubbles-height);
    overflow: hidden;
    background: transparent;
    --border-radius: 2rem;
}

.footer-bubbles-container::before,
.footer-bubbles-container::after{
    content: '';
    display: block;
    width: calc(var(--border-radius) * 2);
    height: var(--border-radius);
    position: absolute;
    bottom: 0.9rem;
    background: transparent;
    pointer-events: none;
}

.footer-bubbles-container::before{
    left: 0;
    border-radius: 0 0 0 var(--border-radius);
    box-shadow: calc(var(--border-radius) * -1) 0 0 0 var(--background-color);
}

.footer-bubbles-container::after{
    right: 0;
    border-radius: 0 0 var(--border-radius) 0;
    box-shadow: var(--border-radius) 0 0 0 var(--background-color);
}

.footer-bubbles-inner {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1rem;
    background-color: var(--background-color);
    background-repeat: repeat;
    background-position: center;
    background-size: 17.8rem auto;
}

.footer-bubbles[data-color-scheme="dark"] .footer-bubbles-inner{
    background-image: url('img/footer-bg.png');
}

.footer-bubbles-bubble {
    position: absolute;
    left: var(--position, 50%);
    background-color: var(--background-color);
    background-repeat: repeat;
    background-position: center;
    background-size: 17.8rem auto;
    border-radius: 100%;
    animation: bubble-size var(--time, 8s) ease-in infinite var(--delay, 0s), bubble-move var(--time, 8s) ease-in infinite var(--delay, 0s);
    transform: translate(-50%, 100%);
}

.footer-bubbles[data-color-scheme="dark"] .footer-bubbles-bubble{
    background-image: url('img/footer-bg.png');
}

.footer-bubbles svg{
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    pointer-events: none;
}

main .footer-bubbles ~ .footer-bubbles[data-hide="1"] .footer-bubbles-container,
main .footer-bubbles ~ .footer-bubbles[data-hide="1"]::after,
main .section-background:has(.footer-bubbles) ~ .footer-bubbles[data-hide="1"] .footer-bubbles-container,
main .section-background:has(.footer-bubbles) ~ .footer-bubbles[data-hide="1"]::after,
main .section-background:has(.footer-bubbles) ~ .section-background .footer-bubbles[data-hide="1"] .footer-bubbles-container,
main .section-background:has(.footer-bubbles) ~ .section-background .footer-bubbles[data-hide="1"]::after,
main:has(.footer-bubbles) + .footer-bubbles[data-hide="1"] .footer-bubbles-container,
main:has(.footer-bubbles) + .footer-bubbles[data-hide="1"]::after{
    display: none;
}

main:has(.footer-bubbles) + .footer-bubbles[data-hide="1"]{
    border-bottom: 0.1rem solid;
}

main:has(+ .footer-bubbles) > .blocks-container > *:not(.section-background):last-child,
main > .blocks-container > *:has( + .footer-bubbles){
    margin-bottom: calc(var(--block-margin) + var(--footer-bubbles-height));
}

main > .blocks-container > .section-background:has( + .footer-bubbles){
    margin-bottom: 0;
}

main > .blocks-container > .section-background:has( + .footer-bubbles),
main:not(:has(.footer-bubbles)):has(+ .footer-bubbles) > .blocks-container > .section-background:last-child,
main:has(+ .footer-bubbles:not([data-hide="1"])) > .blocks-container > .section-background:last-child{
    padding-bottom: calc(var(--block-margin) + var(--footer-bubbles-height));
}

@media (min-width: 768px){
    .footer-bubbles-container{
        --border-radius: 4rem;
    }
}

@keyframes bubble-size {
    0%, 75% {
        width: var(--size, 2.5rem);
        height: var(--size, 2.5rem);
    }
    100% {
        width: 0rem;
        height: 0rem;
    }
}

@keyframes bubble-move {
    0% {
        bottom: -2.5rem;
    }
    100% {
        bottom: var(--distance, 6.25rem);
    }
}