/* =====================================================================
 * п.684 (ТЗ metro-mobile-home-header-menu 07.10.2026, утверждено Сергеем): телефон до 767 px -
 * шапка, нижняя навигация, экран «Меню», порядок и блоки мобильной главной, лента «Новые поступления»,
 * окно собственника, короткий подвал главной. Компьютер и планшет от 768 px не затронуты.
 * Цвета ТЗ: текст #0b1b43, красный #ed1233, вторичный #697c98, подложка #f3f5f9, границы #dfe5ef; поля 18 px.
 * Подключается в <head> последним (header.php); первый экран (ui/home-first-screen.css) вставлен строкой в
 * страницу ниже - его правила здесь перебиваются через .ym-app-home.
 * Разметка: include/mobile-menu.php, include/home-first-screen.php, include/mobile-home.php; поведение -
 * js/mobile-shell.js.
 * ===================================================================== */
@media (max-width: 767px) {
    :root { --ms-ink: #0b1b43; --ms-red: var(--tenant-accent, #ed1233); --ms-muted: #697c98; --ms-soft: #f3f5f9; --ms-line: #dfe5ef; }

    /* ---------- шапка: логотип слева, «Связаться» справа (раздел 2) ---------- */
    body .header .header-top .ym-head-services-m { display: none !important; }   /* «Услуги» у логотипа - в «Меню» (решение 07.10) */
    body .header .header-top { justify-content: flex-start; }
    body .header .header-top .logo { margin: 0 0 0 18px; }
    body .header .header-top .logo img { width: 136px; height: auto; display: block; }
    body .header .header-top .ym-head-chat-m { right: 18px; }
    /* на главной шапка уходит вместе со страницей; открыт раздел поверх страницы («Меню», «Избранное») - шапка на месте */
    body.body--main:not(.ym-mobile-sheet-open) .header { position: absolute; }

    /* ---------- нижняя навигация: п.684а (Сергей 13.10: «надо было поменять только кнопку „о нас“, остальные кнопки надо
       оставить») - вид кнопок, подсветка и красный пин «Карты» прежние (mobile-redesign.css, mobile-layout-kit.css);
       по ТЗ 07.10 - только «Меню» вместо «О нас» ---------- */

    /* ---------- экран «Меню» (раздел 5) ---------- */
    .ymmm.ym-about > .ymmm-scroll { padding: 0 18px calc(var(--ym-mobile-nav-h, 73px) + 24px); background: #fff; color: var(--ms-ink); font-family: inherit; }
    .ymmm-head { padding: 14px 0 0; }
    .ymmm-head h2 { margin: 0; font-size: 26px; line-height: 1.25; letter-spacing: -.7px; font-weight: 700; color: var(--ms-ink); }
    .ymmm .ymmm-region { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; margin: 0; padding: 0; border: 0; background: none; color: var(--ms-muted); font: inherit; font-size: 13px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
    .ymmm-region svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
    .ymmm-region .ymmm-down { width: 13px; height: 13px; }
    .ymmm-group { margin-top: 16px; }
    .ymmm-group h3 { margin: 0 0 4px; font-size: 12px; line-height: 1.4; letter-spacing: .35px; text-transform: uppercase; font-weight: 700; color: var(--ms-muted); }
    .ymmm .ymmm-row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 67px; margin: 0; padding: 10px 0; border: 0; border-bottom: 1px solid var(--ms-line); border-radius: 0; background: none; color: var(--ms-ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
    .ymmm .ymmm-row:active, .ymmm .ymmm-row.is-go { background: #f7f9fc; }
    .ymmm .ymmm-row.is-go .ymmm-next { visibility: hidden; }
    .ymmm .ymmm-row.is-go::after { content: ""; flex: none; width: 16px; height: 16px; margin-left: -30px; border: 2px solid #dfe5ef; border-top-color: var(--ms-red); border-radius: 50%; animation: ymmmSpin .8s linear infinite; }
    @keyframes ymmmSpin { to { transform: rotate(360deg); } }
    .ymmm-row svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; flex: none; }
    .ymmm-row .ymmm-ico { width: 22px; height: 22px; stroke-width: 1.65; color: #195b80; }
    .ymmm-row .ymmm-next { width: 16px; height: 16px; stroke-width: 2; color: var(--ms-muted); }
    .ymmm-txt { flex: 1; min-width: 0; }
    .ymmm-txt strong { display: block; font-size: 13px; line-height: 1.35; font-weight: 700; }
    .ymmm-txt small { display: block; margin-top: 3px; font-size: 11px; line-height: 1.4; color: var(--ms-muted); }
    .ymmm .ymmm-row:focus-visible, .ymmm .ymmm-region:focus-visible { outline: 2px solid #7c99bd; outline-offset: 2px; }

    /* ---------- первый экран по ТЗ (раздел 7): плитки ~103 px, плашка собственника, карта ---------- */
    .ym-app-home .ymh1 { --h1-ink: var(--ms-ink); --h1-muted: var(--ms-muted); --h1-line: var(--ms-line); --h1-soft: var(--ms-soft); }
    .ym-app-home .ymh1 h1 { margin: 8px 0 10px; font-size: 30px; line-height: 1.08; letter-spacing: -1px; }
    .ym-app-home .ymh1 .ymh1-sub { margin: 0 0 16px; font-size: 13px; }
    .ym-app-home .ymh1 .ymh1-grid { gap: 9px; }
    .ym-app-home .ymh1 .ymh1-cat { height: auto; min-height: 103px; padding: 10px 12px; border-radius: 13px; }
    .ym-app-home .ymh1 .ymh1-art { height: 58px; }
    .ym-app-home .ymh1 .ymh1-lbl { font-size: 14px; }
    .ym-app-home .ymh1 .ymh1-own { gap: 11px; margin-top: 11px; padding: 13px 12px; border-radius: 12px; background: var(--ms-ink); }
    .ym-app-home .ymh1 .ymh1-own-ico { width: 37px; height: 37px; border-radius: 9px; }
    .ym-app-home .ymh1 .ymh1-own-ico svg { width: 19px; height: 19px; }
    .ym-app-home .ymh1 .ymh1-own-txt strong { font-size: 14px; }
    .ym-app-home .ymh1 .ymh1-own-txt span { font-size: 12px; }
    .ym-app-home .ymh1 .ymh1-own > svg { width: 18px; height: 18px; }
    .ym-app-home .ymh1 .ymh1-own + .ymh1-map, .ym-app-home .ymh1 .ymh1-map { min-height: 44px; margin-top: 9px; border-radius: 10px; font-size: 13px; }
    .ym-app-home .ymh1 .ymh1-help { margin-top: 26px; padding: 18px; border-radius: 14px; }
    .ym-app-home .ymh1 .ymh1-help h2 { font-size: 20px; }
    .ym-app-home .ymh1 .ymh1-help p { font-size: 13px; line-height: 1.6; }
    .ym-app-home .ymh1 .ymh1-cta { min-height: 46px; border-radius: 10px; font-size: 14px; font-weight: 700; }

    /* ---------- «Новые поступления» (раздел 4) ---------- */
    .ymha { margin-top: 26px; color: var(--ms-ink); }
    .ymha-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
    .ym-app-home .ymha-head h2 { margin: 0; font-size: 21px; line-height: 1.3; letter-spacing: -.5px; font-weight: 700; color: var(--ms-ink); }
    .ymha-all { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; color: var(--ms-muted); font-size: 13px; text-decoration: none; white-space: nowrap; }
    .ymha-all svg, .ymha-foot svg { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
    .ymha-track { display: flex; gap: 12px; margin: 0 calc(-1 * var(--ms-pad, 16px)); padding: 0 var(--ms-pad, 16px) 8px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding-inline: var(--ms-pad, 16px); scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .ymha-track::-webkit-scrollbar { display: none; }
    .ymha-track[hidden] { display: none; }
    .ymha-card { flex: 0 0 min(290px, calc(100vw - 2 * var(--ms-pad, 16px) - 26px)); display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid var(--ms-line); border-radius: 13px; background: #fff; scroll-snap-align: start; }
    .ymha-track.is-few .ymha-card { flex-basis: min(290px, calc(100vw - 2 * var(--ms-pad, 16px))); }
    .ymha-media { position: relative; height: 177px; background: #e9edf3; flex: none; }
    .ymha-media > a { display: block; width: 100%; height: 100%; }
    .ymha-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
    .ymha-nophoto { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--ms-muted); font-size: 12px; }
    .ymha-deal { position: absolute; top: 10px; left: 10px; padding: 4px 7px; border-radius: 5px; background: rgba(255,255,255,.95); color: var(--ms-ink); font-size: 11px; line-height: 1.3; pointer-events: none; }
    .ymha .ymha-heart { position: absolute; top: 5px; right: 5px; display: grid; place-items: center; width: 44px; height: 44px; margin: 0; padding: 0; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
    .ymha .ymha-heart::before { content: ""; position: absolute; width: 35px; height: 35px; border-radius: 50%; background: #fff; box-shadow: 0 1px 5px rgba(23,37,75,.12); }
    .ymha .ymha-heart svg { position: relative; width: 20px; height: 20px; fill: none; stroke: var(--ms-ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
    .ymha .ymha-heart.is-active svg { fill: var(--ms-red); stroke: var(--ms-red); }
    .ymha-body { display: flex; flex: 1; flex-direction: column; padding: 12px 14px 10px; }
    .ymha-price { font-size: 21px; line-height: 1.3; letter-spacing: -.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .ymha-price small { font-size: 13px; letter-spacing: 0; font-weight: 500; color: var(--ms-ink); }
    .ymha-price--none { font-size: 16px; color: var(--ms-muted); }
    .ym-app-home .ymha-body h3 { margin: 7px 0 4px; font-size: 13px; line-height: 1.4; font-weight: 600; color: var(--ms-ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
    .ymha-body h3 a { color: inherit; text-decoration: none; }
    .ymha-addr { margin: 0; font-size: 12px; line-height: 1.5; color: var(--ms-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
    .ymha-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 8px; color: var(--ms-muted); font-size: 11px; }
    .ymha-foot span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .ymha-foot a { display: inline-flex; align-items: center; gap: 5px; min-height: 40px; color: var(--ms-ink); font-size: 12px; font-weight: 600; text-decoration: none; white-space: nowrap; }
    .ymha-card--ph .ymha-media { animation: ymhaPulse 1.2s ease-in-out infinite; }
    .ymha-card--ph .ymha-body i { display: block; height: 12px; margin: 4px 0 10px; border-radius: 4px; background: #eef1f6; }
    .ymha-card--ph .ymha-body i:first-child { width: 55%; height: 20px; }
    .ymha-card--ph .ymha-body i:nth-child(2) { width: 85%; }
    .ymha-card--ph .ymha-body i:nth-child(3) { width: 65%; margin-bottom: 30px; }
    @keyframes ymhaPulse { 50% { background: #f3f5f9; } }
    @media (prefers-reduced-motion: reduce) { .ymha-card--ph .ymha-media { animation: none; } }
    .ymha-msg { padding: 14px 16px; border: 1px solid var(--ms-line); border-radius: 13px; background: var(--ms-soft); color: var(--ms-ink); font-size: 13px; }
    .ymha-msg p { margin: 0; }
    .ymha-msg a, .ymha-msg button { display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: none; color: var(--ms-red); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }

    /* ---------- «Помощь с недвижимостью» и «Встретимся лично» (раздел 3, блоки 5-6) ---------- */
    .ymhs { margin-top: 26px; color: var(--ms-ink); }
    .ym-app-home .ymhs h2 { margin: 0 0 10px; font-size: 21px; line-height: 1.3; letter-spacing: -.5px; font-weight: 700; color: var(--ms-ink); }
    .ymhs-list { border-top: 1px solid var(--ms-line); }
    .ymhs-row { display: flex; align-items: center; gap: 14px; min-height: 67px; padding: 10px 0; border-bottom: 1px solid var(--ms-line); color: var(--ms-ink); text-decoration: none; -webkit-tap-highlight-color: transparent; }
    .ymhs-row svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; flex: none; }
    .ymhs-row .ymhs-ico { width: 22px; height: 22px; stroke-width: 1.65; color: #195b80; }
    .ymhs-row .ymhs-next { width: 16px; height: 16px; stroke-width: 2; color: var(--ms-muted); }
    .ymhs-row > span { flex: 1; min-width: 0; }
    .ymhs-row strong { display: block; font-size: 13px; line-height: 1.35; }
    .ymhs-row small { display: block; margin-top: 3px; font-size: 11px; line-height: 1.4; color: var(--ms-muted); }
    .ymho { margin-top: 26px; padding: 17px; border: 1px solid var(--ms-line); border-radius: 13px; background: #fafbfd; color: var(--ms-ink); }
    .ymho-label { display: block; margin-bottom: 8px; font-size: 10px; letter-spacing: .5px; text-transform: uppercase; color: var(--ms-muted); }
    .ym-app-home .ymho h2 { margin: 0; font-size: 16px; line-height: 1.4; font-weight: 700; color: var(--ms-ink); }
    .ymho p { margin: 5px 0 0; font-size: 13px; line-height: 1.5; color: var(--ms-muted); }
    .ymho a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 4px; color: var(--ms-ink); font-size: 13px; font-weight: 700; text-decoration: none; }
    .ymho a svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
    .ym-app-home .ym-home-editorial { margin-top: 26px; }

    /* ---------- окно собственника (раздел 6): прежний блок #owner, без «Как начнём работу» и сценариев ---------- */
    .ymow { position: fixed; inset: 0; z-index: 1200; display: flex; flex-direction: column; justify-content: flex-end; }
    .ymow[hidden] { display: none !important; }
    .ymow-back { position: absolute; inset: 0; width: 100%; padding: 0; border: 0; background: rgba(7,24,63,.45); }
    .ymow-box { position: relative; max-height: calc(100% - 16px); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 6px 0 env(safe-area-inset-bottom); border-radius: 18px 18px 0 0; background: #fff; }
    .ymow .ymow-x { position: absolute; top: 6px; right: 6px; z-index: 2; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; background: none; cursor: pointer; }
    .ymow .ymow-x svg { width: 22px; height: 22px; fill: none; stroke: var(--ms-ink); stroke-width: 2; stroke-linecap: round; }
    .ymow .ym-home-owner { margin: 0; }
    .ymow .ysp-owner { margin: 0 !important; padding: 0 !important; border: 0 !important; background: none !important; }
    .ymow .ysp-owner .ysp-section, .ymow .ysp-owner .ysp-cards2,
    .ymow .ysp-owner .ysp-eyebrow, .ymow .ysp-owner .ysp-lead, .ymow .ysp-owner .ysp-benefits { display: none !important; }
    .ymow .ysp-owner__top { display: block !important; margin: 0 !important; padding: 0 !important; background: none !important; }
    .ymow .ysp-owner__lead { padding: 12px 62px 0 18px !important; margin: 0 !important; background: none !important; }
    .ymow .ysp-owner__lead h2 { margin: 0 !important; color: var(--ms-ink) !important; font-size: 21px !important; line-height: 1.3 !important; }
    .ymow .ysp-owner__form { margin: 0 !important; box-shadow: none !important; border: 0 !important; }
    html.ymow-lock, html.ymow-lock body { overflow: hidden; }

    /* ---------- подвал главной - коротко: телефон, часы, обязательные ссылки (раздел 3, блок 8) ---------- */
    .body--main .ymft .ymft-top,
    .body--main .ymft .ymft-group,
    .body--main .ymft .ymft-chat,
    .body--main .ymft .ymft-contact > a:not(.ymft-phone) { display: none !important; }
}
@media (max-width: 370px) {
    body .header .header-top .logo img { width: 123px; }
    .ym-app-home .ymh1 h1 { font-size: 28px; }
    .ym-app-home .ymh1 .ymh1-grid { gap: 8px; }
    .ym-app-home .ymh1 .ymh1-cat { padding: 9px 10px; }
}
