/* ==========================================================================
   Шапка сайта. Подключается после style.v10.css и переопределяет его.
   Палитра: белый + #0059cd, холодные голубые как акцент.
   Структура: полоса с «северным сиянием» (.site-top) + плавающая карточка-шапка (.site-header).
   ========================================================================== */

:root {
  --nh-blue: #0059cd;
  --nh-blue-dark: #00419a;
  --nh-ice: #eef4ff;
  --nh-ice-2: #dce9ff;
  --nh-ink: #14213d;
  --nh-aurora: linear-gradient(90deg, #0059cd 0%, #2f8cff 38%, #9fd0ff 70%, rgba(159, 208, 255, 0) 100%);
}

/* ---------- Верхняя полоса: сияние, выбор города, соцсети ---------- */

.site-top {
  position: relative;
  padding: 10px 24px 48px;
  text-align: center;
}

/* мягкое северное сияние, внизу растворяется в фоне страницы */
.site-top::before {
  content: "";
  position: absolute;
  inset: 0;
  background-color: #e6f0ff;
  background-image:
    radial-gradient(28% 220% at 10% -20%, rgba(0, 89, 205, 0.34), transparent 70%),
    radial-gradient(26% 200% at 38% 100%, rgba(76, 196, 255, 0.55), transparent 70%),
    radial-gradient(28% 220% at 66% -30%, rgba(0, 89, 205, 0.24), transparent 70%),
    radial-gradient(26% 200% at 92% 100%, rgba(150, 130, 255, 0.36), transparent 70%);
  background-size: 200% 100%;
  animation: nh-aurora 28s ease-in-out infinite alternate;
  -webkit-mask-image: linear-gradient(#000 45%, transparent);
  mask-image: linear-gradient(#000 45%, transparent);
  pointer-events: none;
}

@keyframes nh-aurora {
  from { background-position: 0% 0; }
  to { background-position: 100% 0; }
}

.city {
  position: relative;
  z-index: 1;
  display: inline-block;
  padding: 0;
  background: none;
}

.city__switch {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--nh-ice-2), 0 6px 16px -8px rgba(0, 53, 125, 0.35);
}

.city a {
  margin: 0;
  padding: 3px 16px;
  border-radius: 999px;
  color: var(--nh-ink);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.02em;
  text-decoration: none;
  opacity: 1;
  transition: background-color 0.2s, color 0.2s;
}

.city a:hover {
  color: var(--nh-blue);
  background: var(--nh-ice);
}

.city a.active,
.city a.active:hover {
  font-weight: 600;
  text-decoration: none;
  color: #fff;
  background: var(--nh-blue);
  box-shadow: 0 3px 10px -3px rgba(0, 89, 205, 0.6);
}

.site-top__socials {
  position: absolute;
  z-index: 1;
  top: 9px;
  right: max(24px, calc((100% - 1768px) / 2 + 24px));
  padding: 0;
  gap: 6px;
  background: none;
}

/* иконки — белые svg на синем круге */
.site-top .header-socials a,
.site-header .header-socials a {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: var(--nh-blue);
  background-size: 15px 15px;
  box-shadow: 0 4px 10px -4px rgba(0, 89, 205, 0.55);
  transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.site-top .header-socials a:hover,
.site-header .header-socials a:hover {
  transform: translateY(-2px);
  background-color: var(--nh-blue-dark);
  box-shadow: 0 8px 14px -6px rgba(0, 89, 205, 0.7);
}

/* ---------- Плавающая карточка-шапка ---------- */

.site-header {
  position: sticky;
  top: 10px;
  z-index: 50;
  width: calc(100% - 32px);
  max-width: 1768px;
  margin: -34px auto 0;
  padding: 0;
  border-radius: 22px;
  background: #fff;
  /* нет backdrop-filter/transform: иначе position:fixed у мобильного меню привяжется к шапке */
  box-shadow: 0 1px 0 rgba(0, 89, 205, 0.08), 0 14px 40px -14px rgba(0, 53, 125, 0.4), 0 2px 8px rgba(0, 53, 125, 0.06);
}

/* холодное свечение внутри карточки */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(ellipse 520px 120px at 96% 0%, rgba(0, 89, 205, 0.07), transparent 70%),
    radial-gradient(ellipse 380px 90px at 4% 100%, rgba(159, 208, 255, 0.2), transparent 70%);
  pointer-events: none;
}


.site-header .container {
  position: relative;
  max-width: none;
  padding: 0 22px;
}

/* три колонки: логотип | меню | телефоны. Крайние равны (1fr), поэтому меню строго по центру шапки */
.site-header__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 16px;
  min-height: 78px;
}

.site-header__brand {
  justify-self: start;
  display: block;
  line-height: 0;
}

.site-header .header-logo {
  width: 180px;
  height: auto;
  transition: transform 0.25s ease;
}

.site-header__brand:hover .header-logo {
  transform: translateY(-1px);
}

/* ---------- Меню-капсула ---------- */

.site-nav {
  justify-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  padding: 4px;
  border-radius: 999px;
  background: var(--nh-ice);
  box-shadow: inset 0 0 0 1px rgba(0, 89, 205, 0.07);
}

.site-nav > a,
.site-nav #btnGroupDrop1 {
  position: relative;
  padding: 8px 14px;
  border-radius: 999px;
  background: transparent;
  color: var(--nh-ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.site-nav > a:hover,
.site-nav #btnGroupDrop1:hover,
.site-nav #btnGroupDrop1.show {
  color: var(--nh-blue);
  background: #fff;
  box-shadow: 0 3px 10px -3px rgba(0, 53, 125, 0.28);
}

.site-nav > a.is-active,
.site-nav > a.is-active:hover {
  color: #fff;
  font-weight: 600;
  background: var(--nh-blue);
  box-shadow: 0 6px 14px -6px rgba(0, 89, 205, 0.8);
}

.site-nav #btnGroupDrop1 {
  flex: none;
  border: 0;
}

.site-nav #btnGroupDrop1::after {
  margin-left: 7px;
  border-top-width: 5px;
  border-right-width: 4px;
  border-left-width: 4px;
  vertical-align: 2px;
  transition: transform 0.2s;
}

.site-nav #btnGroupDrop1.show::after {
  transform: rotate(180deg);
}

.site-header .dropdown-menu {
  min-width: 240px;
  margin-top: 14px !important;
  padding: 8px;
  border: 1px solid rgba(0, 89, 205, 0.1);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 40px -12px rgba(0, 53, 125, 0.3);
}

.site-header .dropdown-menu .dropdown-item {
  margin: 0;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--nh-ink);
  font-size: 14px;
  font-weight: 500;
  white-space: normal;
  transition: background-color 0.15s, color 0.15s;
}

.site-header .dropdown-menu .dropdown-item:hover,
.site-header .dropdown-menu .dropdown-item:focus {
  margin: 0;
  color: var(--nh-blue);
  background: var(--nh-ice);
}

/* ---------- Телефоны и кнопка входа ---------- */

.site-header__contact {
  justify-self: end;
  display: flex;
  align-items: center;
}

.site-header__contact .header-phones {
  display: grid;
  grid-template-columns: 38px auto;
  column-gap: 10px;
  align-items: center;
}

.site-header__contact .header-phones::before {
  content: "";
  grid-row: 1 / span 2;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--nh-ice) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%230059cd' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 16.9v3a2 2 0 0 1-2.2 2 19.8 19.8 0 0 1-8.6-3.1 19.5 19.5 0 0 1-6-6A19.8 19.8 0 0 1 2.1 4.2 2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1 1 .4 1.9.7 2.8a2 2 0 0 1-.5 2.1L8.1 9.9a16 16 0 0 0 6 6l1.3-1.3a2 2 0 0 1 2.1-.4c.9.3 1.8.6 2.8.7a2 2 0 0 1 1.7 2z'/%3E%3C/svg%3E") center / 18px no-repeat;
}

.site-header__contact .header-phone {
  color: var(--nh-ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s;
}

.site-header__contact .header-phone:hover {
  color: var(--nh-blue);
}

/* ---------- Адаптив (десктоп): освобождаем место ---------- */

@media (min-width: 1131px) and (max-width: 1499px) {
  .site-header .header-logo {
    width: 160px;
  }
  .site-nav > a,
  .site-nav #btnGroupDrop1 {
    padding: 8px 11px;
  }
}

@media (min-width: 1131px) and (max-width: 1399px) {
  .site-header .header-logo {
    width: 150px;
  }
  .site-nav > a,
  .site-nav #btnGroupDrop1 {
    padding: 8px 10px;
    font-size: 13.5px;
  }
}

/* на узком десктопе крайним колонкам не хватает места под иконку телефона */
@media (min-width: 1131px) and (max-width: 1299px) {
  .site-header__contact .header-phones {
    grid-template-columns: auto;
  }
  .site-header__contact .header-phones::before {
    display: none;
  }
  .site-header .container {
    padding: 0 16px;
  }
  .site-nav > a,
  .site-nav #btnGroupDrop1 {
    padding: 8px 8px;
    font-size: 13px;
  }
}

/* ---------- Подменю раздела (.header-bottom) ----------
   Разметка лежит в шаблонах разделов, здесь только оформление.
   Скрипт в header.php переносит .header-bottom внутрь .site-header: подменю становится
   второй строкой плавающей шапки и прилипает вместе с ней.
   На ≤1130px скрывается правилом из style.v10.css (те же пункты есть в мобильном меню). */

/* пока скрипт не перенёс блок, не показываем его под шапкой (иначе мелькнёт и прыгнет) */
.js .header-bottom:not(.is-docked) {
  display: none;
}

.site-header .header-bottom {
  position: relative;
  z-index: 3;
  margin: 0;
  padding: 0 22px;
  background: none;
}

/* тонкий разделитель между основной строкой и подменю */
.site-header .header-bottom::before {
  content: "";
  position: absolute;
  top: 0;
  left: 22px;
  right: 22px;
  height: 1px;
  background: var(--nh-ice-2);
}

.site-header .header-bottom .container {
  max-width: none;
  padding: 0;
}

.site-header .header-bottom .header-bottom-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 10px 0 12px;
}

.site-header .header-bottom .header-bottom-links a {
  position: relative;
  margin: 0;
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--nh-ice);
  color: var(--nh-ink);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  opacity: 1;
  box-shadow: none;
  transition: color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.site-header .header-bottom .header-bottom-links a:hover {
  background: var(--nh-ice-2);
  color: var(--nh-blue);
  opacity: 1;
  transform: none;
  box-shadow: none;
}

/* текущий пункт: класс зависит от шаблона, поддерживаем частые варианты */
.site-header .header-bottom .header-bottom-links a.active,
.site-header .header-bottom .header-bottom-links a.is-active,
.site-header .header-bottom .header-bottom-links a.current,
.site-header .header-bottom .header-bottom-links a[aria-current] {
  background: var(--nh-blue);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 14px -6px rgba(0, 89, 205, 0.8);
}

@media (prefers-reduced-motion: reduce) {
  .site-header .header-bottom .header-bottom-links a {
    transition: none;
  }
}

/* ---------- Мобильная шапка (≤1130px, как в style.v10.css) ---------- */

.site-header .mobile-menu-button {
  display: none;
}

@media (max-width: 1130px) {
  .site-nav.header-links-desktop,
  .site-header__contact.header-links-desktop,
  .site-top__socials {
    display: none;
  }

  .site-top {
    padding: 8px 12px 40px;
  }

  .city a {
    padding: 3px 12px;
  }

  .site-header {
    top: 8px;
    width: calc(100% - 20px);
    margin-top: -28px;
    border-radius: 18px;
  }

  .site-header .container {
    padding: 0 14px;
  }

  .site-header__inner {
    display: flex;
    min-height: 62px;
  }

  .site-header .header-logo {
    width: 130px;
  }

  /* бургер в потоке шапки, а не fixed: не налезает на полосу города */
  .site-header .mobile-menu-button {
    display: block;
    position: relative;
    top: auto;
    right: auto;
    z-index: 100;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    margin-left: auto;
    border-radius: 50%;
    background: var(--nh-ice);
    cursor: pointer;
    transition: background-color 0.2s;
  }

  .site-header .mobile-menu-button:hover,
  .site-header .mobile-menu-button.open {
    background: var(--nh-ice-2);
  }

  .site-header .mobile-menu-button span,
  .site-header .mobile-menu-button.open span:nth-child(n) {
    position: absolute;
    left: 12px;
    display: block;
    width: 20px;
    height: 2px;
    margin: 0;
    border-radius: 2px;
    background: var(--nh-blue);
    transform-origin: center;
    transition: transform 0.25s ease, opacity 0.2s, width 0.25s ease, top 0.25s ease;
  }

  .site-header .mobile-menu-button span:nth-child(1) { top: 15px; }
  .site-header .mobile-menu-button span:nth-child(2) { top: 21px; width: 14px; }
  .site-header .mobile-menu-button span:nth-child(3) { top: 27px; }

  .site-header .mobile-menu-button.open span:nth-child(1) {
    top: 21px;
    transform: rotate(45deg);
  }
  .site-header .mobile-menu-button.open span:nth-child(2) {
    opacity: 0;
    width: 20px;
  }
  .site-header .mobile-menu-button.open span:nth-child(3) {
    top: 21px;
    transform: rotate(-45deg);
  }

  /* раскрытое меню: оверлей из style.v10.css, меняем только оформление */
  .site-header .header-links-mobile {
    padding: 96px 28px 40px;
    background:
      radial-gradient(ellipse 80% 260px at 100% 0%, rgba(0, 89, 205, 0.1), transparent 70%),
      #fff;
    text-align: left;
  }

  .site-header .header-links-mobile > a {
    margin: 0;
    padding: 14px 0;
    border-bottom: 1px solid var(--nh-ice-2);
    color: var(--nh-ink);
    font-size: 18px;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    transition: color 0.2s, padding-left 0.2s;
  }

  /* style.v10.css красит .header-links a::before синим при hover — здесь заливка не нужна */
  .site-header .header-links-mobile a::before {
    display: none;
  }

  .site-header .header-links-mobile a:hover {
    color: var(--nh-blue);
    background: none;
  }

  .site-header .header-links-mobile > a:hover {
    padding-left: 6px;
  }

  .site-header .header-links-mobile > div:not(:last-child) {
    width: 100%;
    padding: 4px 0 4px 14px;
    border-left: 2px solid var(--nh-blue);
    margin: 6px 0 8px;
  }

  .site-header .header-links-mobile .sub-link {
    margin: 0 !important;
    padding: 8px 0;
    border: 0;
    text-align: left;
    font-size: 15px;
    font-weight: 500;
    opacity: 0.75;
  }

  .site-header .header-links-mobile > div:last-child {
    width: 100%;
    margin-top: 28px;
  }

  .site-header .header-links-mobile .header-socials {
    justify-content: center;
    gap: 14px;
    margin-bottom: 18px;
    background: none;
  }

  .site-header .header-links-mobile .header-socials a {
    width: 40px;
    height: 40px;
    background-size: 20px 20px;
  }

  .site-header .header-links-mobile .header-phones {
    justify-content: center;
    gap: 6px 22px;
  }

  .site-header .header-links-mobile .header-phone {
    width: auto;
    color: var(--nh-ink);
    font-size: 16px;
    font-weight: 600;
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-header *,
  .city a {
    transition: none !important;
  }
  .site-top::before {
    animation: none;
  }
}
