/* Шапка закреплена поверх страницы; её фон не меняет высоту контента при прокрутке. */
.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    height: 68px;
    background: #c2dc5e url("../assets/header-pattern-desktop-r3.webp") top center / 1440px 68px repeat-x;
}
.header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 200px minmax(0, 1fr);
    height: 68px;
    align-items: center;
    padding-inline: var(--content-inset);
}
.brand-mark { display: block; width: 56px; height: 56px; flex: 0 0 56px; }
.brand-mark img { width: 100%; height: 100%; }
.desktop-nav {
    display: flex;
    height: 24px;
    align-items: center;
    gap: 32px;
    justify-self: center;
    font-size: 16px;
    font-weight: var(--font-weight-bold);
    line-height: 24px;
    white-space: nowrap;
}
.navigation-label {
    color: inherit;
    text-decoration-line: underline;
    text-decoration-color: transparent;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
    transition: color 150ms ease, text-decoration-color 150ms ease;
}
.header-actions {
    display: flex;
    height: 44px;
    align-items: center;
    gap: 12px;
    justify-self: end;
}
.header-cta {
    display: inline-flex;
    width: 214px;
    height: 44px;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    border-radius: 24px;
    color: var(--color-surface-white);
    background: var(--color-brand-strong);
    font-size: 14px;
    font-weight: var(--font-weight-semibold);
    line-height: 20px;
    white-space: nowrap;
    transition: background-color 150ms ease;
}
.social-link {
    position: relative;
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
}
.social-link::before {
    position: absolute;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    content: "";
    transition: background-color 150ms ease;
}
.social-link img { position: relative; z-index: 1; width: 24px; height: 24px; transition: opacity 150ms ease; }
.menu-toggle,
.mobile-nav,
.header-menu-placeholder { display: none; }

.navigation-label:focus-visible {
    color: var(--color-brand-strong);
    text-decoration-color: currentcolor;
    outline: none;
}

.header-cta:focus-visible,
.mobile-nav-cta:focus-visible {
    background: var(--color-action-primary);
    outline: none;
}

.social-link:focus-visible { outline: none; }
.social-link:focus-visible::before { background: var(--color-brand-strong); }

@media (hover: hover) {
    .navigation-label:hover {
        color: var(--color-brand-strong);
        text-decoration-color: currentcolor;
    }

    .header-cta:hover,
    .mobile-nav-cta:hover { background: var(--color-action-primary); }

    .social-link:hover img { opacity: 0.8; }
}

@media (hover: none) {
    .navigation-label:active {
        color: var(--color-brand-strong);
        text-decoration-color: currentcolor;
    }

    .header-cta:active,
    .mobile-nav-cta:active { background: var(--color-action-primary); }

    .social-link:active img { opacity: 0.8; }
}

@media (max-width: 1099px) and (min-width: 900px) {
    .desktop-nav { gap: 18px; }
    .header-actions { margin-left: 24px; }
    .header-cta { width: 192px; margin-right: 0; font-size: 12px; }
    .social-link { display: none; }
}

/* Открытое меню перекрывает viewport, не меняя положение остальных секций. */
@media (max-width: 899px) {
    .site-header,
    .header-inner { height: 72px; }
    .site-header {
        height: var(--header-scroll-offset);
        padding-top: var(--header-safe-area-top);
        background-image: url("../assets/header-pattern-mobile-r3.webp");
        background-position: bottom center;
        background-size: 375px 72px;
    }
    /* Safe area входит в непрозрачный фон шапки; элементы управления занимают отдельные 72 px ниже неё. */
    .header-inner { display: flex; padding-inline: var(--content-inset); }
    .brand-mark { width: 56px; height: 56px; flex-basis: 56px; }
    .brand-mark img { content: url("../assets/bird-mark-mobile.png"); }
    .desktop-nav,
    .social-link { display: none; }
    .header-actions { gap: 8px; margin-left: auto; }
    .header-cta { width: 206px; margin: 0; font-size: 13px; }
    .menu-toggle {
        display: grid;
        width: 44px;
        height: 44px;
        flex: 0 0 44px;
        place-items: center;
        padding: 0;
        border: 0;
        border-radius: 50%;
        color: var(--color-brand-strong);
        background: var(--color-surface-white);
        cursor: pointer;
        font-size: 25px;
        line-height: 1;
    }
    .header-menu-placeholder { display: block; height: var(--header-scroll-offset); }
    /* Шапка и меню используют один viewport даже при блокировке прокрутки страницы. */
    .site-header-menu-open { position: fixed; inset: 0 0 auto; }
    .site-header-menu-open .header-cta { visibility: hidden; }
    .mobile-nav:not([hidden]) {
        position: fixed;
        inset: var(--header-scroll-offset) 0 0;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        padding: 16px var(--content-inset) max(32px, env(safe-area-inset-bottom, 0px));
        background: var(--color-surface-white);
    }
    .mobile-nav > .navigation-label {
        display: flex;
        min-height: 65px;
        align-items: center;
        border-bottom: 1px solid var(--color-canvas-base);
        font-size: 24px;
        font-weight: var(--font-weight-semibold);
        line-height: 32px;
    }
    .mobile-nav-cta {
        display: grid;
        height: 52px;
        place-items: center;
        margin-top: 24px;
        border-radius: 28px;
        color: var(--color-surface-white);
        background: var(--color-brand-strong);
        font-size: 14px;
        font-weight: var(--font-weight-semibold);
        transition: background-color 150ms ease;
    }
    .mobile-socials {
        display: flex;
        flex-direction: column;
        gap: 16px;
        margin-top: 24px;
        color: var(--color-brand-strong);
        font-size: 16px;
        font-weight: var(--font-weight-semibold);
        line-height: 24px;
    }
    .mobile-socials a { display: flex; align-items: center; gap: 12px; }
    .mobile-socials img { width: 24px; height: 24px; flex: 0 0 24px; }
}

@media (max-width: 374px) {
    .header-inner { padding-inline: max(16px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px)); }
    .header-cta { width: 184px; font-size: 12px; }
    .mobile-nav:not([hidden]) { padding-inline: max(16px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px)); }
}
