/* ============================================================================
 * Шапка сайта — стеклянная «капсула» (разметка: tools/site_header.py)
 * Над тёмным hero — тёмное стекло и светлый текст (.on-dark, ставит script.js),
 * над светлым контентом — светлое матовое стекло.
 * ========================================================================== */
.sh {
  --fg: #0b1424; --fg2: #34435a; --hover: rgba(15, 30, 60, .06); --accent: #1976d2;
  position: fixed; top: 10px; left: 0; right: 0; z-index: 1000;
  padding: 0 16px; pointer-events: none;
  font-family: 'Inter', Arial, sans-serif;
}
.sh.on-dark { --fg: #fff; --fg2: rgba(255, 255, 255, .8); --hover: rgba(255, 255, 255, .12); --accent: #6fb2ff; }
.sh a { text-decoration: none; }
.sh svg { display: block; }

.sh-bar {
  pointer-events: auto;
  max-width: 1360px; height: 64px; margin: 0 auto;
  display: flex; align-items: center; gap: 20px; padding: 0 8px 0 22px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(244, 246, 250, .16) 0%, rgba(244, 246, 250, .66) 100%);
  backdrop-filter: blur(24px) saturate(1.5); -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .35);
  transition: background .3s, border-color .3s;
}
.sh.on-dark .sh-bar {
  background: linear-gradient(180deg, rgba(10, 18, 32, .10) 0%, rgba(10, 18, 32, .42) 100%);
  border-color: rgba(255, 255, 255, .14);
}
/* браузеры без backdrop-filter — просто плотнее фон */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .sh-bar { background: rgba(246, 248, 251, .96); }
  .sh.on-dark .sh-bar { background: rgba(10, 18, 32, .82); }
}

/* Логотип текстом */
.sh-logo {
  font: 900 19px/1 'Montserrat', 'Segoe UI', sans-serif; letter-spacing: .6px;
  color: var(--fg); white-space: nowrap; transition: color .3s;
}
.sh-logo span { color: #1976d2; transition: color .3s; }
.sh.on-dark .sh-logo span { color: #6fb2ff; }

/* Пункты меню */
.sh-nav { display: flex; align-items: center; gap: 2px; margin: 0 auto; }
.sh-nav > a, .sh-drop-btn {
  display: flex; align-items: center; gap: 4px; height: 40px; padding: 0 14px; border-radius: 11px;
  font: 500 14.5px 'Inter', sans-serif; color: var(--fg2); background: none; border: 0; cursor: pointer;
  white-space: nowrap; transition: background .15s, color .15s;
}
.sh-nav > a:hover, .sh-drop:hover > .sh-drop-btn, .sh-drop.open > .sh-drop-btn,
.sh-nav > a:focus-visible, .sh-drop-btn:focus-visible { background: var(--hover); color: var(--fg); outline: none; }
.sh-nav > a.is-active, .sh-drop-btn.is-active { color: var(--fg); font-weight: 600; }
.sh-nav > a.is-active::after, .sh-drop-btn.is-active::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin-left: 6px;
}
.sh-drop-btn.is-active::before { order: 3; }
.sh .chev { width: 14px; height: 14px; transition: transform .2s; }
.sh-drop { position: relative; }
.sh-drop:hover .chev, .sh-drop.open .chev { transform: rotate(180deg); }

/* Выпадающие панели (Услуги, Контакты). Они внутри .sh-bar, а у него свой backdrop-filter —
   вложенное размытие браузеры не применяют, поэтому фон почти непрозрачный, иначе текст страницы просвечивает */
.sh-mega, .sh-pop {
  position: absolute; top: calc(100% + 14px);
  padding: 10px; border-radius: 18px; color: #0b1424;
  background: rgba(255, 255, 255, .985);
  border: 1px solid rgba(15, 30, 60, .07); box-shadow: 0 24px 60px rgba(8, 20, 40, .18);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
.sh-mega::before, .sh-pop::before { content: ''; position: absolute; left: 0; right: 0; top: -16px; height: 16px; }
.sh-mega { left: 50%; width: 620px; transform: translate(-50%, 8px); display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.sh-pop { right: -40px; width: 360px; transform: translateY(8px); }
.sh-drop:hover .sh-mega, .sh-drop.open .sh-mega { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.sh-drop:hover .sh-pop, .sh-drop.open .sh-pop { opacity: 1; pointer-events: auto; transform: none; }
.sh-mega a, .sh-pop .row { display: flex; gap: 12px; align-items: center; padding: 11px 12px; border-radius: 12px; color: #0b1424; }
.sh-mega a { align-items: flex-start; }
.sh-mega a:hover, .sh-pop a.row:hover { background: rgba(25, 118, 210, .07); }
.sh-mega .mi, .sh-pop .mi {
  width: 40px; height: 40px; border-radius: 11px; background: #e8f1fd; color: #1976d2;
  display: grid; place-items: center; flex-shrink: 0;
}
.sh-pop .mi { width: 38px; height: 38px; }
.sh-mega .mi svg { width: 20px; height: 20px; }
.sh-pop .mi svg { width: 18px; height: 18px; }
.sh-mega b, .sh-pop b { display: block; font-size: 14px; font-weight: 600; margin-bottom: 2px; color: #0b1424; }
.sh-pop .row.big b { font-size: 17px; letter-spacing: .2px; }
.sh-mega small, .sh-pop small { font-size: 12.5px; color: #5b6b7d; line-height: 1.4; }
.sh-pop small a { color: #1976d2; font-weight: 600; }
.sh-pop small a:hover { text-decoration: underline; }
.sh-mega .foot {
  grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: #f2f5fa; border-radius: 12px; padding: 12px 14px; font-size: 13px; color: #5b6b7d;
}
.sh-mega .foot a { padding: 0; color: #1976d2; font-weight: 600; white-space: nowrap; }
.sh-mega .foot a:hover { background: none; text-decoration: underline; }
.sh-pop .pop-foot { display: flex; gap: 8px; margin-top: 6px; }
.sh-pop .pop-foot > * {
  flex: 1; height: 42px; border-radius: 12px; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font: 600 13.5px 'Inter', sans-serif; background: #f2f5fa;
}
.sh-pop .pop-foot > [hidden] { display: none; }
.sh-pop .pop-foot .all { color: #1976d2; }
.sh-pop .pop-foot .all:hover { background: #e3eefc; }
.sh-pop .pop-foot .chat { color: #0b1424; }
.sh-pop .pop-foot .chat:hover { background: #e9edf3; }

/* Правая часть: язык, вход, заявка */
.sh-actions { display: flex; align-items: center; gap: 4px; }
.sh-icon {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  color: var(--fg2); background: none; border: 0; cursor: pointer;
  font: 700 12.5px 'Inter', sans-serif; transition: background .15s, color .15s;
}
.sh-icon:hover, .sh-icon:focus-visible { background: var(--hover); color: var(--fg); outline: none; }
.sh-icon svg { width: 19px; height: 19px; }
.sh-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sh-user { position: relative; }
.sh-login.is-auth svg { display: none; }
.sh-avatar[hidden] { display: none; }
.sh-avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: #1976d2; color: #fff; font: 700 13px 'Inter', sans-serif;
}
.sh-user-menu {
  top: calc(100% + 14px); width: 230px;
  background: rgba(255, 255, 255, .985);
  border: 1px solid rgba(15, 30, 60, .07); border-radius: 16px;
  box-shadow: 0 24px 60px rgba(8, 20, 40, .18);
}

/* Кнопка «Оставить заявку» — графит */
.sh-cta {
  height: 40px; padding: 0 6px 0 12px; margin-left: 6px; border-radius: 500px;
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
  background: linear-gradient(180deg, #1f2a3d, #0e1626); color: #fff;
  font: 600 13.5px 'Inter', sans-serif;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 6px 16px rgba(8, 15, 28, .28);
  transition: transform .15s, box-shadow .15s;
}
.sh-cta:hover { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 10px 22px rgba(8, 15, 28, .34); }
.sh-cta .cta-ic { font-size: 15px; line-height: 1; }
.sh-cta .cta-go { width: 26px; height: 26px; border-radius: 50%; background: #1976d2; color: #fff; display: grid; place-items: center; transition: background .15s; }
.sh-cta .cta-go svg { width: 13px; height: 13px; }
.sh-cta:hover .cta-go { background: #3d9bff; }

/* Бургер */
.sh-burger { display: none; }
.sh-burger .ic-close { display: none; }
.sh-burger.open .ic-open { display: none; }
.sh-burger.open .ic-close { display: block; }

/* Мобильное меню — стеклянная панель под капсулой */
.sh-mob {
  pointer-events: auto; max-width: 1360px; margin: 8px auto 0; border-radius: 18px; overflow: hidden;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(24px) saturate(1.5); -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .6); box-shadow: 0 24px 60px rgba(8, 20, 40, .18);
  max-height: 0; opacity: 0; visibility: hidden;
  transition: max-height .3s ease, opacity .2s, visibility 0s .3s;
}
.sh-mob.open {
  max-height: calc(100dvh - 96px); opacity: 1; visibility: visible; overflow-y: auto; overscroll-behavior: contain;
  transition: max-height .3s ease, opacity .2s, visibility 0s;
}
.sh-mob nav { padding: 8px; display: grid; }
.sh-mob nav a { padding: 13px 14px; border-radius: 12px; font: 500 16px 'Inter', sans-serif; color: #0b1424; }
.sh-mob nav a:hover, .sh-mob nav a.is-active { background: rgba(25, 118, 210, .07); color: #1976d2; }
.sh-mob-label { padding: 13px 14px 4px; font: 500 16px 'Inter', sans-serif; color: #0b1424; }
.sh-mob .sub { padding-left: 14px; display: grid; }
.sh-mob .sub a { font-size: 14.5px; color: #5b6b7d; padding: 9px 14px; }
.sh-mob-user { border-top: 1px solid rgba(15, 30, 60, .08); padding: 8px; }
.sh-mob-user[hidden] { display: none; }
.sh-mob-user .mob-user-trigger {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px; border: 0; border-radius: 12px;
  background: none; cursor: pointer; font-family: inherit; text-align: left;
}
.sh-mob-user .mob-user-trigger:hover { background: rgba(15, 30, 60, .05); }
.sh-mob-user .mob-u-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: #1976d2; color: #fff;
  display: grid; place-items: center; font-weight: 700; flex-shrink: 0;
}
.sh-mob-user .mob-u-info { flex: 1; display: grid; }
.sh-mob-user .mob-u-name { font-weight: 600; font-size: 15px; color: #0b1424; }
.sh-mob-user .mob-u-label { font-size: 12.5px; color: #5b6b7d; }
.sh-mob-user .mob-user-trigger.open .chev { transform: rotate(180deg); }
.sh-mob-user .mob-user-menu { background: none; padding: 0 0 4px; }
.sh-mob-user .mob-user-menu a, .sh-mob-user .mob-user-menu button { border-radius: 10px; }
.sh-mob .mob-foot { display: grid; gap: 8px; padding: 12px; border-top: 1px solid rgba(15, 30, 60, .08); }
.sh-mob .mob-foot .sh-cta { margin: 0; height: 48px; padding: 0 8px 0 16px; font-size: 15px; justify-content: flex-start; }
.sh-mob .mob-foot .sh-cta .cta-go { margin-left: auto; width: 32px; height: 32px; }
.sh-mob .mob-row { display: flex; gap: 8px; }
.sh-mob .mob-row > * {
  flex: 1; height: 44px; border-radius: 12px; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: rgba(15, 30, 60, .05); color: #0b1424; font: 600 14px 'Inter', sans-serif;
}
.sh-mob .mob-row svg { width: 16px; height: 16px; }

/* Затемнение под открытым мобильным меню */
.sh-backdrop {
  position: fixed; inset: 0; z-index: 999; background: rgba(5, 12, 24, .35);
  opacity: 0; visibility: hidden; transition: opacity .25s, visibility 0s .25s;
}
html.sh-menu-open .sh-backdrop { opacity: 1; visibility: visible; transition: opacity .25s, visibility 0s; }
html.sh-menu-open, html.sh-menu-open body { overflow: hidden; }
/* открытое меню — поверх чата (1300) и баннера cookie (9999) */
html.sh-menu-open .sh { z-index: 10001; }
html.sh-menu-open .sh-backdrop { z-index: 10000; }

/* Шапка сама подстраивается под число пунктов (script.js измеряет, помещаются ли они):
   .sh-compact — плотнее, .sh-tight — кнопка заявки сворачивается до значка, .sh-burger-mode — бургер */
.sh.sh-compact .sh-nav > a, .sh.sh-compact .sh-drop-btn { padding: 0 9px; font-size: 14px; }
.sh.sh-compact .sh-bar { gap: 12px; padding-left: 18px; }
.sh.sh-tight .sh-bar .sh-cta .cta-txt { display: none; }
.sh.sh-tight .sh-bar .sh-cta { padding: 0 6px; }
.sh.sh-burger-mode .sh-nav, .sh.sh-burger-mode .sh-lang, .sh.sh-burger-mode .sh-user { display: none; }
.sh.sh-burger-mode .sh-burger { display: grid; }
.sh.sh-burger-mode .sh-actions { margin-left: auto; }
@media (max-width: 1080px) {
  .sh-nav, .sh-lang, .sh-user { display: none; }
  .sh-burger { display: grid; }
  .sh-actions { margin-left: auto; }
  .sh-bar { height: 58px; padding: 0 6px 0 18px; }
}
@media (min-width: 1081px) {
  .sh:not(.sh-burger-mode) .sh-mob, .sh:not(.sh-burger-mode) + .sh-backdrop { display: none; }
}
@media (max-width: 480px) {
  .sh { padding: 0 10px; top: 8px; }
  .sh-bar .sh-cta { display: none; }
  .sh-logo { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  .sh *, .sh-backdrop { transition: none !important; }
}
