/* Закреплённая шапка и кнопка WhatsApp (inc/site-ui.php, assets/js/site-ui.js) */

html.ptv-sticky #t-header {
  position: -webkit-sticky;
  position: sticky;
  top: var(--ptv-sticky-top, 0px);
  z-index: 990;
  transition: box-shadow .2s ease;
}
html.ptv-sticky #t-header .t1261__panel { background-color: #fff; }
html.ptv-stuck #t-header { box-shadow: 0 6px 18px rgba(0, 0, 0, .10); }
/* переход по якорю — заголовок не прячется под шапкой */
html.ptv-sticky { scroll-padding-top: calc(var(--ptv-sticky-h, 0px) + 12px); }

.ptv-wa {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 995;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #25d366;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
  transition: transform .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}
.ptv-wa svg { width: 30px; height: 30px; display: block; }
.ptv-wa:hover { transform: scale(1.06); box-shadow: 0 8px 22px rgba(0, 0, 0, .26); }
.ptv-wa:focus-visible { outline: 3px solid #204547; outline-offset: 3px; }
.ptv-wa__tip {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: #1e1e1e;
  color: #fff;
  font: 600 13px/1 Arial, sans-serif;
  padding: 9px 12px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}
@media (hover: hover) and (min-width: 981px) {
  .ptv-wa:hover .ptv-wa__tip { opacity: 1; }
}
@media (max-width: 639px) {
  .ptv-wa { width: 52px; height: 52px; right: max(16px, env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom)); }
  .ptv-wa svg { width: 28px; height: 28px; }
}
@media print { .ptv-wa { display: none; } }

/* Значок кнопки «Каталог» в шапке — сетка 2×2 с одной зелёной плиткой (как на первом экране главной).
 * У Тильды значок — маска цвета текста, поэтому маску снимаем и рисуем свою картинку. */
#t-header .t1261__catalog-button .t-btnflex__icon_default_glyph::before {
  -webkit-mask-image: none; mask-image: none; background-color: transparent;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cg fill='none' stroke='%23fff' stroke-width='1.8'%3E%3Crect x='.9' y='.9' width='7.2' height='7.2' rx='2.2'/%3E%3Crect x='.9' y='11.9' width='7.2' height='7.2' rx='2.2'/%3E%3Crect x='11.9' y='11.9' width='7.2' height='7.2' rx='2.2'/%3E%3C/g%3E%3Crect x='11' width='9' height='9' rx='2.5' fill='%230ab088'/%3E%3C/svg%3E") center / 18px 18px no-repeat;
}

/* Шапка Тильды на узких экранах (≤980 px).
 * Поля: 24 px, на телефоне (<640) — 16 px; они же у первого экрана главной (--ptv-g).
 * Контакты — по краям, а не по центру. 640–980 — логотип, «Каталог» и поиск в одну строку
 * (вся строка закрепляется при прокрутке, site-ui.js сам видит, что строк больше не две). */
@media (max-width: 980px) {
  :root { --ptv-g: 24px; }
  #t-header .t1331 .t-container { max-width: none; width: auto; padding: 0 var(--ptv-g); }
  #t-header .t1331 .t-col { width: auto; max-width: none; margin: 0; padding: 0; }
  #t-header .t1331__row { justify-content: space-between; }
  #t-header .t1331__row .t-btnflex { padding-left: 0 !important; padding-right: 0 !important; }
  #t-header .t1261__container { padding-left: var(--ptv-g); padding-right: var(--ptv-g); }
}
@media (max-width: 639px) {
  :root { --ptv-g: 16px; }
}
@media (min-width: 640px) and (max-width: 980px) {
  #t-header .t1261__panel { padding-top: 14px; padding-bottom: 14px; }
  #t-header .t1261__container { flex-wrap: nowrap; gap: 16px; }
  #t-header .t1261__top-left { flex: 0 0 auto; width: auto; max-width: none; }
  #t-header .t1261__logo { margin-right: 0; }
  #t-header .t1261__logo-image { width: 200px; max-width: none; height: auto; }
  #t-header .t1261__top-middle { flex: 1 1 auto; flex-basis: auto; width: auto; min-width: 0; margin-top: 0; order: 0; }
  #t-header .t1261__catalog-search { flex: 1 1 auto; min-width: 0; }
  #t-header .t1261__catalog-buttons + .t1261__catalog-search { margin-left: 10px; }
}
/* до 820 px от кнопки «Каталог» остаётся значок — поиску нужно место */
@media (min-width: 640px) and (max-width: 819px) {
  #t-header .t1261__catalog-button { width: 45px; padding: 0 !important; justify-content: center; }
  #t-header .t1261__catalog-button .t-btnflex__text { display: none; }
}

/* ссылки из текстов страниц (inc/links.php) — цветом текста, с подчёркиванием */
a.ptv-al { color: inherit !important; text-decoration: underline !important; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent) !important; }
a.ptv-al:hover { text-decoration-color: currentColor !important; }
