/* Global Back to Top button. Colours arrive as --btt-bg / --btt-fg on the element. */
.btt {
    --btt-size: 52px;
    --btt-lift: 0px;
    position: fixed;
    bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px) + var(--btt-lift));
    z-index: 1030; /* above page content, below sticky bars, sheets, lightboxes and the navbar */
    width: var(--btt-size);
    height: var(--btt-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--btt-bg, #2E4220);
    color: var(--btt-fg, #fff);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .22), 0 2px 6px rgba(0, 0, 0, .14);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px) scale(.9);
    transition: opacity .3s ease, transform .3s cubic-bezier(.22, 1, .36, 1), visibility 0s linear .3s,
                bottom .25s ease, box-shadow .25s ease;
}
/* Physical sides on purpose: the admin picks bottom-left or bottom-right. */
.btt--right { right: max(1rem, env(safe-area-inset-right, 0px)); }
.btt--left { left: max(1rem, env(safe-area-inset-left, 0px)); }

.btt.is-visible {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
}
.btt-arrow { position: relative; transition: transform .25s ease; }
.btt-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg); /* progress starts at 12 o'clock */
    pointer-events: none;
}
.btt-ring circle { fill: none; stroke-width: 3; }
.btt-ring-track { stroke: currentColor; opacity: .22; }
.btt-ring-bar {
    stroke: currentColor;
    stroke-linecap: round;
    stroke-dasharray: 144.51; /* 2 * PI * 23 */
    stroke-dashoffset: 144.51;
    transition: stroke-dashoffset .12s linear;
}
@media (hover: hover) and (pointer: fine) {
    .btt.is-visible:hover {
        transform: translateY(-3px);
        box-shadow: 0 12px 28px rgba(0, 0, 0, .28), 0 3px 8px rgba(0, 0, 0, .16);
    }
    .btt:hover .btt-arrow { transform: translateY(-2px); }
}
.btt:active { transform: scale(.94); }
.btt:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--btt-bg, #2E4220), 0 8px 22px rgba(0, 0, 0, .22);
}
@media (max-width: 575.98px) {
    .btt { --btt-size: 48px; bottom: calc(1rem + env(safe-area-inset-bottom, 0px) + var(--btt-lift)); }
}
@media print { .btt { display: none !important; } }
@media (prefers-reduced-motion: reduce) {
    .btt, .btt.is-visible, .btt-arrow, .btt-ring-bar { transition: none !important; }
    .btt, .btt.is-visible:hover, .btt:active { transform: none; }
}
