/*
Theme Name: Salient Child
Template: salient
Version: 1.0.0
Description: Дочерняя тема Salient с кастомным хэдером
*/

/* =============================================
   ИЗОЛЯЦИЯ СТИЛЕЙ
   ============================================= */
/* Все стили используют префикс #custom-* или .custom-*
   и НЕ затрагивают родительскую тему Salient.
   
   Отступы контента управляются Salient через:
   - #header-space (spacer под хэдер)
   - .container (max-width, padding)
   - --container-padding CSS-переменная
   
   Мы переопределяем ТОЛЬКО:
   1. #header-outer (скрываем оригинальный хэдер)
   2. #header-space (высота отступа под наш хэдер)
*/

/* =============================================
   CUSTOM HEADER — DESKTOP
   ============================================= */

/* ВРЕМЕННО ОТКЛЮЧЕНО ДЛЯ ДИАГНОСТИКИ
#header-outer {
  display: none !important;
}
*/

/* header-space оставляем — Salient использует его как отступ под хэдер.
   Переопределяем высоту под наш хэдер (72px + 12px padding + 12px запас = 96px) */
#header-space {
  display: block !important;
  height: 96px !important;
  background: transparent !important;
}

@media (max-width: 1024px) {
  #header-space {
    height: 92px !important;
  }
}

/* На главной странице убираем header-space, чтобы хэдер перекрывал hero-секцию */
.home #header-space {
  display: none !important;
  height: 0 !important;
}

/* Наш хэдер — фиксированный, плавает над контентом */
#custom-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  padding: 12px 16px;
  background: transparent;
  pointer-events: none;
  /* Изолируем stacking context только внутри хэдера */
  isolation: isolate;
}

/* Убираем маркеры списков ТОЛЬКО внутри нашего кастомного хэдера */
#custom-header ul,
#custom-header ul li {
  list-style: none !important;
  list-style-type: none !important;
}

#custom-header ul li::before,
#custom-header ul li::marker {
  display: none !important;
  content: none !important;
}

/* Сам блок-«таблетка» — кликабелен */
.custom-header-inner,
.custom-header-mobile {
  pointer-events: all;
}

.custom-header-inner {
  display: flex;
  align-items: center;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  height: 72px;
  gap: 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}

/* Логотип */
.custom-header-logo {
  flex-shrink: 0;
  margin-right: 32px;
  display: flex;
  align-items: center;
}

.custom-header-logo a {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.custom-header-logo img {
  height: 52px;
  width: auto;
  display: block;
}

/* Основное меню (слева) */
.custom-header-nav {
  flex: 1;
}

.custom-header-nav > ul {
  list-style: none !important;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.custom-header-nav > ul > li > a {
  display: block;
  padding: 8px 14px;
  font-size: 15px;
  font-weight: 500;
  color: #1a1a1a;
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.custom-header-nav > ul > li > a:hover,
.custom-header-nav > ul > li.current-menu-item > a,
.custom-header-nav > ul > li.current-menu-ancestor > a {
  background: #f0f0f0;
  color: #000;
}

/* Дропдаун */
.custom-header-nav ul ul {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  border-radius: 8px;
  min-width: 220px;
  list-style: none;
  margin: 4px 0 0;
  padding: 8px 0;
  z-index: 9999;
}

.custom-header-nav ul li {
  position: relative;
}

.custom-header-nav ul ul li a {
  display: block;
  padding: 9px 18px;
  font-size: 14px;
  color: #1a1a1a;
  text-decoration: none;
  transition: background 0.15s;
  white-space: nowrap;
}

.custom-header-nav ul ul li a:hover {
  background: #f5f5f5;
}

.custom-header-nav ul li:hover > ul {
  display: block;
}

/* Правая группа */
.custom-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

/* Кнопка «Адрес» */
.custom-header-address {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #fff;
  color: #1a1a1a !important;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none !important;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.custom-header-address:hover {
  background: #0a0a0a;
  color: #fff !important;
  border-color: #0a0a0a;
}

.custom-header-address svg {
  flex-shrink: 0;
}

/* Телефон */
.custom-header-phone {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: #1a1a1a !important;
  text-decoration: none !important;
  white-space: nowrap;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  background: #fff;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.custom-header-phone:hover {
  background: #0a0a0a;
  color: #fff !important;
  border-color: #0a0a0a;
}

/* Кнопка поиска */
.custom-header-search-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.2s;
  color: #1a1a1a;
}

.custom-header-search-btn:hover {
  background: #f0f0f0;
}

/* =============================================
   SEARCH OVERLAY
   ============================================= */

#custom-search-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 99999;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
}

#custom-search-overlay.is-active {
  display: flex;
}

.custom-search-box {
  background: #fff;
  border-radius: 12px;
  padding: 28px 32px;
  width: 100%;
  max-width: 680px;
  margin: 0 16px;
  position: relative;
}

.custom-search-box input[type="search"] {
  width: 100%;
  border: none;
  border-bottom: 2px solid #1a1a1a;
  outline: none;
  font-size: 24px;
  padding: 8px 0;
  background: transparent;
  color: #1a1a1a;
  box-sizing: border-box;
}

.custom-search-box input[type="search"]::placeholder {
  color: #aaa;
}

.custom-search-box p {
  margin: 8px 0 0;
  font-size: 13px;
  color: #999;
}

.custom-search-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #666;
  line-height: 1;
  padding: 4px;
}

.custom-search-close:hover {
  color: #000;
}

/* =============================================
   MOBILE HEADER
   ============================================= */

.custom-header-mobile {
  display: none;
}

/* ---- Drawer-меню (выезжает справа) ---- */

/* Затемнение фона */
#custom-mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 99996;
  opacity: 0;
  transition: opacity 0.35s ease;
}
#custom-mobile-overlay.is-active {
  display: block;
}
#custom-mobile-overlay.is-visible {
  opacity: 1;
}

/* Сам drawer */
#custom-mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  width: 75vw;
  max-width: 360px;
  height: 100%;
  background: #0a0a0a;
  z-index: 99997;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 72px 32px 48px;
  box-sizing: border-box;
}
#custom-mobile-menu.is-active {
  transform: translateX(0);
}

/* Кнопка закрытия */
.custom-mobile-menu-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.custom-mobile-menu-close:hover {
  opacity: 1;
}

/* КРИТИЧНО: НЕ сдвигаем контент при открытом меню.
   Это предотвращает поломку Flickity и других Salient-компонентов.
   Transform создаёт новый stacking context и ломает z-index/position. */
body.mobile-menu-open {
  overflow: hidden;
  /* ВАЖНО: никаких других свойств! Не трогаем position, transform, etc. */
}

/* Навигация в drawer */
.custom-mobile-menu-nav {
  flex: 1;
}

.custom-mobile-menu-nav ul {
  list-style: none !important;
  margin: 0;
  padding: 0;
}

.custom-mobile-menu-nav ul li {
  list-style: none !important;
}

.custom-mobile-menu-nav > ul > li {
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.custom-mobile-menu-nav > ul > li:last-child {
  border-bottom: none;
}

/* Строка пункта меню */
.custom-mobile-menu-nav > ul > li > .menu-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.custom-mobile-menu-nav > ul > li > a,
.custom-mobile-menu-nav > ul > li > .menu-item-row > a {
  display: block;
  flex: 1;
  font-size: 18px;
  color: #fff;
  text-decoration: none;
  padding: 14px 0;
  transition: opacity 0.2s;
  line-height: 1.3;
}

.custom-mobile-menu-nav > ul > li > a:hover {
  opacity: 0.65;
}

/* Кнопка раскрытия подменю */
.mobile-toggle-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 20px;
  cursor: pointer;
  padding: 14px 0 14px 16px;
  line-height: 1;
  transition: color 0.2s, transform 0.25s;
  flex-shrink: 0;
}
.mobile-toggle-btn.is-open {
  color: #fff;
  transform: rotate(180deg);
}

/* Подменю */
.custom-mobile-menu-nav ul ul {
  display: none;
  list-style: none !important;
  padding: 0 0 8px 12px;
  margin: 0;
}
.custom-mobile-menu-nav ul ul.is-open {
  display: block;
}
.custom-mobile-menu-nav ul ul li a {
  font-size: 15px;
  color: rgba(255,255,255,0.6);
  display: block;
  padding: 8px 0;
  text-decoration: none;
  transition: color 0.2s;
}
.custom-mobile-menu-nav ul ul li a:hover {
  color: #fff;
}

/* Контактные кнопки в drawer */
.custom-mobile-menu-contacts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 24px;
  margin-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.custom-mobile-menu-address,
.custom-mobile-menu-phone {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff !important;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none !important;
  transition: background 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.custom-mobile-menu-address:hover,
.custom-mobile-menu-phone:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.4);
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 1024px) {
  .custom-header-desktop {
    display: none;
  }

  .custom-header-mobile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 68px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.10);
  }

  .custom-header-mobile-logo a {
    display: flex;
    align-items: center;
  }

  .custom-header-mobile-logo img {
    height: 48px;
    width: auto;
  }

  .custom-header-mobile-right {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  /* Закреплённый пункт меню в мобильном хэдере */
  .custom-header-mobile-pinned {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    background: #fff;
    color: #1a1a1a !important;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none !important;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    margin-right: 4px;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
  }

  .custom-header-mobile-pinned:hover {
    background: #0a0a0a;
    color: #fff !important;
    border-color: #0a0a0a;
  }

  .custom-header-mobile-search-btn,
  .custom-header-mobile-burger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a1a1a;
    border-radius: 6px;
  }

  .custom-header-mobile-search-btn:hover,
  .custom-header-mobile-burger:hover {
    background: rgba(0,0,0,0.06);
  }
}

@media (min-width: 1025px) {
  .custom-header-mobile {
    display: none !important;
  }
}
