/* 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;
}

@supports selector(:has(*)) {
    @media (min-width: 1096px) {
        .site-content > .gdt-quick-actions-anchor {
            --gdt-tray-container-width: 1000px;
            --gdt-tray-button: 46px;
            /* Tighten the gap as the left gutter gets narrower. */
            --gdt-tray-gap: clamp(3px, calc((100vw - var(--gdt-tray-container-width)) / 2 - 45px), 30px);
            display: block;
            position: sticky;
            top: 50vh;
            z-index: 100;
            width: 0;
            height: 0;
        }

        @media (min-width: 1200px) {
            .site-content > .gdt-quick-actions-anchor {
                --gdt-tray-container-width: var(--gk-site-max-width, 1120px);
            }
        }

        :where(.site-content) .gdt-quick-actions {
            --gdt-tray-background: rgba(255, 255, 255, 0.92);
            --gdt-tray-glass: rgba(255, 255, 255, 0.52);
            --gdt-tray-border: rgba(44, 52, 74, 0.13);
            --gdt-tray-highlight: rgba(255, 255, 255, 0.85);
            --gdt-tray-ink: #343b4a;
            --gdt-tray-hover: rgba(52, 61, 86, 0.09);
            display: block;
            position: absolute;
            right: var(--gdt-tray-gap);
            bottom: calc(var(--gdt-tray-button) / -2);
            box-sizing: border-box;
            width: var(--gdt-tray-button);
            height: var(--gdt-tray-button);
            border: 1px solid var(--gdt-tray-border);
            border-radius: 999px;
            background: var(--gdt-tray-background);
            box-shadow: inset 0 1px 0.5px var(--gdt-tray-highlight),
                        2px 2px 10px rgba(14, 18, 31, 0.08);
            overflow: hidden;
            transition: height 260ms cubic-bezier(0.2, 0.7, 0.3, 1);
        }

        .gdt-dark :where(.site-content) .gdt-quick-actions {
            --gdt-tray-background: rgba(22, 22, 26, 0.94);
            --gdt-tray-glass: rgba(22, 22, 26, 0.52);
            --gdt-tray-border: rgba(255, 255, 255, 0.20);
            --gdt-tray-highlight: rgba(255, 255, 255, 0.28);
            --gdt-tray-ink: #e9edf5;
            --gdt-tray-hover: rgba(255, 255, 255, 0.10);
        }

        @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
            :where(.site-content) .gdt-quick-actions {
                background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.02) 40%),
                            var(--gdt-tray-glass);
                -webkit-backdrop-filter: blur(30px) saturate(190%) brightness(1.05);
                backdrop-filter: blur(30px) saturate(190%) brightness(1.05);
            }
        }

        :where(.site-content) .gdt-quick-actions:has(.gdt-scroll-top--visible) {
            height: calc(2 * var(--gdt-tray-button));
        }

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

        :where(.site-content) .gdt-quick-actions #gdt-toggle {
            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 {
            bottom: calc(var(--gdt-tray-button) - 1px);
            visibility: hidden;
        }

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

        :where(.site-content) .gdt-quick-actions #gdt-scroll-top::after {
            content: "";
            position: absolute;
            bottom: 0;
            inset-inline: 12px;
            border-bottom: 1px solid var(--gdt-tray-border);
        }

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

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

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