/* ================================================================
   section: header
   ================================================================ */
/* Блок скролла при открытом мобильном меню */
body.nav-open,
html.nav-open {
    overflow: hidden !important;
    height: 100vh;
    height: 100dvh;
    touch-action: none;
}
.header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: var(--z-header);
    padding: 16px 0;
    transition: padding 0.3s ease, background-color 0.3s ease;
}

.header.is-scrolled {
    position: fixed;
    padding: 10px 0;
}

.header__container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ================================================================
   inner — pill-хедер
   ================================================================ */
.header__inner {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    padding: 6px 6px 6px 24px;
    min-height: 60px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* ================================================================
   logo
   ================================================================ */
.header__logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.header__logo:hover { opacity: 0.85; }

.header__logo:hover,
.header__logo:focus,
.header__logo:active {
    outline: none;
    box-shadow: none;
    color: inherit;
}

.header__logo-img {
    display: block;
    height: 22px;
    width: auto;
    object-fit: contain;
}

.header__logo-text {
    font-family: var(--font-heading);
    font-size: 18px;
    color: var(--color-white);
    white-space: nowrap;
    line-height: 1;
}

/* ================================================================
   nav — DESKTOP inline
   ================================================================ */
.header__nav {
    display: flex;
    align-items: center;
    margin-left: auto;
}

.header__nav-right {
    display: flex;
    align-items: center;
    gap: 0;
}

/* ================================================================
   menu
   ================================================================ */
.header__menu {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0;
}

.header__menu li {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.header__menu li::before,
.header__menu li::after {
    display: none !important;
    content: none !important;
}

.header__menu a {
    font-family: var(--font-primary);
    font-weight: 500;
    font-size: 14px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    padding: 8px 18px;
    border-radius: 100px;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.header__menu a:hover,
.header__menu a:focus,
.header__menu a:active {
    outline: none;
    box-shadow: none;
    background-color: transparent;
    color: var(--color-white);
}

.header__menu .current-menu-item a,
.header__menu .current_page_item a {
    color: var(--color-white);
}

/* ================================================================
   CTA
   ================================================================ */
.header__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 14px;
    line-height: 1;
    color: var(--color-white);
    text-decoration: none;
    padding: 14px 30px;
    background-color: var(--color-red);
    border-radius: 100px;
    white-space: nowrap;
    transition: background-color 0.2s ease, transform 0.15s ease;
    flex-shrink: 0;
    margin-left: 8px;
}

.header__cta:hover,
.header__cta:focus,
.header__cta:active {
    outline: none;
    box-shadow: none;
    color: var(--color-white);
}

@media (hover: hover) {
    .header__cta:hover {
        background-color: var(--color-red-hover);
        transform: scale(1.02);
    }
}

.header__cta:active {
    transform: scale(0.98);
    background-color: var(--color-red-dark);
}

/* ================================================================
   LANG — общие стили для обоих блоков
   ================================================================ */
.header__lang {
    position: relative;
    flex-shrink: 0;
}

/* По умолчанию: desktop показан, mobile скрыт */
.header__lang--desktop {
    display: block;
}

.header__lang--mobile {
    display: none;
}

.header__lang-toggle {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background-color: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    font-family: var(--font-primary);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 22px;
    border-radius: 100px;
    min-height: 60px;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.header__lang-toggle:hover,
.header__lang-toggle:focus,
.header__lang-toggle:active {
    outline: none;
    box-shadow: none;
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.header__lang-toggle[aria-expanded="true"] {
    border-color: rgba(255, 255, 255, 0.2);
    background-color: rgba(255, 255, 255, 0.05);
}

.header__lang-toggle[aria-expanded="true"] .header__lang-arrow {
    transform: rotate(180deg);
}

.header__lang-current {
    font-weight: 500;
    font-size: 14px;
    line-height: 1;
    color: var(--color-white);
}

.header__lang-arrow {
    width: 12px;
    height: 12px;
    color: rgba(255, 255, 255, 0.45);
    transition: transform 0.25s ease;
}

/* dropdown */
.header__lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 100%;
    background: transparent;
    border: 0;
    padding: 0;
    list-style: none;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 100;
}

.header__lang-dropdown li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.header__lang-dropdown li::before,
.header__lang-dropdown li::after {
    display: none !important;
    content: none !important;
}

.header__lang-toggle[aria-expanded="true"] ~ .header__lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.header__lang-link {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-primary);
    font-weight: 500;
    font-size: 14px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    padding: 18px 22px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    background-color: rgba(15, 15, 15, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
    white-space: nowrap;
}

.header__lang-link:hover,
.header__lang-link:focus,
.header__lang-link:active {
    outline: none;
    box-shadow: none;
    color: var(--color-white);
    border-color: rgba(255, 255, 255, 0.2);
    background-color: rgba(255, 255, 255, 0.05);
}

/* ================================================================
   burger
   ================================================================ */
.header__burger {
    display: none;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    appearance: none;
    margin-left: 6px;
}

.header__burger:focus,
.header__burger:hover,
.header__burger:active {
    outline: none;
    box-shadow: none;
    background-color: transparent;
}

.header__burger-box {
    width: 26px;
    height: 18px;
    position: relative;
    margin: 0 auto;
}

.header__burger-line {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #fff;
    border-radius: 2px;
    transition: transform 0.4s cubic-bezier(0.075, 0.82, 0.16, 1),
                opacity 0.2s ease;
}

.header__burger-line:nth-child(1) { top: 0; }
.header__burger-line:nth-child(2) { top: 50%; transform: translateY(-50%); }
.header__burger-line:nth-child(3) { bottom: 0; }

.header__burger[aria-expanded="true"] .header__burger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.header__burger[aria-expanded="true"] .header__burger-line:nth-child(2) {
    opacity: 0;
}
.header__burger[aria-expanded="true"] .header__burger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* ================================================================
   TABLET + MOBILE — <= 1024px
   ================================================================ */
@media (max-width: 1024px) {
    /* Сбрасываем эффекты для оберток, если это необходимо */
    .header,
    .header__container {
        transform: none !important;
        filter: none !important;
        will-change: auto !important;
        perspective: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    /* Для самого "pill" хедера оставляем блюр, сбрасывая только остальное */
    .header__inner {
        transform: none !important;
        filter: none !important;
        will-change: auto !important;
        perspective: none !important;
        /* Мы НЕ сбрасываем backdrop-filter здесь, поэтому он наследуется из основных стилей */
    }
    .header {
        padding: 14px 0;
    }
/* Убираем блюр у родителя при открытом меню, 
       чтобы position: fixed прилипал к краям экрана, а не к хедеру */
    body.nav-open .header__inner {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    .header,
    .header__container,
    .header__inner {
        overflow: visible !important;
    }

    .header__container {
        padding: 0 12px;
        gap: 0;
    }

    .header__inner {
        padding: 6px 6px 6px 16px;
        min-height: 52px;
    }

    .header__logo {
        order: 1;
        margin-right: auto;
    }

    /* Скрываем десктопный язык, показываем мобильный */
    .header__lang--desktop {
        display: none !important;
    }

    .header__lang--mobile {
        display: block;
        order: 2;
        margin: 0 8px 0 0;
    }

    .header__lang--mobile .header__lang-toggle {
        min-height: 40px;
        padding: 10px 14px;
        background-color: transparent;
        border-color: rgba(255, 255, 255, 0.12);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .header__lang--mobile .header__lang-current {
        font-size: 13px;
    }

    .header__burger {
        display: flex;
        order: 3;
    }

    /* Overlay меню */
    .header__nav {
        position: fixed;
        inset: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        margin: 0 !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        background-color: #0e0e0e;
        border: none !important;
        border-radius: 0 !important;
        padding: 100px 32px 60px;
        z-index: 1500;
        min-height: auto;
        overflow-y: auto;
        transform: translateX(100%);
        opacity: 1;
        visibility: hidden;
        transition: transform 0.5s cubic-bezier(0.77, 0.2, 0.05, 1);
    }

    .header__nav.is-open {
        transform: translateX(0);
        visibility: visible;
    }

    .header__nav-right {
        flex-direction: column;
        align-items: center;
        width: 100%;
        max-width: 360px;
        gap: 0;
        margin: 0;
    }

    .header__menu {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .header__menu li {
        display: block;
        width: 100%;
        text-align: center;
        opacity: 0;
        transform: translateY(20px);
        transition: opacity 0.4s ease, transform 0.4s ease;
    }

    .header__nav.is-open li {
        opacity: 1;
        transform: translateY(0);
    }

    .header__nav.is-open li:nth-child(1) { transition-delay: 0.1s; }
    .header__nav.is-open li:nth-child(2) { transition-delay: 0.2s; }
    .header__nav.is-open li:nth-child(3) { transition-delay: 0.3s; }
    .header__nav.is-open li:nth-child(4) { transition-delay: 0.4s; }

    .header__menu a {
        display: block;
        width: 100%;
        font-size: 26px;
        font-weight: 600;
        padding: 20px 0;
        border-radius: 0;
        color: #fff;
        text-align: center;
    }

    .header__cta {
        margin: 40px 0 0 0;
        padding: 18px 40px;
        font-size: 16px;
        width: 100%;
        max-width: 210px;
        text-align: center;
        justify-content: center;
    }

    body.nav-open {
        overflow: hidden;
    }
}

/* ================================================================
   MOBILE — 768px
   ================================================================ */
@media (max-width: 768px) {
    .header {
        padding: 12px 0;
    }

    .header.is-scrolled {
        padding: 8px 0;
    }

    .header__container {
        padding: 0 10px;
    }

    .header__inner {
        padding: 5px 13px 5px 16px;
        min-height: 48px;
    }

    .header__logo-img {
        height: 20px;
    }

    .header__burger {
        width: 40px;
        height: 40px;
    }

    .header__burger-box {
        width: 22px;
        height: 16px;
    }

    .header__lang--mobile .header__lang-toggle {
        padding: 8px 12px;
        min-height: 36px;
        gap: 4px;
    }

    .header__lang--mobile .header__lang-current {
        font-size: 12px;
    }

    .header__lang-arrow {
        width: 10px;
        height: 10px;
    }

    .header__nav {
        padding: 90px 24px 40px;
    }

    .header__menu a {
        font-size: 20px;
        padding: 16px 0;
    }

    .header__cta {
        margin-top: 24px;
        padding: 16px 32px;
        font-size: 15px;
    }
}

/* ================================================================
   SMALL — 375px
   ================================================================ */
@media (max-width: 375px) {
    .header__container {
        padding: 0 8px;
    }

    .header__inner {
        padding: 4px 4px 4px 12px;
    }

    .header__logo-img {
        height: 16px;
    }

    .header__lang--mobile .header__lang-toggle {
        padding: 7px 10px;
        min-height: 32px;
    }

    .header__lang--mobile .header__lang-current {
        font-size: 11px;
    }

    .header__burger {
        width: 36px;
        height: 36px;
    }

    .header__nav {
        padding: 80px 20px 32px;
    }

    .header__menu a {
        font-size: 18px;
        padding: 14px 0;
    }

    .header__cta {
        padding: 14px 28px;
        font-size: 14px;
    }
}