/* v4: no forced logo sizing; keep theme defaults */

/* Иконка переключателя */
#gdt-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.gdt-label { display: none !important; }

/* ── Scroll-to-top: вертикальная зона на всю высоту ─────────── */
#gdt-scroll-top {
    display: none;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 48px;
    height: 100vh;
    border: none;
    cursor: pointer;
    background: transparent;
    color: #9aa0a8;
    opacity: 0;
    transition: opacity 0.25s ease, background 0.2s ease, color 0.2s ease;
    z-index: 100;
    padding: 0;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}

#gdt-scroll-top svg {
    display: block;
    flex-shrink: 0;
    pointer-events: none;
    position: relative;
    z-index: 1;
}

/* Desktop only */
@media (min-width: 1024px) {
    #gdt-scroll-top {
        display: flex;
    }
}

/* Visible (class added by JS on scroll) */
#gdt-scroll-top.gdt-scroll-top--visible {
    opacity: 1;
    pointer-events: auto;
}

/* Hover — полупрозрачная полоса на весь бок */
#gdt-scroll-top:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    color: #5a6370 !important;
}

/* Dark mode */
.gdt-dark #gdt-scroll-top {
    color: #6b7480;
}
.gdt-dark #gdt-scroll-top:hover {
    background: rgba(255, 255, 255, 0.07) !important;
    color: #b3bcc9 !important;
}

/* On mobile the buttons keep their original independent placement. */
.gdt-quick-actions-anchor,
.gdt-quick-actions {
    display: contents;
}

@media (min-width: 1096px) {
    .site-content > .gdt-quick-actions-anchor {
        display: block;
        position: sticky;
        top: 100vh;
        z-index: 100;
        height: 0;
    }

    :where(.site-content) .gdt-quick-actions {
        --gdt-rail-ink: #626c7b;
        --gdt-rail-edge: rgba(52, 64, 86, 0.045);
        display: block;
        position: absolute;
        /* The site container is centered. Align the rail to the viewport gutter. */
        left: calc(50% - 50vw);
        bottom: 0;
        width: 54px;
        height: 100vh;
        pointer-events: none;
    }

    .gdt-dark :where(.site-content) .gdt-quick-actions {
        --gdt-rail-ink: #a2acbc;
        --gdt-rail-edge: rgba(255, 255, 255, 0.045);
    }

    :where(.site-content) .gdt-quick-actions :is(#gdt-toggle, #gdt-scroll-top) {
        position: absolute;
        inset: auto 0 0;
        width: 100%;
        border: 0 !important;
        border-radius: 0;
        background: transparent !important;
        color: var(--gdt-rail-ink) !important;
        box-shadow: none;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        transform: none;
        transition: opacity 150ms ease, background-color 150ms ease;
    }

    :where(.site-content) .gdt-quick-actions #gdt-toggle {
        height: 20%;
        opacity: 1;
        pointer-events: auto;
    }

    :where(.site-content) .gdt-quick-actions #gdt-toggle:active::after {
        content: none;
    }

    :where(.site-content) .gdt-quick-actions #gdt-scroll-top {
        top: 0;
        bottom: auto;
        height: 80%;
        visibility: hidden;
    }

    :where(.site-content) .gdt-quick-actions #gdt-scroll-top.gdt-scroll-top--visible {
        visibility: visible;
    }

    :where(.site-content) .gdt-quick-actions :is(#gdt-icon, #gdt-scroll-top svg) {
        position: absolute;
        left: 21px;
        width: 18px;
        height: 18px;
        pointer-events: none;
    }

    :where(.site-content) .gdt-quick-actions #gdt-scroll-top svg {
        bottom: 13px;
    }

    :where(.site-content) .gdt-quick-actions #gdt-icon {
        bottom: clamp(6px, 10vh - 9px, 37px);
    }

    :where(.site-content) .gdt-quick-actions #gdt-icon svg {
        width: 18px;
        height: 18px;
    }

    :where(.site-content) .gdt-quick-actions :is(#gdt-toggle, #gdt-scroll-top):is(:hover, :focus-visible) {
        background-color: var(--gdt-rail-edge) !important;
        color: var(--gdt-rail-ink) !important;
    }

    :where(.site-content) .gdt-quick-actions #gdt-toggle:focus-visible #gdt-icon,
    :where(.site-content) .gdt-quick-actions #gdt-scroll-top:focus-visible svg {
        outline: 2px solid currentColor;
        outline-offset: 4px;
        border-radius: 50%;
    }

    @media (prefers-reduced-motion: reduce) {
        :where(.site-content) .gdt-quick-actions :is(#gdt-toggle, #gdt-scroll-top) {
            transition: none;
        }
    }
}
