/* ==================================================================
   SOVKOVA FIT — мобильные фиксы
   ВЕРСИЯ: v6-2026-08-05-GRIDSPACE
   Продублированы селекторы с пробелом и без пробела после ':'
   внутри значений style*=, т.к. на проде инлайн-стили могут
   приходить без пробелов (минификация на стороне хостинга).
   ================================================================== */

@media (max-width: 768px) {

  /* Страховка от бокового скролла */
  html, body { overflow-x: hidden !important; overflow-x: clip !important; }

  /* ---- Сетки с фиксированной колонкой: не влезают в 390px ---- */
  [style*="grid-template-columns: 1fr 420px"],
  [style*="grid-template-columns:1fr 420px"],
  [style*="grid-template-columns: 1fr 320px"],
  [style*="grid-template-columns:1fr 320px"],
  [style*="grid-template-columns: 420px 1fr"],
  [style*="grid-template-columns:420px 1fr"],
  [style*="grid-template-columns: 380px 1fr"],
  [style*="grid-template-columns:380px 1fr"],
  [style*="grid-template-columns: 280px 1fr"],
  [style*="grid-template-columns:280px 1fr"],
  [style*="grid-template-columns: 220px 1fr"],
  [style*="grid-template-columns:220px 1fr"],
  [style*="grid-template-columns: 200px 1fr"],
  [style*="grid-template-columns:200px 1fr"],
  [style*="grid-template-columns: 140px 1fr"],
  [style*="grid-template-columns:140px 1fr"] {
    grid-template-columns: 1fr !important;
    min-height: auto !important;
  }
  /* Фото-колонки героев после схлопывания */
  [style*="grid-template-columns: 1fr 420px"] > div:last-child,
  [style*="grid-template-columns:1fr 420px"] > div:last-child,
  [style*="grid-template-columns: 1fr 320px"] > div:last-child,
  [style*="grid-template-columns:1fr 320px"] > div:last-child {
    min-height: 300px !important;
  }
  [style*="grid-template-columns: 1fr 320px"] > div:last-child img,
  [style*="grid-template-columns:1fr 320px"] > div:last-child img {
    object-position: 50% 62% !important;
  }

  /* ---- Равные колонки: на телефоне давятся в нечитаемое ---- */
  [style*="grid-template-columns: 1fr 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1.4fr 1fr 1fr"],
  [style*="grid-template-columns:1.4fr 1fr 1fr"],
  [style*="grid-template-columns: 1fr auto 1fr auto 1fr"],
  [style*="grid-template-columns:1fr auto 1fr auto 1fr"] {
    grid-template-columns: 1fr !important;
  }
  [style*="grid-column: span 2"],
  [style*="grid-column:span 2"] {
    grid-column: 1 !important;
  }

  /* ---- Карточки «номер + текст»: горизонтальная строка, не стопка ---- */
  div[style*="grid-template-columns: 42px 1fr"],
  div[style*="grid-template-columns:42px 1fr"],
  div[style*="grid-template-columns: 48px 1fr"],
  div[style*="grid-template-columns:48px 1fr"] {
    grid-template-columns: 34px 1fr !important;
    gap: 12px !important;
    padding: 18px !important;
  }

  /* ---- Флекс-герои с фото фиксированной ширины ---- */
  [style*="min-height: 520px"][style*="display: flex"],
  [style*="min-height:520px"][style*="display:flex"],
  [style*="min-height: 540px"][style*="display: flex"],
  [style*="min-height:540px"][style*="display:flex"],
  [style*="min-height: 480px"][style*="display: flex"],
  [style*="min-height:480px"][style*="display:flex"],
  [style*="min-height: 420px"][style*="display: flex"],
  [style*="min-height:420px"][style*="display:flex"] {
    flex-direction: column !important;
    min-height: auto !important;
  }
  [style*="width: 380px"][style*="flex-shrink: 0"],
  [style*="width:380px"][style*="flex-shrink:0"] {
    width: 100% !important;
    height: 340px !important;
    background-position: center 65% !important;
  }
  [style*="width: 360px"][style*="flex-shrink: 0"],
  [style*="width:360px"][style*="flex-shrink:0"] {
    width: 100% !important;
    height: 300px !important;
  }

  /* ---- Горизонтальные ряды «этапов» (ob-inne): в столбик ---- */
  [style*="display: flex"][style*="gap: 16px"][style*="align-items: center"],
  [style*="display:flex"][style*="gap:16px"][style*="align-items:center"] {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  [style*="flex: 1 1 0%"][style*="align-items: center"][style*="gap: 0px"],
  [style*="flex:1 1 0%"][style*="align-items:center"][style*="gap:0px"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    margin-bottom: 24px !important;
  }
  [style*="flex: 1 1 0%"][style*="align-items: center"][style*="gap: 0px"] > svg,
  [style*="flex:1 1 0%"][style*="align-items:center"][style*="gap:0px"] > svg {
    display: none !important;
  }
  [style*="flex: 0 0 180px"],
  [style*="flex:0 0 180px"] {
    flex: none !important;
    width: 100% !important;
  }

  /* ---- Кнопки: фиксированная высота + длинный текст = вылет ---- */
  a[style*="height: 50px"],
  a[style*="height:50px"],
  a[style*="height: 54px"],
  a[style*="height:54px"],
  a[style*="height: 52px"],
  a[style*="height:52px"] {
    box-sizing: border-box !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 50px !important;
    white-space: normal !important;
    text-align: center !important;
    justify-content: center !important;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
  }

  /* ---- Крупные десктопные отступы секций ---- */
  [style*="padding: 80px 32px"], [style*="padding:80px 32px"] { padding: 40px 16px !important; }
  [style*="padding: 72px 48px 64px 32px"], [style*="padding:72px 48px 64px 32px"] { padding: 36px 16px 32px !important; }
  [style*="padding: 64px 32px"], [style*="padding:64px 32px"] { padding: 32px 16px !important; }
  [style*="padding: 56px 32px"], [style*="padding:56px 32px"] { padding: 28px 16px !important; }

  /* ---- Длинные строки в документах (email, ссылки) ---- */
  a, td, li { overflow-wrap: anywhere; }

  /* ---- Переключатель треков (Лёгкость): в столбик ---- */
  div:has(> a[href="legkost-zhivot.html"][style*="display: block"]),
  div:has(> a[href="legkost-zhivot.html"][style*="display:block"]),
  div:has(> a[href="legkost-otekov.html"][style*="display: block"]),
  div:has(> a[href="legkost-otekov.html"][style*="display:block"]) {
    display: flex !important;
    flex-wrap: wrap !important;
    width: 100% !important;
  }
  div:has(> a[href="legkost-zhivot.html"][style*="display: block"]) > *,
  div:has(> a[href="legkost-zhivot.html"][style*="display:block"]) > *,
  div:has(> a[href="legkost-otekov.html"][style*="display: block"]) > *,
  div:has(> a[href="legkost-otekov.html"][style*="display:block"]) > * {
    flex: 1 1 100% !important;
  }

  /* ---- Счётчик обратного отсчёта: воздух до кнопки ---- */
  [style*="gap: 6px"][style*="align-items: flex-start"],
  [style*="gap:6px"][style*="align-items:flex-start"] {
    margin-bottom: 16px !important;
  }

  /* ---- ob-inne: белый градиент поверх фото героя ---- */
  [style*="linear-gradient(to right, rgb(245, 241, 234)"],
  [style*="linear-gradient(to right,rgb(245,241,234)"] {
    display: none !important;
  }
}

/* ---- Плейсхолдер, пока грузятся фото/видео (все экраны) ---- */
img { background-color: rgba(140, 122, 102, 0.12); }
