/* ========================================================================== */
/* ШАПКА — header.css                                                         */
/* ========================================================================== */

:root {
    --title-color: rgb(18, 124, 124);
    --accent: rgb(34, 104, 109);
    --accent-hover: rgb(24, 84, 88);
    --header-text: #1f2a2a;
    --header-h: 84px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* ничто не должно быть шире экрана;
   overflow-x НЕ ставим на html/body — он ломает position: sticky */
body {
    max-width: 100%;
}

body.no-scroll {
    overflow: hidden;
}

.site-header {
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 100;
    /* фон и блюр — на псевдоэлементе (см. ниже).
       Сам .site-header НЕ должен иметь backdrop-filter/transform/filter:
       иначе он становится containing block для потомков с position: fixed
       (в частности для .nav-menu), и выезжающее меню откроется
       только на высоту шапки, а не на весь экран. */
    background: transparent;
    border-bottom: 1px solid rgba(18, 124, 124, 0.12);
    transition: box-shadow 0.3s ease;
}

.site-header::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    transition: background-color 0.3s ease;
}

.site-header.is-scrolled {
    box-shadow: 0 6px 24px rgba(18, 124, 124, 0.1);
}

.site-header.is-scrolled::before {
    background: rgba(255, 255, 255, 0.96);
}

.header-container {
    width: min(1440px, 94%);
    margin: 0 auto;
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: var(--header-h);
    padding: 14px 0;
    min-width: 0;
}

.nav-container>* {
    min-width: 0;
}

/* --- Логотип (текстовый, вписан в стиль шапки) --- */
.logo-link {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
    transition: opacity 0.25s ease;
}

.logo-link:hover {
    opacity: 0.85;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.logo-text__main {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 40px;
    letter-spacing: 1px;
    color: var(--title-color);
}

.logo-text__sub {
    margin-top: 5px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent);
    opacity: 0.9;
}

/* --- Навигация --- */
.nav-menu {
    display: flex;
    justify-content: center;
    flex: 1;
}

.nav-items {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    row-gap: 10px;
    column-gap: 35px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* принудительный перенос пунктов меню на вторую строку (см. header.php: nav-break после 5-го пункта) */
.nav-break {
    flex-basis: 100%;
    width: 100%;
    height: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-item a {
    position: relative;
    display: inline-block;
    padding: 6px 2px;
    color: var(--header-text);
    font-size: 19px;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.25s ease;
}

.nav-item a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: var(--title-color);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.28s ease;
}

.nav-item a:hover {
    color: var(--title-color);
}

.nav-item a:hover::after,
.nav-item a.is-active::after {
    transform: scaleX(1);
}

.nav-item a.is-active {
    color: var(--title-color);
    font-weight: 600;
}

/* контакты внутри мобильного меню — на десктопе скрыты */
.nav-menu__contacts {
    display: none;
}

/* --- Контакты справа --- */
.contacts {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.contacts__phone {
    color: var(--header-text);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.25s ease;
}

.contacts__phone:hover {
    color: var(--title-color);
}

.contacts__social {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(18, 124, 124, 0.08);
    transition: background-color 0.25s ease, transform 0.25s ease;
}

.contacts__social:hover {
    background: rgba(18, 124, 124, 0.18);
    transform: translateY(-2px);
}

.contacts__cta,
.contacts__cta:visited {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    padding: 0 22px;
    border-radius: 24px;
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
}

.contacts__cta:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(18, 124, 124, 0.25);
}

/* --- Бургер --- */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-radius: 12px;
    background: rgba(18, 124, 124, 0.08);
    cursor: pointer;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    margin: 0 auto;
    border-radius: 2px;
    background: var(--title-color);
    transition: transform 0.3s ease, opacity 0.2s ease;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* затемнение под меню */
.nav-overlay {
    position: fixed;
    inset: 0;
    z-index: 98;
    background: rgba(15, 35, 35, 0.45);
    backdrop-filter: blur(2px);
}

/* ========================================================================== */
/* АДАПТИВ                                                                    */
/* ========================================================================== */

@media (max-width: 1250px) {
    .nav-items {
        column-gap: 14px;
        row-gap: 8px;
    }

    .nav-item a {
        font-size: 14px;
    }

    .contacts {
        gap: 12px;
    }

    .contacts__phone {
        font-size: 13px;
    }
}

@media (max-width: 1100px) {
    .contacts__phone {
        display: none;
    }
}

/* Планшеты и телефоны — выдвижное меню */
@media (max-width: 1024px) {
    :root {
        --header-h: 72px;
    }

    .nav-container {
        padding: 0;
    }

    .hamburger {
        display: flex;
        order: 3;
    }

    .logo-text__main {
        font-size: 32px;
    }

    .logo-text__sub {
        font-size: 11px;
        letter-spacing: 2.5px;
    }

    .contacts {
        order: 2;
        margin-left: auto;
        gap: 10px;
    }

    .contacts__phone {
        display: inline-block;
        font-size: 15px;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        right: 0;
        z-index: 99;
        display: block;
        width: min(340px, 84vw);
        max-width: 100%;
        height: 100%;
        padding: 96px 28px 32px;
        background: #fff;
        box-shadow: -12px 0 40px rgba(0, 0, 0, 0.12);
        overflow-y: auto;
        overscroll-behavior: contain;
        box-sizing: border-box;

        /* закрытое меню полностью выключено из отрисовки:
           не создаёт горизонтальную прокрутку и не ловит клики */
        visibility: hidden;
        opacity: 0;
        transform: translateX(100%);
        transition:
            transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1),
            opacity 0.25s ease,
            visibility 0s linear 0.35s;
    }

    .nav-menu.open {
        visibility: visible;
        opacity: 1;
        transform: translateX(0);
        transition:
            transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1),
            opacity 0.2s ease,
            visibility 0s;
    }

    .nav-items {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .nav-break {
        display: none;
    }

    .nav-item {
        width: 100%;
    }

    .nav-item a {
        display: block;
        width: 100%;
        padding: 14px 0;
        border-bottom: 1px solid rgba(18, 124, 124, 0.1);
        font-size: 18px;
    }

    .nav-item a::after {
        display: none;
    }

    .nav-menu__contacts {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 28px;
    }

    .nav-menu__phone {
        color: var(--title-color);
        font-size: 19px;
        font-weight: 600;
        text-decoration: none;
    }

    .nav-menu__address {
        color: #666;
        font-size: 15px;
        text-decoration: none;
    }
}

@media (max-width: 768px) {
    .contacts__cta {
        height: 38px;
        padding: 0 16px;
        font-size: 14px;
    }

    .contacts__phone {
        display: none;
    }
}

@media (max-width: 560px) {
    :root {
        --header-h: 64px;
    }

    .header-container {
        width: 92%;
    }

    .logo-text__main {
        font-size: 26px;
    }

    .logo-text__sub {
        font-size: 9.5px;
        letter-spacing: 2px;
    }

    .contacts__social {
        width: 34px;
        height: 34px;
    }

    .contacts__cta {
        height: 36px;
        padding: 0 14px;
        font-size: 13px;
    }

    .hamburger {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 380px) {
    .contacts__cta {
        display: none;
    }

    .nav-menu {
        width: 100%;
    }
}