

.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: white;
}

.header__top {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 12px 0;
    margin: 0 40px;
    border-bottom: 1px solid #E5E5E5;
    background: white;
}

.header__link__1 {
    justify-self: start;
}

.header__logo {
    grid-column: 2;
    justify-self: center;
}

.header__link__2,
.header__link__3 {
    grid-column: 3;
    margin: 0 2px;
    justify-self: end;
}

.header__link__2,
.header__link__3 {
    display: inline-block;
}

.header__menu {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px 40px; 
    list-style: none;
}

.header__icon {
    width: 25px;
    height: 25px;
}

.header__nav {
    padding: 20px 80px;
    color: #4e4d93;
    background: white;
}

/* Гамбургер-кнопка */
.menu-toggle {
    display: none;
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1002;
    width: 44px;
    height: 44px;
}

.menu-toggle__line {
    display: block;
    width: 24px;
    height: 2px;
    background-color: #2a254b;
    margin: 5px 0;
    transition: 0.3s;
}

/* Медиазапросы для адаптивности */

/* Ноутбуки (меньше 1200px) */
@media (max-width: 1199px) {
    .header__nav {
        padding: 20px 40px;
    }
}

/* Планшеты (меньше 992px) */
@media (max-width: 991px) {
    .header__nav {
        padding: 20px 20px;
    }
    .header__menu {
        gap: 15px;
    }
}

/* Мобильные в альбомной ориентации (меньше 768px) */
@media (max-width: 767px) {
    .header__nav {
        padding: 15px;
    }
    .header__menu {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    .header__top {
        margin: 0 20px;
    }
    .menu-toggle {
        display: block;
    }
    
    /* Sticky для мобильных */
    .header {
        position: sticky;
        top: 0;
        z-index: 1000;
        background: white;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
}

/* Мобильные (меньше 576px) */
@media (max-width: 575px) {
    .header__nav {
        padding: 10px;
    }
    .header__menu {
        gap: 8px;
    }
    .header__top {
        margin: 0 10px;
    }
}

/* Очень маленькие экраны (меньше 400px) */
@media (max-width: 399px) {
    .header__nav {
        padding: 10px 5px;
    }
    .header__menu {
        gap: 5px;
    }
}


@media (max-width: 767px) {
    .header__nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 300px;
        height: 100vh;
        background: white;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        padding: 80px 30px 30px;
        transition: right 0.4s ease;
        z-index: 1000;
        overflow-y: auto;
    }
    
    .header__nav.active {
        right: 0;
    }
    
    .header__menu {
        flex-direction: column;
        gap: 0;
    }
    
    .header__menu-item {
        width: 100%;
    }
    
    .header__menu-link {
        display: block;
        width: 100%;
        padding: 15px 0;
        font-size: 18px;
        border-bottom: 1px solid #eee;
    }
    
    .header__menu-link:hover,
    .header__menu-link:focus {
        background-color: #f8f9fa;
        padding-left: 15px;
        transition: all 0.3s ease;
    }
    
    /* Анимация гамбургера в крестик */
    .menu-toggle.active .menu-toggle__line:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }
    
    .menu-toggle.active .menu-toggle__line:nth-child(2) {
        opacity: 0;
    }
    
    .menu-toggle.active .menu-toggle__line:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }
    
    /* Затемнение фона при открытом меню */
    .nav-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    
    .nav-overlay.active {
        display: block;
    }
}


@media (max-width: 768px) {
    .header__menu-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .menu-toggle {
        min-width: 44px;
        min-height: 44px;
    }
    
    .header__link__1,
    .header__link__2,
    .header__link__3 {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}