/* TIREI 2026-10-29 общий файл для всех страниц — телефон в горизонтальной ориентации (вместо оверлея «Поверните устройство»).
   Только сенсорные телефоны: десктоп, ноутбуки и портрет не затрагиваются. */
@media (orientation: landscape) and (max-height: 500px) and (hover: none) and (pointer: coarse) {
    #orientationWarning { display: none !important; }
    html body { padding-top: 56px !important; overflow: auto !important; }

    /* Шапка компактная */
    .site-header { height: 56px !important; }
    .site-header .header-inner { height: 56px !important; }
    .site-header .logo img { height: 42px !important; width: auto !important; }
    /* Бургер-меню: в пределах низкого экрана, со скроллом */
    #navMenu.nav-menu.active, #navMenu.nav-menu.open, .nav-menu.active, .nav-menu.open {
        max-height: calc(100vh - 56px) !important; max-height: calc(100dvh - 56px) !important;
        overflow-y: auto !important; -webkit-overflow-scrolling: touch;
    }

    /* Шапка раздела: не на весь экран */
    .hero-image, .hero-image .hero-container { height: 150px !important; max-height: 40vh !important; overflow: hidden; }
    .hero-image .compressor-image { width: 100% !important; height: 100% !important; object-fit: cover !important; }
    .hero-image .subtitle-container { position: absolute !important; left: 50%; bottom: 0 !important; transform: translateX(-50%); margin-top: 0 !important; padding: 8px 24px !important; }
    .hero-image .subtitle-text { font-size: 18px !important; margin: 0 !important; }

    /* Поиск */
    .search-section { margin-top: 10px !important; padding-top: 0 !important; }
    .search-section .search-input { height: 44px !important; }
    .search-section .search-button, .search-section .compare-wrapper, .search-section .compare-icon { height: 44px !important; width: 44px !important; }
    .filter-section { margin-top: 12px !important; }

    /* Сетка товаров: 3 колонки (<=768) */
        html body .catalog-section .catalog-row { display: flex !important; flex-direction: row !important; flex-wrap: wrap !important; gap: 10px !important; justify-content: flex-start !important; }
        html body .catalog-section .catalog-row .catalog-card { width: calc((100% - 20px) / 3) !important; flex: 0 0 calc((100% - 20px) / 3) !important; max-width: none !important; min-width: 0 !important; height: auto !important; margin: 0 !important; box-sizing: border-box; }
        html body .catalog-section .catalog-row .catalog-card .product-image-container { height: 150px !important; }
        html body .catalog-section .catalog-row .catalog-card .product-img { height: 140px !important; width: auto !important; max-width: 100%; object-fit: contain; }
        html body .catalog-section .catalog-row .catalog-card h3 { font-size: 13px !important; }
        html body .catalog-section .catalog-row .catalog-card .product-feature { font-size: 11px !important; }
        /* Панель фильтров (открывается по «Фильтры») — со скроллом */
        .filter-column.active { max-height: calc(100vh - 70px) !important; overflow-y: auto !important; }

    /* Попапы: в пределах высоты экрана, со скроллом */
    #contactPopup, #successPopup { align-items: flex-start !important; overflow-y: auto !important; }
    #contactPopup .popup-content, #successPopup .popup-content { max-height: calc(100vh - 20px) !important; overflow-y: auto !important; margin: 10px auto !important; top: auto !important; transform: none !important; }
    #comparePopup { align-items: flex-start !important; padding: 0 !important; }
    #comparePopup .popup-content2 { max-height: calc(100vh - 20px) !important; overflow-y: auto !important; margin-top: 0 !important; top: 0 !important; }

    /* «Написать нам» и сравнение: на весь экран, со скроллом, крестик всегда виден */
    #contactPopup .popup-content, #successPopup .popup-content { width: 100vw !important; max-width: 100vw !important; height: 100vh !important; height: 100dvh !important; max-height: none !important; margin: 0 !important; border-radius: 0 !important; box-sizing: border-box !important; padding: 16px 24px 24px !important; overflow-y: auto !important; -webkit-overflow-scrolling: touch; }
    #contactPopup, #successPopup { padding: 0 !important; }
    #comparePopup .popup-content2 { width: 100vw !important; max-width: 100vw !important; height: 100vh !important; height: 100dvh !important; max-height: none !important; margin: 0 !important; border-radius: 0 !important; box-sizing: border-box !important; overflow: auto !important; -webkit-overflow-scrolling: touch; }
    #contactPopup .close-btn, #contactPopup .popup-close, #contactPopup [class*="close"], #comparePopup [class*="close"] { position: sticky !important; top: 0 !important; z-index: 5 !important; }
    body:has(#comparePopup[style*="block"]) #floatingCompare, body:has(#comparePopup[style*="flex"]) #floatingCompare, body:has(#comparePopup.active) #floatingCompare, body:has(#comparePopup.show) #floatingCompare,
    body:has(#contactPopup[style*="flex"]) #floatingCompare, body:has(#contactPopup.active) #floatingCompare { display: none !important; }

    /* Ровные ряды: верх по одной линии, одинаковая высота */
    html body .catalog-section .catalog-row { align-items: stretch !important; align-content: flex-start !important; }
    html body .catalog-section .catalog-row .catalog-card { align-self: stretch !important; margin: 0 !important; top: 0 !important; transform: none !important; display: flex !important; flex-direction: column !important; }
    html body .catalog-section .catalog-row .catalog-card .product-image-container { flex: 0 0 150px !important; margin-top: 0 !important; }
    /* Фильтры открыты: боковая панель + 2 колонки */
    html body .catalog-section:has(.filter-column.active) .catalog-row .catalog-card { width: calc((100% - 10px) / 2) !important; flex: 0 0 calc((100% - 10px) / 2) !important; }
    html body .catalog-section:has(.filter-column.active) .filter-column.active { flex: 0 0 170px !important; width: 170px !important; max-width: 170px !important; box-sizing: border-box !important; }
    html body .catalog-section:has(.filter-column.active) { display: flex !important; flex-direction: row !important; align-items: flex-start !important; gap: 10px !important; }
    html body .catalog-section:has(.filter-column.active) .products-column { flex: 1 1 0 !important; min-width: 0 !important; }

    /* Шапка при прокрутке: лупа слева от бургера, без наложения */
    html body .site-header .header-search.header-search, html body .site-header.scrolled .header-search.header-search.header-search { right: 80px !important; left: auto !important; top: 50% !important; transform: translateY(-50%) !important; }
    /* Кнопки в боковой панели фильтров — по ширине панели */
    html body .catalog-section:has(.filter-column.active) .filter-column.active button, html body .catalog-section:has(.filter-column.active) .filter-column.active a[class*="btn"], html body .catalog-section:has(.filter-column.active) .filter-column.active [class*="button"] { width: 100% !important; max-width: 100% !important; min-width: 0 !important; box-sizing: border-box !important; margin-left: 0 !important; margin-right: 0 !important; padding-left: 6px !important; padding-right: 6px !important; font-size: 13px !important; white-space: normal !important; }
}

/* Страховка от «старой» десктопной шапки и горизонтального переполнения (класс ставит скрипт в <head>) */
html.tirei-land, html.tirei-land body { overflow-x: hidden !important; max-width: 100% !important; }
html.tirei-land body .site-header #navMenu.nav-menu:not(.open):not(.active) { display: none !important; }
html.tirei-land body .site-header #hamburger.hamburger { display: flex !important; }
html.tirei-land body .site-header .header-inner { box-sizing: border-box !important; max-width: 100% !important; }
html.tirei-land body section, html.tirei-land body .search-container, html.tirei-land body .catalog-section { max-width: 100% !important; box-sizing: border-box !important; }

/* Сортировка поверх карточек */
html.tirei-land body .filter-section { position: relative !important; z-index: 60 !important; overflow: visible !important; }
html.tirei-land body .filter-section .sort-section { position: relative !important; z-index: 61 !important; }
html.tirei-land body .filter-section .sort-dropdown { z-index: 62 !important; }
html.tirei-land body .catalog-section { position: relative; z-index: 1; }

/* Бургер-меню на весь экран */
html.tirei-land body:has(#navMenu.open), html.tirei-land:has(#navMenu.open) { overflow: hidden !important; }
html.tirei-land body:has(#navMenu.open) .site-header { background: #333F48 !important; opacity: 1 !important; backdrop-filter: none !important; z-index: 10000 !important; }
html.tirei-land body .site-header #navMenu.nav-menu.open { display: flex !important; position: fixed !important; inset: 56px 0 0 0 !important; top: 56px !important; left: 0 !important; right: 0 !important; bottom: 0 !important; transform: none !important; translate: none !important; width: 100% !important; max-width: none !important; height: auto !important; max-height: none !important; margin: 0 !important; box-sizing: border-box !important; background: #333F48 !important; overflow-y: auto !important; overflow-x: hidden !important; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; z-index: 9999 !important; justify-content: flex-start !important; padding: 16px 0 24px !important; }
html.tirei-land body .site-header #navMenu.nav-menu.open::-webkit-scrollbar { display: none; }

/* «Написать нам» — чистый полноэкранный слой */
html.tirei-land body:has(#contactPopup[style*="flex"]), html.tirei-land body:has(#successPopup[style*="flex"]) { overflow: hidden !important; }
html.tirei-land body #contactPopup.popup-overlay, html.tirei-land body #successPopup.popup-overlay { position: fixed !important; inset: 0 !important; width: 100% !important; height: 100% !important; padding: 0 !important; margin: 0 !important; background: #fff !important; overflow: hidden !important; align-items: stretch !important; justify-content: stretch !important; z-index: 20000 !important; }
html.tirei-land body #contactPopup .popup-content, html.tirei-land body #successPopup .popup-content { position: relative !important; width: 100% !important; max-width: none !important; height: 100% !important; max-height: none !important; margin: 0 !important; border-radius: 0 !important; box-shadow: none !important; box-sizing: border-box !important; overflow-y: auto !important; overflow-x: hidden !important; scrollbar-width: none; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: calc(16px + env(safe-area-inset-top)) calc(72px + env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) calc(24px + env(safe-area-inset-left)) !important; }
html.tirei-land body #contactPopup .popup-content::-webkit-scrollbar, html.tirei-land body #successPopup .popup-content::-webkit-scrollbar { display: none; }
html.tirei-land body #contactPopup .popup-close.popup-close, html.tirei-land body #successPopup .popup-close.popup-close { position: fixed !important; top: calc(10px + env(safe-area-inset-top)) !important; right: calc(14px + env(safe-area-inset-right)) !important; left: auto !important; bottom: auto !important; margin: 0 !important; z-index: 20001 !important; }
html.tirei-land body #contactPopup form input, html.tirei-land body #contactPopup form textarea { box-sizing: border-box !important; max-width: 100% !important; }

/* Оверлей «Поверните устройство» отключён везде */
#orientationWarning { display: none !important; }

/* fix 2026-10-29b: карточки не растягиваются при 1–2 товарах */
html.tirei-land body .catalog-section .catalog-row > .catalog-card.catalog-card.catalog-card { flex: 0 0 calc((100% - 20px) / 3) !important; width: calc((100% - 20px) / 3) !important; max-width: calc((100% - 20px) / 3) !important; }
html.tirei-land body .catalog-section:has(.filter-column.active) .catalog-row > .catalog-card.catalog-card.catalog-card { flex: 0 0 calc((100% - 10px) / 2) !important; width: calc((100% - 10px) / 2) !important; max-width: calc((100% - 10px) / 2) !important; }
/* Поиск на некаталожных страницах: кнопки на всю высоту поля */
html.tirei-land body .search-section .search-container { height: 44px !important; min-height: 0 !important; align-items: stretch !important; }
html.tirei-land body .search-section .search-container > * { height: 44px !important; min-height: 0 !important; margin-top: 0 !important; margin-bottom: 0 !important; align-self: stretch !important; box-sizing: border-box !important; }
/* Контакты: текстовый блок в потоке, без наложения */
html.tirei-land body .contacts-right-column .text-block { height: auto !important; display: block !important; margin: 0 0 16px !important; }
html.tirei-land body .contacts-right-column .text-block p { position: static !important; transform: none !important; left: auto !important; top: auto !important; width: auto !important; max-width: 100% !important; margin: 0 !important; }
html.tirei-land body .catalog-section .catalog-row > .catalog-card.catalog-card.catalog-card { min-width: 0 !important; }
html.tirei-land body .catalog-section .products-column, html.tirei-land body .catalog-section .catalog-block, html.tirei-land body .catalog-section .catalog-wrapper, html.tirei-land body .catalog-section .catalog-row { width: 100% !important; min-width: 0 !important; box-sizing: border-box !important; }
html.tirei-land body .catalog-section:has(.filter-column.active) .products-column { width: auto !important; }
/* fix 2026-10-29d: «Преимущества» (О бренде, главная) — как в портрете, без огромных иконок и наложений */
html.tirei-land:not(#z) body .advantages-grid:not(#z) .catalog-item.catalog-item { padding-top: 20px !important; height: auto !important; min-height: 0 !important; justify-content: flex-start !important; align-items: center !important; }
html.tirei-land:not(#z) body .advantages-grid:not(#z) .advantage-img-container.advantage-img-container, html.tirei-land:not(#z) body .advantages-grid:not(#z) .catalog-item .advantage-img-container { width: 133px !important; height: 145px !important; min-width: 0 !important; min-height: 0 !important; max-width: 133px !important; max-height: 145px !important; margin: 0 auto !important; }
html.tirei-land:not(#z) body .advantages-grid:not(#z) .advantage-img.advantage-img, html.tirei-land:not(#z) body .advantages-grid:not(#z) .catalog-item .advantage-img { width: 133px !important; height: 133px !important; min-width: 0 !important; min-height: 0 !important; max-width: 133px !important; max-height: 133px !important; }
html.tirei-land:not(#z) body .advantages-grid:not(#z) .advantage-text { margin-top: 20px !important; }
html.tirei-land:not(#z) body .advantages-grid:not(#z), html.tirei-land:not(#z) body .advantages-grid:not(#z) .catalog-row { height: auto !important; }
html.tirei-land:not(#z) body .advantages-grid:not(#z) { margin-bottom: 0 !important; padding-bottom: 0 !important; }
html.tirei-land:not(#z) body .advantages-grid:not(#z) + *, html.tirei-land:not(#z) body .motto-title:not(#z) { margin-top: 40px !important; top: auto !important; transform: none !important; }
html.tirei-land:not(#z) body .advantages-grid:not(#z) .catalog-item { width: 100% !important; max-width: 400px !important; aspect-ratio: auto !important; margin-left: auto !important; margin-right: auto !important; box-sizing: border-box !important; }

/* fix 2026-10-29f: «Написать нам» в открытом бургер-меню — обычная кнопка, как в портрете */
html.tirei-land:not(#z) body #navMenu.open .contact-button, html.tirei-land:not(#z) body #navMenu.active .contact-button { width: auto !important; min-width: 166px !important; max-width: 260px !important; height: 48px !important; min-height: 48px !important; flex: 0 0 auto !important; align-self: center !important; margin: 12px auto !important; padding: 0 16px !important; display: flex !important; align-items: center !important; justify-content: center !important; text-align: center !important; line-height: 1 !important; box-sizing: border-box !important; white-space: nowrap !important; }
