/**
 * SD Back to Top Button Styles
 * BEM methodology with sd- prefix
 */

.sd-back-to-top {
    position: fixed;
    bottom: 125px;
    right: 0;
    width: 40px;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.4);
    border: none;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transform: translateY(20px);
}

.sd-back-to-top--visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.sd-back-to-top:hover {
    background-color: #5f7d3a;
    transform: translateY(-3px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.sd-back-to-top:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sd-back-to-top__icon {
    width: 24px;
    height: 24px;
    fill: #ffffff;
    transition: transform 0.2s ease;
}

.sd-back-to-top:hover .sd-back-to-top__icon {
    transform: translateY(-2px);
}

/* Accessibility - focus styles */
.sd-back-to-top:focus {
    outline: 2px solid #4a90e2;
    outline-offset: 2px;
}

.sd-back-to-top:focus:not(:focus-visible) {
    outline: none;
}

/* Print styles - hide on print */
@media print {
    .sd-back-to-top {
        display: none !important;
    }
}

/* Design pass 2026-09-27: a round brand button inset from the edge, not a grey
   tab flush against it. */
.sd-back-to-top {
    right: 1rem;
    bottom: max(1.5rem, env(safe-area-inset-bottom));
    width: 44px;
    height: 44px;
    background-color: var(--sd-color-primary-dark, #36452f);
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.sd-back-to-top:hover {
    background-color: var(--sd-color-cta, #5f7d3a);
}

.sd-back-to-top__icon {
    width: 22px;
    height: 22px;
}

/* Cookie-settings badge (Webtoffee, bottom-left): smaller on phones so it
   stops covering hero buttons. */
@media (max-width: 767px) {
    .sd-back-to-top {
        right: 0.75rem;
        bottom: max(1rem, env(safe-area-inset-bottom));
        width: 40px;
        height: 40px;
    }

    .wcc-btn-revisit-wrapper {
        width: 40px !important;
        height: 40px !important;
        left: 0.75rem !important;
        bottom: max(1rem, env(safe-area-inset-bottom)) !important;
    }

    .wcc-btn-revisit-wrapper img {
        width: 24px !important;
        height: 24px !important;
    }
}

/* Both float above the service pages' section bar while it shows. */
body:has(.sp-pagenav.is-visible) .sd-back-to-top,
body:has(.sp-pagenav.is-visible) .wcc-btn-revisit-wrapper {
    bottom: calc(max(1rem, env(safe-area-inset-bottom)) + 68px) !important;
}
