/*
 * Мобильная версия (телефоны и планшеты до 1023px).
 * Вёрстка оригинала рассчитана на 1260px, здесь она перестраивается в одну колонку.
 * На компьютере этот файл ничего не меняет.
 */

.mobile-burger,
.mobile-section-toggle {
    display: none;
}

@media (max-width: 1023px) {
    html,
    body {
        min-width: 0 !important;
        overflow-x: hidden;
    }

    img {
        max-width: 100%;
        height: auto;
    }

    .body,
    .wrapper-container,
    .md-content form {
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 16px !important;
        box-sizing: border-box;
    }

    .footer {
        min-width: 0 !important;
        height: auto !important;
    }

    .body {
        margin-bottom: 0 !important;
        min-height: 0 !important;
    }

    .body:after,
    .page-home .body:after {
        display: none !important;
    }

    /* ---------- шапка ---------- */
    .body-header {
        position: relative;
        padding-top: 10px;
    }

    .homelink {
        width: 150px !important;
        height: 68px !important;
        background-size: contain !important;
        background-repeat: no-repeat !important;
        margin: 0 !important;
    }

    .body-header-top {
        display: block !important;
        padding: 6px 0 0 !important;
    }

    .body-header-top table,
    .body-header-top tbody,
    .body-header-top tr,
    .body-header-top td {
        display: block;
        height: auto !important;
        padding: 0 !important;
    }

    .body-header-top td:empty {
        display: none;
    }

    .body-header-top .gray {
        font-size: 12px;
    }

    .body-header-top .header-black-tel {
        font-size: 22px !important;
    }

    .body-header-button {
        float: none !important;
        margin: 8px 0 0 !important;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }

    .body-header-button span {
        font-size: 13px;
    }

    .body-header-button .callback-button {
        margin: 0 !important;
        width: auto !important;
        padding: 6px 18px;
        height: auto;
    }

    .mobile-burger {
        display: flex;
        position: absolute;
        top: 22px;
        right: 0;
        width: 46px;
        height: 42px;
        border: 0;
        border-radius: 4px;
        background: #292929;
        cursor: pointer;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;
        padding: 0;
    }

    .mobile-burger span {
        display: block;
        width: 22px;
        height: 2px;
        background: #fff;
        transition: transform .2s, opacity .2s;
    }

    .menu-open .mobile-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .menu-open .mobile-burger span:nth-child(2) { opacity: 0; }
    .menu-open .mobile-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    /* меню: скрыто, открывается кнопкой */
    .body-header-menu {
        height: auto !important;
        display: none;
        margin-top: 12px !important;
        padding: 6px 0 10px;
    }

    .menu-open .body-header-menu {
        display: block;
    }

    .body-header-menu .menu {
        display: block !important;
    }

    .body-header-menu .menu li {
        display: block !important;
        border-right: 0 !important;
        border-bottom: 1px solid #3b3b3b;
    }

    .body-header-menu .menu li:last-child {
        border-bottom: 0;
    }

    .body-header-menu ul li a {
        display: block !important;
        padding: 0 16px !important;
        line-height: 46px !important;
        font-size: 16px !important;
    }

    .body-header-menu .search {
        float: none !important;
        width: auto !important;
        margin: 8px 12px 4px !important;
    }

    .body-header-menu .search input[type="search"] {
        width: 100% !important;
        box-sizing: border-box;
        height: 36px;
        font-size: 15px;
    }

    .menu-production-slide {
        display: none !important;
    }

    /* баннер с акциями */
    .banner {
        margin: 16px 0 0 !important;
    }

    .slider-container .slick-slide img {
        display: block;
        margin: 0 auto;
    }

    /* у галереи Phoca высота задана жёстко (800px) */
    #phocagallery {
        height: auto !important;
    }

    #phocagallery ul.nav.menu li {
        width: 100% !important;
    }

    .description {
        width: auto !important;
        max-width: 100% !important;
    }

    /* ---------- колонки ---------- */
    .wrapper {
        display: flex;
        flex-direction: column;
    }

    .wrapper-left,
    .wrapper-content,
    .wrapper-right,
    .page-home .wrapper-content,
    .page-home .wrapper-right,
    .full-width-module {
        display: block !important;
        float: none !important;
        width: auto !important;
        padding-top: 0 !important;
        margin: 0 !important;
    }

    .wrapper-content {
        order: 2;
        font-size: 15px;
    }

    .wrapper-left {
        order: 1;
        margin-top: 12px !important;
    }

    .wrapper-right {
        order: 3;
        margin-top: 30px !important;
    }

    .full-width-module {
        order: 4;
    }

    .page-home .wrapper-right .moduletable {
        margin-top: 20px !important;
    }

    .wrapper-content h1 {
        font-size: 28px !important;
        line-height: 1.2;
        margin: 18px 0 14px !important;
    }

    .wrapper-content p,
    .wrapper-content li {
        text-align: left !important;
    }

    /* боковое меню раздела — кнопками в несколько рядов */
    .mobile-section-toggle {
        display: block;
        width: 100%;
        box-sizing: border-box;
        border: 1px solid #d0d0d0;
        border-radius: 4px;
        background: #fff;
        color: #404040;
        font-size: 15px;
        text-align: left;
        padding: 10px 14px;
        cursor: pointer;
    }

    .mobile-section-toggle:after {
        content: '\f107';
        font-family: FontAwesome;
        float: right;
    }

    .section-open .mobile-section-toggle:after {
        content: '\f106';
    }

    .wrapper-left ul {
        display: none;
        margin: 8px 0 0 !important;
    }

    .wrapper-left.section-open ul {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .wrapper-left ul li {
        margin: 0 !important;
    }

    .wrapper-left ul li a {
        width: auto !important;
        border: 1px solid #d0d0d0 !important;
        border-radius: 16px;
        padding: 5px 12px !important;
        font-size: 14px !important;
    }

    .wrapper-left ul li:before,
    .wrapper-left ul li a:before {
        display: none !important;
    }

    .custom-company-left-img {
        display: none;
    }

    /* таблицы и встроенные блоки не шире экрана */
    .wrapper-content table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .wrapper-content iframe,
    .wrapper-right iframe {
        max-width: 100% !important;
    }

    .wrapper-content [style*="width"]:not(.slick-track):not(.slick-slide) {
        max-width: 100% !important;
    }

    /* подменю «Благодарственные письма / Тёплые слова» и «2016» у заголовка */
    ul.nav.menu-podmenu-otziv {
        position: static !important;
        display: flex !important;
        flex-wrap: wrap;
        gap: 4px 16px;
        margin: 12px 0 14px !important;
        padding: 0 !important;
    }

    ul.nav.menu-podmenu-otziv li {
        padding: 0 !important;
    }

    /* слайдеры в правой колонке — точно по ширине экрана */
    .slider-home,
    .slider-team,
    .slider-callback {
        overflow: hidden;
    }

    .slider-home .slick-slide img,
    .slider-team .slick-slide img {
        width: 100% !important;
        height: auto !important;
    }

    /* контакты: почта/скайп/телефон и блок «Свяжитесь с менеджером» друг под другом */
    .custom-contacts .table-div {
        display: block !important;
        width: auto !important;
        float: none !important;
        margin: 0 0 16px !important;
    }

    .custom-contacts table {
        display: table;
    }

    .custom-contacts .callback-block {
        width: auto !important;
        margin: 0 !important;
        box-sizing: border-box;
    }

    .custom-contacts button {
        max-width: 100%;
    }

    .callback-block .red-button-img {
        display: none !important;
    }

    .map {
        width: 100% !important;
    }

    /* технологии: слайдер с фото на всю ширину */
    .slider-tech {
        width: auto !important;
        max-width: 100%;
    }

    .slider-tech img {
        width: 100% !important;
        height: auto !important;
    }

    /* этапы оформления заказа: текст и фото в столбик, декоративные стрелки убираем */
    .etap-overflow > div > table,
    .etap-overflow > div > table > tbody,
    .etap-overflow > div > table > tbody > tr,
    .etap-overflow > div > table > tbody > tr > td {
        display: block !important;
        width: auto !important;
        height: auto !important;
        padding: 0 !important;
        text-align: left !important;
        overflow: visible;
    }

    .etap-overflow > div > table > tbody > tr > td {
        margin-bottom: 12px;
    }

    /* вложенная таблица «по почте / по скайпу / по телефону» остаётся таблицей */
    .etap-overflow td table td {
        padding: 3px 6px 3px 0 !important;
        vertical-align: top;
        word-break: break-word;
    }

    .etap-overflow img[id^="step-"] {
        display: none !important;
    }

    .etap-overflow img {
        max-width: 220px;
    }

    .etap-overflow button.red-button {
        margin: 6px 0 20px !important;
        width: auto !important;
        padding: 0 18px;
    }

    /* переключатели и галочки в формах — обычного размера */
    .wrapper-right input[type="radio"],
    .wrapper-right input[type="checkbox"],
    .md-content input[type="radio"],
    .md-content input[type="checkbox"] {
        width: auto !important;
        display: inline-block !important;
        margin: 0 6px 0 0 !important;
        vertical-align: middle;
    }

    .wrapper-right label[for^="val_"] {
        display: inline-block;
        margin-right: 12px;
    }

    /* галерея работ — сеткой в 2 колонки */
    #pg-msnr-mobile {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    #pg-msnr-mobile .pg-cv-box,
    #pg-msnr-mobile .pg-cv-box-img {
        width: auto !important;
        height: auto !important;
        float: none !important;
        margin: 0 !important;
        position: static !important;
    }

    #pg-msnr-mobile .pg-cv-box-img img,
    #pg-msnr-mobile img.pg-image {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 7 / 4;
        object-fit: cover;
    }

    #pg-msnr-mobile .pg-box1,
    #pg-msnr-mobile .pg-box2,
    #pg-msnr-mobile .pg-box3,
    #pg-msnr-mobile .pg-box3 > a {
        display: block !important;
        width: auto !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    #pg-msnr-mobile .pg-cv-name {
        font-size: 12px;
        line-height: 1.3;
        padding-top: 4px;
    }

    .wrapper-content .nav.menu {
        display: grid !important;
        grid-template-columns: 1fr;
    }

    /* клиенты — по 2 в ряд */
    table.table-clients,
    table.table-clients tbody {
        display: block;
    }

    table.table-clients tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-bottom: 8px;
    }

    table.table-clients td {
        display: block;
        width: auto !important;
    }

    /* каталог продукции (страница «Продукция») — по 2 в ряд */
    ul.nav.menu-product {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px 10px;
        padding: 0;
    }

    ul.nav.menu-product li {
        width: auto !important;
        padding: 0 !important;
        margin: 0 !important;
        text-align: center !important;
    }

    ul.nav.menu-product a:before {
        margin: 0 auto 8px !important;
        transform: scale(.8);
        transform-origin: center top;
    }

    /* ---------- главная ---------- */
    .page-home ul.nav.menu-product {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px 10px;
        padding: 0;
    }

    .page-home ul.nav.menu-product li {
        width: auto !important;
        margin: 0 !important;
        text-align: center !important;
    }

    .page-home ul.nav.menu-product a {
        display: block !important;
        padding: 0 !important;
        font-size: 14px !important;
    }

    .page-home ul.nav.menu-product a:before {
        float: none !important;
        margin: 0 auto 8px !important;
        transform: scale(.8);
        transform-origin: center top;
    }

    .how_order h3 {
        font-size: 26px !important;
    }

    .full-width-module [style*="width"]:not(.slick-track):not(.slick-slide) {
        max-width: 100% !important;
    }

    /* слайды «Как заказать» — картинки 1280×140 с текстом, на телефоне нечитаемы:
       оставляем только список этапов */
    .order-slider {
        display: none !important;
    }

    .order-slider-control > div {
        cursor: default !important;
    }

    .advantages {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 22px 14px;
        padding: 0;
    }

    .advantages li {
        width: auto !important;
        margin: 0 !important;
    }

    .advantages .adv-img {
        transform: scale(.75);
        transform-origin: left top;
        margin-bottom: 0 !important;
    }

    .advantages .adv-title,
    .advantages .adv-text {
        width: auto !important;
    }

    /* блоки главной на всю ширину: «Как заказать», «Наши преимущества», «О компании» */
    .full-width-module > .moduletable {
        margin: 40px 0 0 !important;
        padding: 0 !important;
    }

    .full-width-module > .moduletable:first-child {
        margin-top: 32px !important;
    }

    .how_order h3,
    .full-width-module .moduletable > h3 {
        font-size: 26px !important;
        line-height: 1.2;
        margin: 0 0 10px !important;
        padding: 0 !important;
    }

    .full-width-module .moduletable > p,
    .how_order > p {
        margin: 0 0 18px !important;
        padding: 0 !important;
        font-size: 15px !important;
        line-height: 1.45;
    }

    .full-width-module p {
        line-height: 1.5;
    }

    /* этапы заказа: одинаковые плашки, номер в кружке, текст по центру */
    .order-slider-control {
        height: auto !important;
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin: 0 !important;
    }

    .order-slider-control > div,
    .order-slider-control > div:hover,
    .order-slider-control > div.active {
        display: flex !important;
        align-items: center;
        float: none !important;
        width: auto !important;
        min-height: 54px;
        height: auto !important;
        margin: 0 !important;
        padding: 8px 10px !important;
        box-sizing: border-box;
        background: #f3f3f3 !important;
        border-radius: 6px;
        color: #292929 !important;
        cursor: default !important;
    }

    .order-slider-control > div:before,
    .order-slider-control > div:hover:before,
    .order-slider-control > div.active:before {
        float: none !important;
        flex: 0 0 28px;
        width: 28px !important;
        height: 28px !important;
        margin: 0 10px 0 0 !important;
        padding: 0 !important;
        line-height: 28px;
        font-size: 16px !important;
        background: #ff190b !important;
        color: #fff !important;
        border: 0 !important;
    }

    .order-slider-control > div > span,
    .order-slider-control > .open-order-1 > span {
        display: block !important;
        margin: 0 !important;
        max-width: none !important;
        font-size: 14px;
        line-height: 1.25;
    }

    /* «О компании» на главной: текст и форма обратного звонка */
    .full-width-module .how_order p,
    .full-width-module .description p {
        margin: 0 0 14px !important;
        padding: 0 !important;
    }

    .full-width-module .description span {
        font-size: 15px !important;
        line-height: 1.5;
    }

    .order-callback {
        margin-top: 26px;
        padding-top: 22px;
        border-top: 1px solid #eee;
    }

    .order-callback > p:first-child {
        font-size: 18px !important;
        line-height: 1.3;
        margin-bottom: 10px !important;
    }

    .order-callback form.simpleForm {
        margin: 16px 0 0;
    }

    .order-callback form.simpleForm p {
        display: block !important;
        margin: 0 0 10px !important;
    }

    .order-callback form.simpleForm input {
        margin: 0 !important;
    }

    .order-callback form.simpleForm input.inputtext {
        width: 100% !important;
        box-sizing: border-box;
        height: 42px;
        padding: 0 12px;
        font-size: 15px;
    }

    .order-callback form.simpleForm input[type=submit] {
        width: 100%;
        height: 44px;
        font-size: 16px;
    }

    /* «Так же вы можете позвонить…» — телефон одной строкой, время ниже */
    table.contacts,
    table.contacts tbody,
    table.contacts tr {
        display: block !important;
        overflow: visible !important;
    }

    table.contacts td {
        display: block !important;
        padding: 0 !important;
        width: auto !important;
    }

    table.contacts td:empty {
        display: none !important;
    }

    table.contacts td[style*="font-size"] {
        font-size: 24px !important;
        white-space: nowrap;
        margin: 4px 0 10px;
        color: #292929;
    }

    table.contacts {
        margin: 14px 0 6px;
        font-size: 14px;
        line-height: 1.5;
    }

    .full-width-module h4,
    .full-width-module .how_order b,
    .full-width-module .how_order strong {
        line-height: 1.3;
    }

    /* ---------- формы ---------- */
    .wrapper-right input,
    .wrapper-right textarea {
        width: 100% !important;
        box-sizing: border-box;
        padding: 8px !important;
    }

    .md-modal {
        width: 100% !important;
        max-width: none !important;
    }

    .md-content form input[type=text],
    .md-content form textarea {
        width: 100% !important;
        box-sizing: border-box;
    }

    .md-modal {
        max-height: 100vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .md-content {
        padding: 52px 0 20px !important;
        position: relative;
    }

    .md-content .md-close {
        display: block !important;
        position: absolute !important;
        top: 8px !important;
        right: 12px !important;
        left: auto !important;
        width: 38px !important;
        height: 38px !important;
        margin: 0 !important;
        border: 0 !important;
        border-radius: 4px;
        background: #292929 !important;
        cursor: pointer;
    }

    .md-content .md-close:before {
        content: '\00d7';
        color: #fff;
        font-size: 26px;
        line-height: 38px;
    }

    .md-content label[for^="val_"] {
        display: inline !important;
        margin-right: 14px;
    }

    .md-content form p {
        display: block !important;
        margin: 10px 0 0 !important;
        padding: 0 !important;
    }

    /* ---------- подвал ---------- */
    .footer-left,
    .footer-right {
        display: block !important;
        width: auto !important;
        margin: 0 !important;
    }

    .footer-left ul {
        padding: 0;
    }

    .footer-left li {
        min-width: 0 !important;
        width: 48%;
    }

    .footer-left p[style*="padding: 45px"] {
        padding: 12px 0 !important;
    }

    .footer-right table,
    .footer-right tbody,
    .footer-right tr,
    .footer-right td {
        display: block;
        padding-left: 0 !important;
    }

    .footer-right td:empty {
        display: none;
    }

    .footer-right p {
        text-align: left !important;
        padding-bottom: 20px !important;
    }
}

@media (max-width: 420px) {
    .body-header-button span {
        display: none;
    }

    .body-header-button {
        justify-content: flex-start;
    }
}

/* планшет: по 3 в ряд */
@media (min-width: 600px) and (max-width: 1023px) {
    #pg-msnr-mobile,
    ul.nav.menu-product,
    .page-home ul.nav.menu-product,
    .advantages {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}
