/* ═══════════════════════════════════════════
   MOBILE-GLOBAL.CSS — универсальные мобильные правки
   Подключается на ВСЕХ страницах lot-click.ru
   Правила с !important чтобы перебивать inline styles
   v2026-04-05
   ═══════════════════════════════════════════ */

/* ─── БАЗА: убираем кастомный курсор на тач-устройствах ─── */
@media (hover: none) and (pointer: coarse) {
  body, a, button, input, textarea, select, .lots-filter, .faq-q, .nav-links a, .nav-dropdown a {
    cursor: auto !important;
  }
  #cur, #cur-ring { display: none !important; }
}

/* ─── ПЛАНШЕТЫ И МЕНЬШЕ (≤1024px) ─── */
@media (max-width: 1024px) {
  /* Схлопываем широкие сетки */
  [style*="grid-template-columns:repeat(5"],
  [style*="grid-template-columns: repeat(5"],
  [style*="grid-template-columns:repeat(6"],
  [style*="grid-template-columns: repeat(6"] {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  [style*="grid-template-columns:repeat(4"],
  [style*="grid-template-columns: repeat(4"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ─── МОБИЛЬНЫЕ ТЕЛЕФОНЫ (≤768px) ─── */
@media (max-width: 768px) {

  /* ── Базовая типографика ── */
  html { font-size: 15px !important; }
  /* C14/Kravets I12: overflow-x:clip вместо hidden + убран * max-width:100vw (перерасчёт на каждом элементе) */
  html, body { overflow-x: clip; }

  /* ── Горизонтальный скролл: убираем вылеты ── */
  img, video, iframe, table, pre { max-width: 100% !important; height: auto; }

  /* ── Схлопываем inline grid-сетки ── */
  [style*="grid-template-columns:repeat(3"],
  [style*="grid-template-columns: repeat(3"] {
    grid-template-columns: 1fr !important;
  }
  [style*="grid-template-columns:repeat(4"],
  [style*="grid-template-columns: repeat(4"],
  [style*="grid-template-columns:repeat(5"],
  [style*="grid-template-columns: repeat(5"],
  [style*="grid-template-columns:repeat(6"],
  [style*="grid-template-columns: repeat(6"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  [style*="grid-template-columns:1fr 380px"],
  [style*="grid-template-columns:1fr 360px"],
  [style*="grid-template-columns:1fr 320px"],
  [style*="grid-template-columns:1fr 300px"],
  [style*="grid-template-columns:380px 1fr"],
  [style*="grid-template-columns:360px 1fr"],
  [style*="grid-template-columns:280px 1fr"],
  [style*="grid-template-columns:200px 1fr"],
  [style*="grid-template-columns:240px 1fr"],
  [style*="grid-template-columns:2fr 1fr"],
  [style*="grid-template-columns:1fr 2fr"],
  [style*="grid-template-columns:3fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* ── Уменьшаем большие inline padding (только вертикаль, чтобы не ломать секции X 0) ── */
  [style*="padding:80px"], [style*="padding: 80px"] { padding-top: 40px !important; padding-bottom: 40px !important; }
  [style*="padding:60px"], [style*="padding: 60px"] { padding-top: 32px !important; padding-bottom: 32px !important; }
  [style*="padding:48px"], [style*="padding: 48px"] { padding-top: 28px !important; padding-bottom: 28px !important; }
  [style*="padding:40px"], [style*="padding: 40px"] { padding-top: 24px !important; padding-bottom: 24px !important; }
  /* Для карточек (padding: X ) горизонтальный тоже режем, но только если это all-sides */
  div[style*="padding:40px;"], div[style*="padding: 40px;"],
  div[style*="padding:40px\""], div[style*="padding: 40px\""] { padding-left: 20px !important; padding-right: 20px !important; }
  div[style*="padding:48px;"], div[style*="padding: 48px;"],
  div[style*="padding:48px\""], div[style*="padding: 48px\""] { padding-left: 20px !important; padding-right: 20px !important; }

  /* ── Flex-ряды в колонку ── */
  [style*="display:flex"][style*="gap:48px"],
  [style*="display:flex"][style*="gap:40px"],
  [style*="display:flex"][style*="gap:32px"] {
    flex-wrap: wrap !important;
  }

  /* ── Фикс ширины контейнеров ── */
  .container, .invoice, .wrap, .wrapper, main { padding-left: 16px !important; padding-right: 16px !important; }

  /* ── Hero и Section: меньше top/bottom ── */
  .hero, [class*="hero"] { padding-top: 88px !important; padding-bottom: 48px !important; }
  .section { padding-top: 48px !important; padding-bottom: 48px !important; }

  /* ── Навбар на мобилке: безопасная высота ── */
  .nav, nav.nav, header.nav { height: 64px !important; padding-left: 16px !important; padding-right: 16px !important; }

  /* ── Topbar (для кастомных шапок на invoice-страницах) ── */
  .topbar { padding: 12px 16px !important; flex-wrap: wrap; gap: 8px; }
  .topbar-right { font-size: 11px !important; }

  /* ── Кнопки: тач-таргет минимум 44px ── */
  button, .btn, .btn-primary, .btn-outline, .btn-secondary, a[class*="btn"], input[type="submit"] {
    min-height: 44px !important;
  }

  /* ── Шрифты: h1/h2 не должны вылетать за экран ── */
  h1 { font-size: clamp(26px, 7vw, 38px) !important; line-height: 1.15 !important; }
  h2 { font-size: clamp(22px, 6vw, 32px) !important; line-height: 1.2 !important; }
  h3 { font-size: clamp(18px, 5vw, 24px) !important; }

  /* ── Inline font-size с пикселями > 32 уменьшаем ── */
  [style*="font-size:56px"], [style*="font-size: 56px"] { font-size: 32px !important; }
  [style*="font-size:48px"], [style*="font-size: 48px"] { font-size: 28px !important; }
  [style*="font-size:44px"], [style*="font-size: 44px"] { font-size: 26px !important; }
  [style*="font-size:40px"], [style*="font-size: 40px"] { font-size: 26px !important; }
  [style*="font-size:36px"], [style*="font-size: 36px"] { font-size: 24px !important; }

  /* ── Таблицы: горизонтальный скролл ── */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* ── Модалки/поповеры: на всю ширину с отступом ── */
  [style*="max-width:440px"], [style*="max-width:480px"], [style*="max-width:520px"] {
    max-width: calc(100vw - 32px) !important;
  }

  /* ── Фиксированные кнопки "наверх" и виджеты не должны перекрывать контент ── */
  .owl-trigger, .chat-trigger, [class*="floating"], [class*="fab"] {
    bottom: 16px !important;
    right: 16px !important;
  }
}

/* ─── УЗКИЕ ТЕЛЕФОНЫ (≤480px) ─── */
@media (max-width: 480px) {
  html { font-size: 14px !important; }

  /* Схлопываем 2-колонные inline сетки до 1 */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:repeat(2"],
  [style*="grid-template-columns: repeat(2"] {
    grid-template-columns: 1fr !important;
  }

  /* Гэпы уменьшаем */
  [style*="gap:48px"], [style*="gap: 48px"] { gap: 20px !important; }
  [style*="gap:40px"], [style*="gap: 40px"] { gap: 16px !important; }
  [style*="gap:32px"], [style*="gap: 32px"] { gap: 14px !important; }
  [style*="gap:24px"], [style*="gap: 24px"] { gap: 12px !important; }

  /* Контейнеры: ещё уже padding */
  .container, .invoice, .wrap, .wrapper { padding-left: 12px !important; padding-right: 12px !important; }

  /* Любые inline padding: 40-80px режем ещё сильнее */
  [style*="padding:60px"], [style*="padding: 60px"],
  [style*="padding:80px"], [style*="padding: 80px"] { padding: 24px 12px !important; }
}

/* ─── ЛАНДШАФТ МОБИЛКИ (короткая высота) ─── */
@media (max-height: 500px) and (orientation: landscape) {
  .hero, [class*="hero"] { padding-top: 80px !important; padding-bottom: 40px !important; }
}
