/* ===== HEADER ===== */
header {
    /* прозрачная подложка — работает размытие, а не заливка */
    background: rgba(12, 30, 60, 0.35);
    backdrop-filter: blur(22px) saturate(1.6);
    -webkit-backdrop-filter: blur(22px) saturate(1.6);
    padding: 0;
    height: 100px;
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1000;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(91, 147, 255, 0.16);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

/* Та же схема, что и у остальных секций: контент не шире --maxw,
   от края экрана не ближе --pad. Отступ на внутреннем блоке, а не на самой
   шапке: она position: fixed, и проценты в ней считаются от другой базы. */
.logo-and-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: var(--maxw);
    margin: auto;
    height: 100%;
    padding-inline: var(--pad);
}

.logo {
    text-decoration: none;
    font-size: 54px;
    font-weight: 700;
    /* логотип чисто белый */
    color: #ffffff;
    -webkit-text-fill-color: #ffffff;
    text-shadow: none;
    filter: drop-shadow(0 0 30px rgba(30, 94, 255, 0.2));
    transition: 0.3s;
}

.logo:hover {
    filter: drop-shadow(0 0 50px rgba(30, 94, 255, 0.4));
    transform: scale(1.02);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 40px;
}
/* кнопка «Позвонить» и бутерброд — только в мобильном меню */
.nav-links a.nav-call,
.nav-toggle {
    display: none;
}

.nav-links a {
    text-decoration: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 21px;
    transition: all 0.3s ease;
    position: relative;
    padding: 5px 0;
}

/* Подчёркивание при наведении */
.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--blue);
    transition: width 0.3s ease;
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(30, 94, 255, 0.4);
}

.nav-links a:hover {
    color: #ffffff;
}

.nav-links a:hover::after {
    width: 100%;
}

/* Активная ссылка */
.nav-links a.active {
    color: var(--blue-2);
}

.nav-links a.active::after {
    width: 100%;
}

/* ===== АДАПТИВ ===== */
@media (max-width: 1720px) {
    header {
        height: 90px;
    }
    .logo {
        font-size: 50px;
    }
    .nav-links a {
        font-size: 19px;
    }
}

@media (max-width: 1530px) {
    header {
        height: 80px;
    }
    .logo {
        font-size: 44px;
    }
    .nav-links {
        gap: 30px;
    }
    .nav-links a {
        font-size: 17px;
    }
}

@media (max-width: 1260px) {
    header {
        height: 70px;
    }
    /* пять ссылок: логотип и шрифт поменьше, чтобы на 1025px оставался зазор */
    .logo {
        font-size: 34px;
    }
    .nav-links {
        gap: 22px;
    }
    .nav-links a {
        font-size: 15px;
    }
}

@media (max-width: 1024px) {
    header {
        height: 65px;
        backdrop-filter: blur(15px);
    }
    .logo {
        font-size: 32px;
    }
    .nav-links {
        gap: 20px;
    }
    .nav-links a {
        font-size: 16px;
    }
}

/* ===== ТЕЛЕФОН И УЗКИЙ ПЛАНШЕТ: бутерброд =====
   Меню — не отдельная плашка под шапкой, а сама шапка, раскрывающаяся вниз:
   тот же стеклянный фон и размытие, один сплошной лист. */
@media (max-width: 1024px), (max-height: 500px) and (orientation: landscape) {
    header {
        height: auto;
        padding: 0;
        backdrop-filter: blur(18px) saturate(1.5);
        -webkit-backdrop-filter: blur(18px) saturate(1.5);
        transition: transform 0.3s ease, background-color 0.3s ease;
    }
    /* открытое меню читается поверх страницы: стекло плотнее, но того же тона */
    header.nav-open {
        background: rgba(12, 30, 60, 0.9);
    }
    .logo-and-nav {
        flex-direction: row;
        flex-wrap: wrap;
        height: auto;
    }
    /* строка шапки — 64px: кнопка 46px + по 9px сверху и снизу */
    .logo {
        font-size: 26px;
        line-height: 1;
    }
    .nav-toggle {
        display: grid;
        place-content: center;
        gap: 6px;
        width: 46px;
        height: 46px;
        margin: 9px -6px 9px 0;
        padding: 0;
        border: 1px solid rgba(91, 147, 255, 0.35);
        border-radius: 14px;
        background: rgba(91, 147, 255, 0.1);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: background 0.25s ease, border-color 0.25s ease;
    }
    .nav-open .nav-toggle {
        background: rgba(91, 147, 255, 0.18);
        border-color: rgba(91, 147, 255, 0.6);
    }
    .nav-toggle span {
        display: block;
        width: 22px;
        height: 2px;
        border-radius: 2px;
        background: var(--blue-4);
        transition: transform 0.3s ease, opacity 0.2s ease;
    }
    /* три полоски → крестик */
    .nav-open .nav-toggle span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
    .nav-open .nav-toggle span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

    /* список — второй строкой внутри шапки, раскрывается по высоте */
    .nav-links {
        flex-basis: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        visibility: hidden;
        transition: max-height 0.35s ease, opacity 0.25s ease, visibility 0s linear 0.35s;
    }
    .nav-open .nav-links {
        max-height: calc(100vh - 64px);
        overflow-y: auto;
        opacity: 1;
        visibility: visible;
        transition: max-height 0.35s ease, opacity 0.25s ease 0.05s;
    }
    .nav-links a {
        font-size: 18px;
        padding: 15px 0;
        border-top: 1px solid var(--hairline);
    }
    .nav-links a::after {
        display: none;
    }
    .nav-links a.active {
        color: var(--blue-3);
    }
    .nav-links a.nav-call {
        display: flex;
        justify-content: center;
        margin: 12px 0 22px;
        padding: 15px 20px;
        border: none;
        border-radius: 999px;
        background: var(--btn-grad);
        box-shadow: 0 6px 18px rgba(30, 94, 255, 0.22);
        font-size: 17px;
        font-weight: 600;
    }
    /* у tel-ссылок цвет задан через color: inherit !important — красим span */
    .nav-links a.nav-call span {
        color: #ffffff;
    }
}

@media (max-width: 400px) {
    .logo {
        font-size: 23px;
    }
    .nav-links a {
        font-size: 16px;
        padding: 14px 0;
    }
}
