/* =========================================================
   SITE HEADER — fluid responsive
   ========================================================= */

:root {
  --hdr-bg:        #ffffff;
  --hdr-text:      #333333;
  --hdr-border:    #e5e5e5;
  --hdr-nav-rule:  rgba(0, 0, 0, 0.06);
  --hdr-catalog:        #21562e;
  --hdr-catalog-hover:  #1a4528;
  /* Смуга меню: зелений фон, білі пункти */
  --hdr-nav-bar-bg:     #21562e;
  --hdr-nav-menu-text:  #ffffff;
  --hdr-nav-bg:    #f2c94c;
  --hdr-accent:    #e31720;
  --hdr-surveyor-btn:       #db2b2f;
  --hdr-surveyor-btn-hover: #c41e22;
  --hdr-height:    clamp(60px, 7vw, 80px);
  --hdr-pad:       clamp(16px, 4vw, 80px);
}

/* ── Sticky wrapper ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
  background: var(--hdr-bg);
  color: var(--hdr-text);
  /* без нижньої «полоски» — лише легка тінь */
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  overflow: visible;
}

/* ── Shared container ── */
.header-container {
  width: 100%;
  max-width: 1920px;
  margin: 0 auto;
  padding-inline: var(--hdr-pad);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(12px, 2vw, 32px);
}

/* ═══════════════════════════════════════
   TOP ROW: logo + search + cart
═══════════════════════════════════════ */
.header-top {
  background: var(--hdr-bg);
  color: var(--hdr-text);
  border-bottom: none;
  overflow: visible;
}

.header-top .header-container {
  min-height: var(--hdr-height);
  padding-block: clamp(8px, 1vw, 14px);
}

/* ── Logo ── */
.header-logo {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 14px);
  text-decoration: none;
  flex-shrink: 0;
}

/* Розмір під екран (vw) — трохи більший за попередній фікс, без «гіганта» */
.header-logo__img {
  height: auto;
  width: auto;
  max-height: clamp(46px, 5.5vw, 72px);
  max-width: clamp(104px, 13vw, 158px);
  object-fit: contain;
  display: block;
}

@media (min-width: 1101px) {
  .header-top {
    position: relative;
    z-index: 2;
  }

  .header-logo {
    align-self: center;
    margin-bottom: 0;
  }

  .header-top .header-container {
    gap: clamp(8px, 0.85vw, 16px);
  }

  .header-search--desktop {
    margin-left: 0;
  }

  .header-phones {
    gap: clamp(6px, 0.75vw, 12px);
  }
}

/* Fallback text badge (shown when no ACF logo image) */
.header-logo__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
  color: var(--hdr-text);
  font-size: clamp(11px, 1.3vw, 16px);
  font-weight: 800;
  letter-spacing: .04em;
  white-space: nowrap;
  padding: clamp(6px, .7vw, 10px) clamp(12px, 1.5vw, 22px);
  border-radius: 50px;
  text-transform: uppercase;
  line-height: 1;
}

/* ── Tagline — separate block between logo and search ── */
.header-tagline {
  font-size: clamp(9px, .8vw, 13px);
  color: #555;
  line-height: 1.4;
  max-width: clamp(130px, 14vw, 220px);
  flex-shrink: 0;
}

/* ── Викликати замірника ── */
.header-surveyor-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-shrink: 0;
  max-width: min(100%, 240px);
  padding: 11px 16px;
  min-height: 40px;
  box-sizing: border-box;
  background: var(--hdr-surveyor-btn);
  border: 1px solid var(--hdr-surveyor-btn);
  border-radius: 8px;
  color: #fff;
  text-decoration: none;
  font-size: clamp(9px, 0.9vw, 12px);
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.12;
  white-space: nowrap;
  transition: background 0.18s, border-color 0.18s;
}

button.header-surveyor-btn {
  cursor: pointer;
  margin: 0;
  font-family: inherit;
}

.header-surveyor-btn:hover {
  background: var(--hdr-surveyor-btn-hover);
  border-color: var(--hdr-surveyor-btn-hover);
  color: #fff;
}

.header-surveyor-btn__phone {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  fill: currentColor;
}

/* ── Месенджери (посилання з опцій теми) ── */
.header-messengers {
  display: none;
  align-items: center;
  gap: clamp(4px, 0.45vw, 8px);
  flex-shrink: 0;
}

@media (min-width: 1101px) {
  .header-messengers {
    display: flex;
  }
}

.header-messengers__link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(30px, 1.75vw, 34px);
  height: clamp(30px, 1.75vw, 34px);
  border-radius: clamp(6px, 0.45vw, 9px);
  color: #fff;
  text-decoration: none;
  transition: transform 0.2s ease, opacity 0.2s;
}

.header-messengers__link:hover {
  transform: scale(1.05);
  opacity: 0.95;
}

.header-messengers__link svg {
  display: block;
  width: 52%;
  height: auto;
  max-height: 56%;
}

.header-messengers__link .viber-brand-icon {
  width: 56%;
  max-height: 60%;
}

.header-messengers__link--telegram { background-color: #05a0eb; }
.header-messengers__link--whatsapp { background-color: #12c868; }
.header-messengers__link--viber { background-color: #7360f2; }

/* ── Search ── */
form.header-search {
  margin: 0;
}

.header-search {
  flex: 1 1 180px;   /* won't shrink below 180px */
  min-width: 0;
  position: relative;
}

.header-search-mobile__inner form {
  margin: 0;
  width: 100%;
}

.header-search__wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid #d9d9d9;
  border-radius: clamp(6px, .7vw, 10px);
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
  background: #fff;
}

.header-search__wrap:focus-within {
  border-color: var(--hdr-catalog);
  box-shadow: 0 0 0 2px rgba(47, 128, 237, 0.2);
}

.header-search__input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  padding: clamp(8px, .9vw, 12px) clamp(10px, 1.2vw, 16px);
  font-size: clamp(12px, 1vw, 15px);
  background: #fff;
  color: var(--hdr-text);
}

.header-search__input::placeholder {
  color: #888;
}

.header-search__divider {
  flex-shrink: 0;
  align-self: center;
  width: 1px;
  height: clamp(22px, 2.2vw, 28px);
  background: #e0e0e0;
}

.header-search__submit {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 clamp(10px, 1.1vw, 14px);
  margin: 0;
  border: none;
  background: #fff;
  color: #666;
  cursor: pointer;
  transition: color 0.18s, background 0.18s;
}

.header-search__submit:hover {
  color: var(--hdr-text);
  background: #fafafa;
}

/* Нативний «хрестик» у type=search дублює .srch-clear (фокус / наведення) */
.header-search__input::-webkit-search-cancel-button,
.header-search__input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.header-search__input[type="search"]::-ms-clear {
  display: none;
  width: 0;
  height: 0;
}

.header-search__input[type="search"]::-moz-search-clear-button {
  display: none;
}

/* ── Currency (UAH / USD) ── */
.header-currency {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}
.header-currency__toggle {
  display: inline-flex;
  border: 1px solid var(--hdr-border);
  border-radius: clamp(6px, 0.6vw, 10px);
  overflow: hidden;
  background: #f5f5f5;
}
.header-currency__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: clamp(34px, 3.2vw, 46px);
  padding: clamp(6px, 0.55vw, 9px) clamp(8px, 0.75vw, 12px);
  font-size: clamp(11px, 1vw, 15px);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--hdr-text);
  text-decoration: none;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}
.header-currency__btn:hover {
  background: #eee;
  color: var(--hdr-text);
}
.header-currency__btn--active {
  background: var(--hdr-nav-bg);
  color: #111;
}
.header-currency__btn--active:hover {
  background: #e0b800;
  color: #111;
}

/* Після базових правил валюти: на ПК менше відступів навколо перемикача — пошук ширший */
@media (min-width: 1101px) {
  .header-currency {
    margin-inline: -8px;
    padding: 0;
  }

  .header-currency__toggle {
    border-width: 1px;
    border-radius: 7px;
  }

  .header-currency__btn {
    min-width: 0;
    padding: 7px 10px;
    font-size: clamp(11px, 0.95vw, 14px);
  }
}

/* ═══════════════════════════════════════
   PHONE NUMBERS BLOCK
═══════════════════════════════════════ */
.header-phones {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 16px);
  flex-shrink: 0;
}

.header-phones__divider {
  width: 1px;
  align-self: stretch;
  background: var(--hdr-border);
}

.header-phones__group {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.header-phones__label {
  font-size: clamp(9px, .75vw, 11px);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #666;
  line-height: 1.2;
  text-align: center;
}

.header-phones__icon {
  flex-shrink: 0;
  color: #888;
}

/* phone-ico (filled path SVG from footer) */
.header-phones .phone-ico {
  fill: currentColor;
  color: var(--hdr-catalog);
  width: 13px;
  height: 13px;
}

.header-phones__num {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: clamp(11px, .9vw, 13px);
  font-weight: 500;
  color: var(--hdr-text);
  text-decoration: none;
  white-space: nowrap;
  transition: color .18s;
  line-height: 1.4;
}

.header-phones__num:hover { color: #000; }

.header-phones__main {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: clamp(13px, 1.1vw, 16px);
  font-weight: 700;
  color: var(--hdr-text);
  text-decoration: none;
  white-space: nowrap;
  transition: color .18s, opacity .18s;
}

.header-phones__main:hover { opacity: .75; }

/* ── Clear button ── */
.srch-clear {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: #aaa;
  padding: 0 8px;
  flex-shrink: 0;
  transition: color .18s;
}

.srch-clear:hover { color: #555; }

/* ── Search results dropdown ── */
.header-search__results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1.5px solid #e8e8e8;
  border-radius: clamp(8px, .9vw, 12px);
  box-shadow: 0 12px 40px rgba(0,0,0,.14);
  z-index: 500;
  max-height: clamp(300px, 55vh, 480px);
  overflow-y: auto;
  overflow-x: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity .2s, transform .2s, visibility .2s;
  scrollbar-width: thin;
  scrollbar-color: #ddd transparent;
}

.header-search__results.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ── Section label ── */
.srch-section-label {
  font-size: clamp(10px, .8vw, 11px);
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #aaa;
  padding: clamp(8px, 1vw, 12px) clamp(12px, 1.2vw, 18px) 4px;
}

/* ── Category list (legacy / кешований JS) — не показуємо, лише товари ── */
.srch-section-label:has(+ .srch-cats) {
  display: none !important;
}

.header-search__results .srch-cats {
  display: none !important;
}

.srch-cat-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: clamp(7px, .8vw, 10px) clamp(12px, 1.2vw, 18px);
  text-decoration: none;
  color: #222;
  font-size: clamp(12px, 1vw, 14px);
  font-weight: 500;
  transition: background .15s;
}

.srch-cat-link:hover,
.srch-cat-link.is-active {
  background: #fff8e1;
}

.srch-cat-icon {
  flex-shrink: 0;
  color: #aaa;
}

.srch-cat-name {
  flex: 1;
  min-width: 0;
}

.srch-cat-name strong { color: #e31720; font-weight: 700; }

.srch-cat-parent {
  font-size: clamp(10px, .8vw, 12px);
  color: #aaa;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Products divider ── */
.srch-cats + .srch-section-label {
  border-top: 1px solid #f0f0f0;
  margin-top: 4px;
  padding-top: clamp(8px, 1vw, 12px);
}

/* ── Products list ── */
.srch-products {
  list-style: none;
  margin: 0;
  padding: 0 0 6px;
}

.srch-product-link {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1vw, 14px);
  padding: clamp(7px, .8vw, 10px) clamp(12px, 1.2vw, 18px);
  text-decoration: none;
  color: #222;
  transition: background .15s;
}

.srch-product-link:hover,
.srch-product-link.is-active {
  background: #f5f5f5;
}

.srch-product-img {
  width: clamp(40px, 4vw, 56px);
  height: clamp(40px, 4vw, 56px);
  flex-shrink: 0;
  border-radius: 6px;
  background: #f5f5f5;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.srch-product-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.srch-no-img {
  width: 100%;
  height: 100%;
  background: #eee;
  border-radius: 6px;
}

.srch-product-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.srch-product-name {
  font-size: clamp(12px, .95vw, 14px);
  font-weight: 400;
  color: #222;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.srch-product-name strong { color: #e31720; font-weight: 700; }

.srch-product-price {
  font-size: clamp(11px, .9vw, 13px);
  font-weight: 600;
  color: #35c345;
  white-space: nowrap;
}

/* ── Footer link ── */
.srch-footer {
  border-top: 1px solid #f0f0f0;
  padding: clamp(8px, 1vw, 12px) clamp(12px, 1.2vw, 18px);
}

.srch-footer-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: clamp(12px, .95vw, 14px);
  font-weight: 600;
  color: #555;
  text-decoration: none;
  padding: clamp(7px, .8vw, 10px);
  border-radius: 8px;
  background: #f7f7f7;
  transition: background .18s, color .18s;
}

.srch-footer-link:hover {
  background: #fff5f5;
  color: #e31720;
}

.srch-footer-count {
  color: #999;
  font-weight: 400;
}

/* ── Empty state ── */
.srch-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 3vw, 36px) 16px;
  gap: 8px;
  color: #bbb;
  font-size: clamp(12px, 1vw, 14px);
}

.srch-empty p { margin: 0; }

/* ── Loading spinner ── */
.srch-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 2vw, 28px);
}

.srch-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2.5px solid #e0e0e0;
  border-top-color: #e31720;
  border-radius: 50%;
  animation: srch-spin .7s linear infinite;
}

@keyframes srch-spin {
  to { transform: rotate(360deg); }
}

/* ── Mobile drawer: results below full-width ── */
.mobile-drawer__search .header-search__results {
  position: relative;
  top: 0;
  border: 1px solid #eee;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
  max-height: 50vh;
  margin-top: 6px;
}

/* ── Cart button ── */
.header-cart {
  display: flex;
  align-items: center;
  gap: clamp(6px, .7vw, 10px);
  flex-shrink: 0;
  background: #fafafa;
  border: 1px solid var(--hdr-border);
  border-radius: clamp(8px, .9vw, 12px);
  padding: clamp(7px, .8vw, 12px) clamp(10px, 1.2vw, 18px);
  cursor: pointer;
  color: var(--hdr-text);
  transition: border-color .2s, background .2s;
  white-space: nowrap;
}

.header-cart:hover {
  border-color: #ccc;
  background: #f0f0f0;
  color: var(--hdr-text);
}

.header-cart__icon {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.header-cart__icon svg {
  width: clamp(20px, 2vw, 26px);
  height: clamp(20px, 2vw, 26px);
}

.header-cart__badge {
  position: absolute;
  top: -6px;
  right: -8px;
  min-width: clamp(16px, 1.6vw, 20px);
  height: clamp(16px, 1.6vw, 20px);
  background: var(--hdr-accent);
  color: #fff;
  font-size: clamp(9px, .75vw, 11px);
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 1px;
}

.header-cart__total {
  font-size: clamp(12px, 1vw, 14px);
  font-weight: 600;
  color: inherit;
}

/* Bump cart total on count change */
.header-cart__total bdi,
.header-cart__total .woocommerce-Price-amount {
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
}

/* ── Burger (hidden on desktop) ── */
.header-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: clamp(4px, .5vw, 6px);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  flex-shrink: 0;
}

.header-burger__line {
  display: block;
  width: clamp(20px, 2.5vw, 26px);
  height: 2.5px;
  background: var(--hdr-text);
  border-radius: 2px;
  transition: transform .28s, opacity .2s;
  transform-origin: center;
}

.header-burger.is-active .header-burger__line:nth-child(1) {
  transform: translateY(calc(clamp(4px, .5vw, 6px) + 2.5px)) rotate(45deg);
}

.header-burger.is-active .header-burger__line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.header-burger.is-active .header-burger__line:nth-child(3) {
  transform: translateY(calc(-1 * (clamp(4px, .5vw, 6px) + 2.5px))) rotate(-45deg);
}

/* ═══════════════════════════════════════
   NAVIGATION BAR
═══════════════════════════════════════ */
.header-nav {
  background: var(--hdr-nav-bar-bg);
  color: var(--hdr-nav-menu-text);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  border-bottom: none;
  /* overflow must stay visible so position:absolute sub-menus can escape */
}

/* Ті самі max-width / padding-inline, що й у .header-top .header-container (var(--hdr-pad)) */
.header-nav .header-container,
.header-nav__container {
  container-type: inline-size;
  container-name: hdr-nav;
  min-height: clamp(38px, 4vw, 52px);
  padding-block: clamp(4px, 0.5vw, 8px);
  overflow: visible;
}

.header-nav__list {
  display: flex;
  align-items: stretch;
  flex-wrap: nowrap;
  justify-content: center;
  gap: clamp(4px, 0.55vw, 12px);
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  /* no overflow:hidden — sub-menus are position:absolute and must be visible */
}

.header-nav__list li {
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  align-items: stretch;
}

.header-nav__list li > a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: 100%;
  min-width: 0;
  height: 100%;
  box-sizing: border-box;
  gap: 0.35em;
  padding: clamp(8px, 0.5vw, 11px) clamp(8px, 0.65vw, 16px);
  font-size: clamp(12px, 0.82vw, 14px);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--hdr-nav-menu-text);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: clip;
  text-align: center;
  border-radius: 4px;
  transition: background .18s, color .18s;
}

/* Стрілка вниз для пунктів із підменю */
.header-nav__list li.menu-item-has-children > a::after {
  content: "";
  display: block;
  width: 0;
  height: 0;
  margin-left: 2px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  flex-shrink: 0;
  opacity: 0.85;
}

.header-nav__list li > a:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--hdr-nav-menu-text);
}

.header-nav__list li.current-menu-item > a {
  background: rgba(0, 0, 0, 0.12);
  color: var(--hdr-nav-menu-text);
  font-weight: 600;
}

.header-nav__list li.current-menu-item > a:hover {
  background: rgba(0, 0, 0, 0.18);
  color: var(--hdr-nav-menu-text);
}

/* ── Dropdown submenu ── */
.header-nav__list .sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 240px;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
  list-style: none;
  padding: 6px 0;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .18s, transform .18s, visibility .18s;
  z-index: 999;                     /* high enough to clear page content */
}

.header-nav__list li:hover > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.header-nav__list .sub-menu li a {
  padding: 8px 12px;
  font-size: clamp(11px, .9vw, 13px);
  font-weight: 500;
  text-transform: none;
  white-space: normal;
  letter-spacing: 0;
  color: #333;
  background: transparent;
}

.header-nav__list .sub-menu li a:hover {
  background: rgba(33, 86, 46, 0.12);
  color: var(--hdr-catalog);
}

/* ═══════════════════════════════════════
   MOBILE OVERLAY + DRAWER
═══════════════════════════════════════ */
.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1100;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s, visibility .3s;
}

.mobile-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 88vw);
  background: #fff;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform .32s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
  overflow-x: hidden;
}

.mobile-drawer.is-open {
  transform: translateX(0);
}

.mobile-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(14px, 4vw, 22px) clamp(16px, 5vw, 24px);
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.mobile-drawer__logo img {
  height: 36px;
  object-fit: contain;
}

.mobile-drawer__close {
  background: none;
  border: none;
  cursor: pointer;
  color: #555;
  padding: 4px;
  display: flex;
  transition: color .18s;
}

.mobile-drawer__close:hover {
  color: var(--hdr-accent);
}

/* Mobile search inside drawer */
.mobile-drawer__search {
  padding: clamp(12px, 4vw, 20px) clamp(16px, 5vw, 24px);
  border-bottom: 1px solid #f0f0f0;
  position: relative;
  flex-shrink: 0;
}

/* Mobile menu */
.mobile-drawer__menu {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  flex: 1;
}

.mobile-drawer__menu li a {
  display: block;
  padding: clamp(10px, 3vw, 14px) clamp(16px, 5vw, 24px);
  font-size: clamp(13px, 4vw, 16px);
  font-weight: 600;
  color: #111;
  text-decoration: none;
  border-bottom: 1px solid #f5f5f5;
  text-transform: uppercase;
  letter-spacing: .03em;
  transition: background .18s, color .18s;
}

.mobile-drawer__menu li a:hover,
.mobile-drawer__menu li.current-menu-item > a {
  background: #fff5f5;
  color: var(--hdr-accent);
}

/* Submenu in drawer */
.mobile-drawer__menu .sub-menu {
  list-style: none;
  padding: 0;
  margin: 0;
  background: #fafafa;
}

.mobile-drawer__menu .sub-menu li a {
  padding-left: clamp(28px, 8vw, 40px);
  font-size: clamp(12px, 3.5vw, 14px);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: #444;
}

.mobile-drawer__tagline {
  font-size: clamp(11px, 3vw, 13px);
  color: #888;
  line-height: 1.5;
  padding: clamp(12px, 4vw, 20px) clamp(16px, 5vw, 24px);
  border-top: 1px solid #f0f0f0;
  margin: 0;
}

button.mobile-drawer__surveyor {
  cursor: pointer;
  font-family: inherit;
  box-sizing: border-box;
  align-self: stretch;
  width: auto;
  min-width: 0;
}

.mobile-drawer__surveyor {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 0.6vw, 12px);
  flex-shrink: 0;
  margin: 0 clamp(16px, 5vw, 24px) clamp(12px, 4vw, 16px);
  padding: 10px 18px;
  background: var(--hdr-surveyor-btn, #db2b2f);
  border: 1px solid var(--hdr-surveyor-btn, #db2b2f);
  border-radius: 6px;
  color: #fff;
  text-decoration: none;
  font-size: clamp(0.72rem, 0.9vw, 0.82rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.25;
  text-align: center;
  transition: background 0.18s, border-color 0.18s;
}

.mobile-drawer__surveyor:hover {
  background: var(--hdr-surveyor-btn-hover, #c41f23);
  border-color: var(--hdr-surveyor-btn-hover, #c41f23);
  color: #fff;
}

.mobile-drawer__surveyor__phone {
  width: clamp(14px, 1.1vw, 18px);
  height: clamp(14px, 1.1vw, 18px);
  flex-shrink: 0;
  fill: currentColor;
}

/* ── Mobile icon buttons (shared base) ── */
.header-search-icon,
.header-phone-icon {
  display: none;           /* shown via media query below */
  align-items: center;
  justify-content: center;
  background: #fafafa;
  border: 1px solid var(--hdr-border);
  border-radius: 8px;
  padding: clamp(7px, 2vw, 10px);
  cursor: pointer;
  color: var(--hdr-text);
  flex-shrink: 0;
  transition: border-color .18s, background .18s;
}

.header-search-icon:hover,
.header-search-icon.is-active,
.header-phone-icon:hover,
.header-phone-icon.is-active {
  border-color: #ccc;
  background: #f0f0f0;
}

/* ── Mobile contacts panel ── */
.header-contacts-mobile {
  display: block;
  background: var(--hdr-bg);
  border-top: 1px solid var(--hdr-border);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: max-height .3s ease, opacity .22s;
}

.header-contacts-mobile.is-open {
  max-height: 440px;
  opacity: 1;
  pointer-events: auto;
}

.header-contacts-mobile__inner {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: clamp(10px, 2vw, 14px);
  padding: clamp(14px, 3vw, 20px) var(--hdr-pad);
}

.header-contacts-mobile__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.header-contacts-mobile__messengers {
  display: none;
  align-items: center;
  flex-wrap: wrap;
  gap: clamp(6px, 2vw, 10px);
  padding-top: clamp(8px, 2vw, 12px);
  border-top: 1px solid var(--hdr-border);
}

.header-contacts-mobile__messengers .header-messengers__link {
  width: clamp(34px, 10vw, 40px);
  height: clamp(34px, 10vw, 40px);
}

.header-contacts-mobile__groups {
  display: flex;
  gap: clamp(20px, 6vw, 40px);
  flex-wrap: wrap;
}

.header-contacts-mobile__group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.header-contacts-mobile__label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}

.header-contacts-mobile__phone {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: clamp(14px, 4vw, 17px);
  font-weight: 700;
  color: var(--hdr-text);
  text-decoration: none;
  transition: color .18s;
}

.header-contacts-mobile__phone:hover {
  color: #000;
}

.header-contacts-mobile__phone svg {
  flex-shrink: 0;
  color: var(--hdr-catalog);
  opacity: 1;
}

.header-contacts-mobile__close {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f5f5f5;
  border: 1px solid var(--hdr-border);
  border-radius: 8px;
  color: var(--hdr-text);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .18s;
}

.header-contacts-mobile__close:hover {
  background: #eee;
}

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */

/* Лише шапка: номери зникають раніше за пошук/теглайн — іконка телефону + панель контактів */
@media (max-width: 1400px) and (min-width: 1101px) {
  .header-phones {
    display: none;
  }

  .header-phone-icon {
    display: flex;
  }
}

/* Месенджери в рядку шапки ховаємо, коли показана іконка телефону — вони в панелі під номерами */
@media (max-width: 1400px) {
  .header-top .header-messengers {
    display: none !important;
  }

  .header-contacts-mobile__messengers {
    display: flex;
  }
}

/* ── 1100px: burger mode — all icons become equal squares ── */
@media (max-width: 1100px) {
  :root { --hdr-pad: clamp(12px, 3vw, 40px); }

  /* Hide desktop-only blocks */
  .header-phones        { display: none; }
  .header-tagline       { display: none; }
  .header-surveyor-btn   { display: none; }
  .header-search--desktop { display: none !important; }
  .header-nav           { display: none; }

  /* Logo grows → pushes icon group to the right */
  .header-logo {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    overflow: hidden;
    align-self: center;
    margin-bottom: 0;
  }

  /* Tighter container gap */
  .header-top .header-container { gap: 8px; }

  /* Валюта: компактно поруч з іконками */
  .header-currency__btn {
    min-width: 42px;
    padding: 7px 10px;
    font-size: 12px;
  }

  /* Show burger + phone icon + search icon */
  .header-burger     { display: flex; }
  .header-phone-icon { display: flex; }
  .header-search-icon { display: flex; }

  /* ── Cart: same square size as phone/search icons ── */
  .header-cart__total { display: none; }   /* hide price text */
  .header-cart {
    padding: clamp(7px, 2vw, 10px);        /* same as icon buttons */
    border-radius: 8px;
    flex-shrink: 0;
  }
  .header-cart__icon svg {
    width: 21px;
    height: 21px;
  }
}

/* ── Mobile expandable search bar ── */
.header-search-mobile {
  display: block;
  background: var(--hdr-bg);
  border-top: 1px solid var(--hdr-border);
  max-height: 0;
  overflow: hidden;                 /* stays hidden; no jump to "visible" */
  opacity: 0;
  pointer-events: none;
  transition: max-height .3s ease, opacity .22s;
}

.header-search-mobile.is-open {
  max-height: 540px;                /* enough for input + results list */
  opacity: 1;
  pointer-events: auto;
  /* keep overflow: hidden so search results stay within max-height */
}

.header-search-mobile__inner {
  padding: 10px clamp(12px, 4vw, 20px) 12px;
}

/* Results inside mobile icon-search: position inline so they're not clipped */
.header-search__results--inline {
  position: relative !important;
  top: 0 !important;
  transform: none !important;
  margin-top: 6px;
  box-shadow: 0 4px 20px rgba(0,0,0,.1);
}

.header-search__results--inline.is-open {
  opacity: 1 !important;
  visibility: visible !important;
}

/* ── 768px: small tablet / phone ── */
@media (max-width: 768px) {
  :root { --hdr-pad: clamp(10px, 4vw, 16px); }

  .header-top .header-container { gap: 6px; }
}

/* ── 480px: small phone ── */
@media (max-width: 480px) {
  :root { --hdr-pad: 12px; }

  .header-top .header-container { gap: 6px; }

  .header-logo__badge {
    font-size: 11px;
    padding: 5px 10px;
  }

  .header-cart       { padding: 7px; }
  .header-search-icon { padding: 7px; }
}
