/* MOST — адаптивный слой (планшеты + телефоны).
   ВАЖНО: сервер отдаёт inline-стили БЕЗ пробела после двоеточия
   (display:grid; padding:12px 64px). Поэтому селекторы — прежде всего
   БЕЗ пробела; варианты с пробелом добавлены для реактивных узлов,
   которые рантайм (support.js) перерисовывает с пробелом.
   Классы .mnav-* навешивает mobile-nav.js (бургер-меню). */

/* базово: бургер и клон CTA скрыты (видны только на ≤1024) */
.mnav-burger { display: none; }
.mnav-cta-clone { display: none; }

/* ============ 1025–1439px: узкие ноутбуки / ландшафт-планшеты ============
   корень из фикс-1440 делаем резиновым, многоколоночные сетки оставляем. */
@media (min-width: 1025px) and (max-width: 1439px) {
  [data-screen-label] { width: 100% !important; max-width: 1440px; min-width: 0 !important; margin: 0 auto !important; }
  img, image-slot, video, canvas, svg { max-width: 100% !important; }
}

/* ============ ≤1024px: одна колонка, всё резиновое ============ */
@media (max-width: 1024px) {
  [data-screen-label] { width: 100% !important; min-width: 0 !important; margin: 0 !important; }

  /* многоколоночные сетки → одна колонка (оба варианта сериализации) */
  [style*="display:grid"], [style*="display: grid"] { grid-template-columns: 1fr !important; }
  .reel-grid[style*="display:grid"], .reel-grid { grid-template-columns: repeat(3, 1fr) !important; }
  /* видео-отзывы на главной → горизонтальный скролл */
  .home-reels { overflow-x: auto !important; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; padding-bottom: 6px; margin-left: -2px; margin-right: -2px; }
  .home-reels > a { flex: 0 0 44% !important; min-width: 0 !important; scroll-snap-align: start; }
  [style*="grid-column"] { grid-column: auto !important; }
  [style*="grid-row"] { grid-row: auto !important; }

  /* медиа не шире экрана */
  img, image-slot, video, canvas, svg { max-width: 100% !important; height: auto; }

  /* длинные слова и «таблицы» переносим, а не скроллим */
  [style*="white-space:nowrap"], [style*="white-space: nowrap"] { white-space: normal !important; }
  h1, h2, h3 { overflow-wrap: break-word; word-break: break-word; }

  /* flex-строки «слева↔справа» переносим (кроме бегущей строки — она не space-between) */
  [style*="justify-content:space-between"], [style*="justify-content: space-between"] { flex-wrap: wrap !important; }
  /* заголовочные ряды секций (h2 + подзаголовок + ссылка) — в аккуратный столбик */
  [style*="justify-content:space-between"][style*="align-items:baseline"],
  [style*="justify-content: space-between"][style*="align-items: baseline"] {
    flex-direction: column !important; align-items: flex-start !important; gap: 6px !important;
  }
  /* ссылка «Все …→» в таком столбике — без левого отступа (иначе уезжает вправо) */
  [style*="justify-content:space-between"][style*="align-items:baseline"] > a,
  [style*="justify-content: space-between"][style*="align-items: baseline"] > a {
    margin-left: 0 !important;
  }

  /* вложенные крупные горизонтальные паддинги карточек/баров (2-е значение шортхенда) */
  [style*=" 52px"], [style*=" 64px"], [style*=" 48px"], [style*=" 44px"] {
    padding-left: 20px !important; padding-right: 20px !important;
  }

  /* горизонтальные отступы секций (прямые дети корня) */
  [data-screen-label] > div { padding-left: 24px !important; padding-right: 24px !important; }
  /* исключения: липкая шапка (свой паддинг у .mnav-row) и полноширинные полосы */
  [data-screen-label] > div[style*="position:sticky"], [data-screen-label] > div[style*="position: sticky"],
  [data-screen-label] > div[style*="overflow:hidden"], [data-screen-label] > div[style*="overflow: hidden"] {
    padding-left: 0 !important; padding-right: 0 !important;
  }

  /* ужимаем гигантский тайп */
  h1 { font-size: clamp(34px, 6.4vw, 60px) !important; line-height: 1.04 !important; }
  h2 { font-size: clamp(26px, 4.4vw, 38px) !important; line-height: 1.08 !important; }
  [style*="font-size:200px"], [style*="font-size: 200px"] { font-size: 72px !important; line-height: 1.02 !important; }
  [style*="font-size:104px"], [style*="font-size: 104px"] { font-size: 56px !important; }
  [style*="font-size:92px"],  [style*="font-size: 92px"],
  [style*="font-size:88px"],  [style*="font-size: 88px"],
  [style*="font-size:84px"],  [style*="font-size: 84px"],
  [style*="font-size:82px"],  [style*="font-size: 82px"],
  [style*="font-size:80px"],  [style*="font-size: 80px"] { font-size: 48px !important; line-height: 1.05 !important; }
  [style*="font-size:72px"],  [style*="font-size: 72px"] { font-size: 44px !important; }
  [style*="font-size:58px"],  [style*="font-size: 58px"],
  [style*="font-size:56px"],  [style*="font-size: 56px"] { font-size: 36px !important; }

  /* большие межколоночные gap ужимаем */
  [style*="gap:48px"], [style*="gap: 48px"] { gap: 24px !important; }
  [style*="gap:44px"], [style*="gap: 44px"] { gap: 22px !important; }
  [style*="gap:40px"], [style*="gap: 40px"] { gap: 20px !important; }

  /* ===== компактный подвал: бренд на всю ширину, 4 рубрики сеткой 2×2 =====
     (правило идёт ПОСЛЕ общего схлопывания сеток — перебивает его по порядку) */
  [style*="grid-template-columns:1.2fr 1fr 1fr 1fr 1fr"],
  [style*="grid-template-columns: 1.2fr 1fr 1fr 1fr 1fr"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 26px 18px !important;
  }
  [style*="grid-template-columns:1.2fr 1fr 1fr 1fr 1fr"] > div:first-child,
  [style*="grid-template-columns: 1.2fr 1fr 1fr 1fr 1fr"] > div:first-child {
    grid-column: 1 / -1 !important;
  }

  /* высокие фото-слоты */
  image-slot[style*="height:360px"], image-slot[style*="height: 360px"],
  image-slot[style*="height:340px"], image-slot[style*="height: 340px"],
  image-slot[style*="height:320px"], image-slot[style*="height: 320px"],
  image-slot[style*="height:280px"], image-slot[style*="height: 280px"] { height: 230px !important; }

  /* ===== бургер-меню (классы навешивает mobile-nav.js) ===== */
  .mnav-row { padding-left: 20px !important; padding-right: 20px !important; }
  .mnav-cta { display: none !important; }              /* исходный CTA в шапке прячем */

  .mnav-burger {
    display: inline-flex !important; flex-direction: column; justify-content: center;
    gap: 5px; width: 44px; height: 44px; padding: 0; box-sizing: border-box;
    background: transparent; border: 1.5px solid #111; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .mnav-burger span { display: block; width: 20px; height: 2px; margin: 0 auto; background: #111;
    transition: transform .2s ease, opacity .2s ease; }
  .mnav-burger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .mnav-burger.is-open span:nth-child(2) { opacity: 0; }
  .mnav-burger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .mnav-panel {
    position: absolute !important; top: 100% !important; left: 0 !important; right: 0 !important;
    display: none !important; flex-direction: column !important; align-items: stretch !important;
    gap: 0 !important; background: #ECEBE4; border-top: 1.5px solid #111;
    padding: 6px 20px 16px !important; z-index: 200; box-shadow: 0 14px 26px rgba(0,0,0,.10);
  }
  .mnav-open .mnav-panel { display: flex !important; }
  .mnav-panel > a { margin: 0 !important; padding: 14px 2px !important; font-size: 16px !important;
    border-bottom: 1px solid rgba(17,17,17,.12); }
  .mnav-panel .mnav-cta-clone {
    display: block !important; margin-top: 12px !important; border-bottom: none !important;
    text-align: center; background: #C7F23E !important; color: #111 !important;
    border: 1.5px solid #111 !important; padding: 14px 18px !important; font-size: 13px !important;
  }
}

/* ============ ≤720px: телефоны — плотнее ============ */
@media (max-width: 720px) {
  [data-screen-label] > div { padding-left: 18px !important; padding-right: 18px !important; }
  [data-screen-label] > div[style*="position:sticky"], [data-screen-label] > div[style*="position: sticky"],
  [data-screen-label] > div[style*="overflow:hidden"], [data-screen-label] > div[style*="overflow: hidden"] {
    padding-left: 0 !important; padding-right: 0 !important;
  }
  .mnav-row { padding-left: 16px !important; padding-right: 16px !important; }
  .mnav-panel { padding-left: 16px !important; padding-right: 16px !important; }
  .reel-grid[style*="display:grid"], .reel-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .home-reels > a { flex: 0 0 60% !important; }

  h1 { font-size: clamp(30px, 10vw, 44px) !important; }
  h2 { font-size: clamp(23px, 6.6vw, 30px) !important; }
  [style*="font-size:200px"], [style*="font-size: 200px"] { font-size: 48px !important; }
  [style*="font-size:104px"], [style*="font-size: 104px"] { font-size: 42px !important; }
  [style*="font-size:92px"],  [style*="font-size: 92px"],
  [style*="font-size:88px"],  [style*="font-size: 88px"],
  [style*="font-size:84px"],  [style*="font-size: 84px"],
  [style*="font-size:82px"],  [style*="font-size: 82px"],
  [style*="font-size:80px"],  [style*="font-size: 80px"] { font-size: 38px !important; }
  [style*="font-size:72px"],  [style*="font-size: 72px"] { font-size: 34px !important; }
  [style*="font-size:58px"],  [style*="font-size: 58px"],
  [style*="font-size:56px"],  [style*="font-size: 56px"] { font-size: 30px !important; }

  /* бегущая строка логотипов — мельче */
  [style*="animation:most-marquee"], [style*="animation: most-marquee"] { font-size: 13px !important; }

  /* ряды чипов-эйброу (display:flex;gap:8px) переносим, а не скроллим на узких телефонах */
  [style*="display:flex"][style*="gap:8px"], [style*="display: flex"][style*="gap: 8px"] { flex-wrap: wrap !important; }

  image-slot[style*="height:360px"], image-slot[style*="height: 360px"],
  image-slot[style*="height:340px"], image-slot[style*="height: 340px"],
  image-slot[style*="height:320px"], image-slot[style*="height: 320px"],
  image-slot[style*="height:280px"], image-slot[style*="height: 280px"] { height: 200px !important; }
}
