.back-to-top {
    position: fixed;
    right: 20px;
    bottom: 80px;
    z-index: 1002;
    display: none;
    width: 50px;
    height: 50px;
    padding: 0;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--primary, #ca0c16);
    box-shadow: none;
    cursor: pointer;
}

.back-to-top__progress {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
    transform: rotate(-90deg);
}

.back-to-top__track,
.back-to-top__value {
    fill: none;
    stroke-width: 1.5;
}

.back-to-top__track {
    stroke: color-mix(in srgb, currentColor 20%, transparent);
}

.back-to-top__value {
    stroke: currentColor;
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset 80ms linear;
}

.back-to-top.show {
    display: flex;
    animation: back-to-top-enter 0.3s ease;
}

.back-to-top__icon {
    position: relative;
    z-index: 1;
    width: 11px;
    height: 11px;
    margin-top: 5px;
    border-top: 2px solid currentColor;
    border-left: 2px solid currentColor;
    transform: rotate(45deg);
}

:root:not([data-theme="light"]) .back-to-top {
    color: #a00a14;
}

#backToTop.back-to-top[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 50%;
    right: calc(100% + 10px);
    bottom: auto;
    left: auto;
    padding: 6px 9px;
    border-radius: 4px;
    background: var(--tooltip-bg, rgba(32, 32, 32, 0.92));
    color: var(--tooltip-color, #fff);
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
    z-index: 2;
    pointer-events: none;
    transform: translateY(-50%);
}

#backToTop.back-to-top[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    top: 50%;
    right: calc(100% + 4px);
    bottom: auto;
    left: auto;
    border: 4px solid transparent;
    border-left-color: var(--tooltip-bg, rgba(32, 32, 32, 0.92));
    z-index: 2;
    pointer-events: none;
    transform: translateY(-50%);
}

@keyframes back-to-top-enter {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .back-to-top__value {
        transition: none;
    }

    .back-to-top.show {
        animation: none;
    }
}
