/**
 * Back-to-Top button styles
 *
 * Site-wide floating button injected via wp_footer (see
 * oyb-elementor-widgets.php). Consumes the --oew-* design tokens
 * introduced by 2026-06-19-visual-design-tokens.
 *
 * Visibility is toggled by JS via the .oew-back-to-top--visible class
 * (added when window.scrollY >= 300px). CSS keeps the element non-
 * interactive and out of the a11y tree when hidden.
 */

/* === Hidden state (default) ====================================== */
.oew-back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;

    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    padding: 0;

    background-color: var(--oew-primary, #003556);
    color: var(--oew-background, #FFFFFF);
    box-shadow: 0 2px 8px var(--oew-shadow, rgba(0, 0, 0, 0.08));


    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;

    /* Hidden by default; JS adds .oew-back-to-top--visible at >= 300px */
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    visibility: hidden;

    transition:
        opacity 200ms ease,
        transform 200ms ease,
        box-shadow 200ms ease,
        visibility 0s linear 200ms;  /* delay visibility:hidden so fade is visible */
}

.oew-back-to-top--visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    visibility: visible;
    transition:
        opacity 200ms ease,
        transform 200ms ease,
        box-shadow 200ms ease,
        visibility 0s linear 0s;
}

/* === Icon (filled SVG triangle) =================================== */
.oew-back-to-top__icon {
    display: block;
    width: 22px;
    height: 22px;
    /* fill="currentColor" on the SVG inherits color from the button
       → resolves to --oew-background (white). */
    color: inherit;
    user-select: none;
    -webkit-user-select: none;
}

/* === Hover / focus =============================================== */
.oew-back-to-top:hover {
    box-shadow: 0 4px 12px var(--oew-shadow-hover, rgba(0, 0, 0, 0.12));
}

.oew-back-to-top:focus-visible {
    outline: 2px solid var(--oew-primary, #003556);
    outline-offset: 3px;
    box-shadow: 0 4px 12px var(--oew-shadow-hover, rgba(0, 0, 0, 0.12));
}

/* === Reduced motion ============================================== */
@media (prefers-reduced-motion: reduce) {
    .oew-back-to-top,
    .oew-back-to-top--visible {
        transition: opacity 0s, transform 0s, box-shadow 0s, visibility 0s;
    }
}

/* === Mobile breakpoint (≤ 768px) ================================= */
@media (max-width: 768px) {
    .oew-back-to-top {
        bottom: 16px;
        right: 16px;
        width: 40px;
        height: 40px;
    }

    .oew-back-to-top__icon {
        width: 18px;
        height: 18px;
    }
}
