/**
 * Botão “voltar ao topo” — site institucional (todas as páginas).
 */
.mgi-scroll-top {
    position: fixed;
    right: 1.25rem;
    bottom: calc(6rem + env(safe-area-inset-bottom, 0px));
    z-index: 1040;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    padding: 0;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    color: #fff;
    isolation: isolate;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    -webkit-backdrop-filter: blur(14px) saturate(1.25);
    backdrop-filter: blur(14px) saturate(1.25);
    background:
        linear-gradient(165deg, rgba(255, 255, 255, 0.26) 0%, rgba(255, 255, 255, 0.06) 42%, rgba(0, 0, 0, 0.1) 100%),
        rgba(145, 0, 10, 0.52);
    border: 1px solid rgba(255, 255, 255, 0.32);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.38) inset,
        0 -1px 0 rgba(0, 0, 0, 0.18) inset,
        0 4px 0 rgba(56, 0, 4, 0.55),
        0 8px 20px rgba(90, 0, 6, 0.42);
    transition:
        opacity 0.35s ease,
        transform 0.28s ease,
        visibility 0.35s ease,
        box-shadow 0.28s ease,
        background 0.28s ease,
        border-color 0.28s ease;
}

.mgi-scroll-top.mgi-scroll-top--visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.mgi-scroll-top__icon {
    display: block;
    width: 1.5rem;
    height: 1.5rem;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}

.mgi-scroll-top:hover {
    transform: translateY(-5px);
    background:
        linear-gradient(165deg, rgba(255, 255, 255, 0.32) 0%, rgba(255, 255, 255, 0.1) 42%, rgba(0, 0, 0, 0.06) 100%),
        rgba(145, 0, 10, 0.68);
    border-color: rgba(255, 255, 255, 0.42);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.45) inset,
        0 -1px 0 rgba(0, 0, 0, 0.12) inset,
        0 6px 0 rgba(46, 0, 3, 0.58),
        0 14px 28px rgba(90, 0, 6, 0.48);
}

.mgi-scroll-top:active {
    transform: translateY(-2px);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.28) inset,
        0 2px 0 rgba(56, 0, 4, 0.45) inset,
        0 3px 0 rgba(56, 0, 4, 0.5),
        0 6px 16px rgba(90, 0, 6, 0.38);
}

.mgi-scroll-top:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.55);
    outline-offset: 3px;
}

@media (min-width: 640px) {
    .mgi-scroll-top {
        right: 2rem;
        bottom: 2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mgi-scroll-top {
        transition: opacity 0.2s ease, visibility 0.2s ease;
    }
    .mgi-scroll-top:hover,
    .mgi-scroll-top:active {
        transform: none;
    }
}
