/* Шапка сайта (вставка через header.js + header.html). Подключать после css/site.css */

/* Над лендингом и внутри .page-shell (блог, услуги): шапка поверх hero и без обрезки меню */
.page-shell #main-header {
  position: relative;
  z-index: 2000;
  width: 100%;
  flex-shrink: 0;
  /* Пока грузится header.html — не схлопывать ленту в ноль (меньше «прыжка») */
  min-height: 64px;
  box-sizing: border-box;
}

.page-shell .new-header-container {
  position: sticky;
  top: 0;
  z-index: 2000;
  overflow: visible;
}

.page-shell .new-header-inner {
  overflow: visible;
}

.page-shell > main {
  position: relative;
  z-index: 0;
}

.element .element-TOP #main-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 500;
  width: 100%;
  pointer-events: auto;
  isolation: isolate;
}

.new-header-container {
  width: 100%;
  background: #fff;
  position: relative;
  z-index: 1000;
  box-shadow: 0 1px 0 rgba(13, 27, 42, 0.06);
}

.new-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 20px;
  /* Flex: центральная зона (flex:1) заполняет ровно пространство между логотипом и правым блоком;
     меню внутри — по центру этой зоны, отступы слева/справа от текста визуально равны (как в макете). */
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0 20px;
}

.new-header-logo {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #0d1b2a;
}

/* Полоса по горизонтали: только между логотипом и телефоном/кнопкой */
.new-header-nav-center {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.new-header-logo .logo-text {
  font-family: "Manrope", "Inter", system-ui, sans-serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.new-header-logo .logo-icon {
  width: 20px;
  height: 20px;
  border: 2px solid #d32f2f;
  border-radius: 4px;
  flex: 0 0 auto;
}

.new-header-nav {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: center;
  gap: calc(24px * 1.2);
  min-width: 0;
  white-space: nowrap;
}

.new-header-nav .nav-link {
  font-family: "Manrope", "Inter", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  font-weight: 500;
  color: #0d1b2a;
  text-decoration: none;
  transition: color 0.2s;
  white-space: nowrap;
}

/* Пункт «Услуги» — не ссылка, открытие по hover / на touch */
.new-header-nav .nav-dropdown__label {
  display: inline-block;
  font-family: "Manrope", "Inter", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  font-weight: 500;
  color: #0d1b2a;
  cursor: default;
  user-select: none;
}

.new-header-nav .nav-link:hover,
.new-header-nav .nav-link:focus-visible,
.new-header-nav .nav-dropdown__label:hover,
.new-header-nav .nav-dropdown__label:focus-visible {
  color: #2b7fff;
  text-decoration: none;
}

.new-header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 24px;
  min-width: 0;
}

.new-header-actions .phone-link {
  font-family: "Manrope", "Inter", system-ui, sans-serif;
  font-size: 1.125rem;
  line-height: 1.6;
  font-weight: 700;
  color: #0d1b2a;
  text-decoration: none;
  white-space: nowrap;
}

.new-header-actions .phone-link:hover,
.new-header-actions .phone-link:focus-visible {
  text-decoration: none;
  color: #2b7fff;
}

.new-header-actions .login-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #3448f0;
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  font-family: "Manrope", "Inter", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.4;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
  white-space: nowrap;
}

.new-header-actions .login-btn:hover,
.new-header-actions .login-btn:focus-visible {
  background: #2a38d6;
  color: #fff;
  text-decoration: none;
}

.new-header-actions .login-btn svg {
  flex: 0 0 auto;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding-top: 10px;
  min-width: 300px;
  z-index: 200;
}

.nav-dropdown-menu-inner {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 8, 72, 0.12);
  padding: 8px 0;
}

.nav-dropdown-menu a {
  display: block;
  padding: 10px 20px;
  font-family: "Manrope", "Inter", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  font-weight: 500;
  color: #0d1b2a;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.15s;
}

.nav-dropdown-menu a:hover,
.nav-dropdown-menu a:focus-visible {
  background: rgba(43, 127, 255, 0.08);
  text-decoration: none;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.active .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  display: block;
}

.header-mobile-toggle {
  display: none;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid rgba(13, 27, 42, 0.12);
  background: #fff;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
}

.header-mobile-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #0d1b2a;
  position: relative;
}

.header-mobile-toggle span::before,
.header-mobile-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
  width: 22px;
  height: 2px;
  background: #0d1b2a;
  transition: transform 0.2s ease;
}

.header-mobile-toggle span::before {
  top: -6px;
}

.header-mobile-toggle span::after {
  top: 6px;
}

.header-mobile-toggle.active span {
  background: transparent;
}

.header-mobile-toggle.active span::before {
  transform: translateY(6px) rotate(45deg);
}

.header-mobile-toggle.active span::after {
  transform: translateY(-6px) rotate(-45deg);
}

.header-mobile-panel {
  display: none;
  width: 100%;
  background: #fff;
  padding: 20px;
  border-top: 1px solid rgba(13, 27, 42, 0.08);
}

.header-mobile-panel.open {
  display: block;
}

.mobile-nav {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.mobile-nav .nav-link {
  font-family: "Manrope", "Inter", system-ui, sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: #0d1b2a;
  text-decoration: none;
}

.mobile-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mobile-actions .phone-link {
  font-family: "Manrope", "Inter", system-ui, sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #0d1b2a;
  text-decoration: none;
}

.mobile-actions .login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #3448f0;
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-family: "Manrope", "Inter", system-ui, sans-serif;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
}

/* До 900px — компактные экраны и телефоны: бургер. 901–~1280px — полоса ссылок, иначе на многих ноутбуках
   вместо меню показывался только бургер (брейкпоинт 1024px был слишком «широким»). */
@media (max-width: 1200px) and (min-width: 901px) {
  .new-header-nav {
    gap: calc(16px * 1.2);
  }

  .new-header-nav .nav-link,
  .new-header-nav .nav-dropdown__label {
    font-size: 0.9375rem;
    line-height: 1.6;
  }

  .new-header-actions {
    gap: 12px;
  }

  .new-header-actions .phone-link {
    font-size: 1.0625rem;
    line-height: 1.6;
  }

  .new-header-actions .login-btn {
    padding: 8px 14px;
    font-size: 0.9375rem;
  }
}

@media (max-width: 900px) {
  .new-header-inner {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  .new-header-nav-center,
  .new-header-actions {
    display: none;
  }

  .header-mobile-toggle {
    display: inline-flex;
  }
}
