/* =========================================================
   БАЗА
   ========================================================= */
* { box-sizing: border-box; }

html, body {
    width: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Montserrat', sans-serif;
}

/* =========================================================
   ОБЩИЙ КАРКАС ШАПКИ
   ========================================================= */
.site-header-wrap {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #fff;
}

.site-header {
    display: flex;
    width: 100%;
    background-color: #00634f;
    border-bottom: 1px solid rgba(255,255,255,.18);
}

.site-header__inner {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 16px;
    flex-wrap: nowrap;
}

/* =========================================================
   ЛОГО
   ========================================================= */
.site-header__logo {
    flex: 0 0 auto;
    margin-left: 6px;
}

.logo-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.logo-link img {
    display: block;
    height: 90px;
    width: auto;
}

/* =========================================================
   ЗАГОЛОВОК САЙТА
   ========================================================= */
.site-header__title {
    flex: 1 1 auto;
    text-align: center;
    min-width: 0;
    padding: 0 8px;
}

.site-title {
    display: inline-block;
    font: 600 22px/1.25 'Montserrat', sans-serif;
    color: #fff;
    text-decoration: none;
}

/* =========================================================
   ПРАВАЯ ЧАСТЬ: НАВИГАЦИЯ + СОЦСЕТИ
   ========================================================= */
.site-header__right {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    min-width: 0;
}

.site-header__nav {
    flex: 0 1 auto;
    min-width: 0;
}

.site-header__nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: nowrap;
}

.site-header__nav__link {
    display: inline-block;
    padding: 6px 10px;
    color: #fff;
    text-decoration: none;
    font: 500 14px/1.2 'Montserrat', sans-serif;
    white-space: nowrap;
}

.site-header__nav__link:hover {
    text-decoration: underline;
}

/* =========================================================
   СОЦСЕТИ
   ========================================================= */
.site-header__social-end {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    flex: 0 0 auto;
}

.icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 10px;
    background: rgba(255,255,255,.08);
    text-decoration: none;
    flex: 0 0 auto;
}

.icon-link:hover {
    background: rgba(255,255,255,.16);
}

.icon-link__img {
    display: block;
    width: 16px;
    height: 16px;
}

/* =========================================================
   ГЛАВНОЕ МЕНЮ ПОД ШАПКОЙ (.nav-main)
   ========================================================= */
.nav-main {
    display: flex;
    width: 100%;
    background: #fff;
}

.nav-main__list {
    width: 100%;
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: stretch;
    justify-content: center;   /* не липнет к левому краю; при полном заполнении не влияет */
    gap: 4px;
    flex-wrap: nowrap;
    color: #00634f;
}

.nav-main__item {
    flex: 1 1 0;               /* равномерное распределение ширины */
    min-width: max-content;    /* но не уже текста — без обрезки */
    text-align: center;
    display: flex;
}

.nav-main__link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 6px;
    color: #00634f;
    text-decoration: none;
    font: 500 13px/1.2 'Montserrat', sans-serif;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: background .2s, border-color .2s;
    box-sizing: border-box;
}

.nav-main__link:hover {
    background: #e8f5f1;
}

.nav-main__item.is-active .nav-main__link {
    border-bottom-color: #00634f;
    font-weight: 600;
}

/* Поиск */
.nav-main__item--search {
    flex: 0 0 auto;
    margin-left: 2px;
}

.nav-main__link--search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    color: #00634f;
    border-radius: 6px;
    border-bottom: none;
    transition: background .2s;
}

.nav-main__link--search:hover {
    background: #e8f5f1;
}

.search-icon {
    width: 18px;
    height: 18px;
    color: #00634f;
    display: block;
}

/* =========================================================
   ПЕРЕНОС ПУНКТОВ МЕНЮ НА СРЕДНИХ ЭКРАНАХ
   Предотвращает переполнение на 861–1200px
   ========================================================= */
@media (max-width: 1200px) {
    .nav-main__list {
        flex-wrap: wrap;          /* разрешаем перенос пунктов */
        justify-content: center;
        gap: 2px 6px;
    }

    .nav-main__item {
        flex: 0 1 auto;           /* ширина по контенту, без принудительного растяжения */
        min-width: max-content;   /* не уже текста */
    }

    .nav-main__link {
        padding: 8px 10px;        /* чуть компактнее, чтобы больше влезало в строку */
    }
}

/* =========================================================
   ПЛАНШЕТ: ≤ 1024px
   ========================================================= */
@media (max-width: 1024px) {
    /* Шапка */
    .logo-link img { height: 70px; }
    .site-title { font-size: 18px; }
    .site-header__inner { gap: 10px; padding: 10px 12px; }
    .site-header__right { gap: 10px; }
    .site-header__nav__link { padding: 6px 8px; font-size: 13px; }

    /* Меню */
    .nav-main__link {
        font-size: 12px;
        padding: 9px 4px;
    }
    .search-icon { width: 16px; height: 16px; }
}

/* =========================================================
   ПЛАНШЕТ / БОЛЬШОЙ ТЕЛЕФОН: ≤ 860px
   ========================================================= */
@media (max-width: 860px) {
    /* Шапка: лого+соцсети сверху, заголовок — отдельной строкой */
    .site-header__inner {
        flex-wrap: wrap;
        row-gap: 8px;
    }
    .site-header__logo { order: 1; }
    .site-header__right { order: 2; margin-left: auto; }
    .site-header__title {
        order: 3;
        flex: 1 1 100%;
        text-align: left;
        padding: 0;
        margin-top: 2px;
    }
    .site-title { font-size: 16px; line-height: 1.3; }
    .logo-link img { height: 56px; }

    /* Верхнее меню — компактнее */
    .site-header__nav__list { gap: 6px; }
    .site-header__nav__link { padding: 4px 6px; font-size: 12px; }

    /* Главное меню — компактнее, но всё ещё в строку */
    .nav-main__list { gap: 2px; }
    .nav-main__link {
        font-size: 11.5px;
        padding: 8px 3px;
        letter-spacing: -.2px;
    }
    .nav-main__link--search { padding: 6px; }
    .search-icon { width: 16px; height: 16px; }
}

/* =========================================================
   ТЕЛЕФОН: ≤ 640px — вертикальный список
   ========================================================= */
@media (max-width: 640px) {
    /* Шапка */
    .site-header__inner {
        padding: 8px 10px;
        gap: 8px;
    }
    .logo-link img { height: 48px; }
    .site-title { font-size: 14px; line-height: 1.3; }
    .icon-link { width: 28px; height: 28px; }
    .icon-link__img { width: 14px; height: 14px; }

    /* Верхнее горизонтальное меню скрываем — дублирует основное */
    .site-header__nav { display: none; }

    /* Главное меню — вертикально */
    .nav-main__list {
        flex-direction: column;
        gap: 0;
        align-items: stretch;
    }

    .nav-main__item {
        width: 100%;
        flex: 0 0 auto;
        min-width: 0;
        border-bottom: 1px solid rgba(0,99,79,.12);
    }

    .nav-main__item:last-child { border-bottom: none; }

    .nav-main__link {
        font-size: 14px;
        padding: 12px 14px;
        justify-content: flex-start;
        white-space: normal;
        text-align: left;
    }

    .nav-main__item.is-active .nav-main__link {
        background: #e8f5f1;
        border-bottom-color: transparent;
        border-left: 3px solid #00634f;
        padding-left: 11px;
    }

    /* Поиск — отдельной строкой по центру */
    .nav-main__item--search {
        width: 100%;
        margin-left: 0;
        border-bottom: none;
    }
    .nav-main__link--search {
        width: 100%;
        padding: 10px;
        justify-content: center;
    }
    .search-icon { width: 20px; height: 20px; }
}

/* =========================================================
   ОЧЕНЬ УЗКИЙ ЭКРАН: ≤ 380px
   ========================================================= */
@media (max-width: 380px) {
    .site-title { font-size: 13px; }
    .logo-link img { height: 40px; }
    .icon-link { width: 26px; height: 26px; }

    .nav-main__link { font-size: 13px; padding: 10px 12px; }
}