/* ============================================================
   responsive.css — адаптивная вёрстка forekast.ru (1024px → 320px)
   Подключать ПОСЛЕ /assets/css/style.css:
   <link rel="stylesheet" href="/local/templates/forekast/responsive.css">
   Брейкпоинты: 1024, 992, 768, 640, 560, 480, 380
   ============================================================ */

/* ------------------------------------------------------------
   ДО 1024px — снимаем «корсет» min-width, базовые правки
   ------------------------------------------------------------ */
@media (max-width: 1024px) {
    *, *::before, *::after { -webkit-box-sizing: border-box; box-sizing: border-box; }

    html, body { width: auto; max-width: 100%; }
    body { min-width: 0; overflow-x: hidden; }
    header { min-width: 0; }
    img { max-width: 100%; height: auto; }

    .row { max-width: 100%; padding: 24px 16px; }

    /* ---- Шапка ---- */
    header .row nav { margin-left: 32px; }
    header .row nav a { padding: 15px 8px; font-size: 12px; }
    header .row .phone, header .row .phone a { font-size: 14px; }
    header .row .btn-medium { margin-left: 12px; }

    /* ---- Типографика ---- */
    h1 { font-size: 30px !important; line-height: 36px !important; margin-bottom: 32px; }
    h2, h2 a { font-size: 30px; line-height: 38px; }
    h3, h3 a { font-size: 24px; line-height: 30px; }

    /* ---- Внутренние страницы: сайдбар переезжает наверх ---- */
    .wrapper .middle:before { display: none; }
    .wrapper .left-sidebar { float: none; width: auto; margin-left: 0; position: static; padding: 24px; }
    .wrapper .container { float: none; }
    .wrapper .content { padding: 24px 16px 24px 16px; }

    /* ---- Главное окно (hero) ---- */
    .main-page .main-window { height: auto; min-height: 400px; overflow: visible; }
    .main-page .main-window .row:before { display: none; }
    .main-page .main-window .row { min-height: 400px; }
    .main-page .main-window .row .title-box { margin-left: 0; margin-top: 0; max-width: 520px; padding-top: 96px; }
    .main-page .main-window .row .title-box h1 { font-size: 28px; line-height: 34px; }

    /* ---- Сетка категорий («Возможности КАСТ») — 2 колонки ---- */
    .main-page .capability-main-nav .nav-category-flow .nav-category { width: 50%; margin-bottom: 16px; }

    /* ---- Статистика доступа ---- */
    .main-page .access-statistic .access-statistic-dsc { margin-left: 0; }
    .main-page .access-statistic .access-statistic-dsc p { width: auto; max-width: 560px; }
    .main-page .access-statistic .access-statistic-body .row:before { display: none; }

    /* ---- Техническое обслуживание ---- */
    .main-page .technical .row .technical-dsc { padding-right: 340px; background-size: 320px auto; }
    .main-page .technical .row .technical-dsc p { width: auto; max-width: 380px; }
    .main-page .technical .row .technical-dsc .technical-ui {
        width: auto; height: 0; padding-bottom: 61.8%; /* пропорция 671x415 */
        background-size: contain; background-position: center; margin-left: 0; margin-top: 24px;
    }

    /* ---- RFID-контроль доступа ---- */
    .main-page .access-rfid .access-rfid-body .row:before { display: none; }
    .main-page .access-rfid .access-rfid-body .row p { margin-left: 0; width: auto; max-width: 420px; padding-top: 8px; }

    /* ---- Нештатные ситуации ---- */
    .main-page .crash-situation .crash-situation-title { margin-bottom: 150px; }
    .main-page .crash-situation .crash-situation-dsc p { margin-left: 0; width: auto; max-width: 320px; padding-top: 8px; }

    /* ---- Блок «Комплект / Демо» ---- */
    .conversion-box-flow .kit-box .kit-box-inner .dsc { margin-left: 251px; }

    /* ---- Карусель UI ---- */
    .main-page .ui-about .ui-about-dsc { width: auto; max-width: 860px; }
    .main-page .ui-about .ui-slider .swiper-container { height: 900px; }

    /* ---- Модальные окна ---- */
    .box-modal { max-width: calc(100vw - 32px); width: auto; }
    .box-modal.big-modal { max-width: calc(100vw - 16px); padding: 16px; }
    .box-modal.big-modal .modal-body-eq,
    .box-modal.big-modal .modal-body-op { width: auto !important; height: 0 !important; background-size: contain; background-repeat: no-repeat; background-position: center top; }
    .box-modal.big-modal .modal-body-eq { padding-bottom: 96%; }   /* пропорция 1000x958 */
    .box-modal.big-modal .modal-body-op { padding-bottom: 51%; }   /* пропорция 1000x506 */
}

/* ------------------------------------------------------------
   ДО 1023px (шапка остаётся фиксированной) — уплотняем шапку,
   чтобы всё влезало в одну строку и не лезло под .wrapper(97px)
   ------------------------------------------------------------ */
@media (max-width: 1023px) {
    .wrapper, .wrapper.main-page { padding-top: 97px !important; } /* = высота уплотнённой однострочной шапки */
    header .row .logo { width: 230px; height: 38px; background-size: contain; background-repeat: no-repeat; }
    header .row nav { margin-left: 16px; }
    header .row nav a { padding: 15px 6px; font-size: 11px; }
    header .row .btn-medium { display: none; } /* CTA-кнопки есть внутри страницы */
}

/* ------------------------------------------------------------
   ДО 992px — «декорации» с фиксированными размерами уходят,
   секции-баннеры становятся фоном cover с затемнением
   ------------------------------------------------------------ */
@media (max-width: 992px) {
    .main-page .main-window {
        background-image: -webkit-linear-gradient(left, rgba(0,36,80,.92) 0%, rgba(0,36,80,.7) 55%, rgba(0,36,80,.35) 100%), url("https://forekast.ru/assets/img/kast-eq-main-bg.jpg");
        background-image: linear-gradient(to right, rgba(0,36,80,.92) 0%, rgba(0,36,80,.7) 55%, rgba(0,36,80,.35) 100%), url("https://forekast.ru/assets/img/kast-eq-main-bg.jpg");
        background-size: cover; background-position: right top; background-repeat: no-repeat;
    }
    .main-page .main-window .row { min-height: 460px; display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; }
    .main-page .main-window .row .title-box { padding-top: 72px; }

    /* Устройство (тёмный баннер с фото техники): текст сверху, фото ЦЕЛИКОМ ниже */
    .main-page .device-box { height: auto; min-height: 0; padding-bottom: 8px; background-image: none !important; }
    .main-page .device-box .row { min-height: 0; display: -webkit-flex; display: flex; -webkit-flex-direction: column; flex-direction: column; -webkit-align-items: stretch; align-items: stretch; padding-bottom: 24px; }
    .main-page .device-box .row h2 { order: 1; margin-bottom: 32px; }
    .main-page .device-box .row .device-dsc { order: 2; width: auto; max-width: none; margin-right: 0; }
    .main-page .device-box .row:before {
        content: ''; display: block; -webkit-order: 3; order: 3; z-index: 1;
        position: relative; top: auto; right: auto; left: auto; bottom: auto;
        width: 100%; height: 0; margin-top: 32px; padding-bottom: 65.7%; /* пропорция фото 947x621 — влезает целиком */
        background-image: url("https://forekast.ru/assets/img/device-bg.jpg");
        background-size: contain; background-position: center bottom; background-repeat: no-repeat;
    }

    /* Статистика доступа — фон секции вместо абсолютного слоя */
    .main-page .access-statistic .access-statistic-body { height: auto; min-height: 320px; padding-bottom: 24px; }
    .main-page .access-statistic .access-statistic-body:before { display: none; }
    .main-page .access-statistic .access-statistic-body {
        background-image: url("https://forekast.ru/assets/img/access-statistic-bg.jpg");
        background-size: cover; background-position: center top; background-repeat: no-repeat;
    }

    /* RFID — фото-шапка секции */
    .main-page .access-rfid .access-rfid-title { height: auto; min-height: 260px; }
    .main-page .access-rfid .access-rfid-title:before { display: none; }
    .main-page .access-rfid .access-rfid-title {
        background-image: -webkit-linear-gradient(left, rgba(243,243,243,.95) 0%, rgba(243,243,243,.6) 50%, rgba(243,243,243,.15) 100%), url("https://forekast.ru/assets/img/access-rfid-bg.jpg");
        background-image: linear-gradient(to right, rgba(243,243,243,.95) 0%, rgba(243,243,243,.6) 50%, rgba(243,243,243,.15) 100%), url("https://forekast.ru/assets/img/access-rfid-bg.jpg");
        background-size: cover; background-position: right center; background-repeat: no-repeat;
    }
    .main-page .access-rfid .access-rfid-title h2 { padding-top: 48px; }
    .main-page .access-rfid .access-rfid-body .row { min-height: auto; }

    /* Нештатные ситуации — фото-шапка секции */
    .main-page .crash-situation .crash-situation-title { height: auto; min-height: 260px; margin-bottom: 0; padding-bottom: 8px; }
    .main-page .crash-situation .crash-situation-title:before,
    .main-page .crash-situation .crash-situation-title .row:before { display: none; }
    .main-page .crash-situation .crash-situation-title {
        background-image: -webkit-linear-gradient(left, rgba(4,4,4,.9) 0%, rgba(4,4,4,.65) 50%, rgba(4,4,4,.25) 100%), url("https://forekast.ru/assets/img/crash-bg.jpg");
        background-image: linear-gradient(to right, rgba(4,4,4,.9) 0%, rgba(4,4,4,.65) 50%, rgba(4,4,4,.25) 100%), url("https://forekast.ru/assets/img/crash-bg.jpg");
        background-size: cover; background-position: right center; background-repeat: no-repeat;
    }
    .main-page .crash-situation .crash-situation-title .row h2 a { padding-left: 0; }

    /* Карточки решений — одна колонка */
    .content-prev-box-flow { margin-left: 0; }
    .content-prev-box-flow .content-prev-box,
    .content-prev-box-flow.thre .content-prev-box { width: 100%; float: none; }
    .content-prev-box-flow .content-prev-box .content-prev-box-inner { margin-left: 0; margin-bottom: 24px; height: auto; }
    /* thre-c-p (внутренние страницы) — перебиваем их 33.3%/50% по специфичности */
    .thre-c-p .content-prev-box-flow { margin-left: 0; }
    .thre-c-p .content-prev-box-flow .content-prev-box { width: 100%; float: none; }
    .thre-c-p .content-prev-box-flow .content-prev-box .content-prev-box-inner { margin-left: 0; padding: 24px; }
    .content-prev-box-flow .content-prev-box .content-prev-box-inner .dsc { height: auto; }
    .content-prev-box-flow .content-prev-box .content-prev-box-inner .dsc:before { display: none; }

    /* Комплект / Демо — стопкой */
    .conversion-box { padding: 40px 0; }
    .conversion-box-flow { margin-left: 0; }
    .conversion-box-flow .kit-box { margin-bottom: 32px; }
    .conversion-box-flow .kit-box,
    .conversion-box-flow .demo-box,
    .conversion-box-flow.inner-page .kit-box,
    .conversion-box-flow.inner-page .demo-box { width: 100%; float: none; }
    .conversion-box-flow .kit-box .kit-box-inner,
    .conversion-box-flow .demo-box .demo-box-inner,
    .conversion-box-flow.inner-page .kit-box .kit-box-inner,
    .conversion-box-flow.inner-page .demo-box .demo-box-inner { margin-left: 0; height: auto; }
    .conversion-box-flow .kit-box .kit-box-inner .dsc,
    .conversion-box-flow.inner-page .kit-box .kit-box-inner .dsc { margin-left: 0; }
    .conversion-box-flow .kit-box .kit-box-inner { padding-bottom: 260px; background-size: auto 220px; }
    .conversion-box-flow .kit-box .kit-box-inner .title { font-size: 32px; line-height: 38px; margin-bottom: 24px; }

    /* «Задачи, которые решает КАСТ» — стопкой */
    .tasks-solved .tasks-solved-flow { margin-left: 0; }
    .tasks-solved .tasks-solved-flow .tasks-solved-item { width: 100%; float: none; }
    .tasks-solved .tasks-solved-flow .tasks-solved-item .tasks-solved-item-inner { margin-left: 0; margin-bottom: 24px; }

    /* Карусель UI */
    .main-page .ui-about .ui-slider .swiper-container { height: 760px; }
    .main-page .ui-about .ui-slider .gallery-top .swiper-slide .swiper-slide-inner { padding: 16px; }
    .main-page .ui-about .ui-slider .gallery-thumbs .swiper-slide span { font-size: 14px; padding-top: 44px; }
    /* Карусель UI: высота по картинке (пустота снизу убирается), табы — шире и с воздухом */
    .main-page .ui-about .ui-slider { height: auto !important; }
    .main-page .ui-about .ui-slider .gallery-top,
    .main-page .ui-about .ui-slider .gallery-top .swiper-wrapper { height: auto !important; }
    .main-page .ui-about .ui-slider .gallery-thumbs { height: auto !important; padding: 12px 0; overflow: hidden; }
    .main-page .ui-about .ui-slider .gallery-thumbs .swiper-slide {
        width: auto !important; flex: 0 0 auto; min-width: 108px;
        height: auto !important; padding: 6px 10px; box-sizing: border-box; text-align: center;
    }
    .main-page .ui-about .ui-slider .gallery-thumbs .swiper-slide span { width: auto; white-space: nowrap; line-height: 1.25; }

    /* Внутренние страницы */
    .category-content .img-big-solutions:before { display: none; }
    .category-content .category-dsc { padding-right: 0; max-width: none; }
    .category-content .access-statistic-title { margin-left: 0; }
    .category-content .technical-title { padding-right: 0; background-size: auto 320px; height: auto; min-height: 340px; padding-top: 120px; margin-top: 0; }
    .category-content .access-statistic-cat:before { display: none; }
    .category-content .access-statistic-cat { background-image: url("https://forekast.ru/assets/img/access-statistic-bg.jpg"); background-size: cover; background-position: center top; height: auto; min-height: 320px; }

    /* Контакты */
    .contacts-page .contacts-page-left { float: none; width: auto; }

    /* Фото техники в about-блоке (внутр. страницы) — целиком, вместо обрезки справа */
    .about-box .abut-img { height: 0; padding-bottom: 65.7%; background-size: contain; background-position: center bottom; margin-top: 24px; }
}

/* ------------------------------------------------------------
   ДО 768px — шапка-«мобилка», сетки в одну колонку
   ------------------------------------------------------------ */
@media (max-width: 768px) {
    /* Шапка: статичная, элементы в столбик */
    header { position: static; }
    .wrapper, .wrapper.main-page { padding-top: 0 !important; } /* перебиваем padding-top шапки из других файлов/JS */
    header .row { display: -webkit-flex; display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; -webkit-align-items: center; align-items: center; }
    /* Логотип крупный «до телефона», зазор между лого и телефоном ровно 24px */
    header .row .logo { float: none; -webkit-flex: 1 1 auto; flex: 1 1 auto; width: auto; height: auto; aspect-ratio: 296 / 49; background-size: contain; background-repeat: no-repeat; }
    header .row nav { float: none; margin-left: 0; -webkit-order: 4; order: 4; width: 100%; text-align: center; border-top: 1px solid rgba(255,255,255,.18); margin-top: 8px; padding-top: 4px; }
    header .row nav a { display: inline-block; float: none; padding: 10px 6px; font-size: 12px; }
    header .row .phone, header .row .phone a { float: none; margin-left: 24px; }
    header .row .btn-medium { float: none; margin-top: 0; }

    h1 { font-size: 26px !important; line-height: 32px !important; }
    h2, h2 a { font-size: 24px; line-height: 32px; }
    h3, h3 a { font-size: 20px; line-height: 26px; }

    /* Hero: фото видно затемнённым сверху, заголовок и текст опущены вниз */
    .main-page .main-window {
        min-height: 520px;
        background-image: -webkit-linear-gradient(top, rgba(0,36,80,.35) 0%, rgba(0,36,80,.7) 55%, rgba(0,36,80,.95) 100%), url("https://forekast.ru/assets/img/kast-eq-main-bg.jpg");
        background-image: linear-gradient(to bottom, rgba(0,36,80,.35) 0%, rgba(0,36,80,.7) 55%, rgba(0,36,80,.95) 100%), url("https://forekast.ru/assets/img/kast-eq-main-bg.jpg");
        background-size: cover; background-position: right top; background-repeat: no-repeat;
    }
    .main-page .main-window .row { min-height: 520px; -webkit-align-items: flex-end; align-items: flex-end; padding-bottom: 36px; }
    .main-page .main-window .row .title-box { padding-top: 0; max-width: none; width: 100%; }
    .main-page .main-window .row .title-box h1 { font-size: 26px; line-height: 32px; }

    /* Сетка категорий — одна колонка */
    .main-page .capability-main-nav .nav-category-flow .nav-category { width: 100%; margin-bottom: 8px; }
    .nav-category a.title { font-size: 15px; margin-bottom: 24px; }
    /* Пункты списков — строго в одну строку, длинное — многоточием */
    .main-page .capability-main-nav .nav-category nav a,
    .wrapper .left-sidebar .nav-category a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    /* Иконки заголовков (78px) целиком, подразделы — в одну линию с текстом заголовков */
    .nav-category a, .nav-category a.title { padding-left: 90px; }

    /* Карусель UI */
    .main-page .ui-about .ui-slider .swiper-container { height: 620px; }

    /* Модальные окна */
    .box-modal { padding: 16px; max-width: calc(100vw - 16px); }
    .box-modal .modal-title { font-size: 24px; line-height: 28px; margin-left: -16px; margin-top: -16px; padding: 16px; }

    /* Подвал */
    footer .copyrigh, footer .integrator { float: none; text-align: center; }
    footer .integrator { width: 250px; height: 25px; margin: 16px auto 0; background-size: contain; background-repeat: no-repeat; background-position: center bottom; }
}

/* ------------------------------------------------------------
   ДО 640px — компактный режим
   ------------------------------------------------------------ */
@media (max-width: 640px) {
    .row { padding: 16px 12px; }

    header .row nav a { font-size: 11px; padding: 8px 5px; }
    header .row .logo { width: 150px; height: 26px; }
    header .row .phone, header .row .phone a { font-size: 13px; }

    /* Технические секции без декораций — чистый текст */
    .main-page .technical .row .technical-dsc { padding-right: 0; background-image: none; }
    .main-page .technical .row .technical-dsc p { max-width: none; }
    .main-page .crash-situation .crash-situation-dsc p { max-width: none; }

    /* Карусель UI */
    .main-page .ui-about .ui-slider .swiper-container { height: 520px; }
    .main-page .ui-about .ui-slider .gallery-thumbs .swiper-slide span { font-size: 12px; padding-top: 38px; }
    .main-page .ui-about .ui-slider .swiper-button-next,
    .main-page .ui-about .ui-slider .swiper-button-prev { width: 36px; }

    /* Карточка «Комплект» */
    .conversion-box-flow .kit-box .kit-box-inner { padding: 24px 16px; padding-bottom: 200px; background-size: auto 170px; }
    .conversion-box-flow .kit-box .kit-box-inner .title { font-size: 26px; line-height: 32px; margin-bottom: 18px; }
    .conversion-box-flow .demo-box .demo-box-inner { padding: 24px 16px; }

    /* Модальное окно запроса цены — в столбик */
    .box-modal#zapros, .box-modal#zapros#zapros { width: auto; max-width: calc(100vw - 16px); padding: 0; }
    .box-modal#zapros .asking-price-box { display: block; }
    .box-modal#zapros .asking-price-box .asking-price-left,
    .box-modal#zapros .asking-price-box .asking-price-left.asking-price-left,
    .box-modal#zapros .asking-price-box .asking-price-right,
    .box-modal#zapros .asking-price-box .asking-price-right.asking-price-right { display: block; width: auto; padding: 16px; }
    .box-modal#zapros .asking-price-box .asking-price-left .a-p-flow .a-p-item#SIMPLE_QUESTION_104 textarea,
    .box-modal#zapros .asking-price-box .asking-price-left .a-p-flow .a-p-item#SIMPLE_QUESTION_121 textarea { width: 100%; height: auto; min-height: 64px; }
    .box-modal#zapros .asking-price-box .asking-price-left .a-p-flow .a-p-item input,
    .box-modal#zapros .input-form input { width: 100%; height: auto; }

    /* «Запрос» в hero — список */
    .main-page .ask-box li { padding-left: 72px; font-size: 18px; line-height: 24px; min-height: 48px; background-size: 56px auto; margin-bottom: 24px; }

    /* Внутренние страницы */
    .category-content li { margin-left: 24px; }
    .category-content .category-dsc li { margin-left: 36px; }
}

/* ------------------------------------------------------------
   ДО 480px — узкий телефон
   ------------------------------------------------------------ */
@media (max-width: 480px) {
    h1 { font-size: 22px !important; line-height: 28px !important; margin-bottom: 24px; }
    h2, h2 a { font-size: 20px; line-height: 26px; }
    h3, h3 a { font-size: 18px; line-height: 24px; }

    .main-page .main-window { min-height: 460px; }
    .main-page .main-window .row { min-height: 460px; padding-bottom: 28px; }
    .main-page .main-window .row .title-box h1 { font-size: 22px; line-height: 28px; }
    .main-page .main-window .row .title-box .pre-title { font-size: 14px; }

    /* Шапка в одну строку-компакт */
    header .row { padding: 12px; }
    header .row nav a { padding: 7px 4px; }
    header .row .btn-medium { display: none; } /* на узких экранах — только телефон */

    /* Карточки решений компактнее */
    .content-prev-box-flow .content-prev-box .content-prev-box-inner { padding: 16px; }
    .content-prev-box-flow .content-prev-box .content-prev-box-inner .dsc .title { font-size: 18px; line-height: 24px; }

    /* Карусель UI */
    .main-page .ui-about .ui-slider .swiper-container { height: 460px; }
    .main-page .ui-about .ui-slider .gallery-thumbs .swiper-slide span { font-size: 11px; padding-top: 34px; width: 72px; }

    /* Комплект — фон-картинка уходит, текст сплошняком */
    .conversion-box-flow .kit-box .kit-box-inner { padding-bottom: 24px; background-image: none; }

    /* Навигация категорий без «воздуха» */
    .nav-category a { padding-left: 90px; margin-bottom: 12px; font-size: 13px; }
    .nav-category a.title { padding-left: 90px; font-size: 14px; margin-bottom: 18px; }

    /* Кнопки-формы во всю ширину */
    .conversion-box-flow .demo-box .demo-box-inner #callback input[type="text"] { width: 100%; }
    form#callback input.btn, form#request_price input.btn { width: 100%; text-align: center; }

    /* Подвал */
    footer { padding: 24px 0; text-align: center; font-size: 13px; }
}

/* ------------------------------------------------------------
   ДО 380px — минимальная ширина (iPhone SE и т.п.)
   ------------------------------------------------------------ */
@media (max-width: 380px) {
    .row { padding: 12px 8px; }

    header .row nav a { font-size: 10px; padding: 6px 3px; }
    header .row .phone, header .row .phone a { font-size: 12px; }

    h1 { font-size: 20px !important; line-height: 26px !important; }
    h2, h2 a { font-size: 18px; line-height: 24px; }

    .main-page .main-window { min-height: 420px; }
    .main-page .main-window .row { min-height: 420px; padding-bottom: 24px; }

    /* Карусель UI — компакт (табы остаются, прокручиваются) */
    .main-page .ui-about .ui-slider .swiper-container { height: 400px; }

    /* Модальные окна без полей */
    .box-modal { max-width: calc(100vw - 8px); padding: 12px; }
    .box-modal.big-modal .modal-body-eq { padding-bottom: 96%; }

    /* «Запрос цены» — всё в столбик */
    .box-modal#zapros .asking-price-box .asking-price-left .a-p-flow { margin-left: 0; }
    .box-modal#zapros .asking-price-box .asking-price-left .a-p-flow .a-p-item { float: none; width: auto; margin-bottom: 10px; }

    /* Контакты */
    .contacts-page .contacts-page-left ul.contacts-page-top li { display: block; margin: 0 0 24px 0; font-size: 18px; padding-left: 60px; height: auto; line-height: 24px; }
    .contacts-page .contacts-page-left ul.contacts-page-top li span { margin-top: 4px; }
}
