/**
 * БФ «Ева» — Шапка сайта и мобильная навигация
 */

/* ==========================================================================
   Шапка сайта, десктопное меню, мобильный дровер и бургер
   ========================================================================== */

/* Шапка и навигация */
header {
    background-color: var(--header-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--header-border);
    padding: 8px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.logo {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.logo img {
    height: 52px;
    width: auto;
    max-height: 56px;
    object-fit: contain;
    transition: var(--transition);
}

.logo:hover img {
    transform: scale(1.04);
}

header nav {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
}

header nav > ul {
    display: flex;
    list-style: none;
    align-items: center;
    flex-wrap: nowrap;
    margin: 0;
    padding: 0;
    gap: 16px;
}

header nav > ul > li > a {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
    white-space: nowrap;
    padding: 6px 0;
    position: relative;
    text-decoration: none;
    transition: var(--transition);
}

header nav > ul > li > a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: var(--transition);
    border-radius: 2px;
}

header nav > ul > li > a:hover,
header nav > ul > li > a.active,
header nav > ul > li.current-menu-item > a,
header nav > ul > li.current-menu-ancestor > a,
header nav > ul > li.current_page_item > a {
    color: var(--text-dark);
}

header nav > ul > li > a:hover::after,
header nav > ul > li > a.active::after,
header nav > ul > li.current-menu-item > a::after,
header nav > ul > li.current-menu-ancestor > a::after,
header nav > ul > li.current_page_item > a::after {
    width: 100%;
}

@media (min-width: 993px) {
    nav ul li.dropdown,
    nav ul li.menu-item-has-children {
        position: relative;
    }
    .dropdown-menu,
    nav ul .sub-menu {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        list-style: none;
        margin: 0;
        gap: 0;
        visibility: hidden;
        opacity: 0;
        position: absolute;
        top: calc(100% + 18px);
        left: 0;
        background: rgba(255, 255, 255, 0.98);
        border: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.04);
        border-radius: 14px;
        padding: 8px 0;
        min-width: 320px;
        width: max-content;
        white-space: nowrap;
        z-index: 1000;
        transform: translateY(6px);
        transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
    }
    .dropdown-menu::before,
    nav ul .sub-menu::before {
        content: '';
        position: absolute;
        top: -24px;
        left: 0;
        right: 0;
        height: 24px;
    }
    nav ul li.dropdown:hover > .dropdown-menu,
    nav ul li.menu-item-has-children:hover > .sub-menu {
        visibility: visible;
        opacity: 1;
        transform: translateY(0);
    }
    .dropdown-menu li,
    nav ul .sub-menu li {
        width: 100%;
        display: block;
        position: relative;
        margin: 0;
        padding: 0;
    }
    .dropdown-menu a,
    nav ul .sub-menu a {
        padding: 10px 22px;
        display: block;
        width: 100%;
        box-sizing: border-box;
        text-align: left;
        font-size: 14px;
        line-height: 1.4;
        color: var(--text-light);
        font-weight: 500;
        transition: var(--transition);
        border-bottom: none;
    }
    .dropdown-menu a::after,
    nav ul .sub-menu a::after {
        display: none;
    }
    .dropdown-menu a:hover,
    nav ul .sub-menu a:hover {
        background: rgba(197, 78, 112, 0.05);
        color: var(--primary);
        padding-left: 26px;
    }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.header-socials {
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #f1f2f6;
    color: var(--text-dark);
    border: 1px solid rgba(0, 0, 0, 0.08);
    transition: all 0.25s ease;
    text-decoration: none;
}

.header-social-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.header-social-tg:hover {
    background: #229ED9;
    border-color: #229ED9;
    color: #ffffff;
}

.header-social-vk:hover {
    background: #0077ff;
    border-color: #0077ff;
    color: #ffffff;
}

.btn-visually-impaired {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50%;
    background: #f1f2f6;
    color: var(--text-dark);
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.08);
    transition: all 0.25s ease;
    text-decoration: none;
    flex-shrink: 0;
}

.btn-visually-impaired:hover {
    background: #e4e7eb;
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.btn-visually-impaired svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
}

.btn-visually-impaired span {
    display: none;
}

.btn-volunteer {
    color: var(--primary);
    border: 1.5px solid var(--primary);
    padding: 7px 14px;
    border-radius: 100px;
    font-weight: 600;
    font-size: 13px;
    font-family: 'Manrope', sans-serif;
    transition: var(--transition);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    text-decoration: none;
}

.btn-volunteer:hover {
    background: var(--primary);
    color: var(--white);
    transform: translateY(-2px);
}

.btn-donate {
    background: linear-gradient(135deg, var(--secondary) 0%, #d98e3b 100%);
    color: var(--white);
    padding: 7px 15px;
    border-radius: 100px;
    font-weight: 600;
    font-size: 13px;
    font-family: 'Manrope', sans-serif;
    box-shadow: var(--shadow-sm);
    border: none;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn-donate:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 10px 20px rgba(235, 160, 78, 0.2);
}

.mobile-only-actions {
    display: none;
}

.mobile-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 32px;
    height: 26px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 2px 0;
    z-index: 1001;
}

.mobile-nav-toggle span {
    width: 100%;
    height: 2.5px;
    background: var(--text-dark);
    border-radius: 4px;
    transition: transform 0.25s ease, opacity 0.2s ease;
    transform-origin: center;
    display: block;
}

@media (min-width: 1400px) {
    header .container {
        max-width: 1680px;
        padding: 0 32px;
    }
    header nav > ul {
        gap: 20px;
    }
}

@media (min-width: 993px) and (max-width: 1200px) {
    header nav > ul {
        gap: 10px;
    }
    header nav > ul > li > a {
        font-size: 12.5px;
    }
    .header-actions .btn-volunteer {
        display: none;
    }
    .btn-visually-impaired span {
        display: none;
    }
}

@media (max-width: 992px) {
    .mobile-nav-toggle {
        display: flex;
        margin-left: 15px;
    }
    .logo img {
        height: 44px;
    }
    .header-actions {
        display: none;
    }
    .header-inner {
        position: relative;
        padding: 8px 16px;
    }
    .header-inner nav {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: #ffffff;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: 0 15px 30px rgba(0, 0, 0, 0.12);
        max-height: 0;
        overflow-y: auto;
        transition: max-height 0.3s ease, opacity 0.2s ease;
        opacity: 0;
        z-index: 9999;
        pointer-events: none;
        -webkit-overflow-scrolling: touch;
    }
    .header-inner nav.active {
        max-height: calc(100vh - 65px);
        opacity: 1;
        pointer-events: all;
    }
    .header-inner nav > ul {
        width: 100%;
        box-sizing: border-box;
        flex-direction: column;
        gap: 0;
        padding: 14px 22px 30px;
        align-items: stretch;
    }
    .header-inner nav > ul > li {
        width: 100%;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }
    .header-inner nav > ul > li:last-child {
        border-bottom: none;
    }
    .header-inner nav a {
        font-size: 15px;
        font-weight: 600;
        color: var(--text-dark);
        padding: 11px 0;
        width: 100%;
        display: block;
        text-decoration: none;
    }
    .header-inner nav > ul > li > a::after {
        display: none !important;
    }
    .header-inner nav > ul > li > a.active,
    .header-inner nav > ul > li.current-menu-item > a,
    .header-inner nav > ul > li.current-menu-ancestor > a,
    .header-inner nav > ul > li.current_page_item > a {
        color: var(--primary) !important;
        font-weight: 700;
    }
    .header-inner nav > ul > li.dropdown,
    .header-inner nav > ul > li.menu-item-has-children {
        position: relative;
    }
    .header-inner nav > ul > li.dropdown > a,
    .header-inner nav > ul > li.menu-item-has-children > a {
        display: inline-block;
        width: calc(100% - 48px);
    }
    .mobile-submenu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        font-size: 14px;
        color: var(--text-light);
        cursor: pointer;
        position: absolute;
        right: 0;
        top: 0;
        transition: transform 0.25s ease, color 0.25s ease;
    }
    .mobile-submenu-toggle svg {
        transition: transform 0.25s ease;
    }
    .header-inner nav > ul > li.active-mobile > .mobile-submenu-toggle {
        transform: rotate(180deg);
        color: var(--primary);
    }
    .header-inner nav .dropdown-menu,
    .header-inner nav .sub-menu {
        display: none;
        list-style: none;
        padding: 4px 0 12px 16px;
        margin: 0;
        border-left: 2px solid rgba(197, 78, 112, 0.2);
    }
    .header-inner nav > ul > li.active-mobile > .dropdown-menu,
    .header-inner nav > ul > li.active-mobile > .sub-menu {
        display: block;
    }
    .header-inner nav .dropdown-menu li,
    .header-inner nav .sub-menu li {
        width: 100%;
        border-bottom: none;
    }
    .header-inner nav .dropdown-menu li a,
    .header-inner nav .sub-menu li a {
        font-size: 14px;
        font-weight: 500;
        color: var(--text-light);
        padding: 8px 0;
    }
    .header-inner nav .dropdown-menu li a:hover,
    .header-inner nav .sub-menu li a:hover {
        color: var(--primary);
    }
    .mobile-only-actions {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin-top: 16px;
        padding-top: 18px;
        padding-bottom: 28px;
        border-top: 1px solid rgba(0, 0, 0, 0.06);
        width: 100%;
    }
    .mobile-only-actions .header-socials {
        display: flex;
        gap: 12px;
        justify-content: center;
        margin-bottom: 6px;
    }
    .mobile-only-actions .header-social-link {
        width: 42px;
        height: 42px;
        border-radius: 50%;
        background: #f1f3f7;
        color: var(--text-dark);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-decoration: none;
    }
    .mobile-only-actions > a {
        padding: 12px 18px;
        font-size: 14px;
        font-weight: 600;
        text-align: center;
        border-radius: 100px;
        text-decoration: none;
        width: 100%;
        box-sizing: border-box;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }
    .mobile-only-actions .btn-visually-impaired {
        width: 100% !important;
        height: auto !important;
        min-height: 46px !important;
        border-radius: 100px !important;
        padding: 12px 18px !important;
        background: #f4f5f8 !important;
        border: 1px solid rgba(0, 0, 0, 0.08) !important;
        color: var(--text-dark) !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 10px !important;
        box-sizing: border-box !important;
        font-size: 14px !important;
        font-weight: 600 !important;
        text-decoration: none !important;
    }
    .mobile-only-actions .btn-visually-impaired svg {
        width: 18px !important;
        height: 18px !important;
        flex-shrink: 0 !important;
        stroke: currentColor !important;
        stroke-width: 2 !important;
        fill: none !important;
        display: block !important;
    }
    .mobile-only-actions .btn-visually-impaired span {
        display: inline !important;
        font-size: 14px !important;
        font-weight: 600 !important;
        line-height: 1 !important;
    }
    .mobile-only-actions .btn-volunteer {
        background: transparent !important;
        color: var(--primary) !important;
        border: 1.5px solid var(--primary) !important;
        font-weight: 700 !important;
    }
    .mobile-only-actions .btn-donate {
        background: linear-gradient(135deg, var(--secondary) 0%, #d98e3b 100%) !important;
        color: #ffffff !important;
        font-weight: 700 !important;
        box-shadow: 0 4px 14px rgba(235, 160, 78, 0.35) !important;
    }
    .mobile-nav-toggle.active span:nth-child(1) {
        transform: translateY(6.5px) rotate(45deg);
    }
    .mobile-nav-toggle.active span:nth-child(2) {
        opacity: 0;
        transform: scaleX(0);
    }
    .mobile-nav-toggle.active span:nth-child(3) {
        transform: translateY(-6.5px) rotate(-45deg);
    }
}

@media (max-width: 768px) {
    .header-inner {
        padding: 8px 12px;
    }
    .logo img {
        height: 40px;
    }
}
