/* =================================== */
/*  Стили для шапки (Header)         */
/* =================================== */

/* 1. Основной контейнер шапки */
.site-header {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(18, 18, 18, 0.85);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    z-index: 1000;
    border-bottom: 1px solid #2c2c2c;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    font-family: var(--font-headers);
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-primary);
    text-decoration: none;
    z-index: 10;
}

/* 2. Стили для бургер-меню (только для мобильных) */
.burger-menu {
    display: block; /* Показываем бургер на мобильных */
    position: relative;
    width: 30px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 10;
}

.burger-menu__line {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--text-main);
    transition: all 0.3s ease;
}

/* Применяем отступы только на мобильных устройствах */
@media (max-width: 767px) {
    .main-nav__wrapper {
        padding: 2.5rem 2rem;
    }
}

.burger-menu__line:nth-child(1) {
    top: 0;
}

.burger-menu__line:nth-child(2) {
    top: 50%;
    transform: translateY(-50%);
}

.burger-menu__line:nth-child(3) {
    bottom: 0;
}

/* Анимация бургера в крестик */
.burger-menu--active .burger-menu__line:nth-child(1) {
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}

.burger-menu--active .burger-menu__line:nth-child(2) {
    opacity: 0;
}

.burger-menu--active .burger-menu__line:nth-child(3) {
    bottom: 50%;
    transform: translateY(50%) rotate(-45deg);
}


/* 3. Стили для навигации (Mobile First) */
.main-nav {
    display: none; /* Скрываем навигацию по умолчанию */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    transition: background-color 0.3s ease, backdrop-filter 0.3s ease;
    /* Flex-контейнер для позиционирования дочернего меню */
    justify-content: flex-end; /* Горизонтальное выравнивание по правому краю */
    align-items: flex-start; /* Вертикально сверху */
    padding-top: 5rem; /* Отступ сверху, чтобы меню было ниже шапки */
    padding-right: 1rem; /* Небольшой отступ от правого края */
}

/* Обертка для ссылок, которая и будет нашим меню */
.main-nav__wrapper {
    display: flex;
    flex-direction: column;
    align-items: center; /* Ссылки по центру внутри меню */
    gap: 2rem;
    /* Убираем лишнюю ширину, чтобы меню не растягивалось */
    max-width: 340px;
    border-radius: 12px;
    /* По умолчанию обертка прозрачна */
    background-color: transparent;
    backdrop-filter: blur(0px);
    transition: all 0.3s ease;
}

.main-nav--active {
    display: flex; /* Показываем, когда меню активно */
    backdrop-filter: blur(5px); /* Слегка размываем фон за всем меню */
    -webkit-backdrop-filter: blur(5px);
}

/* Применяем glass-эффект к обертке, когда меню активно */
.main-nav--active .main-nav__wrapper {
    background-color: rgba(18, 18, 18, 0.9); /* Как у хедера */
    backdrop-filter: blur(10px); /* Как у хедера */
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid #2c2c2c; /* Как у хедера */
}

.nav-link {
    font-family: var(--font-headers);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.5rem;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--color-accent);
}

/* 4. Адаптация для планшетов и десктопов (breakpoint 768px) */
@media (min-width: 768px) {
    .burger-menu {
        display: none; /* Скрываем бургер на больших экранах */
    }

    .main-nav {
        display: flex; /* Показываем навигацию */
        position: static;
        width: auto;
        height: auto;
        background-color: transparent;
        /* Сбрасываем мобильные стили выравнивания для десктопа */
        justify-content: initial;
        align-items: center;
        padding-top: 0; /* Сброс отступа */
        padding-right: 0; /* Сброс отступа */
    }

    .main-nav__wrapper {
        flex-direction: row;
        align-items: center;
        gap: 1.5rem;
        height: auto; /* Сбрасываем высоту для десктопа */
        margin-top: 0; /* Сбрасываем отступ на десктопе */
        max-width: none; /* Сбрасываем ограничение ширины для десктопа */
    }

    .nav-link {
        font-size: 1rem;
        color: var(--text-secondary);
    }

    .nav-link:hover {
        color: var(--text-primary);
    }
    
    .main-nav .button--small {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}
