/* =============================================================
   mobile-fix.css — песочница test-mobile/
   Подключается ПОСЛЕДНИМ после всех прод-CSS.
   Правила здесь имеют приоритет — добавляем точечно, по шагам:
     P0 — блокеры (overflow, viewport, бургер, tap-targets)
     P1 — единая модалка + sticky-CTA
     P2 — типографика, сетки, мелочи

   Все правки сюда. Прод-файлы (css/base.css и т.д.) НЕ трогаем
   до приёмки.
   ============================================================= */


/* =========================================================
   ШАГ 2 — P0 фиксы
   ========================================================= */

/* Защита от горизонтального скролла на любых вьюпортах.
   clip современнее hidden — не создаёт scroll-context и не ломает
   position:sticky у потомков. */
html,
body {
  overflow-x: clip;
}

/* Медиа кроме img (img уже покрыт в reset.css) не должны вылезать. */
video,
iframe,
svg:not([width]),
canvas {
  max-width: 100%;
}

/* iOS Safari: 100vh в .mobile-menu (components.css:799) съедает
   адресную строку при появлении/исчезновении — меню прыгает.
   100dvh решает; первая строка — фолбек для старых браузеров. */
.mobile-menu {
  height: 100vh;
  height: 100dvh;
}

/* Длинные гео-слова («поверка-вод-Балашиха-домодедовская-обл»)
   и одиночные слова в h1 не должны вылезать за контейнер.
   break-word разрывает только когда слово не помещается, в отличие
   от anywhere — поэтому обычный перенос по словам остаётся. */
h1, h2, h3, h4,
.breadcrumbs,
.breadcrumbs a,
.breadcrumbs span {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Tap-targets минимум 44×44 (Apple HIG).
   Визуальный размер иконок сохраняется внутри inline-flex. */
.phone-icon,
.phone-link-mobile,
.mobile-menu-close,
.mobile-nav-link {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* Для пунктов меню жёсткая ширина «свернёт» текст — растягиваем. */
.mobile-nav-link {
  width: 100%;
  justify-content: flex-start;
}

/* Бургер-кнопка по образцу домка: 44×44 tap-target + 3 равномерные
   полоски 24×2.5 внутри. Родной .burger-btn в components.css задан
   28×20 без padding — обновляем layout под HIG, сохраняя анимацию
   в крестик (.burger-btn.active span:nth-child(...) из прод-CSS). */
.burger-btn {
  min-width: 44px;
  min-height: 44px;
  width: 44px !important;
  height: 44px !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 5px;
  padding: 0;
  background: transparent;
  border: 0;
}
.burger-btn span {
  display: block;
  width: 24px;
  height: 2.5px;
  background: var(--color-text, #0f172a);
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}

/* =========================================================
   ШАГ 3 — единая модалка заказа звонка
   Прод не имеет CSS для .modal-overlay/.modal — добавляем здесь.
   Существующие .form-input/.form-label/.form-group/.btn-primary
   из components.css переиспользуются как есть.
   ========================================================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.modal-overlay[hidden] { display: none !important; }
.modal-overlay.is-open { display: flex; }

.modal {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 28px 22px 22px;
  width: 100%;
  max-width: 460px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
  animation: modalIn .18s ease-out;
}
@keyframes modalIn {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 40px 14px 0;
  line-height: 1.25;
  color: var(--color-text, #0f172a);
}

.modal-close {
  position: absolute;
  top: 10px; right: 10px;
  width: 40px; height: 40px;
  min-width: 44px; min-height: 44px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
}
.modal-close svg { width: 18px; height: 18px; }
.modal-close:hover { background: #e2e8f0; color: #0f172a; }

.modal-phone-cta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #eef5ff;
  border: 1px solid #c8def7;
  border-radius: 12px;
  text-decoration: none;
  margin-bottom: 6px;
  color: inherit;
}
.modal-phone-cta:hover { background: #e2eeff; border-color: #97bef0; }
.modal-phone-icon {
  flex-shrink: 0;
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--color-primary, #2563eb);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.modal-phone-label { font-size: 12px; color: #475569; font-weight: 500; }
.modal-phone-num { font-size: 18px; font-weight: 700; color: #0f172a; letter-spacing: -0.3px; }

.modal-or {
  position: relative;
  text-align: center;
  font-size: 13px;
  color: #64748b;
  margin: 16px 0 12px;
}
.modal-or::before,
.modal-or::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 70px);
  height: 1px;
  background: #e2e8f0;
}
.modal-or::before { left: 0; }
.modal-or::after  { right: 0; }

.modal .form-note {
  font-size: 12px;
  color: #64748b;
  text-align: center;
  margin: 10px 0 0;
  line-height: 1.4;
}

/* =========================================================
   ШАГ 4 — sticky-CTA снизу на мобиле
   Показывается только ≤900px, после скролла на ≥40vh.
   ========================================================= */

.sticky-cta {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1000;
  display: none;
  gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.08);
  transform: translateY(100%);
  transition: transform .25s ease;
}
.sticky-cta[hidden] { display: none !important; }
.sticky-cta.is-visible {
  display: flex;
  transform: translateY(0);
}

.sticky-cta-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border: 0;
  cursor: pointer;
}
.sticky-cta-call {
  background: #fff;
  color: var(--color-primary, #2563eb);
  border: 1.5px solid var(--color-primary, #2563eb);
}
.sticky-cta-call:hover { background: #eef5ff; }
.sticky-cta-order {
  background: var(--color-primary, #2563eb);
  color: #fff;
}
.sticky-cta-order:hover { filter: brightness(0.95); }

/* Иконочные кнопки «Назад» и «На главную» — компактные квадраты,
   чтобы основная пара «Позвонить»/«Заявка» не сжалась на 360-375px.
   Тап-таргет 44×48 — соответствует Apple HIG. */
.sticky-cta-icon {
  flex: 0 0 44px;
  width: 44px;
  min-width: 44px;
  padding: 0;
  background: #fff;
  color: var(--color-primary, #2563eb);
  border: 1.5px solid #cbd5e1;
}
.sticky-cta-icon:hover { background: #f1f5f9; }
.sticky-cta-icon[hidden] { display: none !important; }
.sticky-cta-icon svg { display: block; }
/* На очень узких экранах (320-360) уменьшаем gap, чтобы 4 кнопки
   точно поместились без переноса. */
@media (max-width: 380px) {
  .sticky-cta { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .sticky-cta-icon { flex: 0 0 40px; width: 40px; min-width: 40px; }
}
/* Складные/узкие (Galaxy Z Fold 5 в сложенном — 344px и меньше):
   ужимаем до предела, иначе «Заявка» уходит за правый край. */
@media (max-width: 360px) {
  .sticky-cta { gap: 4px; padding-left: 6px; padding-right: 6px; }
  .sticky-cta-icon { flex: 0 0 36px; width: 36px; min-width: 36px; }
  .sticky-cta-btn {
    font-size: 13px !important;
    padding: 8px 6px !important;
    gap: 4px !important;
    min-width: 0 !important;
  }
  .sticky-cta-btn svg { width: 16px !important; height: 16px !important; }
}

/* Когда панель видна — отступаем низ страницы, чтобы не закрывала
   последние элементы (footer, кнопки внизу контента). */
body.has-sticky-cta { padding-bottom: 76px; }

/* Скрываем на десктопе и планшете-альбомной (≥901px). */
@media (min-width: 1025px) {
  .sticky-cta { display: none !important; }
  body.has-sticky-cta { padding-bottom: 0; }
}

/* =========================================================
   ШАГ 5 — типографика, сетки, мелочи
   ========================================================= */

/* Уплотнение вертикальных отступов секций на мобиле.
   Прод-CSS даёт section padding 60-80 сверху/снизу → пользователь
   листает «пустые километры». На мобиле снижаем до 28px,
   страницы становятся ~30% короче, контент-плотность выше. */
@media (max-width: 700px) {
  /* Все <section> на мобиле — без огромного vertical padding
     и без LR-padding (иначе вложенные карточки расходятся по
     ширине неравномерно от секции к секции). */
  section,
  [class*="-section"]:not(.section-tag):not(.section-title):not(.footer-section):not(.footer-section-requisites) {
    padding-top: 28px !important;
    padding-bottom: 28px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  section[style*="padding: var(--spacing-xl)"],
  section[style*="padding:var(--spacing-xl)"],
  section[style*="padding: var(--spacing-xl) 0"],
  section[style*="padding: var(--spacing-lg)"],
  section[style*="padding:var(--spacing-lg)"],
  section[style*="padding: var(--spacing-lg) 0"] {
    padding-top: 24px !important;
    padding-bottom: 24px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
}

/* Заголовки на мобиле: clamp() — рост от 24px до десктопного размера.
   line-height tighter — заголовки в 4-6 строк больше не съедают
   первый экран на главной/гео/manufacturers. */
@media (max-width: 600px) {
  h1 {
    font-size: clamp(1.5rem, 6vw, 2.5rem);
    line-height: 1.18;
    letter-spacing: -0.01em;
  }
  h2 {
    font-size: clamp(1.25rem, 5vw, 2rem);
    line-height: 1.22;
  }
  h3 {
    font-size: clamp(1.1rem, 4.2vw, 1.5rem);
    line-height: 1.3;
  }
  /* Hero-абзац pumped размером — на мобиле явно ужимаем. */
  .hero p,
  .hero-subtitle {
    font-size: 0.9375rem;
    line-height: 1.5;
  }
}

/* Breadcrumbs на ≤480: «Главная / … / Текущая» — скрываем
   промежуточные звенья и оставляем только корень + последний
   разделитель + текущую страницу. Снимает 2 строки с первого
   экрана на гео-районах с глубокой вложенностью. */
/* Псевдо-separator: на mobile + tablet (≤900), только если нет
   родных separator-li в разметке. */
@media (max-width: 1024px) {
  .breadcrumbs-list:not(:has(.breadcrumbs-separator)) .breadcrumbs-item:not(:last-child)::after {
    content: '/';
    margin-left: 6px;
    color: #94a3b8;
    font-weight: 400;
    display: inline !important;     /* прод-CSS даёт block — выбивает разделитель на новую строку */
    flex-shrink: 0;
  }
}

/* Компактные breadcrumbs только на узких мобильных (≤480):
   font смаленьким, скрываем промежуточные звенья, ellipsis на хвосте. */
@media (max-width: 480px) {
  .breadcrumbs {
    font-size: 12px;
    line-height: 1.35;
    padding: 8px 0;
  }
  .breadcrumbs-list {
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
  }
  /* Списки с отдельными separator-li (cao, область):
     скрываем все звенья, оставляем первый + последний разделитель + последний */
  .breadcrumbs-list:has(.breadcrumbs-separator) .breadcrumbs-item { display: none; }
  .breadcrumbs-list:has(.breadcrumbs-separator) .breadcrumbs-item:first-child,
  .breadcrumbs-list:has(.breadcrumbs-separator) .breadcrumbs-item:nth-last-child(1),
  .breadcrumbs-list:has(.breadcrumbs-separator) .breadcrumbs-item:nth-last-child(2) {
    display: inline-flex;
    min-width: 0;
  }
  /* Списки без separator-li (manufacturers, articles):
     скрываем только middle items, оставляем «Главная … Текущая». */
  .breadcrumbs-list:not(:has(.breadcrumbs-separator)) .breadcrumbs-item:not(:first-child):not(:last-child) {
    display: none !important;
  }
  .breadcrumbs-item:last-child {
    flex: 1 1 auto;
    overflow: hidden;
  }
  .breadcrumbs-item:last-child a,
  .breadcrumbs-item:last-child span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    max-width: 100%;
  }
}

/* Унификация: на 768 (iPad portrait) бургер уже не нужен —
   ширины хватает для горизонтальной навигации. Но без знания
   точной разметки десктоп-меню — только подсказка цвета (баг 10).
   Оставляю как TODO для шага мерджа: на проде поменять брейкпойнт
   с 1024 на 900 в css/components.css. */

/* Поле текста на 360 сужено суммой:
   .container (24×2) + inline-style карточек (32-48 × 2) = до 144px съедено.
   Текст «по 2 слова в строку», заголовок в 4 строки.
   Снижаем .container padding и перебиваем большие inline-padding'и.
   После шага мерджа в прод inline-padding'и нужно почистить в HTML. */
/* Container и внешние margin'ы карточек — без «воздуха» по бокам на
   всех мобильных вьюпортах вплоть до tablet portrait. Прод-CSS даёт
   container padding 24px → на 360 это 14% поля, отбираемых у текста. */
@media (max-width: 768px) {
  .container {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
  .card,
  [class*="-card"]:not(.review-card):not(.location-card) {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  /* Большие margin-top между секциями (64-80px на проде)
     уплотняем до 16px — пользователю меньше скроллить. */
  [class*="-section"] {
    margin-top: 16px !important;
    margin-bottom: 0 !important;
  }
}
@media (max-width: 600px) {
  [style*="padding: 48px"],
  [style*="padding:48px"],
  [style*="padding: 40px"],
  [style*="padding:40px"],
  [style*="padding: 32px"],
  [style*="padding:32px"],
  [style*="padding: var(--spacing-xl)"],
  [style*="padding:var(--spacing-xl)"],
  [style*="padding: var(--spacing-lg)"],
  [style*="padding:var(--spacing-lg)"] {
    padding: 16px !important;
  }
  [style*="padding-left: 48px"], [style*="padding-left:48px"],
  [style*="padding-left: 40px"], [style*="padding-left:40px"],
  [style*="padding-left: 32px"], [style*="padding-left:32px"] {
    padding-left: 14px !important;
  }
  [style*="padding-right: 48px"], [style*="padding-right:48px"],
  [style*="padding-right: 40px"], [style*="padding-right:40px"],
  [style*="padding-right: 32px"], [style*="padding-right:32px"] {
    padding-right: 14px !important;
  }
  /* Карточный вид (border-radius + рамка + большой padding) на мобиле
     визуально сжимает текст без пользы — упрощаем рамку и радиус. */
  [style*="border-radius: 24px"],
  [style*="border-radius:24px"] {
    border-radius: 14px !important;
  }
  /* Карточки из прод-CSS (не inline) — собственные классы с
     padding 32-40px. На мобиле сжимаем до 16px по горизонтали,
     поле текста расширяется на ~30%. */
  /* Универсальное правило: любой класс с «-card» в имени на мобиле
     получает padding 12px LR. Покрывает .text-page-card, .toc-card,
     .info-card, .feature-card, .tariff-card, .usluga-hero-card,
     .odpu-function-card и т.д. Исключения: review-card (уже свой
     override), location-card (это тонкие плашки округов). */
  .card,
  [class*="-card"]:not(.review-card):not(.location-card) {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  /* Иконки внутри карточек на мобиле — диапазон 36–56 px.
     min-* защищает от пропадания на «icon-wrapper»-обёртках
     (иначе моя предыдущая правка сжимала уже маленькие иконки до 0).
     max-* не даёт большой иллюстрации съесть треть ширины поля. */
  [class*="-card"] [class*="-icon"]:not([class*="title-icon"]):not([class*="reviews-title"]):not(.icon-emoji),
  [class*="-card"] [class*="__avatar"],
  [class*="-card"] [class*="__media"] {
    min-width: 36px;
    max-width: 56px !important;
    min-height: 36px;
    max-height: 56px !important;
    flex-shrink: 0 !important;
  }
  /* Сжимаем gap между иконкой и текстовой колонкой внутри карточек */
  [class*="-card"][class*="-card"] {
    gap: 10px !important;
  }
  /* Сжимаем большой вертикальный padding (48px → 14px).
     :where() обнуляет specificity исключений — иначе это правило
     перебивает более специфичные настройки cross-link cards ниже. */
  [class*="-card"]:where(:not(.review-card):not(.location-card):not(.odpu-card)) {
    padding-top: 14px !important;
    padding-bottom: 14px !important;
  }
  /* Типографика внутри карточек — компактные заголовки и тексты.
     Раньше h3 в карточке = 22-24px, p = 16-17px с line-height 1.65.
     Это «раздувало» плашки даже при коротком тексте. */
  [class*="-card"] h2,
  [class*="-card"] h3,
  [class*="-card"] h4 {
    font-size: 1rem !important;       /* 16px */
    line-height: 1.25 !important;
    margin-bottom: 6px !important;
    margin-top: 0 !important;
  }
  [class*="-card"] p {
    font-size: 0.875rem !important;   /* 14px */
    line-height: 1.45 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }
  /* Заголовки секций — компактные на мобиле */
  h2.section-title,
  .section-title,
  h2[class*="-title"] {
    font-size: 1.25rem !important;
    line-height: 1.22 !important;
    margin-bottom: 14px !important;
    margin-top: 0 !important;
  }
  /* Стрелка-аватар в cross-link карточках — фиксированный круг. */
  [class*="-card__arrow"],
  [class*="-card__icon"] {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    flex-shrink: 0 !important;
  }
  [class*="-card__arrow"] {
    border-radius: 50% !important;
  }
  /* Cross-link/related карточки сами по себе компактнее */
  [class*="related-"][class*="-card"],
  [class*="cross-link"][class*="-card"],
  .related-brand-card {
    padding: 10px 14px !important;
    gap: 10px !important;
  }
  /* Вложенные блоки внутри карточек (__body, __name, __title, __content)
     получили мой padding 22/16 поверх своего родительского — тройная
     вложенность раздувала карточку в 3 раза. Обнуляем.
     Это правило идёт ПОСЛЕДНИМ в каскаде, чтобы перебить все
     предыдущие card-padding правила одинаковой specificity. */
  [class*="-card"] [class*="-card__body"],
  [class*="-card"] [class*="-card__name"],
  [class*="-card"] [class*="-card__title"],
  [class*="-card"] [class*="-card__content"],
  [class*="-card"] [class*="-card__inner"],
  [class*="-card"] [class*="__body"],
  [class*="-card"] [class*="__name"],
  [class*="-card"] [class*="__title"],
  [class*="-card"] [class*="__content"],
  [class*="-card"] [class*="__inner"] {
    padding: 0 !important;
  }
  /* odpu-* — двойная вложенность .odpu-card → .odpu-hero/features/duties
     создавала суммарный padding 32px по бокам внутри карточки.
     На мобиле дочерние блоки внутри карточки идут БЕЗ собственного
     LR-padding — поле текста заголовка вырастает с 202 до 268px. */
  .odpu-card > .odpu-hero,
  .odpu-card > .odpu-features,
  .odpu-card > .odpu-divider,
  .odpu-card > .odpu-duties,
  .odpu-card > .odpu-callouts,
  .odpu-card > .odpu-actions {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  /* Карточка ОДПУ — снизу/сверху тоже сжимаем (было 48px) */
  .odpu-card {
    padding-top: 20px !important;
    padding-bottom: 20px !important;
  }
  /* Списки внутри карточек с inline padding-left: var(--spacing-md)
     дают +32px lhs — на мобиле снижаем. */
  li[style*="padding-left: var(--spacing-md)"],
  li[style*="padding-left:var(--spacing-md)"],
  li[style*="padding-left: var(--spacing-lg)"],
  li[style*="padding-left:var(--spacing-lg)"] {
    padding-left: 22px !important;
  }
}

/* =========================================================
   ШАГ 5b (часть 1): карточки отзывов в стиле домка
   - Карусель → вертикальная стопка (без auto-scroll)
   - Лёгкая рамка + мягкая тень вместо «карточки в кубе»
   - Звёзды жёлтые (тёплый акцент, как в домке)
   - Текст 14.5px вместо 16-17 — поле читается широко
   ========================================================= */

@media (max-width: 700px) {
  .reviews-carousel { overflow: visible !important; }
  .reviews-track {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    transform: none !important;
    width: 100% !important;
  }
  .review-slide {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .review-card {
    padding: 16px !important;
    background: #fff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 14px !important;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05) !important;
  }
  .review-card > div { gap: 12px !important; }
  /* Звёзды — тёплый жёлтый вместо синего primary */
  .review-card [style*="color: var(--color-primary)"]:not(p) {
    color: #f5a524 !important;
  }
  .review-card p {
    font-size: 14.5px !important;
    line-height: 1.55 !important;
    color: #334155 !important;
    margin: 0 !important;
  }
  /* Аватар компактнее + защита от flex-сжатия (был 48×48,
     но без flex-shrink сжимался до 15×40 при длинных именах). */
  .review-card [style*="width: 48px"][style*="height: 48px"] {
    width: 40px !important;
    height: 40px !important;
    flex-shrink: 0 !important;
    min-width: 40px !important;
    font-size: 14px !important;
  }
  /* Кнопки навигации карусели не нужны — стопка прокручивается общим скроллом */
  .reviews-prev, .reviews-next,
  .service-reviews-section .reviews-nav,
  .manufacturer-reviews-section .reviews-nav {
    display: none !important;
  }
}

/* =========================================================
   ШАГ 5b (часть 2): шапка по образцу домка
   Порядок: ЛОГО | «Заявка» | бургер.
   Кнопка «Заявка» инжектится через JS в .header-content-mobile.
   Длинный телефон-блок скрывается — его функцию заменяет
   sticky-CTA + модалка с tel:-кнопкой сверху.
   ========================================================= */

@media (max-width: 1024px) {
  /* Прод прячет десктоп-шапку только до 768. Мы расширили
     мобильную до 1024 (планшеты-портрет/складные: iPad Mini/Air/Pro,
     Surface Pro, Asus Zenbook Fold). Десктопная должна уйти на этом
     же интервале, иначе на 769-1024 показываются обе одновременно. */
  .header-content { display: none !important; }
  .header-content-mobile {
    display: flex !important;
    align-items: center !important;
    /* НЕ space-between: на 800-1024 это размазывает «Заявку» в центр,
       выглядит висящей в воздухе. Прижимаем лого слева, CTA+бургер — справа. */
    justify-content: flex-start !important;
    gap: 8px;
    padding: 6px 0;
  }
  .header-content-mobile .logo { order: 1; flex-shrink: 0; margin-right: auto; }
  .header-content-mobile .header-mobile-cta { order: 2; flex: 0 0 auto; }
  .header-content-mobile .burger-btn { order: 3; flex-shrink: 0; }
  .header-content-mobile .header-mobile-contacts { display: none !important; }
}

/* Hero-заголовок на планшетах-узких (601-1024). Прод даёт h1
   48-56px — на 4 строки съедает первый экран. Сжимаем до 28-36px
   и центрируем по высоте с иллюстрацией справа. */
@media (min-width: 601px) and (max-width: 1024px) {
  .usluga-hero-card h1,
  .hero h1,
  .service-hero h1 {
    font-size: clamp(26px, 3.6vw, 34px) !important;
    line-height: 1.18 !important;
  }
  .usluga-hero-card h2,
  .hero h2 {
    font-size: clamp(18px, 2.4vw, 22px) !important;
    line-height: 1.25 !important;
  }
  /* Inline `align-items: start` в grid-2 hero — центрируем,
     чтобы текст и иллюстрация шли по одной оси. И перевешиваем баланс
     колонок: текст с h1 шире (60%), иллюстрация уже (40%) — заголовок
     перестаёт переноситься на 4 строки в узкой левой колонке. */
  .usluga-hero-card .grid.grid-2 {
    align-items: center !important;
    grid-template-columns: 1.5fr 1fr !important;
  }
}

.header-mobile-cta {
  min-height: 40px;
  padding: 8px 14px;
  background: var(--color-primary, #2563eb);
  color: #fff;
  border: 0;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform .15s ease, filter .15s ease;
}
.header-mobile-cta:hover { filter: brightness(0.95); transform: translateY(-1px); }
.header-mobile-cta:active { transform: translateY(0); }

/* На десктопе кнопка не нужна — там есть полная навигация. */
@media (min-width: 1025px) {
  .header-mobile-cta { display: none !important; }
}

/* Уплотнение блоков футера на мобиле — Навигация / Контакты /
   Реквизиты раньше шли с padding 28+28 + margin 16 = 72 px пустоты
   между блоками. На мобиле снижаем до 14 px + 0 margin. */
@media (max-width: 1024px) {
  /* На планшетах (601-1024) подвал в 2 колонки:
        Навигация (col 1, на 2 ряда — она длинная)
        Контакты (col 2 row 1) / Реквизиты+карта (col 2 row 2) */
  footer .footer-content,
  .site-footer .footer-content,
  .footer .footer-content {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    grid-template-areas:
      "nav contacts"
      "nav requisites" !important;
    gap: 0 24px !important;
    align-items: start !important;
  }
  /* Привязка секций к областям. Контакты — это вторая
     .footer-section без специального класса. */
  footer .footer-section:nth-child(1),
  .site-footer .footer-section:nth-child(1),
  .footer .footer-section:nth-child(1) { grid-area: nav; }
  footer .footer-section:nth-child(2),
  .site-footer .footer-section:nth-child(2),
  .footer .footer-section:nth-child(2) { grid-area: contacts; }
  footer .footer-section-requisites,
  .site-footer .footer-section-requisites,
  .footer .footer-section-requisites { grid-area: requisites; }
  /* Карта внутри Реквизитов — растянуть до полной ширины секции. */
  .footer-section-requisites .footer-requisites-content,
  .footer-section-requisites iframe,
  .footer-section-requisites [class*="map"] {
    width: 100% !important;
    max-width: none !important;
  }
}
@media (max-width: 600px) {
  /* Узкие телефоны — обратно в одну колонку, иначе текст ужмётся. */
  footer .footer-content,
  .site-footer .footer-content,
  .footer .footer-content {
    display: block !important;
    grid-template-columns: none !important;
  }
}
@media (max-width: 1024px) {
  .footer-section {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }
  .footer-section h3 {
    margin-bottom: 4px !important;
    line-height: 1.2 !important;
  }
  /* Списки внутри секций — сжать межстрочные margin у li */
  .footer-section ul,
  .footer-section ol { margin: 0 !important; padding: 0 !important; }
  .footer-section li {
    margin-bottom: 2px !important;
    padding-top: 2px !important;
    padding-bottom: 2px !important;
    line-height: 1.35 !important;
  }
  .footer-section p { margin: 0 0 4px !important; line-height: 1.35 !important; }
  /* Границы между блоками — мягко размытые градиентом вместо
     резкой 1px-линии. Внутренняя тень с большим blur даёт фейд
     от тёмного к прозрачному вниз. */
  .footer-section + .footer-section {
    border-top: 0 !important;
    box-shadow: inset 0 14px 14px -14px rgba(15, 23, 42, 0.22);
    padding-top: 16px !important;
  }
  /* Переход от секции выше футера к самому футеру — тоже
     размываем: тонкий градиент-фейд на верхнем крае футера.
     И сразу режем margin/padding-top у самого <footer> — у прода
     там 64+64 = 128 px пустого воздуха перед лого. */
  footer, .site-footer, .footer {
    position: relative;
    margin-top: 0 !important;
    padding-top: 10px !important;
  }
  footer::before, .site-footer::before, .footer::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 18px;
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.10), transparent);
    pointer-events: none;
  }
}

/* Лого в подвале — клон шапочного (с SVG-каплей).
   Размеры синхронизируем с шапкой через одну переменную,
   чтобы оба лого «звучали» как один. */
:root { --logo-size-mobile: 20px; }

.footer-logo-mobile {
  display: flex;
  justify-content: flex-start;
  padding: 10px 8px 6px;
}
/* На планшетных размерах (769-1024) прод `.container` шапки/подвала
   даёт padding 24 — лого подвала должен иметь то же left-смещение,
   иначе он съезжает на 16px влево относительно «Навигация» и шапочного
   лого. На 601-768 прод `.container` ещё мобильный (padding 8) —
   подвал-лого там тоже остаётся на 8. */
@media (min-width: 769px) and (max-width: 1024px) {
  .footer-logo-mobile {
    padding-left: 24px !important;
    padding-right: 24px !important;
  }
}
/* На десктопе подвал-лого должен быть на той же вертикальной оси,
   что и лого в шапке. Шапка кладёт лого в .container (max-width: 1200,
   padding: 0 24px) и центрирует. Подвал-лого по умолчанию прижат к
   левому краю экрана — повторяем ту же обёртку. */
@media (min-width: 1025px) {
  .footer-logo-mobile {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 24px 8px !important;
  }
}
.footer-logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
/* Шапка и подвал — одинаковый размер шрифта, тот же visual rhythm. */
.header-content-mobile .logo,
.footer-logo-mobile .footer-logo-link .logo {
  font-size: var(--logo-size-mobile) !important;
  line-height: 1 !important;
  font-weight: 700 !important;
  letter-spacing: -0.2px !important;
  display: inline-flex !important;
  align-items: center !important;
}
/* SVG-капля масштабируется по em — одинаковая в шапке и подвале. */
.header-content-mobile .logo svg,
.footer-logo-mobile .footer-logo-link .logo svg {
  width: 0.6em;
  height: 0.8em;
  margin: 0 0.22em;
  vertical-align: -0.12em;
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .footer-logo-mobile { padding: 10px 8px 6px; }
}

/* Подвешенная CTA внутри выдвижного мобильного меню.
   Инжектится JS-ом (injectMobileMenuCTA) в конец .mobile-menu, sticky
   к низу — заметна при любой длине меню. */
.mobile-menu .menu-cta-wrap {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, #fff 70%, rgba(255,255,255,0));
  border-top: 1px solid #e2e8f0;
}
.mobile-menu .menu-cta {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  background: var(--color-primary, #2563eb);
  color: #fff;
  border: 0;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}
.mobile-menu .menu-cta:hover { filter: brightness(0.95); }
.mobile-menu .menu-cta-note {
  text-align: center;
  font-size: 12px;
  color: #64748b;
  margin: 8px 0 0;
}
.mobile-menu .menu-cta-tel {
  display: block;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-primary, #2563eb);
  margin-top: 8px;
  padding: 8px;
}

/* =========================================================
   ШАГ 5b (часть 3): hero-форма скрыта на узком мобиле
   На мобиле hero-форма (h ≈ 530px) выпадает ниже фолда,
   занимает место, дублирует модалку + sticky-CTA. Скрываем.
   Кнопки «Вызвать мастера/Оставить заявку» в hero остаются
   и через делегирование открывают модалку.
   ========================================================= */

@media (max-width: 640px) {
  .request-form {
    display: none !important;
  }
}

/* =========================================================
   ШАГ 5b (часть 4): кнопки в карточках цен — компактнее
   На мобиле tariff-card .btn — это outline-кнопка с высотой 60+px.
   На каждую карточку = -50px места. Снижаем до 40px высоты,
   уменьшаем padding. Кнопка как «лёгкий CTA», а не главный фокус
   (главный CTA на мобиле — sticky-CTA + модалка).
   ========================================================= */

@media (max-width: 600px) {
  .tariff-card .btn,
  .price-card .btn {
    min-height: 40px !important;
    padding: 9px 14px !important;
    font-size: 14px !important;
    border-radius: 10px !important;
  }
}

/* grid-2 «карточек-фич» на 360 ломал слова по символам
   («Без снятия счетчик / а»). На узких экранах — одна колонка.
   Часть карточек вёрстается через inline-style на div — отсюда
   атрибутный селектор + !important. Шаг 5 уберёт inline из HTML
   и этот override можно будет почистить. */
@media (max-width: 480px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
  [style*="grid-template-columns: repeat(2"],
  [style*="grid-template-columns:repeat(2"] {
    grid-template-columns: 1fr !important;
  }
}

/* =========================================================
   Градиент для «primary» кнопок — заменяет плоскую синюю
   заливку на лёгкий diagonal-градиент (как у info-блока
   «Номера ГРСИ»). Покрывает все CTA: «Заявка»/«Заказать
   звонок»/«Оставить заявку» в шапке, sticky-CTA, модалке,
   меню, hero-форме и tariff-кнопках.
   ========================================================= */
.btn-primary,
.btn.btn-primary,
button.btn-primary,
a.btn-primary,
.header-mobile-cta,
.sticky-cta-order,
.menu-cta {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(135deg, #3b6fe8 0%, #2563eb 55%, #1d4ed8 100%) !important;
  color: #fff !important;
  border: 0 !important;
  /* Мягкий ореол: ближняя плотная тень + дальний размытый glow. */
  box-shadow:
    0 2px 6px rgba(37, 99, 235, 0.28),
    0 10px 28px -6px rgba(37, 99, 235, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset !important;
  transition: filter .2s ease, transform .15s ease, box-shadow .25s ease;
}
/* Бегущий блик — диагональная световая полоса по кнопке.
   Длинный цикл (9s): сам пробег ~1.6s, остальное время — пауза в крайнем
   положении, чтобы блик появлялся редко и не мельтешил. */
.btn-primary::before,
.btn.btn-primary::before,
button.btn-primary::before,
a.btn-primary::before,
.header-mobile-cta::before,
.sticky-cta-order::before,
.menu-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    transparent 0%,
    transparent 38%,
    rgba(255, 255, 255, 0.42) 50%,
    transparent 62%,
    transparent 100%
  );
  background-size: 220% 100%;
  background-position: 120% 0;
  mix-blend-mode: screen;
  opacity: 0.85;
  z-index: 1;
  animation: pvBtnShine 30s ease-in-out infinite;
}
/* Контент кнопок — над бликом. */
.btn-primary > *,
.btn.btn-primary > *,
button.btn-primary > *,
a.btn-primary > *,
.header-mobile-cta > *,
.sticky-cta-order > *,
.menu-cta > * {
  position: relative;
  z-index: 2;
}
@keyframes pvBtnShine {
  0%   { background-position: 120% 0; }
  5%   { background-position: -120% 0; }
  100% { background-position: -120% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .btn-primary::before,
  .btn.btn-primary::before,
  button.btn-primary::before,
  a.btn-primary::before,
  .header-mobile-cta::before,
  .sticky-cta-order::before,
  .menu-cta::before {
    animation: none;
    opacity: 0;
  }
}
.btn-primary:hover,
.btn.btn-primary:hover,
.header-mobile-cta:hover,
.sticky-cta-order:hover,
.menu-cta:hover {
  filter: brightness(1.06) saturate(1.05);
  box-shadow:
    0 4px 10px rgba(37, 99, 235, 0.32),
    0 14px 36px -6px rgba(37, 99, 235, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset !important;
  transform: translateY(-1px);
}
.btn-primary:active,
.btn.btn-primary:active,
.header-mobile-cta:active,
.sticky-cta-order:active,
.menu-cta:active {
  transform: translateY(0);
  box-shadow:
    0 2px 4px rgba(37, 99, 235, 0.24),
    0 6px 16px -4px rgba(37, 99, 235, 0.35) !important;
}

/* =========================================================
   Пульсирующая точка-индикатор в правой части plate с телефоном.
   Точка справа от номера, по центру вертикально. Из центра
   расходится зелёное кольцо — «оператор онлайн, можно звонить».
   Сама .modal-phone-cta остаётся «светлой plate» — НЕ
   заливается градиентом.
   ========================================================= */
.modal-phone-cta { position: relative; }
.modal-phone-cta::after,
.modal-phone-cta::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 14px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  pointer-events: none;
}
/* ::after — сама точка (зелёный пин с белым ободком), лёгкий scale-пульс. */
.modal-phone-cta::after {
  background: #22c55e;
  box-shadow: 0 0 0 2px #fff, 0 0 6px rgba(34, 197, 94, 0.55);
  transform: translateY(-50%);
  z-index: 2;
  animation: pvPhoneDot 2.2s ease-in-out infinite;
}
/* ::before — расходящееся кольцо вокруг точки, эманирует из центра. */
.modal-phone-cta::before {
  background: transparent;
  transform: translateY(-50%);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
  z-index: 1;
  animation: pvPhonePulse 2.2s ease-out infinite;
}
@keyframes pvPhonePulse {
  0%   { box-shadow: 0 0 0 0   rgba(34, 197, 94, 0.55); opacity: 1; }
  70%  { box-shadow: 0 0 0 16px rgba(34, 197, 94, 0);   opacity: 0; }
  100% { box-shadow: 0 0 0 0   rgba(34, 197, 94, 0);   opacity: 0; }
}
@keyframes pvPhoneDot {
  0%, 100% { transform: translateY(-50%) scale(1); }
  50%      { transform: translateY(-50%) scale(1.18); }
}
@media (prefers-reduced-motion: reduce) {
  .modal-phone-cta::before,
  .modal-phone-cta::after { animation: none; }
}
