:root {
    --header-h: 80px;
}

/* Sticky-шапка перекрывает якорь при переходе — компенсируем её высотой. */
[id] {
    scroll-margin-top: var(--header-h);
}

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    background: var(--bg);
}

.header__container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    width: 100%;
    max-width: 1440px;
    height: var(--header-h);
    margin: 0 auto;
    padding: 16px 50px;
}

.header__logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    width: 200px;
    max-height: 48px;
}

.header__logo-img {
    width: 100%;
    height: auto;
    max-height: 48px;
    object-fit: contain;
    object-position: left center;
}

.header__list {
    display: flex;
    align-items: center;
    gap: 32px;
}

.header__link {
    display: block;
    transition: color 0.2s;
}

.header__link:hover,
.header__link.is-active,
.current-menu-item > .header__link,
.current_page_item > .header__link,
.current-menu-ancestor > .header__link {
    color: var(--brand-primary);
}

.header__contacts {
    display: flex;
    align-items: center;
    gap: 40px;
    flex-shrink: 0;
}

.header__contacts-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header__phone {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    transition: color 0.2s;
}

.header__phone:hover {
    color: var(--brand-primary);
}

.header__phone-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
}

.header__socials {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header__social {
    display: block;
    width: 32px;
    height: 32px;
}

.header__social-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.header__mobile {
    display: none;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.header__mobile-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--brand-primary);
    color: var(--text-white);
    cursor: pointer;
}

.header__mobile-btn svg {
    width: 24px;
    height: 24px;
}

.header__mobile-btn:hover {
    background: var(--state-hover-2);
}

.header__mobile-btn:active {
    background: var(--state-pressed);
}

/* Бургер и крестик лежат в одной кнопке — показывается тот, что соответствует состоянию меню. */
.header__burger-icon--close,
.header:has(.header__menu.open) .header__burger-icon--open {
    display: none;
}

.header:has(.header__menu.open) .header__burger-icon--close {
    display: block;
}

.header__menu {
    position: fixed;
    top: var(--header-h);
    right: 0;
    bottom: 0;
    display: none;
    flex-direction: column;
    justify-content: space-between;
    gap: 32px;
    padding: 24px 20px 32px;
    overflow-y: auto;
    background: var(--bg);
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.header__menu.open {
    transform: translateX(0);
}

.header__menu-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.header__menu-bottom {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.header__menu-cta {
    width: 100%;
}

@media (max-width: 1280px) {
    .header__phone {
        display: none;
    }
}

@media (max-width: 1080px) {

    :root {
        --header-h: 64px;
    }

    .header__container {
        padding: 10px 20px;
    }

    .header__logo,
    .header__logo-img {
        width: 150px;
        max-height: 44px;
    }

    .header__nav,
    .header__contacts {
        display: none;
    }

    .header__mobile {
        display: flex;
    }

    .header__menu {
        display: flex;
        width: 400px;
    }

    body:has(.header__menu.open) {
        overflow: hidden;
    }

    .header__phone {
        display: flex;
    }
}

@media (max-width: 768px) {

    .header__container {
        padding: 10px;
    }

    .header__menu {
        padding: 20px 10px 32px;
    }
}
