/* =========================================================
   GOadvance Custom Header 1.8
   Адаптивное WordPress-меню + Popup Maker.
   ========================================================= */

:root {
    --ga-admin-offset: 0px;
    --ga-header-height: 82px;
    --ga-header-height-scrolled: 64px;
    --ga-header-bg: rgba(5, 5, 8, 0.95);
    --ga-header-border: rgba(255, 255, 255, 0.08);
    --ga-text: #fff;
    --ga-text-muted: rgba(255, 255, 255, 0.78);
    --ga-purple: #6742b7;
    --ga-purple-light: #7b58d2;
    --ga-card: rgba(15, 13, 22, 0.99);
}

body.admin-bar {
    --ga-admin-offset: 32px;
}

body.ga-custom-header-enabled {
    padding-top: var(--ga-header-height) !important;
}

body.ga-custom-header-enabled #Header {
    display: none !important;
}

body.ga-custom-header-enabled #Header_wrapper {
    min-height: 0 !important;
}

body.ga-mobile-menu-open {
    overflow: hidden !important;
    overscroll-behavior: none;
}

.ga-header,
.ga-header * {
    box-sizing: border-box;
}

.ga-header {
    position: fixed;
    top: var(--ga-admin-offset);
    right: 0;
    left: 0;
    z-index: 99990;
    width: 100%;
    height: var(--ga-header-height);
    margin: 0;
    color: var(--ga-text);
    background:
        radial-gradient(circle at 82% -130%, rgba(113, 72, 199, 0.22), transparent 38%),
        var(--ga-header-bg);
    border-bottom: 1px solid var(--ga-header-border);
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.24);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    font-family: Montserrat, Arial, sans-serif;
    transition: height 200ms ease, background-color 200ms ease, box-shadow 200ms ease;
}

.ga-header.ga-header--scrolled {
    height: var(--ga-header-height-scrolled);
    background:
        radial-gradient(circle at 82% -160%, rgba(113, 72, 199, 0.16), transparent 36%),
        rgba(5, 5, 8, 0.985);
    box-shadow: 0 9px 28px rgba(0, 0, 0, 0.34);
}

.ga-header__inner {
    position: relative;
    display: flex;
    align-items: center;
    width: min(calc(100% - 48px), 1720px);
    height: 100%;
    margin: 0 auto;
}

/* Исходный фирменный логотип GOadvance без перерисовки. */
.ga-header__logo {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    margin-right: auto;
    color: #fff !important;
    text-decoration: none !important;
}

.ga-header__logo-image {
    display: block;
    width: 210px;
    max-width: none !important;
    height: auto;
    border: 0;
    object-fit: contain;
    transform: translateZ(0);
    backface-visibility: hidden;
    transition: width 200ms ease;
}

.ga-header--scrolled .ga-header__logo-image {
    width: 170px;
}

.ga-header__nav {
    display: flex;
    align-items: center;
    margin-left: 28px;
}

.ga-menu,
.ga-menu ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ga-menu {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ga-menu li {
    position: relative;
    margin: 0;
    padding: 0;
}

.ga-menu a {
    text-decoration: none !important;
}

.ga-menu > li > a {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 14px;
    color: var(--ga-text-muted) !important;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 11px;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.01em;
    white-space: nowrap;
    transition:
        min-height 200ms ease,
        padding 200ms ease,
        font-size 200ms ease,
        color 160ms ease,
        background-color 160ms ease,
        border-color 160ms ease,
        transform 160ms ease;
}

.ga-header--scrolled .ga-menu > li > a {
    min-height: 38px;
    padding-right: 12px;
    padding-left: 12px;
    font-size: 15px;
}

.ga-menu > li > a:hover,
.ga-menu > li > a:focus-visible {
    color: var(--ga-text) !important;
    background: rgba(255, 255, 255, 0.055);
    border-color: rgba(255, 255, 255, 0.07);
    outline: none;
}

.ga-menu > .current-menu-item > a,
.ga-menu > .current-menu-parent > a,
.ga-menu > .current-menu-ancestor > a {
    color: var(--ga-text) !important;
    background: rgba(103, 66, 183, 0.13);
}

.ga-menu > .current-menu-item > a::before,
.ga-menu > .current-menu-parent > a::before,
.ga-menu > .current-menu-ancestor > a::before {
    content: "";
    position: absolute;
    right: 14px;
    bottom: 5px;
    left: 14px;
    height: 2px;
    background: linear-gradient(90deg, var(--ga-purple-light), #a88cff);
    border-radius: 999px;
}

.ga-menu > .menu-item-has-children > a {
    gap: 8px;
}

.ga-menu > .menu-item-has-children > a::after {
    content: "";
    width: 7px;
    height: 7px;
    margin-top: -4px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    transition: transform 160ms ease, margin 160ms ease;
}

.ga-menu > .menu-item-has-children:hover > a::after,
.ga-menu > .menu-item-has-children:focus-within > a::after {
    margin-top: 3px;
    transform: rotate(225deg);
}

.ga-menu .sub-menu {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    z-index: 20;
    width: max-content;
    min-width: 320px;
    max-width: min(420px, calc(100vw - 32px));
    padding: 9px;
    visibility: hidden;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    background:
        linear-gradient(145deg, rgba(103, 66, 183, 0.12), transparent 44%),
        var(--ga-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.58);
    transition: opacity 170ms ease, transform 170ms ease, visibility 170ms ease;
}

.ga-menu .sub-menu::before {
    content: "";
    position: absolute;
    top: -13px;
    right: 0;
    left: 0;
    height: 13px;
}

.ga-menu li:hover > .sub-menu,
.ga-menu li:focus-within > .sub-menu {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.ga-menu .sub-menu li {
    width: 100%;
}

.ga-menu .sub-menu a {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 50px;
    padding: 11px 13px;
    color: rgba(255, 255, 255, 0.78) !important;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.35;
    white-space: normal;
    transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.ga-menu .sub-menu a:hover,
.ga-menu .sub-menu a:focus-visible,
.ga-menu .sub-menu .current-menu-item > a {
    color: #fff !important;
    background: rgba(103, 66, 183, 0.18);
    border-color: rgba(145, 108, 225, 0.2);
    outline: none;
    transform: translateX(3px);
}

/*
 * Вложенные уровни на десктопе по умолчанию раскрываются влево.
 * Основное меню находится в правой части шапки, поэтому открытие вправо
 * часто уводило третий уровень за пределы окна.
 */
.ga-menu .sub-menu .sub-menu {
    top: -9px;
    right: calc(100% + 9px);
    left: auto;
}

/* JS переключает направление только когда слева действительно мало места. */
.ga-menu .sub-menu .sub-menu.ga-submenu--open-right {
    right: auto;
    left: calc(100% + 9px);
}

/* Первый выпадающий уровень прижимается к правому краю родителя при коллизии. */
.ga-menu > li > .sub-menu.ga-submenu--align-right {
    right: 0;
    left: auto;
}

/* Невидимый коридор между карточками: курсор не теряет hover в зазоре. */
.ga-menu .sub-menu .sub-menu::before {
    top: 0;
    right: -10px;
    left: auto;
    width: 10px;
    height: 100%;
}

.ga-menu .sub-menu .sub-menu.ga-submenu--open-right::before {
    right: auto;
    left: -10px;
}

@media (min-width: 1081px) {
    .ga-menu .sub-menu .menu-item-has-children > a {
        position: relative;
        padding-right: 38px;
    }

    .ga-menu .sub-menu .menu-item-has-children > a::after {
        content: "";
        position: absolute;
        top: 50%;
        right: 15px;
        width: 7px;
        height: 7px;
        border-right: 1.5px solid currentColor;
        border-bottom: 1.5px solid currentColor;
        transform: translateY(-50%) rotate(135deg);
        opacity: 0.8;
    }

    .ga-menu .sub-menu .menu-item-has-children.ga-menu__item--flyout-right > a::after {
        transform: translateY(-50%) rotate(-45deg);
    }
}

.ga-menu__submenu-toggle {
    display: none;
}

/* Popup Maker сам обрабатывает #popmake-732. */
.ga-menu > li > a[href*="#popmake-732"] {
    min-height: 46px;
    margin-left: 12px;
    padding: 0 21px;
    color: #fff !important;
    background: linear-gradient(135deg, var(--ga-purple-light), #4d2f8f);
    border-color: rgba(255, 255, 255, 0.13);
    box-shadow: 0 12px 28px rgba(88, 52, 163, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.ga-header--scrolled .ga-menu > li > a[href*="#popmake-732"] {
    min-height: 40px;
    padding-right: 18px;
    padding-left: 18px;
}

.ga-menu > li > a[href*="#popmake-732"]::before {
    display: none !important;
}

.ga-menu > li > a[href*="#popmake-732"]:hover,
.ga-menu > li > a[href*="#popmake-732"]:focus-visible {
    background: linear-gradient(135deg, #8563db, #5836a0);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 15px 34px rgba(99, 60, 181, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.ga-header__setup {
    padding: 12px 18px;
    color: #fff !important;
    background: #6742b7;
    border-radius: 10px;
    text-decoration: none !important;
}

/* Сбрасываем глобальные стили кнопок Betheme только внутри новой шапки. */
#ga-site-header button.ga-header__burger,
#ga-site-header button.ga-menu__submenu-toggle {
    font: inherit !important;
    line-height: 1 !important;
    letter-spacing: normal !important;
    text-indent: 0 !important;
    text-shadow: none !important;
    text-transform: none !important;
    background-image: none !important;
}

#ga-site-header button.ga-header__burger::before,
#ga-site-header button.ga-header__burger::after,
#ga-site-header button.ga-menu__submenu-toggle::before,
#ga-site-header button.ga-menu__submenu-toggle::after {
    content: none !important;
    display: none !important;
}

.ga-header__burger {
    display: none;
}

@media (max-width: 1340px) {
    .ga-header__inner {
        width: min(calc(100% - 32px), 1280px);
    }

    .ga-header__logo-image {
        width: 190px;
    }

    .ga-header--scrolled .ga-header__logo-image {
        width: 158px;
    }

    .ga-header__nav {
        margin-left: 20px;
    }

    .ga-menu > li > a {
        padding-right: 11px;
        padding-left: 11px;
        font-size: 15px;
    }

    .ga-menu > li > a[href*="#popmake-732"] {
        margin-left: 7px;
        padding-right: 17px;
        padding-left: 17px;
    }
}

@media (max-width: 1080px) {
    :root {
        --ga-header-height: 68px;
        --ga-header-height-scrolled: 58px;
    }

    .ga-header__inner {
        width: calc(100% - 24px);
    }

    .ga-header__logo-image {
        width: 146px;
    }

    .ga-header--scrolled .ga-header__logo-image {
        width: 124px;
    }

    .ga-header__burger {
        position: relative;
        display: inline-grid;
        flex: 0 0 42px;
        place-items: center;
        width: 42px;
        height: 42px;
        margin: 0 0 0 auto;
        padding: 0;
        cursor: pointer;
        touch-action: manipulation;
        color: #fff !important;
        background: rgba(255, 255, 255, 0.035) !important;
        border: 1px solid rgba(255, 255, 255, 0.11) !important;
        border-radius: 12px !important;
        box-shadow: none !important;
        appearance: none;
        -webkit-appearance: none;
        transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
    }

    .ga-header__burger:hover,
    .ga-header__burger:focus-visible {
        background: rgba(103, 66, 183, 0.16) !important;
        border-color: rgba(145, 108, 225, 0.35) !important;
        outline: none;
    }

    .ga-header__burger:active {
        transform: scale(0.96);
    }

    .ga-header__burger-lines {
        position: relative;
        display: block;
        width: 22px;
        height: 16px;
    }

    .ga-header__burger-lines > span {
        position: absolute;
        left: 0;
        display: block;
        width: 22px;
        height: 2px;
        background: currentColor;
        border-radius: 999px;
        transform-origin: center;
        transition: top 180ms ease, transform 180ms ease;
    }

    .ga-header__burger-lines > span:first-child {
        top: 4px;
    }

    .ga-header__burger-lines > span:last-child {
        top: 10px;
    }

    .ga-header--menu-open .ga-header__burger-lines > span:first-child {
        top: 7px;
        transform: rotate(45deg);
    }

    .ga-header--menu-open .ga-header__burger-lines > span:last-child {
        top: 7px;
        transform: rotate(-45deg);
    }

    .ga-header__nav {
        position: fixed;
        top: calc(var(--ga-admin-offset) + var(--ga-header-height));
        right: 0;
        left: 0;
        display: block;
        height: calc(100vh - var(--ga-admin-offset) - var(--ga-header-height));
        height: calc(100dvh - var(--ga-admin-offset) - var(--ga-header-height));
        margin: 0;
        padding: 10px 12px calc(22px + env(safe-area-inset-bottom));
        overflow-x: hidden;
        overflow-y: auto;
        visibility: hidden;
        opacity: 0;
        transform: translateY(-8px);
        pointer-events: none;
        overscroll-behavior: contain;
        background:
            linear-gradient(180deg, rgba(103, 66, 183, 0.07), transparent 180px),
            rgba(7, 7, 11, 0.995);
        border-top: 1px solid rgba(255, 255, 255, 0.06);
        box-shadow: 0 24px 50px rgba(0, 0, 0, 0.5);
        transition: top 200ms ease, height 200ms ease, opacity 170ms ease, transform 170ms ease, visibility 170ms ease;
        -webkit-overflow-scrolling: touch;
    }

    .ga-header--scrolled .ga-header__nav {
        top: calc(var(--ga-admin-offset) + var(--ga-header-height-scrolled));
        height: calc(100vh - var(--ga-admin-offset) - var(--ga-header-height-scrolled));
        height: calc(100dvh - var(--ga-admin-offset) - var(--ga-header-height-scrolled));
    }

    .ga-header--menu-open .ga-header__nav {
        visibility: visible;
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }

    .ga-menu {
        display: block;
        width: min(100%, 680px);
        margin: 0 auto;
    }

    .ga-menu > li {
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.065);
    }

    .ga-menu > li:last-child {
        border-bottom: 0;
    }

    .ga-menu > li > a,
    .ga-header--scrolled .ga-menu > li > a {
        justify-content: flex-start;
        min-height: 50px;
        padding: 0 12px;
        color: rgba(255, 255, 255, 0.88) !important;
        font-size: 15.5px;
        white-space: normal;
        border: 0;
        border-radius: 9px;
    }

    .ga-menu > .menu-item-has-children > a,
    .ga-header--scrolled .ga-menu > .menu-item-has-children > a {
        padding-right: 56px;
    }

    .ga-menu > .menu-item-has-children > a::after {
        display: none;
    }

    .ga-menu > .current-menu-item > a::before,
    .ga-menu > .current-menu-parent > a::before,
    .ga-menu > .current-menu-ancestor > a::before {
        right: auto;
        bottom: 9px;
        left: 12px;
        width: 26px;
    }

    .ga-menu__submenu-toggle {
        position: absolute;
        top: 5px;
        right: 3px;
        z-index: 2;
        display: grid;
        place-items: center;
        width: 40px;
        height: 40px;
        margin: 0;
        padding: 0;
        cursor: pointer;
        touch-action: manipulation;
        color: rgba(255, 255, 255, 0.82) !important;
        background: transparent !important;
        border: 0 !important;
        border-radius: 9px !important;
        box-shadow: none !important;
        appearance: none;
        -webkit-appearance: none;
        transition: color 160ms ease, background-color 160ms ease;
    }

    .ga-menu__submenu-toggle:hover,
    .ga-menu__submenu-toggle:focus-visible {
        color: #fff !important;
        background: rgba(103, 66, 183, 0.16) !important;
        outline: none;
    }

    .ga-menu__submenu-toggle span,
    .ga-menu__submenu-toggle span::after {
        display: block;
        width: 14px;
        height: 2px;
        background: currentColor;
        border-radius: 999px;
        transition: transform 180ms ease;
    }

    .ga-menu__submenu-toggle span {
        position: relative;
    }

    .ga-menu__submenu-toggle span::after {
        content: "";
        position: absolute;
        inset: 0;
        transform: rotate(90deg);
    }

    .ga-menu__submenu-toggle[aria-expanded="true"] span::after {
        transform: rotate(0deg);
    }

    /*
     * На мобильных подменю управляются только классом из JS.
     * display:none исключает вспышку подпунктов при закрытии бургера
     * и полностью отключает desktop-правила :hover / :focus-within.
     */
    .ga-menu .sub-menu,
    .ga-menu .sub-menu .sub-menu {
        position: static;
        display: none !important;
        width: 100%;
        min-width: 0;
        max-width: none;
        margin: 0;
        padding: 0 0 0 12px;
        overflow: hidden;
        visibility: hidden !important;
        opacity: 0 !important;
        transform: none !important;
        pointer-events: none !important;
        background: transparent;
        border: 0;
        border-left: 1px solid rgba(123, 88, 210, 0.24);
        border-radius: 0;
        box-shadow: none;
        transition: none;
    }

    .ga-menu .sub-menu::before {
        display: none;
    }

    /*
     * Открытое состояние имеет более высокую специфичность, чем базовый
     * display:none. Дополнительный селектор по aria-expanded страхует меню,
     * даже если сторонний CSS темы вмешается в класс родительского <li>.
     */
    .ga-menu li.ga-menu__item--open > .sub-menu,
    .ga-menu .ga-menu__submenu-toggle[aria-expanded="true"] + .sub-menu {
        display: block !important;
        padding-bottom: 7px;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    .ga-menu .sub-menu li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.045);
    }

    .ga-menu .sub-menu li:last-child {
        border-bottom: 0;
    }

    .ga-menu .sub-menu a {
        min-height: 44px;
        padding: 8px 10px;
        font-size: 14px;
        border: 0;
        border-radius: 8px;
        transform: none;
    }

    .ga-menu .sub-menu .menu-item-has-children > a {
        padding-right: 50px;
    }

    .ga-menu .sub-menu .ga-menu__submenu-toggle {
        top: 2px;
        right: 2px;
    }

    .ga-menu > li > a[href*="#popmake-732"],
    .ga-header--scrolled .ga-menu > li > a[href*="#popmake-732"] {
        justify-content: center;
        min-height: 48px;
        margin: 12px 0 2px;
        padding: 0 18px;
        font-size: 15px;
        border: 1px solid rgba(255, 255, 255, 0.13);
    }
}

@media (max-width: 480px) {
    .ga-header__inner {
        width: calc(100% - 20px);
    }

    .ga-header__logo-image {
        width: 132px;
    }

    .ga-header--scrolled .ga-header__logo-image {
        width: 112px;
    }
}

@media (max-width: 782px) {
    body.admin-bar {
        --ga-admin-offset: 46px;
    }
}

@media (max-width: 600px) {
    /* В WordPress панель администратора на телефонах прокручивается вместе со страницей. */
    body.admin-bar .ga-header--scrolled {
        --ga-admin-offset: 0px;
    }
}

@media (max-width: 420px) {
    .ga-header__inner {
        width: calc(100% - 20px);
    }

    .ga-header__logo-image {
        width: 126px;
    }

    .ga-header--scrolled .ga-header__logo-image {
        width: 108px;
    }

    .ga-header__burger {
        flex-basis: 40px;
        width: 40px;
        height: 40px;
        border-radius: 11px;
    }

    .ga-header__nav {
        padding-right: 10px;
        padding-left: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ga-header,
    .ga-header__logo-image,
    .ga-menu > li > a,
    .ga-menu .sub-menu,
    .ga-header__nav,
    .ga-header__burger,
    .ga-header__burger-lines > span,
    .ga-menu__submenu-toggle span::after {
        transition: none !important;
    }
}
