/* ==========================================================================
   Шапка — плавающая стеклянная панель
   Стекло (backdrop-filter) висит на ::before, а не на самой панели:
   иначе панель стала бы «backdrop root», и выпадающие меню внутри неё
   не смогли бы размывать то, что под ними.
   ========================================================================== */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  padding: 12px var(--gutter) 0;
  pointer-events: none;
}

.header-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 20px;
  max-width: calc(var(--container) + 2 * var(--s-10));
  height: 72px;
  margin-inline: auto;
  padding: 0 14px 0 24px;
  border-radius: 14px 6px 14px 6px;
  pointer-events: auto;
  transition: transform .45s var(--ease-out), height var(--t-base) var(--ease-out);
}
.header-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(120deg, rgba(16, 31, 52, .72), rgba(11, 22, 38, .6));
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .09),
    inset 0 1px 0 rgba(255, 255, 255, .06),
    0 10px 40px rgba(0, 0, 0, .16);
  transition: background-color var(--t-base), box-shadow var(--t-base);
}
/* тонкий блик триколора по нижней кромке */
.header-bar::after {
  content: "";
  position: absolute;
  left: 30px;
  right: 30px;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--g-tricolor);
  opacity: .0;
  transition: opacity var(--t-base);
}

.site-header.is-scrolled .header-bar { height: 64px; }
.site-header.is-scrolled .header-bar::before {
  background: linear-gradient(120deg, rgba(14, 27, 46, .9), rgba(10, 20, 35, .86));
}
.site-header.is-scrolled .header-bar::after { opacity: .55; }
.site-header.is-hidden .header-bar { transform: translateY(calc(-100% - 20px)); }

/* --- Логотип ------------------------------------------------------------ */
.header-logo {
  display: flex;
  align-items: center;
  flex: none;
  text-decoration: none;
}
.header-logo img { width: auto; height: 40px; }

/* --- Навигация ---------------------------------------------------------- */
.header-nav { margin-inline: auto; min-width: 0; }
.header-nav > ul {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.header-nav li { position: relative; flex: none; }
.header-nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--shape-chip);
  background: transparent;
  color: var(--c-heading);
  font: 600 15px/1.2 var(--f-text);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--t-fast), color var(--t-fast);
}
.header-nav__caret {                 /* значок «есть выпадающее меню» */
  flex: none;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 4px 2px 4px 2px;
  background: rgba(255, 255, 255, .07);
  transition: background-color var(--t-fast), color var(--t-fast), border-radius var(--t-base) var(--ease-out);
}
.header-nav__caret svg { width: 14px; height: 14px; transition: transform var(--t-base) var(--ease-out); }
.header-nav__link.is-active .header-nav__caret { background: rgba(192, 51, 44, .12); }
.header-nav__link:hover .header-nav__caret,
.has-sub.is-open .header-nav__caret { background: var(--c-blue); color: #fff; }
.header-nav__link:hover { background: rgba(255, 255, 255, .07); }
.header-nav__link.is-active { color: var(--c-red-400); }
.header-nav__link.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: var(--g-tricolor);
  box-shadow: 0 0 0 .5px var(--c-line);
  transform: translateX(-50%);
}

/* выпадающее меню — своё стекло */
.submenu {
  position: absolute;
  top: calc(100% + 18px);
  left: 50%;
  min-width: 240px;
  padding: 8px;
  border-radius: var(--shape-card);
  background: rgba(14, 27, 46, .92);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .09), var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 10px);
  transition: opacity var(--t-base) var(--ease-out), transform var(--t-base) var(--ease-out), visibility var(--t-base);
}
.submenu::before {              /* «мостик», чтобы меню не закрывалось при переходе мышью */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -20px;
  height: 20px;
}
.submenu ul { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.has-sub:hover .submenu,
.has-sub:focus-within .submenu,
.has-sub.is-open .submenu {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}
.has-sub:hover .header-nav__caret svg,
.has-sub.is-open .header-nav__caret svg { transform: rotate(180deg); }

.submenu__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 8px 3px 8px 3px;
  color: var(--c-heading);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color var(--t-fast), transform var(--t-base) var(--ease-out);
}
.submenu__link:hover { background: var(--c-accent-soft); transform: translateX(3px); }
.submenu__link.is-active { color: var(--c-red-400); }
.submenu__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px 3px 8px 3px;
  background: var(--c-accent-soft);
  color: var(--c-accent);
  transition: background-color var(--t-fast), color var(--t-fast);
}
.submenu__icon svg { width: 17px; height: 17px; }
.submenu__link:hover .submenu__icon { background: var(--c-blue); color: #fff; }
.submenu__all {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 0 0;
  padding: 12px 14px 6px;
  border-top: 1px solid var(--c-line);
  font-size: 14px;
  font-weight: 700;
  color: var(--c-accent);
  text-decoration: none;
}
.submenu__all svg { width: 16px; height: 16px; transition: transform var(--t-base) var(--ease-out); }
.submenu__all:hover svg { transform: translateX(4px); }
.submenu__all.is-active { color: var(--c-red-400); }
.submenu__flag { flex: none; width: 30px; height: 20px; border-radius: 3px 2px 3px 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }

/* --- Правая часть ------------------------------------------------------- */
.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: none;
}
.header-messengers { display: flex; gap: 6px; }
.header-cta { min-height: 44px; }
.header-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 7px 4px 7px 4px;
  background: rgba(255, 255, 255, .05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1);
  color: var(--c-heading);
  transition: background-color var(--t-fast), color var(--t-fast), transform var(--t-base) var(--ease-out), border-radius var(--t-base) var(--ease-out);
}
.header-icon svg { width: 20px; height: 20px; }
.header-icon:hover { color: #fff; transform: translateY(-2px); }
.header-icon--whatsapp:hover { background: #25D366; }
.header-icon--telegram:hover { background: #229ED9; }
.header-icon--max:hover { background: linear-gradient(135deg, #2F7BFF, #8A3FFC); }

.header-phone {
  display: grid;
  line-height: 1.15;
  text-decoration: none;
  color: var(--c-heading);
}
.header-phone b { font-family: var(--f-display); font-size: 16px; font-weight: 700; white-space: nowrap; }
.header-phone small { font-size: 11px; color: var(--c-text-muted); }
.header-phone:hover b { color: var(--c-accent); }

/* --- Бургер ------------------------------------------------------------- */
.burger {
  display: none;
  position: relative;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 8px 3px 8px 3px;
  background: var(--c-blue);
  cursor: pointer;
}
.burger span {
  position: absolute;
  left: 13px;
  right: 13px;
  height: 2px;
  border-radius: 2px;
  background: #fff;
  transition: transform var(--t-base) var(--ease-out), opacity var(--t-fast);
}
.burger span:nth-child(1) { top: 15px; }
.burger span:nth-child(2) { top: 21px; right: 20px; }
.burger span:nth-child(3) { top: 27px; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* --- Мобильное меню (тёмное стекло) ------------------------------------- */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow-y: auto;
  padding: 104px var(--gutter) 32px;
  background: rgba(8, 22, 38, .72);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  backdrop-filter: blur(24px) saturate(160%);
  color: #fff;
  pointer-events: auto;
  opacity: 0;
  transition: opacity var(--t-base) var(--ease-out);
}
.mobile-menu.is-open { opacity: 1; }
.mobile-menu__inner { display: grid; gap: 32px; max-width: 560px; margin-inline: auto; }
.mobile-menu nav { display: grid; gap: 4px; }
.mobile-menu__link {
  padding: 10px 0;
  font-family: var(--f-display);
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}
.mobile-menu__link.is-active,
.mobile-menu__sublink.is-active { color: var(--c-red-400); }
.mobile-menu__group {
  margin: 16px 0 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--c-on-dark-faint);
}
.mobile-menu__sub { display: grid; gap: 2px; }
.mobile-menu__sublink {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--c-on-dark);
  text-decoration: none;
}
.mobile-menu__icon { flex: none; width: 20px; height: 20px; color: var(--c-accent); }
.mobile-menu__all { color: var(--c-accent); font-weight: 700; }
.mobile-menu__sublink img { border-radius: 4px 1px 4px 1px; }
.mobile-menu__contacts {
  display: grid;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--c-on-dark-line);
}
.mobile-menu__phone { font-family: var(--f-display); font-size: 28px; font-weight: 700; color: #fff; text-decoration: none; }
.mobile-menu__hours { font-size: 14px; color: var(--c-on-dark-muted); }
.mobile-menu__msgs { display: flex; gap: 8px; }
.mobile-menu .btn { width: 100%; }

html.menu-open { overflow: hidden; }
html.menu-open .site-header .header-bar { transform: none; }

/* --- Адаптив ------------------------------------------------------------ */
@media (max-width: 1380px) {
  .header-phone { display: none; }
}
@media (max-width: 1200px) {
  .header-nav,
  .header-messengers { display: none; }
  .burger { display: block; }
  .header-actions { margin-left: auto; }
}
@media (max-width: 480px) {
  .site-header { padding: 8px 8px 0; }
  .header-bar { height: 64px; padding-left: 16px; }
  .header-logo img { height: 34px; }
  .header-cta { display: none; }
}
