/* =====================================================================
   Уніфікований хедер сайту nikoservice.com
   Базується на index.html. Підключається на всіх сторінках для
   забезпечення однакового вигляду шапки.
   ===================================================================== */

:root {
  --sh-blue: #1E4A8C;
  --sh-blue-light: #2B62B8;
  --sh-blue-pale: #E8EFF9;
  --sh-gray: #6B7280;
  --sh-gray-dark: #374151;
  --sh-gray-900: #111827;
  --sh-white: #FFFFFF;
  --sh-accent: #FF6B35;
  --sh-border: #E5E7EB;
  /* Поверхні шапки (перевизначаються у theme.css для темної теми).
     Тут — світлі фолбеки на випадок, якщо theme.css не підключено. */
  --sh-surface: #FFFFFF;
  --sh-surface-2: #F3F4F6;
}

/* ── HEADER — single row, compact */
header.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center;
  height: 60px; padding: 0 36px; gap: 24px;
  background: var(--sh-surface);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 1px 10px rgba(0,0,0,0.06);
  font-family: 'Geologica', sans-serif;
}
header.site-header *, header.site-header *::before, header.site-header *::after {
  box-sizing: border-box;
}
header.site-header .logo-wrap { display: flex; align-items: center; flex-shrink: 0; text-decoration: none; }
header.site-header .logo-img { height: 44px; width: auto; display: block; }

/* Navigation — right of logo */
header.site-header .header-nav { display: flex; align-items: center; gap: 0; flex: 1; }
header.site-header .header-nav a {
  font-family: 'Unbounded', sans-serif; font-size: 9.5px; font-weight: 500;
  color: var(--sh-gray-dark); text-decoration: none; letter-spacing: 0.04em;
  padding: 0 13px; height: 60px; display: flex; align-items: center;
  border-bottom: 2px solid transparent; white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}
header.site-header .header-nav a:hover { color: var(--sh-blue); border-bottom-color: var(--sh-blue); }
header.site-header .header-nav a.active { color: var(--sh-blue); border-bottom-color: var(--sh-blue); }

/* Right side: contacts + CTA */
header.site-header .header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto; }
header.site-header .h-phones { display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
header.site-header .h-phone-desktop {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: 'Unbounded', sans-serif; font-weight: 600; font-size: 11px;
  color: var(--sh-blue); letter-spacing: 0.02em; white-space: nowrap;
}
header.site-header .h-phone-icon {
  display: none; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--sh-blue); color: #fff;
  text-decoration: none; flex-shrink: 0;
  transition: opacity 0.2s;
}
header.site-header .h-phone-icon:hover { opacity: 0.85; }
header.site-header .h-phone-icon svg { width: 17px; height: 17px; fill: currentColor; }
header.site-header .h-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px;
  text-decoration: none; transition: transform 0.15s, opacity 0.15s; flex-shrink: 0;
}
header.site-header .h-icon:hover { transform: scale(1.12); opacity: 0.85; }
header.site-header .h-icon.wa { background: #25D366; }
header.site-header .h-icon.tg { background: #2AABEE; }
header.site-header .h-icon.vb { background: #7360F2; }

header.site-header .btn-free-measure {
  background: var(--sh-accent); color: var(--sh-white); border: none; border-radius: 6px;
  padding: 8px 14px; font-family: 'Unbounded', sans-serif; font-size: 9px;
  font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  cursor: pointer; transition: background 0.2s, transform 0.15s;
  text-decoration: none; display: inline-block; white-space: nowrap; flex-shrink: 0;
}
header.site-header .btn-free-measure:hover { background: #e5561f; transform: translateY(-1px); }

/* Burger */
header.site-header .burger {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  cursor: pointer; padding: 6px; background: none; border: none; flex-shrink: 0;
}
header.site-header .burger span {
  display: block; width: 22px; height: 2px;
  background: var(--sh-gray-900); border-radius: 2px; transition: all 0.3s;
}

/* Mobile menu */
.site-mobile-menu {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--sh-surface); z-index: 300; flex-direction: column;
  padding: 20px 24px 40px; overflow-y: auto;
  font-family: 'Geologica', sans-serif;
}
.site-mobile-menu.open { display: flex; }
.site-mobile-menu .mobile-menu-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.site-mobile-menu .mobile-menu-close {
  background: none; border: none; font-size: 1.6rem;
  cursor: pointer; color: var(--sh-gray-900); line-height: 1;
}
.site-mobile-menu a {
  font-family: 'Unbounded', sans-serif; font-size: 1rem; font-weight: 600;
  color: var(--sh-gray-900); text-decoration: none; padding: 15px 0;
  border-bottom: 1px solid var(--sh-border); letter-spacing: 0.02em;
  display: block;
}
.site-mobile-menu a:hover { color: var(--sh-blue); }
.site-mobile-menu .mobile-contacts {
  display: flex; align-items: center; gap: 10px; margin-top: 28px; flex-wrap: wrap;
  border-bottom: none; padding: 0;
}
.site-mobile-menu .mobile-contacts a { padding: 0; border-bottom: none; }
.site-mobile-menu .mobile-phone-link {
  font-family: 'Unbounded', sans-serif; font-weight: 700; font-size: 1rem;
  color: var(--sh-blue); text-decoration: none;
  padding: 0; border-bottom: none;
}
.site-mobile-menu .h-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px;
  text-decoration: none; flex-shrink: 0;
}
.site-mobile-menu .h-icon.wa { background: #25D366; }
.site-mobile-menu .h-icon.tg { background: #2AABEE; }
.site-mobile-menu .h-icon.vb { background: #7360F2; }
.site-mobile-menu .btn-free-measure {
  background: var(--sh-accent); color: var(--sh-white); border: none; border-radius: 6px;
  padding: 14px 24px; font-family: 'Unbounded', sans-serif; font-size: 12px;
  font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  text-decoration: none; display: inline-block; white-space: nowrap;
}

/* Desktop responsive */
@media (max-width: 1400px) {
  header.site-header { padding: 0 20px; gap: 16px; }
  header.site-header .header-nav a { padding: 0 9px; font-size: 8.5px; }
  header.site-header .btn-free-measure { font-size: 8px; padding: 8px 10px; }
}
/* Вузький десктоп: стовпчик телефонів ховаємо, лишаємо круглу іконку */
@media (max-width: 1150px) {
  header.site-header .h-phones { display: none; }
  header.site-header .h-phone-icon { display: inline-flex; }
}
/* Tablet + landscape phone: nav hidden, burger shown */
@media (max-width: 1024px) {
  header.site-header .header-nav { display: none; }
  header.site-header .btn-free-measure { display: none; }
  header.site-header .h-phone-desktop { display: none; }
  header.site-header { padding: 0 14px; gap: 10px; }
  header.site-header .burger { display: flex; order: -1; }
  header.site-header .logo-wrap { order: 0; }
  header.site-header .logo-img { height: 40px; }
  header.site-header .h-phone-icon { display: inline-flex; }
}
/* Моб.: месенджер-іконки (WhatsApp/Telegram/Viber) у хедері ховаємо — вони
   розширювали шапку за правий край екрану. Знизу вже є липка панель
   «Подзвонити / WhatsApp / Viber», тож доступ до звʼязку зберігається. */
@media (max-width: 768px) {
  header.site-header .h-icon { display: none; }
}
/* Portrait phone */
@media (max-width: 600px) {
  header.site-header { height: 52px; padding: 0 12px; }
  header.site-header .logo-img { height: 36px; }
}
@media (max-width: 380px) {
  header.site-header { height: 48px; }
  header.site-header .logo-img { height: 32px; }
}
/* Landscape phone — height-based */
@media (max-height: 500px) and (orientation: landscape) {
  header.site-header { height: 48px; padding: 0 14px; }
  header.site-header .header-nav { display: none; }
  header.site-header .btn-free-measure { display: none; }
  header.site-header .burger { display: flex; order: -1; }
  header.site-header .logo-wrap { order: 0; }
  header.site-header .logo-img { height: 34px; }
  header.site-header .h-phone-desktop { display: none; }
}

/* ── Перемикач мови UA | RU */
header.site-header .lang-switch {
  display: inline-flex; align-items: center; gap: 0;
  font-family: 'Unbounded', sans-serif; font-size: 10px; font-weight: 600;
  background: var(--sh-surface-2); border-radius: 6px; padding: 3px; flex-shrink: 0;
  letter-spacing: 0.04em;
}
header.site-header .lang-switch a {
  display: inline-block; padding: 4px 8px; border-radius: 4px;
  color: var(--sh-gray-dark); text-decoration: none; transition: background 0.15s, color 0.15s;
}
header.site-header .lang-switch a.active {
  background: var(--sh-blue); color: #fff;
}
header.site-header .lang-switch a:hover:not(.active) {
  color: var(--sh-blue);
}
@media (max-width: 1400px) {
  header.site-header .lang-switch { font-size: 9px; }
  header.site-header .lang-switch a { padding: 3px 6px; }
}
@media (max-width: 380px) {
  header.site-header .lang-switch a { padding: 3px 5px; }
}

.site-mobile-menu .mobile-lang-switch {
  display: inline-flex; gap: 0; margin-top: 20px; padding: 4px;
  background: var(--sh-surface-2); border-radius: 8px; border-bottom: none;
  align-self: flex-start;
}
.site-mobile-menu .mobile-lang-switch a {
  display: inline-block; padding: 8px 14px; font-family: 'Unbounded', sans-serif;
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
  color: var(--sh-gray-dark); text-decoration: none; border-radius: 5px;
  border-bottom: none;
}
.site-mobile-menu .mobile-lang-switch a.active {
  background: var(--sh-blue); color: #fff;
}

/* Spacer для не-головних сторінок (компенсує fixed header) */
body.has-site-header {
  padding-top: 60px;
}
@media (max-width: 600px) {
  body.has-site-header { padding-top: 52px; }
}
@media (max-width: 380px) {
  body.has-site-header { padding-top: 48px; }
}

/* ── Dropdown menus (desktop) */
header.site-header .header-nav .nav-item { position: relative; display: flex; align-items: stretch; }
header.site-header .header-nav .nav-item::after {
  content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 14px;
  pointer-events: none;
}
header.site-header .header-nav .nav-item:hover::after,
header.site-header .header-nav .nav-item.open::after { pointer-events: auto; }
header.site-header .header-nav .nav-item > a { display: flex; align-items: center; }
header.site-header .header-nav .nav-item .caret {
  display: inline-block; margin-left: 5px; width: 8px; height: 8px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px); transition: transform .25s ease;
}
header.site-header .header-nav .nav-item.open > a .caret,
header.site-header .header-nav .nav-item:hover > a .caret { transform: rotate(-135deg) translate(-2px, -2px); }
header.site-header .nav-dropdown {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%) translateY(-8px);
  min-width: 240px; background: var(--sh-surface); border: 1px solid var(--sh-border);
  border-top: 3px solid var(--sh-blue);
  border-radius: 0 0 12px 12px; box-shadow: 0 18px 40px rgba(13,42,85,0.18);
  padding: 8px 0; opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .22s ease, transform .28s cubic-bezier(.2,.7,.3,1), visibility .22s;
  z-index: 110;
}
header.site-header .nav-dropdown::before {
  content: ''; position: absolute; top: -3px; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--sh-blue) 25%, var(--sh-blue) 75%, transparent);
}
header.site-header .header-nav .nav-item:hover .nav-dropdown,
header.site-header .header-nav .nav-item:focus-within .nav-dropdown,
header.site-header .header-nav .nav-item.open .nav-dropdown {
  opacity: 1; visibility: visible; pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
header.site-header .nav-dropdown a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px; height: auto; border: none;
  font-family: 'Geologica', sans-serif; font-size: 13px; font-weight: 400;
  color: var(--sh-gray-dark); text-decoration: none; letter-spacing: 0;
  white-space: nowrap; transition: background .15s, color .15s, padding-left .2s;
}
header.site-header .nav-dropdown a:hover {
  background: var(--sh-blue-pale); color: var(--sh-blue);
  padding-left: 22px; border: none;
}
header.site-header .nav-dropdown .dd-sep { height: 1px; background: var(--sh-border); margin: 6px 12px; }
header.site-header .nav-dropdown .dd-icon {
  width: 18px; height: 18px; flex-shrink: 0; opacity: .65;
  display: inline-flex; align-items: center; justify-content: center;
}
header.site-header .nav-dropdown a:hover .dd-icon { opacity: 1; }
@media (max-width: 1100px) {
  header.site-header .header-nav .nav-item .caret { display: none; }
  header.site-header .nav-dropdown { display: none !important; }
}

/* ── Іконка кошика в хедері ──────────────────────────────── */
header.site-header .h-cart {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 9px; color: var(--sh-blue);
  text-decoration: none; flex-shrink: 0; transition: background .18s, color .18s;
}
header.site-header .h-cart:hover { background: var(--sh-blue-pale); color: var(--sh-blue-light); }
header.site-header .h-cart-badge {
  position: absolute; top: 1px; right: 0; min-width: 17px; height: 17px; padding: 0 4px;
  background: #FF6B35; color: #fff; border-radius: 9px; font-family: 'Geologica', sans-serif;
  font-size: 11px; font-weight: 600; line-height: 17px; text-align: center;
  box-shadow: 0 0 0 2px #fff; pointer-events: none;
}
header.site-header .h-cart-badge[hidden] { display: none; }

/* ── Випадаюче вікно кошика при наведенні (desktop) ──────── */
header.site-header .h-cart-wrap { position: relative; display: inline-flex; }
header.site-header .h-cart-mini {
  position: absolute; top: calc(100% + 10px); right: 0; width: 340px; max-width: calc(100vw - 24px);
  background: var(--sh-surface); border: 1px solid var(--sh-border); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(17,24,39,.16); padding: 14px 16px 16px;
  font-family: 'Geologica', sans-serif; color: var(--sh-gray-dark);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
  z-index: 120;
}
/* «Місток» — щоб курсор не втрачав hover у проміжку між іконкою та вікном */
header.site-header .h-cart-mini::before {
  content: ''; position: absolute; top: -10px; left: 0; right: 0; height: 10px;
}
/* Маленька стрілочка-вказівник угорі праворуч */
header.site-header .h-cart-mini::after {
  content: ''; position: absolute; top: -6px; right: 13px; width: 11px; height: 11px;
  background: var(--sh-surface); border-left: 1px solid var(--sh-border); border-top: 1px solid var(--sh-border);
  transform: rotate(45deg);
}
/* Показуємо лише коли в кошику є товари і пристрій підтримує hover */
@media (hover: hover) {
  header.site-header .h-cart-wrap.has-items:hover .h-cart-mini,
  header.site-header .h-cart-wrap.has-items:focus-within .h-cart-mini {
    opacity: 1; visibility: visible; transform: translateY(0);
  }
}
/* Рівноправні дропдауни хедера (пошук + міні-кошик стоять поряд, обидва праворуч):
   наведений елемент виграє, інший згортається — щоб не накладались і водночас
   обидва були однаково доступні. Доповнюється координацією в site-search.js
   (наведення на кошик примусово згортає пошук, який міг лишитись .open). */
/* Наведено пошук → ховаємо міні-кошик */
header.site-header .site-search:hover ~ .h-cart-wrap .h-cart-mini {
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translateY(-6px) !important;
  pointer-events: none !important;
}
/* Наведено кошик → згортаємо вікно пошуку та його результати */
header.site-header .header-right:has(.h-cart-wrap:hover) .site-search-form,
header.site-header .header-right:has(.h-cart-wrap:hover) .site-search-results {
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translateY(-8px) !important;
  pointer-events: none !important;
}
header.site-header .h-cart-mini-items {
  max-height: 320px; overflow-y: auto; margin: 0 -16px; padding: 0 16px;
}
header.site-header .h-cart-mini-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--sh-border);
}
header.site-header .h-cart-mini-row:first-child { padding-top: 2px; }
header.site-header .h-cart-mini-img {
  width: 46px; height: 46px; flex-shrink: 0; border-radius: 8px; object-fit: cover;
  background: var(--sh-surface-2); border: 1px solid var(--sh-border);
}
header.site-header .h-cart-mini-info { flex: 1; min-width: 0; }
header.site-header .h-cart-mini-name {
  font-size: 12.5px; font-weight: 500; line-height: 1.35; color: var(--sh-gray-900);
  text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
header.site-header .h-cart-mini-name:hover { color: var(--sh-blue); }
header.site-header .h-cart-mini-meta { font-size: 11.5px; color: var(--sh-gray); margin-top: 3px; }
header.site-header .h-cart-mini-line {
  font-size: 12.5px; font-weight: 600; color: var(--sh-gray-900); white-space: nowrap; flex-shrink: 0;
}
header.site-header .h-cart-mini-ask { font-weight: 500; color: var(--sh-accent); }
header.site-header .h-cart-mini-del {
  flex-shrink: 0; width: 24px; height: 24px; padding: 0; margin-left: -2px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: #9CA3AF; cursor: pointer;
  border-radius: 6px; font-size: 18px; line-height: 1; transition: color .15s, background .15s;
}
header.site-header .h-cart-mini-del:hover { color: #EF4444; background: #FEECEC; }
header.site-header .h-cart-mini-del:focus-visible { outline: 2px solid var(--sh-blue); outline-offset: 1px; }
header.site-header .h-cart-mini-total {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  margin-top: 12px; padding-top: 4px;
}
header.site-header .h-cart-mini-total-label { font-size: 12.5px; color: var(--sh-gray); }
header.site-header .h-cart-mini-total-val {
  font-size: 16px; font-weight: 700; color: var(--sh-gray-900); font-family: 'Geologica', sans-serif;
}
header.site-header .h-cart-mini-btn {
  display: block; margin-top: 12px; padding: 11px 14px; text-align: center;
  background: var(--sh-blue); color: #fff; border-radius: 9px; text-decoration: none;
  font-size: 13px; font-weight: 600; letter-spacing: .01em; transition: background .18s;
}
header.site-header .h-cart-mini-btn:hover { background: var(--sh-blue-light); }
/* Мобільний пункт «Кошик» */
.site-mobile-menu .mm-cart { display: inline-flex; align-items: center; gap: 8px; }
.site-mobile-menu .mm-cart-badge {
  position: static; box-shadow: none; display: inline-flex; align-items: center; justify-content: center;
}
.site-mobile-menu .mm-cart-badge[hidden] { display: none; }

/* ── Тост «Додано до кошика» ─────────────────────────────── */
.niko-cart-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: #111827; color: #fff; padding: 13px 22px; border-radius: 10px;
  font-family: 'Geologica', sans-serif; font-size: 14px; font-weight: 500;
  box-shadow: 0 12px 34px rgba(0,0,0,.28); z-index: 9999; opacity: 0;
  transition: opacity .3s ease, transform .3s ease; pointer-events: none; max-width: 90vw;
}
.niko-cart-toast.show { opacity: 1; transform: translate(-50%, 0); }
.niko-cart-toast::before { content: '✓ '; color: #34D399; font-weight: 700; }

/* Mobile menu dropdowns (accordion) */
.site-mobile-menu .mm-group { display: flex; flex-direction: column; }
.site-mobile-menu .mm-group > .mm-trigger {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
}
.site-mobile-menu .mm-group > .mm-trigger .mm-caret {
  display: inline-block; width: 9px; height: 9px;
  border-right: 1.7px solid currentColor; border-bottom: 1.7px solid currentColor;
  transform: rotate(45deg); transition: transform .25s ease; margin-left: 10px;
}
.site-mobile-menu .mm-group.open > .mm-trigger .mm-caret { transform: rotate(-135deg); }
.site-mobile-menu .mm-sub {
  display: none; flex-direction: column; padding-left: 18px;
  border-left: 2px solid var(--sh-blue-pale); margin: 2px 0 6px 12px;
}
.site-mobile-menu .mm-group.open > .mm-sub { display: flex; }
.site-mobile-menu .mm-sub a {
  font-size: 14px !important; font-weight: 400 !important;
  padding: 8px 12px !important;
}

/* ── Вкладені flyout-підменю у випадаючому списку (desktop) */
header.site-header .nav-dropdown .dd-group { position: relative; }
header.site-header .nav-dropdown .dd-group-trigger {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px; height: auto;
  font-family: 'Geologica', sans-serif; font-size: 13px; font-weight: 400;
  color: var(--sh-gray-dark); text-decoration: none; letter-spacing: 0;
  white-space: nowrap; cursor: pointer; border: none;
  transition: background .15s, color .15s;
}
header.site-header .nav-dropdown .dd-arrow {
  width: 6px; height: 6px; flex-shrink: 0; margin-left: auto;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(-45deg); opacity: .5;
}
header.site-header .nav-dropdown .dd-group:hover > .dd-group-trigger,
header.site-header .nav-dropdown .dd-group.fly-open > .dd-group-trigger {
  background: var(--sh-blue-pale); color: var(--sh-blue);
}
header.site-header .nav-dropdown .dd-group:hover > .dd-group-trigger .dd-arrow,
header.site-header .nav-dropdown .dd-group.fly-open > .dd-group-trigger .dd-arrow { opacity: 1; }
header.site-header .nav-dropdown .dd-flyout {
  position: absolute; top: -11px; left: 100%;
  min-width: 240px; background: var(--sh-surface);
  border: 1px solid var(--sh-border); border-top: 3px solid var(--sh-blue);
  border-radius: 0 12px 12px 12px; box-shadow: 0 18px 40px rgba(13,42,85,0.18);
  padding: 8px 0; opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateX(-10px);
  transition: opacity .2s ease, transform .24s cubic-bezier(.2,.7,.3,1), visibility .2s;
  z-index: 130; max-height: calc(100vh - 90px); overflow-y: auto;
}
header.site-header .nav-dropdown .dd-group:hover > .dd-flyout,
header.site-header .nav-dropdown .dd-group.fly-open > .dd-flyout {
  opacity: 1; visibility: visible; pointer-events: auto; transform: translateX(0);
}

/* ── Вкладені підменю у мобільному меню (3-й рівень) */
.site-mobile-menu .mm-group2 { display: flex; flex-direction: column; }
.site-mobile-menu .mm-group2 > .mm-trigger2 {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
  font-family: 'Unbounded', sans-serif; font-size: 14px; font-weight: 500;
  color: var(--sh-gray-900); padding: 8px 12px;
}
.site-mobile-menu .mm-group2 > .mm-trigger2 .mm-caret {
  display: inline-block; width: 8px; height: 8px;
  border-right: 1.7px solid currentColor; border-bottom: 1.7px solid currentColor;
  transform: rotate(45deg); transition: transform .25s ease; margin-left: 10px;
}
.site-mobile-menu .mm-group2.open > .mm-trigger2 .mm-caret { transform: rotate(-135deg); }
.site-mobile-menu .mm-sub2 {
  display: none; flex-direction: column; padding-left: 14px;
  border-left: 2px solid var(--sh-blue-pale); margin: 2px 0 4px 10px;
}
.site-mobile-menu .mm-group2.open > .mm-sub2 { display: flex; }
.site-mobile-menu .mm-sub2 a {
  font-size: 13px !important; font-weight: 400 !important;
  padding: 7px 12px !important;
}

/* =====================================================================
   МЕГА-МЕНЮ «Матеріали» (desktop)
   Рейка всіх розділів ліворуч + панель підрозділів праворуч.
   position:fixed + max-height:100vh — панель НІКОЛИ не випадає нижче
   видимої частини екрана (фікс проблеми на ноутбуках).
   ===================================================================== */
header.site-header .nav-mega {
  /* left/top уточнюються JS-ом (site-header.js) під тригер «Матеріали» і
     обмежуються в межах екрана. left:16px — безпечний фолбек без JS
     (меню широке, тож тригер усе одно потрапляє в його горизонтальну смугу). */
  position: fixed; top: 60px; left: 16px;
  transform: translateY(-8px);
  width: min(960px, calc(100vw - 32px));
  min-width: 0; padding: 0; overflow: hidden;
  border-radius: 0 0 14px 14px;
}
header.site-header .header-nav .nav-item:hover .nav-mega,
header.site-header .header-nav .nav-item:focus-within .nav-mega,
header.site-header .header-nav .nav-item.open .nav-mega {
  transform: translateY(0);
}
header.site-header .nav-mega::before { display: none; }

/* Верхня смужка швидких посилань (Усі матеріали / Добірні елементи) */
header.site-header .nav-mega .mega-top {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 16px; background: var(--sh-blue-pale);
  border-bottom: 1px solid var(--sh-border);
}
header.site-header .nav-mega .mega-top-link {
  display: inline-flex; align-items: center; height: auto; border: none;
  padding: 6px 14px; border-radius: 7px; background: var(--sh-surface);
  font-family: 'Geologica', sans-serif; font-size: 12.5px; font-weight: 600;
  letter-spacing: 0; color: var(--sh-blue); text-decoration: none; white-space: nowrap;
  transition: background .15s, color .15s;
}
header.site-header .nav-mega .mega-top-link:hover { background: var(--sh-blue); color: #fff; padding-left: 14px; }

/* Тіло: рейка + панель */
header.site-header .nav-mega .mega-body {
  position: relative; display: flex; align-items: stretch;
  max-height: calc(100vh - 72px);
}
header.site-header .nav-mega .mega-rail {
  flex: 0 0 262px; width: 262px; padding: 8px 0;
  border-right: 1px solid var(--sh-border); overflow-y: auto; background: var(--sh-surface);
}
header.site-header .nav-mega .mega-cat { position: static; }
header.site-header .nav-mega .mega-cat-link {
  display: flex; align-items: center; gap: 8px; height: auto; border: none;
  padding: 8px 16px; font-family: 'Geologica', sans-serif; font-size: 13px;
  font-weight: 500; letter-spacing: 0; line-height: 1.25; color: var(--sh-gray-dark);
  text-decoration: none; white-space: normal; transition: background .12s, color .12s;
}
header.site-header .nav-mega .mega-cat-arrow {
  width: 6px; height: 6px; margin-left: auto; flex-shrink: 0; opacity: .4;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(-45deg);
}
header.site-header .nav-mega .mega-cat:hover > .mega-cat-link {
  background: var(--sh-blue-pale); color: var(--sh-blue);
}
header.site-header .nav-mega .mega-cat:hover > .mega-cat-link .mega-cat-arrow { opacity: 1; }

/* Панель підрозділів активного розділу */
header.site-header .nav-mega .mega-pane {
  display: none; position: absolute; top: 0; left: 262px; right: 0; bottom: 0;
  padding: 16px 22px 20px; overflow-y: auto; background: var(--sh-surface);
}
header.site-header .nav-mega .mega-cat:first-child > .mega-pane { display: block; }
header.site-header .nav-mega .mega-body:hover .mega-cat:first-child:not(:hover) > .mega-pane,
header.site-header .nav-mega .mega-body:focus-within .mega-cat:first-child:not(:focus-within) > .mega-pane { display: none; }
header.site-header .nav-mega .mega-cat:hover > .mega-pane,
header.site-header .nav-mega .mega-cat:focus-within > .mega-pane { display: block; }
header.site-header .nav-mega .mega-pane-head {
  display: block; height: auto; border: none; padding: 0 0 10px; margin-bottom: 10px;
  border-bottom: 1px solid var(--sh-border);
  font-family: 'Unbounded', sans-serif; font-size: 13px; font-weight: 600;
  letter-spacing: .01em; color: var(--sh-gray-900); text-decoration: none;
}
header.site-header .nav-mega .mega-pane-head:hover { color: var(--sh-blue); }
header.site-header .nav-mega .mega-pane-links { column-width: 215px; column-gap: 22px; }
header.site-header .nav-mega .mega-pane-links a {
  display: block; height: auto; border: none; padding: 7px 10px; border-radius: 6px;
  font-family: 'Geologica', sans-serif; font-size: 12.5px; font-weight: 400;
  letter-spacing: 0; line-height: 1.3; color: var(--sh-gray-dark); text-decoration: none;
  white-space: normal; break-inside: avoid; transition: background .12s, color .12s, padding-left .15s;
}
header.site-header .nav-mega .mega-pane-links a:hover {
  background: var(--sh-blue-pale); color: var(--sh-blue); padding-left: 14px;
}
header.site-header .nav-mega a:focus-visible {
  outline: 2px solid var(--sh-blue); outline-offset: -2px; border-radius: 6px;
}
@media (prefers-reduced-motion: reduce) {
  header.site-header .nav-mega { transition: none; }
}

/* =====================================================================
   Нове мобільне меню-шторка (flat, іконки). Тільки мобільне; десктоп не
   зачіпається. Кольори — через --sh-* токени (перемикаються у theme.css).
   ===================================================================== */
.nk-mm { padding: 0; }
.nk-mm .nk-mm-top {
  position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--sh-surface); border-bottom: 1px solid var(--sh-border);
}
.nk-mm .nk-mm-close {
  width: 36px; height: 36px; flex: 0 0 auto; border: none; background: var(--sh-surface-2);
  border-radius: 10px; color: var(--sh-gray-900); display: grid; place-items: center; cursor: pointer; padding: 0;
}
.nk-mm .nk-mm-close svg { width: 18px; height: 18px; }
.nk-mm .nk-mm-logo { display: flex; align-items: center; padding: 0; border: none; }
.nk-mm .nk-mm-logo img { height: 34px; width: auto; display: block; }
.nk-mm .nk-mm-body { padding: 8px 16px 40px; }

.nk-mm .nk-nav { display: flex; flex-direction: column; gap: 2px; }
.nk-mm .nk-row {
  display: flex; align-items: center; gap: 14px; padding: 13px 12px; border-radius: 12px;
  border: none; color: var(--sh-gray-900); text-decoration: none;
  font-family: 'Geologica', sans-serif; font-size: 15.5px; font-weight: 600; letter-spacing: 0;
}
.nk-mm .nk-row:hover { background: var(--sh-blue-pale); color: var(--sh-gray-900); }
.nk-mm .nk-row .nk-ic { width: 24px; height: 24px; flex: 0 0 auto; color: var(--sh-blue); display: grid; place-items: center; }
.nk-mm .nk-row .nk-ic svg { width: 22px; height: 22px; }
.nk-mm .nk-row .nk-lbl { flex: 1 1 auto; }
.nk-mm .nk-nav.nk-accent .nk-ic { color: var(--sh-accent); }
.nk-mm .nk-badge {
  background: var(--sh-accent); color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px;
  border-radius: 999px; display: inline-grid; place-items: center; padding: 0 6px; margin-left: auto;
}
.nk-mm .nk-badge[hidden] { display: none; }

.nk-mm .nk-divider { height: 1px; background: var(--sh-border); margin: 12px 4px; }
.nk-mm .nk-cap {
  font-family: 'Geologica', sans-serif; font-size: 11px; font-weight: 800; letter-spacing: .13em;
  text-transform: uppercase; color: var(--sh-gray); padding: 14px 8px 4px;
}
.nk-mm .nk-flatlist { display: flex; flex-direction: column; }
.nk-mm .nk-flat {
  display: block; padding: 12px; border: none; border-radius: 10px; color: var(--sh-gray-dark);
  text-decoration: none; font-family: 'Geologica', sans-serif; font-size: 14px; font-weight: 500; letter-spacing: 0;
}
.nk-mm .nk-flat:hover { background: var(--sh-blue-pale); color: var(--sh-blue); }

.nk-mm .nk-toggle-row { display: flex; align-items: center; gap: 14px; padding: 11px 12px; }
.nk-mm .nk-toggle-row .nk-ic { width: 24px; height: 24px; flex: 0 0 auto; color: var(--sh-blue); display: grid; place-items: center; }
.nk-mm .nk-toggle-row .nk-ic svg { width: 23px; height: 23px; }
.nk-mm .nk-toggle-row .nk-lbl { font-size: 15px; font-weight: 600; color: var(--sh-gray-900); font-family: 'Geologica', sans-serif; }
.nk-mm .nk-lang { margin-left: auto; display: inline-flex; border: 1px solid var(--sh-border); border-radius: 999px; overflow: hidden; }
.nk-mm .nk-lang a { padding: 6px 15px; font-size: 12.5px; font-weight: 700; color: var(--sh-gray); text-decoration: none; border: none; }
.nk-mm .nk-lang a.active { background: var(--sh-accent); color: #fff; }
.nk-mm .nk-toggle-row .theme-toggle { margin-left: auto; }

.nk-mm .nk-consult {
  margin-top: 16px; background: var(--sh-surface-2); border: 1px solid var(--sh-border);
  border-radius: 16px; padding: 20px 18px; text-align: center;
}
.nk-mm .nk-consult-cap { font-family: 'Unbounded', sans-serif; font-size: 15px; font-weight: 700; margin: 0 0 10px; color: var(--sh-gray-900); }
.nk-mm .nk-tel {
  display: block; font-family: 'Unbounded', sans-serif; font-size: 20px; font-weight: 700; color: var(--sh-blue);
  text-decoration: none; border: none; padding: 2px 0; letter-spacing: 0;
}
.nk-mm .nk-hrs { color: var(--sh-gray); font-size: 12.5px; line-height: 1.6; margin: 8px 0 2px; }
.nk-mm .nk-247 { color: var(--sh-accent); font-weight: 700; }
.nk-mm .nk-mail {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--sh-gray-dark);
  text-decoration: none; border: none; font-size: 13.5px; font-weight: 600;
}
.nk-mm .nk-mail svg { width: 17px; height: 17px; color: var(--sh-gray); }

.nk-mm .nk-copy { text-align: center; color: var(--sh-gray); font-size: 11.5px; line-height: 1.5; margin: 18px 8px 12px; }
.nk-mm .nk-social { display: flex; justify-content: center; gap: 10px; margin: 0 0 16px; flex-wrap: wrap; }
.nk-mm .nk-social a {
  width: 40px; height: 40px; border-radius: 50%; background: var(--sh-surface-2); display: grid;
  place-items: center; color: var(--sh-gray-dark); text-decoration: none; border: none; padding: 0;
}
.nk-mm .nk-social a:hover { background: var(--sh-blue); color: #fff; }
.nk-mm .nk-pay { display: flex; justify-content: center; gap: 12px; padding: 6px 0 10px; }
.nk-mm .nk-pay .nk-card {
  height: 34px; padding: 0 14px; border: 1px solid var(--sh-border); border-radius: 8px;
  background: var(--sh-surface); display: grid; place-items: center; font-family: Arial, sans-serif;
  font-weight: 800; font-style: italic; letter-spacing: .02em;
}
.nk-mm .nk-pay .nk-visa { color: #1a1f71; }
:root[data-theme="dark"] .nk-mm .nk-pay .nk-visa { color: #5b7fd6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .nk-mm .nk-pay .nk-visa { color: #5b7fd6; } }
.nk-mm .nk-pay .nk-mc { position: relative; padding-left: 38px; }
.nk-mm .nk-pay .nk-mc::before, .nk-mm .nk-pay .nk-mc::after { content: ""; position: absolute; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; border-radius: 50%; }
.nk-mm .nk-pay .nk-mc::before { left: 12px; background: #eb001b; }
.nk-mm .nk-pay .nk-mc::after { left: 21px; background: #f79e1b; mix-blend-mode: multiply; }

/* =====================================================================
   Мобільний хедер у стилі Епіцентру: бургер — логотип — пошук — кошик.
   + headroom (авто-приховування). Тільки мобільне; десктоп без змін.
   ===================================================================== */
header.site-header { transition: transform .28s ease; }
header.site-header.nk-hide { transform: translateY(-100%); }

.hdr-msearch { display: none; }
@media (max-width: 900px) {
  header.site-header { gap: 8px; padding: 0 12px; }
  header.site-header .burger { order: -1; }
  header.site-header .logo-wrap { order: 0; }
  header.site-header .logo-img { height: 30px; }
  .hdr-msearch { display: block; order: 1; flex: 1 1 auto; min-width: 0; }
  header.site-header .header-right { order: 2; margin-left: 0; gap: 4px; flex-shrink: 0; }
  /* На мобільному лишаємо у правій частині лише кошик — решта вже в меню-шторці */
  header.site-header .header-right .site-search,
  header.site-header .header-right .h-recently,
  header.site-header .header-right .theme-toggle,
  header.site-header .header-right .lang-switch,
  header.site-header .header-right .h-phones,
  header.site-header .header-right .h-phone-icon,
  header.site-header .header-right .h-icon,
  header.site-header .header-right .btn-free-measure { display: none !important; }
}
@media (max-width: 360px) {
  header.site-header .logo-img { height: 26px; }
  header.site-header { gap: 6px; padding: 0 10px; }
}

/* Поле пошуку в хедері */
.hdr-msearch .mobile-search { margin: 0; position: static; }
.hdr-msearch .mobile-search-form {
  display: flex; align-items: center; gap: 2px; height: 40px;
  background: var(--sh-surface-2); border: 1.5px solid var(--sh-border);
  border-radius: 11px; padding: 3px 3px 3px 4px;
}
.hdr-msearch .mobile-search-form:focus-within { border-color: var(--sh-blue); }
.hdr-msearch .msearch-mic {
  flex: 0 0 auto; width: 30px; height: 30px; border: none; background: var(--sh-accent);
  color: #fff; border-radius: 50%; display: grid; place-items: center; cursor: pointer; position: relative; padding: 0;
}
.hdr-msearch .msearch-mic svg { width: 16px; height: 16px; }
.hdr-msearch .msearch-mic.listening::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--sh-accent);
  animation: nkmicpulse 1.1s ease-out infinite;
}
@keyframes nkmicpulse { 0% { transform: scale(.9); opacity: .7; } 100% { transform: scale(1.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .hdr-msearch .msearch-mic.listening::after { animation: none; } }
.hdr-msearch .mobile-search-input {
  flex: 1 1 auto; min-width: 0; border: 0; background: none; outline: none;
  font-size: 13px; color: var(--sh-gray-900); font-family: 'Geologica', sans-serif; padding: 0 4px;
}
.hdr-msearch .mobile-search-input::placeholder { color: var(--sh-gray); opacity: 1; }
.hdr-msearch .mobile-search-submit {
  flex: 0 0 auto; width: 34px; height: 30px; border: 0; background: var(--sh-accent); color: #fff;
  border-radius: 8px; display: grid; place-items: center; cursor: pointer;
}
.hdr-msearch .mobile-search-submit svg { width: 16px; height: 16px; }
.hdr-msearch .mobile-search .site-search-results {
  position: absolute; top: 56px; left: 8px; right: 8px; z-index: 400;
  background: var(--sh-surface); border: 1px solid var(--sh-border); border-radius: 12px;
  max-height: 62vh; overflow-y: auto; display: none; margin: 0; width: auto; max-width: none;
  box-shadow: 0 12px 30px rgba(0,0,0,.16);
}
.hdr-msearch .mobile-search.open .site-search-results.has-results { display: block; }
