/* ==========================================================================
   ptkmonolit.ru — адаптивный слой для шаблона Pil-torg (DataLife Engine)
   Подключается ПОСЛЕ styles.css и engine.css, ничего в них не меняет.
   На экранах шире 1219px сайт выглядит как раньше — правила ниже действуют
   только внутри @media. Откат: убрать <link> на этот файл из main.tpl.
   Брейкпоинты: 1219 (планшет/узкий ноутбук), 767, 575 (телефон), 359 (узкий).
   ========================================================================== */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Элементы, которые добавляет mobile.js, на широких экранах скрыты */
.m-burger,
.m-subtoggle { display: none; }

/* ==========================================================================
   ≤ 1219px — планшеты, узкие окна и телефоны
   ========================================================================== */
@media (max-width: 1219px) {

  html, body { max-width: 100%; }

  body {
    background: #fff;
    background-attachment: scroll;
    font-size: 15px;
    line-height: 1.5;
    overflow-x: hidden;
  }

  input, textarea, select, button { font-size: 16px; }   /* iOS не увеличивает страницу при фокусе */

  img { max-width: 100%; }
  #midside img, #dle-content img { max-width: 100%; height: auto; }

  /* --- каркас --------------------------------------------------------- */
  .body_wrap {
    min-width: 0;
    max-width: 100%;
    width: auto;
    padding: 0;
    box-shadow: none;
  }
  .wrapper, .wwide { min-width: 0; max-width: 100%; width: auto; }
  .dpad { margin: 0 12px; }

  .wsh, .wsh .wsh, .wbtm, .wbtm .wsh { padding: 0; height: auto; font-size: 0; }
  .wbtm { margin-bottom: 0; }

  .shadlr { width: auto; }
  .vsep, .vsep .vsep { padding: 0; width: auto; }

  /* --- шапка ---------------------------------------------------------- */
  #header { height: auto; padding: 10px 0 0; }

  .logotip {
    position: static;
    display: block;
    width: auto;
    height: auto;
    min-height: 60px;
    padding: 0 0 0 148px;
    background-size: 138px auto;
    font-size: 17px;
    line-height: 1.25;
  }
  .logotip br { display: none; }

  /* пустая обёртка 100px под скрытым заголовком */
  #header > div:not([class]) { height: 0 !important; width: auto !important; overflow: hidden; }
  div.header_info_left { display: none; }

  div.header_info_right {
    position: static;
    width: auto;
    height: auto;
    margin: 8px 12px 0;
    text-align: left;
  }
  div.header_info_right li { margin: 2px 0 0 !important; font-size: 15px !important; }
  div.header_info_right li:first-child { font-size: 20px !important; }
  div.header_info_right a { color: inherit; text-decoration: none; }

  /* --- главное меню ---------------------------------------------------- */
  .mmmtop {
    position: static;
    width: auto;
    height: auto;
    margin: 10px 0 0;
    clear: both;
  }

  .menubar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    height: auto;
    text-align: left;
  }
  .menubar > div[style] {                      /* RU / EN */
    float: none !important;
    width: auto !important;
    height: 46px !important;
    padding: 0 12px;
    line-height: 46px !important;
    font-size: 17px !important;
  }

  .m-burger {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 0 auto;
    padding: 0 14px;
    height: 46px;
    border: 0;
    background: transparent;
    color: #000;
    font: bold 14px/1 'Trebuchet MS', Verdana, Arial, sans-serif;
    text-transform: uppercase;
    cursor: pointer;
  }
  .m-burger__lines { display: block; width: 22px; height: 16px; position: relative; }
  .m-burger__lines i {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: #000;
    transition: transform .2s, opacity .2s, top .2s;
  }
  .m-burger__lines i:nth-child(1) { top: 0; }
  .m-burger__lines i:nth-child(2) { top: 7px; }
  .m-burger__lines i:nth-child(3) { top: 14px; }
  .m-open .m-burger__lines i:nth-child(1) { top: 7px; transform: rotate(45deg); }
  .m-open .m-burger__lines i:nth-child(2) { opacity: 0; }
  .m-open .m-burger__lines i:nth-child(3) { top: 7px; transform: rotate(-45deg); }

  #topmenu {
    flex: 0 0 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    text-align: left;
    line-height: normal;
    background: #FFC124;
    border-top: 1px solid rgba(0, 0, 0, .12);
  }
  .m-js .menubar:not(.m-open) #topmenu { display: none; }   /* без JS меню остаётся раскрытым */

  .menubar ul li,
  #topmenu li.mm { display: block; position: relative; }
  #topmenu > li > b { display: block; font-weight: bold; }
  .menubar ul a,
  .menubar ul a b {
    float: none;
    display: block;
    height: auto;
    margin: 0;
    padding: 0;
  }
  #topmenu > li > b > a {
    padding: 14px 52px 14px 14px;
    border-bottom: 1px solid rgba(0, 0, 0, .12);
    line-height: 1.25;
  }
  .menubar ul a:hover { background: transparent; color: #000; }

  /* выпадающее подменю → вложенный список */
  .menubar ul li ul,
  .menubar ul li ul.mmm {
    position: static;
    display: none !important;                  /* перебиваем inline-display от jQuery hover */
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: #fff4cc;
  }
  .menubar ul li.m-open > ul { display: block !important; }
  .menubar ul li ul { text-align: left; }
  .menubar ul li ul li a {
    width: auto;
    text-align: left;
    padding: 11px 14px 11px 28px;
    border-bottom: 1px solid rgba(0, 0, 0, .08);
    background: transparent;
    color: #000;
    opacity: 1;
    font-size: 14px;
  }
  .menubar ul li ul li a:hover { background: #ffe9a0; }

  .m-subtoggle {
    display: block;
    position: absolute;
    top: 0;
    right: 0;
    width: 52px;
    height: 100%;
    max-height: 48px;
    border: 0;
    border-left: 1px solid rgba(0, 0, 0, .12);
    background: transparent;
    cursor: pointer;
  }
  .m-subtoggle::before {
    content: '';
    display: block;
    width: 9px;
    height: 9px;
    margin: -6px auto 0;
    border: solid #000;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    transition: transform .2s;
  }
  li.m-open > .m-subtoggle::before { transform: rotate(-135deg); margin-top: 0; }

  /* --- колонки: контент сверху, меню разделов снизу ------------------------ */
  #midside {
    float: none;
    display: block;
    width: auto;
    margin-top: 10px;
  }
  #sidebar {
    float: none;
    display: block;
    width: auto;
    margin: 20px 0 0;
  }
  #leftmenu, .block { width: auto; margin: 0; padding: 0 12px; }
  ul#mega-1 li { padding: 9px 0 9px 25px; font-size: 14px; background-position: 0 9px; }

  /* --- заголовки и текст -------------------------------------------------- */
  h1 { font-size: 24px; line-height: 1.25; }
  h2 { font-size: 20px; line-height: 1.3; }
  h3 { font-size: 18px; line-height: 1.3; }
  .storenumber, .basenavi, .maincont, .berrors, .fullstory, .basecont { text-align: left; }
  .speedbar { height: auto; padding: 0 12px; margin-bottom: 8px; line-height: 1.5; }

  /* --- плитка «Продукция» ------------------------------------------------------ */
  /* десктоп: 340×250 + наведение; здесь — 2 колонки и подпись всегда видна */
  .view,
  .view.seo,
  .viewseo {
    box-sizing: border-box;
    float: left;
    width: calc(50% - 12px);
    height: 200px;
    margin: 6px;
    border-width: 6px;
  }
  .view img,
  .view-tenth img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    -webkit-transform: none;
    transform: none;
  }
  .view .mask,
  .view .content,
  .view-tenth .mask {
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 1;
    filter: none;
  }
  .view-tenth .mask,
  .view .mask {
    background: linear-gradient(to top, rgba(0, 0, 0, .78) 0, rgba(0, 0, 0, 0) 62%);
  }
  .view .content {
    display: flex;
    align-items: flex-end;
    justify-content: center;
  }
  .view .content .h2,
  .view-tenth .content .h2,
  .view-tenth div.h2,
  .view h2 {
    width: 100%;
    margin: 0;
    padding: 10px 8px;
    border: 0;
    background: none;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    line-height: 1.2;
    text-align: center;
    text-transform: uppercase;
    opacity: 1;
    filter: none;
    -webkit-transform: none;
    transform: none;
  }
  .view .h2 a { color: #fff; text-decoration: none; }
  .view .h2 a::after {                            /* вся плитка — ссылка */
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
  }
  .view p,
  .view-tenth p,
  .view .content > a,
  .view a.info { display: none; }
  .view-tenth:hover img,
  .view:hover img { -webkit-transform: none; transform: none; opacity: 1; filter: none; }
  .view-tenth:hover .mask,
  .view:hover .mask { opacity: 1; filter: none; }
  .view-tenth:hover .h2,
  .view-tenth:hover h2 { -webkit-transform: none; transform: none; opacity: 1; }

  /* --- карточки товаров и контент --------------------------------------------- */
  .product { overflow: visible; }
  .prodimage { float: none; width: auto; max-width: 100%; margin: 4px auto 14px; }
  .product_info { float: none; width: auto; margin: 0 0 20px; }
  #dle-content iframe { max-width: 100%; }

  /* таблицы (прайс, характеристики) — прокрутка внутри обёртки, страница не «едет» */
  #dle-content table { max-width: 100%; }
  .m-table {
    max-width: 100%;
    margin: 0 0 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .m-table > table { width: 100% !important; min-width: 560px; margin-bottom: 0; }
  .m-table table td, .m-table table th { padding: 6px 8px; }

  /* формы и калькулятор */
  .f_input, .f_textarea, .searchstyle, .pm_status { width: 100%; max-width: 100%; }
  .body_calk2 { max-width: 100%; }
  .body_calk2 table.tb2 td { display: block; width: auto; border: 0; padding: 4px 0; }
  .body_calk2 table.tb2 td input[type="text"] { width: 40% !important; min-width: 90px; }
  .body_calk2 input[type="button"] { margin: 4px 6px 4px 0; }

  /* --- подвал ------------------------------------------------------------------ */
  #footer { height: auto; padding: 14px 0; }
  .copyright { float: none; width: auto; font-size: 13px; }
  .counts { display: block; }
  .counts ul { float: none; margin: 12px 0 0; overflow: hidden; }
}

/* ==========================================================================
   576–1219px — логотип слева, контакты справа
   ========================================================================== */
@media (min-width: 576px) and (max-width: 1219px) {
  #header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
  }
  .logotip { flex: 1 1 320px; }
  div.header_info_right { flex: 0 0 auto; margin: 4px 12px 0 0; text-align: right; }
}

/* ==========================================================================
   768–1219px — плитка в 3 колонки
   ========================================================================== */
@media (min-width: 768px) and (max-width: 1219px) {
  .view, .view.seo, .viewseo { width: calc(33.333% - 12px); height: 210px; }
}

/* ==========================================================================
   ≤ 767px — крупные телефоны
   ========================================================================== */
@media (max-width: 767px) {
  .logotip { padding-left: 128px; background-size: 118px auto; min-height: 50px; font-size: 15px; }
  div.header_info_right li:first-child { font-size: 19px !important; }
  h1 { font-size: 22px; }
  h2 { font-size: 19px; }
  .view, .view.seo, .viewseo { height: 170px; }
  .view .content .h2, .view-tenth .content .h2, .view-tenth div.h2, .view h2 { font-size: 13px; padding: 8px 6px; }
}

/* ==========================================================================
   ≤ 575px — телефоны
   ========================================================================== */
@media (max-width: 575px) {
  .dpad { margin: 0 10px; }
  .logotip { padding-left: 108px; background-size: 100px auto; min-height: 42px; font-size: 14px; }
  div.header_info_right { margin: 8px 10px 0; }
  .view, .view.seo, .viewseo { width: calc(50% - 8px); height: 150px; margin: 4px; border-width: 4px; }
  .view .content .h2, .view-tenth .content .h2, .view-tenth div.h2, .view h2 { font-size: 12px; padding: 6px 4px; }
  .m-burger b { display: none; }                       /* в узком баре оставляем только иконку */
  #leftmenu, .block { padding: 0 10px; }
}

/* ==========================================================================
   ≤ 359px — совсем узкие экраны
   ========================================================================== */
@media (max-width: 359px) {
  .logotip { padding-left: 0; padding-top: 52px; background-size: 100px auto; }
  .view, .view.seo, .viewseo { width: calc(100% - 8px); height: 180px; }
  .view .content .h2, .view-tenth .content .h2, .view-tenth div.h2, .view h2 { font-size: 14px; }
}

/* ==========================================================================
   Сторонний виджет «Задать вопрос» (RedHelper) — на телефонах компактнее,
   чтобы не закрывал левый край контента
   ========================================================================== */
@media (max-width: 767px) {
  #rh-badge {
    -webkit-transform: scale(.62);
    transform: scale(.62);
    -webkit-transform-origin: 0 100%;
    transform-origin: 0 100%;
    top: auto !important;
    bottom: 14px !important;
    opacity: .92;
  }
}
