.site-header {
	position: sticky;
	top: 0;
	z-index: 100;
	width: 100%;
	max-width: none;
	min-height: 96px;
	padding: 14px clamp(20px, 5vw, 72px);
	background: #fcf8f0;
	border-bottom: 1px solid #dfd9ce;
	box-shadow: 0 5px 18px #302c2910;
}

.site-header .brand { flex: 0 0 auto; }
.site-header .official-logo { display: block; width: clamp(190px, 20vw, 260px); max-width: none; height: auto; }
.site-header .header-menu { position: relative; }
.site-header .header-menu > summary,
.site-header .header-search > summary {
	min-height: 48px;
	display: inline-flex;
	align-items: center;
	padding: 10px 14px;
	border: 1px solid #d7cbbc;
	border-radius: 6px;
	background: #fffdf9;
	font-size: 16px;
	cursor: pointer;
}
.site-header .header-menu > summary::marker,
.site-header .header-search > summary::marker { content: ""; }
.site-header .header-menu > summary::after { content: ""; width: 6px; height: 6px; margin-left: 12px; color: #fe0000; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); }
.site-header .header-menu[open] > summary::after { transform: translateY(2px) rotate(225deg); }
.site-header #primary-navigation {
	position: absolute;
	top: 100%;
	left: 0;
	min-width: 240px;
	display: flex;
	flex-direction: column;
	gap: 0;
	padding: 8px;
	border: 1px solid #e2d8ca;
	border-radius: 8px;
	background: #fffdf9;
	box-shadow: 0 12px 28px #302c2920;
}
.site-header #primary-navigation a { padding: 12px 14px; border-radius: 5px; font-size: 16px; }
.site-header #primary-navigation a:hover,
.site-header #primary-navigation a:focus-visible { background: #f2e9db; }
.site-header .header-search { position: relative; }
.site-header .header-link { min-height: 48px; display: inline-flex; align-items: center; font-size: 16px; }
.site-header summary:focus-visible,
.site-header a:focus-visible { outline: 3px solid #fe0000; outline-offset: 3px; }

@media (max-width: 620px) {
	.site-header { min-height: 78px; gap: 8px; padding: 10px 16px; }
	.site-header .header-menu > summary,
	.site-header .header-search > summary { min-height: 48px; padding: 9px 10px; font-size: 14px; }
	.site-header .header-menu > summary::after { margin-left: 5px; }
	.site-header #primary-navigation { left: auto; right: 0; top: calc(100% + 10px); min-width: min(280px, calc(100vw - 32px)); }
	.site-header .header-link { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.site-header, .site-header * { scroll-behavior: auto; }
}

@media (max-width: 620px) {
    .site-header .header-menu { position: static; }
    .site-header #primary-navigation { left: 16px; right: 16px; top: 100%; }
}
html { scroll-padding-top: 140px; }

.site-header .official-logo {
    width: clamp(118px, 15vw, 168px);
    aspect-ratio: 5 / 3;
    mix-blend-mode: multiply;
    object-fit: contain;
}
@media (max-width: 620px) {
    .site-header .brand { flex: 0 1 118px; min-width: 0; }
    .site-header .official-logo { width: 100%; max-width: 118px; aspect-ratio: auto; }
    .site-header .header-menu,
    .site-header .header-search:not([open]) { flex-shrink: 0; }
}
.site-header { padding-block: 8px; }
.site-header .header-menu[open] #primary-navigation { animation: oil-menu-in 160ms ease-out; }
@keyframes oil-menu-in {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .site-header .header-menu[open] #primary-navigation { animation: none; }
}

.site-header .nav-stations { display: none; }
@media (max-width: 620px) {
    .site-header .nav-stations { display: block; }
    html { scroll-padding-top: 105px; }
}
.site-header #primary-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.site-header #primary-navigation .sub-menu { padding-left: 14px; }
.site-header #primary-navigation li > a { display: block; overflow-wrap: anywhere; }
.site-header #primary-navigation { max-height: min(65vh, 440px); overflow-y: auto; }
body.admin-bar .site-header { top: 32px; }
body.admin-bar { scroll-padding-top: 172px; }
@media (min-width: 601px) and (max-width: 782px) {
    body.admin-bar .site-header { top: 46px; }
}
@media (max-width: 600px) {
    body.admin-bar .site-header { top: 0; }
}
/* Keep navigation in view while the search field is open. */
.site-header .header-search[open] {
 position:static; display:flex; align-items:center; gap:8px;
 flex:1 1 360px; min-width:0; max-width:560px;
}
.site-header .header-search[open] > summary {
 flex:none; font-size:0; width:44px; min-height:44px; justify-content:center; padding:0;
}
.site-header .header-search[open] > summary::after { content:"×"; font-size:26px; line-height:1; }
.header-search-panel { flex:1; min-width:0; }
.header-search[open]::details-content { flex:1; min-width:0; }
.site-header:has(.header-search[open]) #primary-navigation { z-index:4; }
@media(max-width:900px) {
 .site-header:has(.header-search[open]) { flex-wrap:wrap; }
 .site-header .header-search[open] { order:1; flex:1 0 100%; max-width:none; }
}
.header-search-form { display:flex; width:min(850px,100%); margin:0 auto; gap:8px; }
.header-search-form input { min-width:0; flex:1; height:48px; padding:0 14px; border:1px solid #8b7b6b; border-radius:7px; background:#fff; font:inherit; color:#302c29; }

@media (max-width: 360px) {
    .site-header .header-menu > summary,
    .site-header .header-search:not([open]) > summary {
        padding-inline: 6px;
    }
}
.header-search-form button { min-height:48px; padding:0 18px; border:0; border-radius:7px; background:#fe0000; color:white; }
.header-search-results { position:absolute; top:100%; left:clamp(20px,5vw,72px); right:clamp(20px,5vw,72px); max-height:min(55vh,360px); overflow:auto; background:#fffdf9; border:1px solid #ded5c7; border-radius:0 0 10px 10px; box-shadow:0 10px 20px #302c2926; }
.header-search-results { max-height: max(0px, min(55vh, 360px, calc(100dvh - 100% - 4px))); }
.header-search-results[hidden] { display:none; }
.header-search-results a, .header-search-results p { display:block; padding:12px 16px; margin:0; color:#302c29; text-decoration:none; }
.header-search-results a:hover, .header-search-results a:focus { background:#f2e9db; outline-offset:-3px; }
.screen-reader-text { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
@media(max-width:620px) {


 .header-search-form button { padding:0 10px; font-size:14px; }
 .header-search-results { left:12px; right:12px; }
}

/* Меню на компьютере */
@media (min-width: 1200px) {

    .site-header .header-menu {
        position: static;
        flex: 1 1 auto;
        min-width: 0;
    }

    /* Убираем кнопку "Разделы" */
    .site-header .header-menu > summary {
        display: none;
    }

    /* Показываем все разделы горизонтально */
    .site-header #primary-navigation {
        position: static;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 16px;
        min-width: 0;
        max-height: none;
        overflow: visible;
        padding: 0;
        border: none;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        animation: none;
    }

    .site-header #primary-navigation > ul {
        display: flex;
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
        gap: 16px;
    }

.site-header #primary-navigation a {
    padding: 10px 0;
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
}

    /* Освобождаем место при открытии поиска */
    .site-header:has(.header-search[open]) .header-menu {
        display: none;
    }
}
