/* Шапка сайта.
   Компьютер (≥1180): полоса контактов, логотип по центру, меню в одну строку (липкое при прокрутке).
   Планшет (700–1179): полоса контактов, логотип слева, кнопка «Меню» справа, меню выезжает справа.
   Телефон (<700): одна строка — меню | РГВИА | звонок, меню выезжает слева. */

.site-header {
    --header-max: 1350px;
    --header-pad: clamp(16px, 3vw, 32px);
    position: sticky;
    top: var(--header-sticky-top, 0px);
    z-index: 50;
    background: #fff;
    font-family: "Rubik", sans-serif;
}

.site-header.is-scrolled {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.site-topbar__inner,
.site-brand__inner,
.site-header .site-nav__list {
    max-width: var(--header-max);
    margin: 0 auto;
    padding: 0 var(--header-pad);
    box-sizing: border-box;
}

/* ---------- Полоса контактов ---------- */
.site-topbar {
    background: var(--primary-color);
    color: #fff;
    font-size: 13.5px;
}

.site-topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px 24px;
    min-height: 36px;
}

.site-topbar__contacts {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 24px;
}

.site-header .site-topbar a {
    color: #fff;
    border: none;
    opacity: 0.92;
    white-space: nowrap;
}

.site-header .site-topbar a:hover {
    opacity: 1;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.site-topbar i {
    margin-right: 6px;
    opacity: 0.8;
}

.site-topbar__actions {
    display: flex;
    align-items: center;
    gap: 8px 24px;
}

/* Кнопка «Версия для слабовидящих» — как ссылки полосы контактов */
.site-topbar__a11y {
    padding: 0;
    border: none;
    background: none;
    color: #fff;
    font: inherit;
    opacity: 0.92;
    white-space: nowrap;
    cursor: pointer;
}

.site-topbar__a11y:hover {
    opacity: 1;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ---------- Логотип ---------- */
.site-brand__inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-height: 104px;
}

.site-header .site-logo {
    display: flex;
    align-items: center;
    gap: 20px;
    color: #2a2a2a;
    border: none;
    text-decoration: none;
}

.site-logo__emblem {
    display: block;
    width: auto;
    height: 72px;
    margin: 0;
}

.site-logo__name {
    font-family: "Merriweather", serif; /* Playfair Display SC — см. fonts.css */
    font-size: 21px;
    line-height: 1.25;
    letter-spacing: 0.02em;
    color: #2a2a2a;
}

.site-header .site-logo:hover .site-logo__name {
    color: var(--primary-color);
}

.site-logo__short,
.site-burger,
.site-a11y-icon {
    display: none;
}

/* ---------- Меню (компьютер) ---------- */
.site-header .site-nav {
    background: #f4f2ef;
    border-top: 1px solid #e6e2dc;
    border-bottom: 1px solid #e6e2dc;
    padding: 0;
}

.site-header .site-nav__list {
    display: flex;
    justify-content: space-between;
    list-style: none;
    background: none;
}

.site-nav__item {
    position: relative;
    display: flex;
    align-items: stretch;
}

.site-header .site-nav .site-nav__link {
    display: block;
    padding: 15px 2px 15px 8px;
    color: #3a3a3a;
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
    border: none;
}

.site-header .site-nav .site-nav__item:not(.has-children) .site-nav__link {
    padding-right: 8px;
}

.site-header .site-nav .site-nav__item:hover > .site-nav__link,
.site-header .site-nav .site-nav__item.is-open > .site-nav__link,
.site-header .site-nav .site-nav__item.is-active > .site-nav__link {
    color: var(--primary-color);
}

.site-nav__toggle {
    padding: 15px 6px 15px 2px;
    border: none;
    background: none;
    color: #8a8580;
    font-size: 10px;
    cursor: pointer;
}

.site-nav__item:hover .site-nav__toggle,
.site-nav__item.is-open .site-nav__toggle,
.site-nav__item.is-active .site-nav__toggle {
    color: var(--primary-color);
}

.site-nav__toggle i {
    transition: transform 0.2s;
}

.site-nav__item:hover .site-nav__toggle i,
.site-nav__item.is-open .site-nav__toggle i {
    transform: rotate(180deg);
}

.site-header .site-nav__dropdown {
    position: absolute;
    top: 100%;
    left: -12px; /* текст подпунктов — на одной линии с названием пункта */
    z-index: 20;
    display: block;
    min-width: 260px;
    max-width: 360px;
    margin: 0;
    padding: 8px 0;
    list-style: none;
    background: #fff;
    border-radius: 0 0 8px 8px;
    border-top: 3px solid var(--primary-color);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}

.site-nav__item:last-child .site-nav__dropdown,
.site-nav__item:nth-last-child(2) .site-nav__dropdown,
.site-nav__item:nth-last-child(3) .site-nav__dropdown {
    left: auto;
    right: 0;
}

.site-nav__item:hover > .site-nav__dropdown,
.site-nav__item.is-open > .site-nav__dropdown,
.site-nav__item:focus-within > .site-nav__dropdown {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.site-header .site-nav__heading {
    margin: 0 0 6px;
    padding: 6px 20px 10px;
    border-bottom: 1px solid #ece7e1;
    color: var(--primary-color);
    font-family: "Merriweather", serif;
    font-size: 16px;
    white-space: nowrap;
}

.site-header .site-nav__dropdown a {
    display: block;
    padding: 9px 20px;
    color: #333;
    font-size: 15px;
    line-height: 1.35;
    text-transform: none;
    white-space: normal;
    border: none;
}

.site-header .site-nav__dropdown a:hover,
.site-header .site-nav__dropdown a:focus-visible {
    background: #f4f2ef;
    color: var(--primary-color);
}

.site-header .site-nav__dropdown a[aria-current="page"] {
    color: var(--primary-color);
    font-weight: 600;
}

.site-nav__dropdown i,
.site-drawer__sub i {
    margin-left: 4px;
    font-size: 11px;
    opacity: 0.6;
}

/* ---------- Выезжающее меню ---------- */
.site-drawer {
    --drawer-from: 100%;
    position: fixed;
    inset: 0;
    z-index: 100;
    font-family: "Rubik", sans-serif;
}

.site-drawer[hidden] {
    display: none;
}

.site-drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 12, 12, 0.45);
    animation: drawer-fade-in 0.22s ease both;
}

.site-drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(400px, 88vw);
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #cfc6bd transparent;
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.2);
    animation: drawer-slide-in 0.26s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

/* На сенсорных экранах полоса прокрутки и так накладывается поверх и видна только при прокрутке */
@media (hover: none) and (pointer: coarse) {
    .site-drawer__panel {
        scrollbar-width: none;
    }

    .site-drawer__panel::-webkit-scrollbar {
        display: none;
    }
}

.site-drawer.is-closing .site-drawer__backdrop {
    animation: drawer-fade-out 0.2s ease both;
}

.site-drawer.is-closing .site-drawer__panel {
    animation: drawer-slide-out 0.2s ease-in both;
}

@keyframes drawer-slide-in {
    from { transform: translateX(var(--drawer-from)); }
    to { transform: none; }
}

@keyframes drawer-slide-out {
    from { transform: none; }
    to { transform: translateX(var(--drawer-from)); }
}

@keyframes drawer-fade-in {
    from { opacity: 0; }
}

@keyframes drawer-fade-out {
    to { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .site-drawer__panel,
    .site-drawer__backdrop,
    .site-drawer.is-closing .site-drawer__panel,
    .site-drawer.is-closing .site-drawer__backdrop {
        animation-duration: 0.01ms;
    }
}

.site-drawer__head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 10px 10px 20px;
    background: var(--primary-color);
    color: #fff;
}

.site-drawer__title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.site-drawer__close {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
}

.site-drawer__close:hover,
.site-drawer__close:focus-visible {
    background: rgba(255, 255, 255, 0.14);
}

.site-drawer__list,
.site-drawer__sub {
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-drawer__list > li {
    border-bottom: 1px solid #eee;
}

.site-drawer__row {
    display: flex;
    align-items: stretch;
}

.site-drawer .site-drawer__link {
    flex: 1;
    display: block;
    padding: 15px 20px;
    color: #2b2b2b;
    font-size: 16px;
    font-weight: 500;
    border: none;
    text-decoration: none;
}

.site-drawer .site-drawer__item.is-active > .site-drawer__row .site-drawer__link {
    color: var(--primary-color);
    box-shadow: inset 4px 0 0 var(--primary-color);
}

.site-drawer__toggle {
    width: 56px;
    border: none;
    border-left: 1px solid #eee;
    background: none;
    color: #777;
    font-size: 14px;
    cursor: pointer;
}

.site-drawer__toggle i {
    transition: transform 0.2s;
}

.site-drawer__toggle[aria-expanded="true"] i {
    transform: rotate(180deg);
}

.site-drawer__sub {
    padding: 4px 0 10px;
    background: #faf9f7;
}

.site-drawer__sub[hidden] {
    display: none;
}

.site-drawer__heading {
    padding: 10px 20px 6px 32px;
    color: var(--primary-color);
    font-family: "Merriweather", serif;
    font-size: 15px;
}

.site-drawer .site-drawer__sub a {
    display: block;
    padding: 10px 20px 10px 32px;
    color: #444;
    font-size: 15px;
    border: none;
    text-decoration: none;
}

.site-drawer .site-drawer__sub a.is-active {
    color: var(--primary-color);
    font-weight: 600;
}

.site-drawer__contacts {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: auto;
    padding: 20px;
    /* запас снизу: последние ссылки не прилипают к краю экрана и не уходят под панель браузера / полосу жестов */
    padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
    background: #f4f2ef;
    font-size: 14px;
    line-height: 1.35;
}

.site-drawer .site-drawer__contacts a {
    display: flex;
    color: #333;
    border: none;
    text-decoration: none;
}

.site-drawer__contacts i {
    flex: 0 0 18px;
    margin: 2px 8px 0 0;
    color: var(--primary-color);
}

body.menu-open {
    overflow: hidden;
}

/* ---------- Планшет: логотип слева, кнопка «Меню» справа ---------- */
@media (width < 1180px) {
    .site-header .site-nav {
        display: none;
    }

    .site-brand__inner {
        justify-content: flex-start;
        min-height: 84px;
    }

    .site-logo__emblem {
        height: 56px;
    }

        .site-logo__name {
        font-size: 18px;
    }

    .site-burger {
        order: 2;
        display: inline-flex;
        align-items: center;
        gap: 10px;
        margin-left: auto;
        padding: 10px 14px;
        border: 1px solid #e0dbd5;
        border-radius: 8px;
        background: #fff;
        color: var(--primary-color);
        font: inherit;
        font-size: 15px;
        font-weight: 600;
        cursor: pointer;
    }

    .site-burger:hover,
    .site-burger:focus-visible {
        border-color: var(--primary-color);
    }

    .site-burger__lines,
    .site-burger__lines span,
    .site-burger__lines::before,
    .site-burger__lines::after {
        display: block;
        width: 20px;
        height: 2px;
        border-radius: 2px;
        background: currentColor;
    }

    .site-burger__lines {
        position: relative;
        background: none;
    }

    .site-burger__lines::before,
    .site-burger__lines::after {
        content: "";
        position: absolute;
        left: 0;
    }

    .site-burger__lines::before { top: -6px; }
    .site-burger__lines::after { top: 6px; }
}

@media (width < 900px) {
    .site-topbar__extra {
        display: none;
    }
}

/* ---------- Телефон: меню | РГВИА | звонок ---------- */
@media (width < 700px) {
    .site-topbar {
        display: none;
    }

    .site-brand {
        border-bottom: 1px solid var(--primary-color);
    }

    .site-brand__inner {
        display: grid;
        grid-template-columns: 44px 1fr 44px;
        gap: 8px;
        min-height: 60px;
        padding: 0 12px;
    }

    .site-burger {
        order: 0;
        justify-content: center;
        width: 44px;
        height: 44px;
        margin: 0;
        padding: 0;
        border: none;
        border-radius: 50%;
    }

    .site-burger:hover,
    .site-burger:focus-visible {
        background: #f4f2ef;
    }

    .site-burger__text,
    .site-logo__name {
        display: none;
    }

    .site-header .site-logo {
        justify-self: center;
        gap: 10px;
    }

    .site-logo__emblem {
        height: 36px;
    }

    .site-logo__short {
        display: block;
        font-family: "Merriweather", serif;
        font-size: 24px;
        line-height: 1;
        letter-spacing: 0.06em;
        color: var(--primary-color);
    }

    /* справа — «Версия для слабовидящих» (та же ширина, что у кнопки меню: «РГВИА» ровно по центру) */
    .site-a11y-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: 0;
        border: none;
        border-radius: 50%;
        background: none;
        color: var(--primary-color);
        font-size: 20px;
        cursor: pointer;
    }

    .site-a11y-icon:hover,
    .site-a11y-icon:focus-visible {
        background: #f4f2ef;
    }

    .site-drawer {
        --drawer-from: -100%;
    }

    .site-drawer__panel {
        right: auto;
        left: 0;
    }
}
