/**
 * Back-to-top floating button — global (rendered in the footer partial, so it
 * appears on every page). Hidden until the user scrolls down; clicking it
 * smooth-scrolls back to the top.
 */
.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    /* Below the messaging chat (z 50) and notifications (z 60) so an open chat
       window is never obscured, but above ordinary page content. */
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--border-secondary, #e5e7eb);
    background: var(--bg-primary, #ffffff);
    color: var(--text-secondary, #374151);
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16);
    /* Hidden until scrolled; .is-visible (toggled in JS) reveals it. */
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s,
                background 0.2s ease, color 0.2s ease;
}

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

.back-to-top:hover {
    background: #366235;
    color: #ffffff;
    transform: translateY(-2px);
}

.back-to-top:focus-visible {
    outline: 2px solid #366235;
    outline-offset: 2px;
}

.back-to-top svg {
    width: 22px;
    height: 22px;
}

@media (max-width: 768px) {
    .back-to-top {
        right: 16px;
        bottom: 16px;
        width: 44px;
        height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .back-to-top {
        transition: opacity 0.2s ease, visibility 0.2s, background 0.2s ease, color 0.2s ease;
        transform: none;
    }
    .back-to-top.is-visible {
        transform: none;
    }
    .back-to-top:hover {
        transform: none;
    }
}
