/* Единое меню шапки (ПК + мобильный). Не добавлять в defer_css.php: правила нужны сразу при открытии мобильной панели.
   Подключается в include/header/types/main_type.php после dop_main/main.css — равные по весу правила должны побеждать её. */

/* Обёртка верхнего меню (источник для мобильного слота) не влияет на раскладку */
.header__top-menu-source {
    display: contents;
}

/* Мобильный режим каталога: тот же список и панели, drill-down вместо hover */
.header__catalog-mobile-head,
.header__catalog-mobile-back {
    display: none;
}

@media (max-width: 992px) {
    .header .header__catalog .fixBlock2 > .container {
        position: relative;
    }

    /* Список и панели — оверлеи; состояние только через is-mobile-* (legacy header__catalog-nav-active игнорируется) */
    .header .header__catalog .header__catalog-nav,
    .header .header__catalog .header__catalog-content {
        display: none !important;
        position: absolute;
        top: 0;
        right: 0;
        left: 0;
        z-index: 1100;
        box-sizing: border-box;
        width: 100%;
        min-height: 100%;
        max-height: none;
        margin: 0;
        padding: 0 0 24px;
        overflow-y: auto;
        visibility: visible;
        opacity: 1;
        transform: none !important;
        font-family: "Montserrat", sans-serif;
        color: #202020;
        background: #fff;
    }

    .header .header__catalog.is-mobile-catalog-open .header__catalog-nav,
    .header .header__catalog .header__catalog-content.is-mobile-active {
        display: block !important;
    }

    .header .header__catalog .header__catalog-content.is-mobile-active {
        z-index: 1101;
    }

    .header .header__catalog .header__catalog-nav::after,
    .header .header__catalog .header__catalog-nav__item--desktop-only,
    .header .header__catalog .header__catalog-item-close,
    .header .header__catalog .header__catalog-count,
    .header .header__catalog .header__catalog-link-child__icon,
    .header .header__catalog .blockBaner {
        display: none;
    }

    /* Назад + заголовок */
    .header .header__catalog .header__catalog-mobile-head {
        display: block;
    }

    .header .header__catalog .header__catalog-mobile-back {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        min-height: 40px;
        margin: 0 0 8px;
        padding: 4px 20px;
        font: inherit;
        font-size: 13px;
        font-weight: 600;
        color: #202020;
        background: transparent;
        border: 0;
    }

    .header .header__catalog .header__catalog-mobile-back span:first-child {
        font-size: 28px;
        line-height: 1;
    }

    .header .header__catalog .header__catalog-mobile-title,
    .header .header__catalog .header__catalog-title {
        display: block;
        font-size: 20px;
        font-weight: 700;
        line-height: 1.25;
        color: #202020;
        text-decoration: none;
    }

    .header .header__catalog .header__catalog-mobile-title {
        padding: 0 20px 18px;
    }

    /* Разделы */
    .header .header__catalog .header__catalog-nav__item {
        margin: 0;
        border-bottom: 1px solid rgba(25, 47, 124, .13);
    }

    .header .header__catalog .header__catalog-nav__link {
        gap: 10px;
        min-height: 52px;
        padding: 10px 20px;
        font-size: 13px;
        font-weight: 600;
        line-height: 1.35;
        color: #202020;
        background: #fff;
        border-radius: 0;
    }

    .header .header__catalog .header__catalog-nav__link::after {
        display: none;
    }

    .header .header__catalog .header__catalog-nav__link[data-catalog-panel]::after {
        content: "";
        display: block;
        position: static;
        flex: 0 0 8px;
        width: 8px;
        height: 8px;
        margin-left: auto;
        opacity: 1;
        background: none;
        border-top: 2px solid #192f7c;
        border-right: 2px solid #192f7c;
        transform: rotate(45deg);
    }

    .header .header__catalog .header__catalog-nav__icon {
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 46px;
        width: 46px;
        height: 46px;
        margin: 0;
        padding: 5px;
        overflow: hidden;
        border-radius: 3px;
        background: #f2f6fd;
    }

    .header .header__catalog .header__catalog-nav__icon img {
        display: block;
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        mix-blend-mode: darken;
    }

    .header .header__catalog .header__catalog-nav__text {
        font-size: 13px;
        font-weight: 600;
        line-height: 1.35;
        text-transform: none;
    }

    /* Панель раздела */
    .header .header__catalog .header__catalog-content__head {
        display: block;
        padding: 0 20px 18px;
    }

    .header .header__catalog .header__catalog-box {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0 18px;
        max-height: none !important;
        margin: 0;
        padding: 0 20px 18px;
        overflow: visible;
    }

    .header .header__catalog .header__catalog-list {
        width: auto !important;
        margin: 0;
        padding: 0;
    }

    .header .header__catalog .header__catalog-item {
        margin: 0;
    }

    .header .header__catalog .header__catalog-item .header__catalog-link-child {
        display: block;
        padding: 10px 0;
        font-size: 13px;
        font-weight: 600;
        line-height: 1.3;
        color: #202020;
        background: none;
    }

    .header .header__catalog .header__catalog-link-child__text {
        font-size: inherit;
        font-weight: inherit;
        line-height: inherit;
    }

    /* «Часто ищут» — только на ПК */
    .header .header__catalog .custom-menu-links {
        display: none;
    }

    /* «Компания»: ПК-поворот стрелки по :hover/:focus-within (dop_main/main.css) не действует в панели —
       после тапа фокус остаётся на ссылке и складывался с мобильным поворотом по .is-open */
    .header .header__catalog .header-top-menu__item--parent:hover .header-top-menu__arrow,
    .header .header__catalog .header-top-menu__item--parent:focus-within .header-top-menu__arrow {
        margin-top: 0;
        transform: none;
    }
}