/* SputnikovoeTV.by — точечное исправление мобильного отображения
   Основано на трёх скриншотах от 24.11.2026 и сохранённых исходниках MODX.
   Десктопная компоновка и логика miniShop2 не затрагиваются. */

@media screen and (max-width: 767px) {
  /* 1. Убираем desktop full-bleed hack, который смещает шапку на телефоне.
     Исходный блок: left:50%; width:100vw; margin-left:-50vw. */
  html body .header {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }

  html body .header .header-shell,
  html body .header .header-top-inner,
  html body .header .header-main,
  html body .header #sputnik-navigation,
  html body .header #sputnik-navigation .top-bar-container,
  html body .header #sputnik-navigation .nav-inner {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }

  /* Логотип не должен выходить за правую границу шапки. */
  html body .header .header-main > .logo,
  html body .header .stv-logo-link {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }
  html body .header .stv-logo-svg {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
  }

  /* 2. Сбрасываем возможное смещение основного контента на главной.
     Не меняем ширину секций/сетки больше ширины viewport. */
  html body.index-template,
  html body.index-template .main-wrapper,
  html body.index-template .main-wrapper > .container,
  html body.index-template .top-slider-adv-wrapper,
  html body.index-template .top-slider-adv-wrapper > .container,
  html body.index-template .new-hero,
  html body.index-template .catalog,
  html body.index-template .brands-section,
  html body.index-template .about-section {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  html body.index-template .main-wrapper,
  html body.index-template .main-wrapper > .container {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  html body.index-template .new-hero-inner,
  html body.index-template .new-hero-heading,
  html body.index-template .new-hero-intro,
  html body.index-template .stv-trust-stats,
  html body.index-template .stv-trust-stat {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  html body.index-template .new-hero-heading,
  html body.index-template .new-hero-intro {
    overflow-wrap: anywhere !important;
    word-break: normal !important;
  }

  html body.index-template .stv-trust-stats {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
  }

  /* 3. Полное название товара без line-clamp и наложения цены.
     Сохраняем существующий HTML-чанк и miniShop2 hooks. */
  html body .catalog .stv-product-column,
  html body .catalog .stv-product-card,
  html body .catalog .stv-product-form,
  html body .catalog .stv-product-content,
  html body .catalog .stv-product-buy-row {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  html body .catalog .stv-product-title {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 0 12px !important;
    overflow: visible !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
    line-height: 1.38 !important;
    -webkit-line-clamp: unset !important;
    -webkit-box-orient: initial !important;
  }

  html body .catalog .stv-product-buy-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas: "price" "buy" !important;
    align-items: start !important;
    gap: 9px !important;
    width: 100% !important;
    margin: 0 !important;
  }

  html body .catalog .stv-product-buy-row > [class*="col-"],
  html body .catalog .stv-product-price-wrap,
  html body .catalog .stv-product-buy-column {
    float: none !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }

  html body .catalog .stv-product-price-wrap {
    grid-area: price !important;
    display: block !important;
    text-align: left !important;
    padding: 0 !important;
  }
  html body .catalog .stv-product-old-price {
    display: block !important;
    position: static !important;
    height: auto !important;
    margin: 0 0 4px !important;
    line-height: 1.25 !important;
  }
  html body .catalog .stv-product-price {
    display: block !important;
    position: static !important;
    margin: 0 !important;
    text-align: left !important;
    line-height: 1.25 !important;
  }
  html body .catalog .stv-product-buy-column {
    grid-area: buy !important;
  }

  /* Никакой горизонтальной прокрутки из-за дочерних элементов. */
  html,
  body {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
}

/* MOBILE HEADER REFINEMENT — оставляем телефоны и мессенджеры без изменений.
   Только адресный блок, логотип и служебные отступы. */
@media screen and (max-width: 767px) {
  /* Верхняя информационная полоса: компактнее, но оба адреса остаются видимыми. */
  html body .header .header-top {
    display: block !important;
    min-height: 0 !important;
  }

  html body .header .header-top-inner {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 5px !important;
    padding: 7px 12px !important;
  }

  html body .header .header-top-inner .slogan {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    font-size: 11px !important;
    line-height: 1.25 !important;
  }

  html body .header .header-addresses {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 3px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    font-size: 11px !important;
    line-height: 1.25 !important;
  }

  html body .header .header-address-line {
    display: flex !important;
    align-items: flex-start !important;
    gap: 5px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    font-size: 11px !important;
    line-height: 1.25 !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
  }

  /* Логотип ограничиваем только в своей колонке, не затрагивая телефонный блок. */
  html body .header .header-main > .logo {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  html body .header .header-main .stv-logo-link {
    display: block !important;
    width: 100% !important;
    max-width: 190px !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  html body .header .header-main .stv-logo-svg {
    display: block !important;
    width: 100% !important;
    max-width: 190px !important;
    height: auto !important;
  }

  /* Режим работы — компактная строка без изменения текста и индикатора. */
  html body .header .shedule {
    max-width: calc(100% - 24px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    font-size: 11px !important;
    line-height: 1.25 !important;
    white-space: normal !important;
    text-align: center !important;
  }

  /* Поиск сохраняет прежнюю ширину и функциональность. */
  html body .header .header-center,
  html body .header .search_header {
    min-width: 0 !important;
    max-width: 100% !important;
  }
}

@media screen and (max-width: 390px) {
  html body .header .header-main .stv-logo-link,
  html body .header .header-main .stv-logo-svg {
    max-width: 165px !important;
  }
}
