/* ============================================
   RESPONSIVE.CSS — Единый адаптивный файл
   Саммит Логистика
   Брейкпоинты: 1100px, 768px, 480px
   ============================================ */

/* === DESKTOP GRID HELPERS === */
.rt-grid--4 { grid-template-columns: repeat(4, 1fr); }

/* === PAGE-SPECIFIC LAYOUTS === */
.services-form-row { align-items: start; }

/* Footer messenger list items — hidden on desktop */
.foot__msg-li { display: none; }
.foot__msg-a { display: inline-flex; align-items: center; gap: 6px; color: rgba(255,255,255,.5); text-decoration: none; font-size: 12px; transition: color .2s; }
.foot__msg-a:hover { color: #fff; }

/* === GLOBAL FIXES === */
*, *::before, *::after { box-sizing: border-box; }
body { overflow-x: hidden; }
img, video, svg { max-width: 100%; height: auto; }

/* Prevent long words from breaking layout */
h1, h2, h3, h4, p, li, td, th, a, span, div {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Flex containers should wrap on narrow screens */
[style*="display:flex"][style*="gap"] {
    flex-wrap: wrap;
}

/* Table responsive wrapper */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -16px;
    padding: 0 16px;
}

/* ========================================
   TABLET — max-width: 1100px
   ======================================== */
@media (max-width: 1100px) {
    /* Header */
    .nav { display: none !important; }
    .burg { display: flex !important; }
    .em-b, .wh { display: none !important; }

    /* Index hero */
    .hero__in { grid-template-columns: 1fr !important; gap: 40px !important; }
    .hero__right { display: none !important; }

    /* Index grids */
    .svc__grid { grid-template-columns: repeat(2, 1fr) !important; }
    .stats__grid, .stats__in { grid-template-columns: repeat(2, 1fr) !important; }
    .stat:nth-child(2)::after { display: none !important; }
    .how__steps { grid-template-columns: repeat(3, 1fr) !important; }
    .how__steps::before { display: none !important; }
    .adv__in { grid-template-columns: 1fr !important; gap: 48px !important; }
    .geo__in { grid-template-columns: 1fr !important; gap: 44px !important; }
    .cases__grid { grid-template-columns: repeat(2, 1fr) !important; }
    .cont__in { grid-template-columns: 1fr !important; gap: 48px !important; }

    /* Footer */
    .foot__in { grid-template-columns: repeat(3,1fr) !important; gap: 24px !important; }

    /* Page grids */
    .content-grid { grid-template-columns: 1fr !important; }
    .features { grid-template-columns: 1fr 1fr !important; }
    .tl-grid { grid-template-columns: 1fr 1fr !important; }
    .tr-grid { grid-template-columns: 1fr 1fr !important; }
    .steps-grid { grid-template-columns: 1fr 1fr !important; }
    .rt-grid { grid-template-columns: 1fr 1fr !important; }
    .ladv-grid { grid-template-columns: 1fr 1fr !important; }
    .ar-cols { grid-template-columns: 1fr !important; }
    .cg-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .ai-grid { grid-template-columns: 1fr !important; }
    .aadv-grid { grid-template-columns: 1fr 1fr !important; }
    .rate-incl { grid-template-columns: 1fr 1fr !important; }
    .svc-grid { grid-template-columns: 1fr 1fr !important; }
    .adv-grid { grid-template-columns: 1fr 1fr !important; }
    .reg-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .ind-grid { grid-template-columns: 1fr 1fr !important; }
    .ex-grid { grid-template-columns: 1fr 1fr !important; }
    .sch-grid { grid-template-columns: 1fr 1fr !important; }
    .benefits { grid-template-columns: 1fr 1fr 1fr !important; }
    .plans-grid { grid-template-columns: 1fr 1fr !important; }
    .ps-grid { grid-template-columns: 1fr 1fr !important; }
    .pi-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .padv-grid { grid-template-columns: 1fr 1fr !important; }
    .zadv-grid { grid-template-columns: 1fr 1fr !important; }

    /* Services + form row on dostavka page */
    .services-form-row { grid-template-columns: 1fr !important; }

    /* Inline grid overrides — 4-col grids become 2-col */
    [style*="grid-template-columns:repeat(4,1fr)"],
    [style*="grid-template-columns: repeat(4, 1fr)"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    [style*="grid-template-columns:repeat(3,1fr)"],
    [style*="grid-template-columns: repeat(3, 1fr)"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ========================================
   MOBILE — max-width: 768px
   ======================================== */
@media (max-width: 768px) {
    /* Force all fade-up elements visible on mobile */
    .fu {
        opacity: 1 !important;
        transform: none !important;
    }

    /* Header */
    .h-main { height: 60px !important; }
    .msg-b, .ph-b, .h-sep, .wh { display: none !important; }
    /* Fix: keep .btn-r visible in body, only hide in header */
    .header .btn-r:not(.mob-show) { display: none !important; }

    /* Container */
    .container { padding-left: 24px !important; padding-right: 24px !important; }

    /* Hero */
    .hero__in { padding: 100px 0 64px !important; }
    .hero__trust { flex-wrap: wrap !important; gap: 12px !important; }
    .hero__trust-div { display: none !important; }
    .pg-hero { padding: 120px 0 56px !important; min-height: auto !important; }
    .pg-hero h1 { font-size: 28px !important; }
    .pg-hero p { font-size: 14px !important; }

    /* Index sections */
    .svc { padding: 56px 0 !important; }
    .svc__grid { grid-template-columns: 1fr !important; }
    .svc__hd { flex-direction: column !important; align-items: flex-start !important; gap: 16px !important; }
    .stats { padding: 48px 0 !important; }
    .stats__grid, .stats__in { grid-template-columns: 1fr 1fr !important; }
    .stat { padding: 24px 16px !important; }
    .how { padding: 56px 0 !important; }
    .how__steps { grid-template-columns: 1fr 1fr !important; }
    .adv { padding: 56px 0 !important; }
    .adv-grid .adv { padding: 28px 24px !important; }
    .geo { padding: 56px 0 !important; }
    .geo__cities { grid-template-columns: 1fr !important; }
    .geo__nums { grid-template-columns: 1fr 1fr !important; }
    .cases { padding: 56px 0 !important; }
    .cases__hd { flex-direction: column !important; align-items: flex-start !important; gap: 16px !important; }
    .cases__grid { grid-template-columns: 1fr !important; }
    .cont { padding: 56px 0 !important; }
    .f-row { grid-template-columns: 1fr !important; }

    /* Footer messenger links — show in mobile contacts list */
    .foot__msg-li { display: list-item !important; }

    /* Footer */
    .foot__in { grid-template-columns: 1fr 1fr !important; gap: 16px !important; }
    .foot__bot { flex-direction: column !important; gap: 8px !important; text-align: center !important; }
    .foot { padding: 36px 0 20px !important; }
    .foot__ct { margin-bottom: 6px !important; }
    .foot__ul li { margin-bottom: 3px !important; }
    .foot__ul a { font-size: 12px !important; line-height: 1.4 !important; }
    .foot__about { font-size: 11px !important; line-height: 1.6 !important; }
    .foot__bot { padding-top: 16px !important; margin-top: 18px !important; font-size: 11px !important; }

    /* Modal */
    .modal { padding: 32px 20px !important; border-radius: 16px !important; }

    /* Page section padding */
    .content, .timeline, .cta, .transport, .steps, .routes, .ladv,
    .vacancies, .contacts, .example, .scheme, .plans,
    .psvc, .pind, .padv { padding: 56px 0 !important; }

    /* Page grids */
    .features { grid-template-columns: 1fr !important; }
    .tl-grid { grid-template-columns: 1fr !important; }
    .tr-grid { grid-template-columns: 1fr !important; }
    .steps-grid { grid-template-columns: 1fr !important; }
    .rt-grid { grid-template-columns: 1fr !important; }
    .ladv-grid { grid-template-columns: 1fr !important; }
    .cg-grid { grid-template-columns: 1fr !important; }
    .aadv-grid { grid-template-columns: 1fr !important; }
    .rate-incl { grid-template-columns: 1fr 1fr !important; }
    .svc-grid { grid-template-columns: 1fr !important; }
    .adv-grid { grid-template-columns: 1fr !important; }
    .reg-grid { grid-template-columns: 1fr !important; }
    .ind-grid { grid-template-columns: 1fr !important; }
    .ex-grid { grid-template-columns: 1fr !important; }
    .sch-grid { grid-template-columns: 1fr 1fr !important; }
    .benefits { grid-template-columns: 1fr !important; }
    .plans-grid { grid-template-columns: 1fr !important; }
    .plan { padding: 28px 24px !important; }
    .ps-grid { grid-template-columns: 1fr !important; }
    .pi-grid { grid-template-columns: 1fr 1fr !important; }
    .padv-grid { grid-template-columns: 1fr !important; }
    .zadv-grid { grid-template-columns: 1fr !important; }

    /* Stats */
    .stats { margin-top: 24px !important; }
    .stat__v { font-size: 22px !important; }

    /* Inline grid overrides — all multi-col become 1-col */
    [style*="grid-template-columns:repeat(4,1fr)"],
    [style*="grid-template-columns: repeat(4, 1fr)"],
    [style*="grid-template-columns:repeat(3,1fr)"],
    [style*="grid-template-columns: repeat(3, 1fr)"] {
        grid-template-columns: 1fr !important;
    }

    /* Rate table */
    .rate-table { font-size: 13px !important; }
    .rate-table th, .rate-table td { padding: 10px 8px !important; }

    /* Section titles */
    .s-title, .sec-title { font-size: 24px !important; text-align: left !important; }
    .lbl, .sec-label { font-size: 12px !important; display: flex !important; justify-content: flex-start !important; width: fit-content !important; }
    .sec-desc, .sub, .text { font-size: 14px !important; text-align: left !important; }
    section h2, .how__hd .sec-title, .cta .s-title, .cta .sec-title { text-align: left !important; }
    .cta { text-align: left !important; }
    .sub { margin-left: 0 !important; }

    /* Services + form row on dostavka page */
    .services-form-row { grid-template-columns: 1fr !important; }
    .services-form-row .tr-grid { grid-template-columns: 1fr !important; }

    /* Forms in page body */
    [style*="grid-template-columns:1fr 1fr;gap:12px"] {
        grid-template-columns: 1fr !important;
    }

    /* Dostavka hero form */
    .hero__form-card { padding: 28px 20px !important; }
    .hfc__row { grid-template-columns: 1fr !important; }

    /* Company page */
    .vacancies { padding: 56px 0 !important; }
    .contacts { padding: 56px 0 !important; }

    /* Blog grid */
    .blog-grid { grid-template-columns: 1fr !important; }

    /* Contact cards */
    .ci-card { padding: 20px !important; }

    /* Messengers row */
    .msgs-row { flex-wrap: wrap !important; }

    /* Sticky sidebars — disable on mobile, let them flow in document order */
    [style*="position:sticky"] {
        position: relative !important;
        top: auto !important;
    }
}

/* ========================================
   SMALL PHONE — max-width: 480px
   ======================================== */
@media (max-width: 480px) {
    /* Container tighter padding */
    .container { padding-left: 16px !important; padding-right: 16px !important; }

    /* Hero */
    .hero { min-height: auto !important; }
    .hero__in { padding: 88px 0 48px !important; }
    .hero__h1, .pg-hero h1 { font-size: 24px !important; line-height: 1.2 !important; }
    .pg-hero { padding: 100px 0 44px !important; }

    /* Hero form card */
    .hero__form-card { padding: 24px 18px !important; }
    .hfc__title { font-size: 16px !important; }
    .hfc__sub { font-size: 12px !important; margin-bottom: 18px !important; }

    /* How it works — горизонтальный layout: кружок слева, текст справа */
    .how { padding: 40px 0 !important; }
    .how__hd { margin-bottom: 28px !important; }
    .how__steps { grid-template-columns: 1fr !important; gap: 0 !important; }
    .hstep {
        flex-direction: row !important;
        text-align: left !important;
        align-items: flex-start !important;
        padding: 10px 0 !important;
        gap: 14px !important;
        border-bottom: 1px solid var(--g200) !important;
    }
    .hstep:last-child { border-bottom: none !important; }
    .hstep__num {
        width: 40px !important;
        height: 40px !important;
        font-size: 15px !important;
        margin-bottom: 0 !important;
        flex-shrink: 0 !important;
    }
    .hstep__t { font-size: 13px !important; margin-bottom: 0 !important; white-space: nowrap !important; width: 78px !important; flex-shrink: 0 !important; padding-right: 12px !important; border-right: 1px solid var(--g300) !important; align-self: center !important; }
    .hstep__d { font-size: 12px !important; line-height: 1.5 !important; color: var(--g500) !important; }

    /* Stats — 2×2 grid on very small */
    .stats__grid, .stats__in { grid-template-columns: 1fr 1fr !important; }
    .stat { text-align: center !important; }
    .stat::after { display: none !important; }

    /* Geo nums — single column */
    .geo__nums { grid-template-columns: 1fr !important; }

    /* Rate table */
    .rate-table { font-size: 12px !important; }

    /* Rate includes */
    .rate-incl { grid-template-columns: 1fr !important; }

    /* Scheme grid */
    .sch-grid { grid-template-columns: 1fr !important; }

    /* PI grid */
    .pi-grid { grid-template-columns: 1fr !important; }

    /* Section titles even smaller */
    .s-title, .sec-title { font-size: 22px !important; }

    /* Footer text */
    .foot__about { font-size: 11px !important; }
    .foot__bot { font-size: 11px !important; }
    .foot { padding: 32px 0 18px !important; }
    .foot__in { gap: 14px !important; }
    .foot__ct { margin-bottom: 5px !important; }
    .foot__ul li { margin-bottom: 2px !important; }
    .foot__ul a { font-size: 12px !important; line-height: 1.35 !important; }
    .foot__bot { padding-top: 14px !important; margin-top: 16px !important; }

    /* Modal */
    .modal { padding: 24px 16px !important; margin: 16px !important; }
    .modal__t { font-size: 18px !important; }

    /* Contact info cards stack */
    .cont__in { gap: 32px !important; }

    /* Forms */
    .fi { padding: 12px 14px !important; font-size: 14px !important; }
    .btn-submit, .btn-r, .btn-cta-full { font-size: 14px !important; padding: 13px 20px !important; }

    /* Mobile menu — no overrides, handled by base.css */

    /* Inline 2-col grids */
    [style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Cards padding */
    .tr-card { padding: 24px 20px !important; }
    .la { padding: 20px !important; }
    .feat { padding: 20px !important; }
    .sc { padding: 28px 20px !important; }
    .rt { padding: 20px !important; }

    /* Step cards */
    .step, .hstep { padding: 24px 20px !important; }

    /* Service cards on pages */
    .svc-card { padding: 24px 20px !important; }

    /* CTA buttons full width */
    .btn-r, .btn-ol { width: 100% !important; justify-content: center !important; }
    .hero__btns { flex-direction: column !important; gap: 12px !important; }
    .hero__btns .btn-r,
    .hero__btns .btn-ol { width: 100% !important; justify-content: center !important; }
}

/* ========================================
   VERY SMALL PHONE — max-width: 360px
   ======================================== */
@media (max-width: 360px) {
    .container { padding-left: 12px !important; padding-right: 12px !important; }
    .hero__h1, .pg-hero h1 { font-size: 21px !important; }
    .s-title, .sec-title { font-size: 20px !important; }
    .modal { margin: 8px !important; padding: 20px 14px !important; }
    .stat__n, .gn__n { font-size: 28px !important; }

    /* Section paddings — tighter on smallest phones */
    .svc, .how, .adv, .geo, .cases, .cont, .stats { padding: 40px 0 !important; }
    .content, .timeline, .cta, .transport, .steps, .routes, .ladv,
    .vacancies, .contacts, .example, .scheme, .plans,
    .psvc, .pind, .padv { padding: 40px 0 !important; }

    /* Footer — single column on 360px */
    .foot__in { grid-template-columns: 1fr !important; }
    .foot__lists { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 12px !important; }
    .foot { padding: 28px 0 16px !important; }
    .foot__ct { margin-bottom: 5px !important; font-size: 10px !important; }
    .foot__ul li { margin-bottom: 2px !important; }
    .foot__ul a { font-size: 11px !important; }
    .foot__logo { margin-bottom: 8px !important; }
    .foot__about { margin-top: 4px !important; }

    /* Hero main */
    .hero__in { padding: 72px 0 40px !important; }
    .pg-hero { padding: 88px 0 36px !important; }

    /* Hero form card */
    .hero__form-card { padding: 20px 14px !important; }
    .hfc__title { font-size: 15px !important; }
    .hfc__sub { font-size: 11px !important; margin-bottom: 14px !important; }
    .hfi { padding: 11px 12px !important; font-size: 14px !important; }
    .btn-cta-full { padding: 13px !important; font-size: 13px !important; }

    /* Hero service links */
    .hero__svc { font-size: 13px !important; padding: 10px 14px !important; }

    /* Step numbers — ещё компактнее на 360px */
    .hstep__num { width: 36px !important; height: 36px !important; font-size: 13px !important; }
    .hstep { gap: 12px !important; padding: 8px 0 !important; }

    /* Cards */
    .sc { padding: 24px 16px !important; }
    .tr-card { padding: 20px 16px !important; }
    .feat { padding: 18px 16px !important; }
    .la { padding: 18px 16px !important; }
    .ai { padding: 16px !important; }

    /* Contact info */
    .ci-card { padding: 16px !important; }
    .ci-val { font-size: 14px !important; }

    /* Messenger buttons in content */
    .msgs-row .ml { font-size: 11px !important; padding: 7px 10px !important; }
}

/* ========================================
   LARGE DESKTOP — min-width: 1400px
   ======================================== */
@media (min-width: 1400px) {
    .container { max-width: 1260px !important; }
}

/* ========================================
   TOUCH DEVICE IMPROVEMENTS
   ======================================== */
@media (hover: none) and (pointer: coarse) {
    /* Larger tap targets */
    .tm-link, .dd__a {
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
    }

    /* Footer links — компактный тап-таргет через padding, не min-height */
    .foot__ul a {
        display: block !important;
        min-height: unset !important;
        padding-top: 5px !important;
        padding-bottom: 5px !important;
    }

    /* Messenger icon buttons — minimum 44×44 tap area (только иконки в шапке) */
    .ml {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
    }

    /* Мессенджеры с текстом в блоке контактов — авто-ширина, тап-таргет через min-height */
    .msgs-row .ml {
        width: auto !important;
        min-width: unset !important;
        height: auto !important;
        min-height: 44px !important;
        padding: 10px 16px !important;
        gap: 8px !important;
    }

    /* Mobile nav accordion rows */
    .mob__acc-t {
        min-height: 48px !important;
    }

    /* Remove hover effects that cause sticky states on mobile */
    .tr-card:hover, .la:hover, .feat:hover, .sc:hover, .step:hover,
    .gc:hover, .ci-card:hover, .sc:hover, .cc:hover {
        transform: none !important;
        box-shadow: none !important;
    }
}

/* ========================================
   LANDSCAPE PHONE
   ======================================== */
@media (max-height: 500px) and (orientation: landscape) {
    .pg-hero { padding: 80px 0 40px !important; min-height: auto !important; }
    .hero__in { padding: 80px 0 40px !important; }
    /* mob handled by base.css */
}

/* ========================================
   PRINT
   ======================================== */
@media print {
    .header, .foot, .modal-bg, .mob, .burg { display: none !important; }
    body { color: #000 !important; background: #fff !important; }
    .container { max-width: 100% !important; padding: 0 !important; }
    section { padding: 20px 0 !important; }
}
