/* Mobile fixes — terma-istochnik.ru */

/* 1. Колонка во всю ширину экрана */
@media (max-width:767px){
  .container{width:auto!important;max-width:100%}
  .content{padding:20px 0}
  .content h1.widgettitle{font-size:24px;line-height:30px;margin-bottom:20px}
  .main_text{font-size:16px;line-height:26px}
  .main_text p{margin-bottom:16px}
  .main_text h1,.main_text h2,.main_text h3,.main_text h4,.main_text h5,.main_text h6{margin-top:22px}
  .main_text ul li,.main_text ol li{padding-left:1.7rem;margin-bottom:8px}
  .main_text ol ol li{padding-left:2.6rem}
  .main_text ol ol ol li{padding-left:3.6rem}
  .main_text ol ol ol ol li{padding-left:4.4rem}
  .left_side_share{display:none}
}

/* 2. Таблицы — прокрутка */
.main_text table,
table.tablepress{max-width:100%;table-layout:auto}
@media (max-width:767px){
  .main_text table,
  .main_text .table-responsive,
  .tablepress-wrapper,
  .wp-block-table{
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
  }
  .tablepress{width:100%!important;max-width:100%!important}
  .main_text table>tbody>tr>td,
  .main_text table>thead>tr>th{padding:6px 10px;white-space:normal}
  .main_text table td,
  .main_text table th,
  .tablepress td,.tablepress th{min-width:0}
}

/* 3. Любой iframe/embed/video в статье и вокруг — 100% ширины */
.main_text iframe,
.main_text embed,
.main_text object,
.main_text video,
.single_articel iframe,
.single_articel embed,
article iframe,
.content iframe{max-width:100%!important;border:0}
@media (max-width:767px){
  .main_text iframe,
  .main_text embed,
  .main_text object,
  .main_text video,
  .single_articel iframe,
  .single_articel embed,
  article iframe,
  .content iframe{
    width:100%!important;
    max-width:100%!important;
    height:auto!important;
    min-height:0!important;
  }
  .main_text iframe[src*="youtube.com/embed"],
  .main_text iframe[src*="youtube-nocookie.com/embed"],
  .main_text iframe[src*="youtu.be/"],
  .main_text iframe[src*="player.vimeo.com"]{aspect-ratio:16/9;height:auto}
  .main_text iframe[src*="google.com/maps"],
  .main_text iframe[src*="maps.google.com"],
  .main_text iframe[src*="yandex.ru/map"],
  .main_text iframe[src*="yandex.ru/maps"]{aspect-ratio:4/3;height:auto}
  /* fallback height if aspect-ratio unsupported */
  .main_text iframe[src*="youtube"]:not([style*="aspect-ratio"]),
  .main_text iframe[src*="vimeo"]:not([style*="aspect-ratio"]){height:200px!important;min-height:200px}
  .main_text iframe[src*="maps"]:not([style*="aspect-ratio"]){height:240px!important;min-height:240px}
}

/* 4. Длинные ссылки */
.main_text{overflow-wrap:break-word;word-wrap:break-word}
.main_text a{overflow-wrap:anywhere;max-width:100%}
.main_text p,.main_text li,.main_text h1,.main_text h2,.main_text h3{overflow-wrap:break-word}

/* 5. Картинки */
.main_text img,.entry-content img,.wp-caption img,.size-full,.size-large,.size-medium{
  max-width:100%!important;height:auto!important;width:auto
}
.ngg-gallery-thumbnail img,.ngg-galleryimage img,.gallery img{max-width:100%!important;height:auto!important}

/* 6. WP caption — перебиваем inline width (1034px, 1717px и т.п.) */
.wp-caption,
.main_text .wp-caption,
.single_articel .wp-caption{
  max-width:100%!important;
  width:auto!important;
  box-sizing:border-box;
}
/* inline style width: Npx на caption */
div.wp-caption[style],
.main_text div[style*="width:"][class*="wp-caption"]{
  width:100%!important;
  max-width:100%!important;
}
.wp-caption img,
.main_text .wp-caption img{max-width:100%!important;height:auto!important}
.wp-caption dd,.wp-caption-text{max-width:100%}

/* 7. blockquote: тема ставит width:560px */
.main_text blockquote,
.one_quote{width:100%!important;max-width:100%}

/* 8. pre / code / embeds */
.main_text pre{max-width:100%;overflow-x:auto;white-space:pre-wrap;word-break:break-word}
.main_text .wp-block-preformatted{max-width:100%;overflow-x:auto}

/* 9. Любые inline width > контейнера */
@media (max-width:767px){
  .main_text div[style*="width:"],
  .main_text figure[style*="width:"],
  .main_text p[style*="width:"],
  .single_articel div[style*="width:"]{
    max-width:100%!important;
  }
  .main_text .wp-caption[style],
  div.wp-caption[style]{width:100%!important;max-width:100%!important}
}

/* 10. Safety: нет горизонтального скролла у body */
@media (max-width:767px){
  html,body{overflow-x:hidden;max-width:100%}
  .main_text,.content,.container,.single_articel{overflow-x:hidden;max-width:100%}
  .main_text table,.main_text .table-responsive,.tablepress-wrapper{overflow-x:auto!important}
}

/* 11. Header banner 728px */
@media (max-width:767px){
  .box728x90,header .box728x90,.banner_wrap,.banner_wrap .box728x90{
    width:100%!important;max-width:100%!important;height:auto!important;margin-left:auto;margin-right:auto
  }
}

/* 12. Узкие экраны */
@media (max-width:480px){
  .expert-skin1{margin:16px 0}
  .expert-skin1-cloud{font-size:15px;line-height:22px;padding:11px 14px}
  .expert-skin1-author{font-size:13px;line-height:17px}
  .main_text div[style*="2e7d32"]{padding:12px 14px!important}
  .subscribe_box{padding:20px 15px}
  .widgettitle{font-size:20px;line-height:26px}
  .main_text iframe[src*="youtube"]:not([style*="aspect-ratio"]){height:180px!important;min-height:180px}
}

/* 13. figure captions от terma-width-fix */
figure.wp-caption{max-width:100%!important;width:auto!important;margin-left:auto!important;margin-right:auto!important}
figure.wp-caption img{max-width:100%!important;height:auto!important}
figcaption.wp-caption-text{max-width:100%;font-size:14px;line-height:20px;color:#666;margin-top:8px}


/* 14. Footer full-bleed 100vw не вылезает на мобильных */
@media (max-width:767px){
  .tm-footer{
    width:100%!important;
    max-width:100%!important;
    left:auto!important;
    margin-left:0!important;
  }
  html{overflow-x:hidden}
}

/* 15. Контейнер темы: жёсткие 414/320/480 → 100% */
@media (max-width:767px){
  .container,
  .container-fluid{
    width:100%!important;
    max-width:100%!important;
    padding-left:12px!important;
    padding-right:12px!important;
  }
  .row{margin-left:-12px!important;margin-right:-12px!important}
  .row>[class*="col-"]{padding-left:12px;padding-right:12px}
  /* колонки стекаются, не в ряд по ширине экрана */
  .row>[class*="col-xs-"],
  .row>[class*="col-sm-"]{float:none!important;width:100%!important;margin-left:0!important;margin-right:0!important}
}

/* 16. body{display:table} из style.min распирает страницу вширь */
body{display:block!important;width:100%!important;max-width:100%!important}
html{overflow-x:hidden!important}
.site_wrap{width:100%!important;max-width:100%!important}

/* 17. Колонки темы без grid: col-xs/sm на мобильных — 100% */
@media (max-width:767px){
  .col-xs-12,.col-sm-12,.col-md-8,.col-lg-8{width:100%!important;float:none!important}
}
