/* Каталог автомобилей (katalog.html). Цвета и шрифты — из css/style.css */
.catalog { padding: calc(var(--header-h) + 30px) 0 40px; }
.catalog h1 { font-size: clamp(28px, 4vw, 48px); max-width: 900px; }
.catalog h1 span { color: var(--yellow); }
.catalog__lead { color: var(--muted); max-width: 760px; margin: 14px 0 0; }

.cat-filters { position: sticky; top: 0; z-index: 5; background: rgba(11,11,11,.92); backdrop-filter: blur(10px); border-block: 1px solid var(--line); padding: 14px 0; margin-top: 28px; }
.cat-filters .container { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.cat-seg[hidden] { display: none; }
.cat-seg { display: inline-flex; background: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.cat-seg button { border: 0; background: none; padding: 8px 16px; border-radius: 999px; cursor: pointer; font: inherit; font-weight: 700; color: var(--muted); }
.cat-seg button.on { background: var(--yellow); color: #111; }
.cat-select { font: inherit; color: var(--text); background: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 10px 34px 10px 16px; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.cat-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 14px; padding: 6px 4px; }
.cat-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.cat-toggle i { width: 40px; height: 22px; border-radius: 99px; background: #333; position: relative; transition: .2s; flex: none; }
.cat-toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; }
.cat-toggle input:checked + i { background: var(--yellow); }
.cat-toggle input:checked + i::after { left: 21px; background: #111; }
.cat-select--sm { min-width: 0; }
.cat-select:disabled { opacity: .5; }
.cat-ftoggle { display: none; }
/* Поиск марки и модели с подсказками */
.cat-combo { position: relative; }
.cat-combo__input { background-image: none; padding-right: 36px; width: 210px; font-size: 16px; }
.cat-combo__input::placeholder { color: var(--muted); }
.cat-combo__clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border: 0; border-radius: 50%; background: #2a2a2a; color: var(--text); cursor: pointer; font-size: 12px; }
.cat-combo__list { position: absolute; z-index: 30; left: 0; top: calc(100% + 6px); min-width: 100%; width: max-content; max-width: min(360px, 92vw); max-height: min(60vh, 420px); overflow-y: auto; margin: 0; padding: 6px; list-style: none; background: #161616; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px rgba(0,0,0,.5); -webkit-overflow-scrolling: touch; }
.cat-combo__list li { padding: 9px 12px; border-radius: 9px; cursor: pointer; display: flex; justify-content: space-between; gap: 16px; font-size: 15px; }
.cat-combo__list li small { color: var(--muted); font-size: 12px; }
.cat-combo__list li:hover, .cat-combo__list li.on { background: rgba(255,213,0,.12); color: var(--yellow); }
.cat-combo__list .cat-combo__head { cursor: default; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 10px 12px 4px; }
.cat-combo__list .cat-combo__head:hover { background: none; color: var(--muted); }
.cat-combo__list .cat-combo__empty { color: var(--muted); cursor: default; }
.cat-reset { border: 0; background: none; color: var(--yellow); font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; padding: 6px 4px; }
.cat-count { margin-left: auto; color: var(--muted); font-size: 14px; }
.cat-count b { color: var(--text); }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; padding: 26px 0 30px; }
.cat-card { background: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: border-color .25s, transform .25s; display: flex; flex-direction: column; text-align: left; color: inherit; font: inherit; padding: 0; }
.cat-card:hover, .cat-card:focus-visible { border-color: rgba(255,213,0,.55); transform: translateY(-3px); outline: none; }
.cat-card__img { position: relative; aspect-ratio: 4/3; background: #1f1f1f; }
.cat-card__img img { width: 100%; height: 100%; object-fit: cover; display: block; color: transparent; }
.cat-badges { position: absolute; left: 12px; top: 12px; right: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.cat-badge { font-size: 12px; font-weight: 800; padding: 5px 10px; border-radius: 99px; background: rgba(11,11,11,.82); }
.cat-badge--y { background: var(--yellow); color: #111; }
.cat-photos { position: absolute; right: 12px; bottom: 12px; font-size: 12px; font-weight: 700; background: rgba(11,11,11,.75); padding: 3px 9px; border-radius: 99px; }
.cat-card__body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.cat-card__title { font-family: var(--font-head); font-size: 17px; font-weight: 700; }
.cat-card__sub { color: var(--muted); font-size: 13px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-specs { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: #cfcfcb; }
.cat-warn { font-size: 12.5px; color: #FF6B5A; font-weight: 600; }
.cat-price { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.cat-price small { display: block; color: var(--muted); font-size: 12px; }
.cat-price strong { font-family: var(--font-head); font-size: 21px; color: var(--yellow); white-space: nowrap; }
.cat-price em { font-style: normal; color: var(--muted); font-size: 12px; text-align: right; }
.cat-more { text-align: center; padding-bottom: 30px; }
.cat-more .btn[hidden], .cat-pick[hidden] { display: none; }
.cat-pick { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0 0 30px; padding: 26px 28px; border-radius: var(--radius); background: linear-gradient(120deg, rgba(255,213,0,.12), rgba(255,213,0,.03)); border: 1px solid rgba(255,213,0,.3); }
.cat-pick h3 { margin: 0 0 6px; font-size: 22px; }
.cat-pick p { margin: 0; color: var(--muted); max-width: 640px; }
.cat-pick .btn { flex: none; }
@media (max-width: 640px) { .cat-pick { flex-direction: column; align-items: stretch; text-align: left; padding: 22px 18px; } }
.cat-empty, .cat-loading { color: var(--muted); padding: 30px 0; }
.cat-hub { margin: 0 0 14px; }
/* Карточки на текстовых страницах (страницы моделей) — без стилей обычных ссылок */
.doc a.cat-card, .doc a.cat-card:hover { color: var(--text); text-decoration: none; }
.doc a.cat-card .cat-price strong { color: var(--yellow); }
.doc .seo-models a { text-decoration: none; color: var(--text); }
.doc .seo-models a:hover { color: var(--yellow); }
/* Списки моделей: страницы моделей, /katalog/, «Авто из Китая» */
.seo-models { display: flex; flex-wrap: wrap; gap: 8px; }
.seo-models .chip small { color: var(--muted); font-weight: 600; margin-left: 4px; }
.cat-legal { color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--line); padding: 22px 0 10px; }

/* ---- Карточка машины ---- */
.cat-modal { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.72); display: none; overflow-y: auto; padding: 30px 16px; }
.cat-modal.open { display: block; }
.cat-sheet { max-width: 1180px; margin: 0 auto; background: var(--black); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; position: relative; }
.cat-close { position: absolute; right: 18px; top: 18px; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--ink); color: var(--text); cursor: pointer; font-size: 20px; }
.cat-detail { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); gap: 28px; }
.cat-gallery { aspect-ratio: 4/3; border-radius: var(--radius-sm); overflow: hidden; background: #1f1f1f; }
.cat-gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cat-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; margin-top: 10px; }
.cat-thumbs img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; cursor: pointer; opacity: .6; border: 2px solid transparent; }
.cat-thumbs img.on { opacity: 1; border-color: var(--yellow); }
.cat-d-title { font-size: clamp(22px, 2.6vw, 30px); padding-right: 50px; }
.cat-d-sub { color: var(--muted); margin-top: 6px; }
.cat-box { background: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 18px 20px; margin-top: 16px; }
.cat-box h3 { font-size: 15px; margin-bottom: 12px; }
.cat-rows { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; font-size: 14px; }
.cat-rows > span:nth-child(odd) { color: var(--muted); }
.cat-rows > span:nth-child(even) { text-align: right; font-weight: 600; white-space: nowrap; }
.cat-rows .tot { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; font-family: var(--font-head); font-size: 16px; color: var(--text) !important; }
.cat-rows .tot + .tot { color: var(--yellow) !important; font-size: 22px; }
.cat-rows .bad { color: #FF6B5A; }
.cat-note { font-size: 12.5px; color: var(--muted); margin: 12px 0 0; }
.cat-specgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; font-size: 14px; }
.cat-specgrid span { display: block; color: var(--muted); font-size: 12px; }
.cat-order { display: grid; gap: 10px; margin-top: 16px; }
.cat-order input[type=text], .cat-order input[type=tel] { width: 100%; padding: 13px 14px; border-radius: 12px; border: 1.5px solid rgba(255,255,255,.14); background: #0e0e0e; color: var(--text); font: inherit; font-size: 16px; }
.cat-order input:focus { outline: none; border-color: var(--yellow); }
.cat-order input.is-error { border-color: #E5484D; }
.cat-order .consent { color: var(--muted); margin: 2px 0 4px; }
.cat-order .consent__box { border-color: rgba(255,255,255,.35); }
.cat-order .consent input:checked + .consent__box { background: var(--yellow); border-color: var(--yellow); }
.cat-order .consent input:checked + .consent__box::after { border-color: #111; }
.cat-order .hp { position: absolute; left: -9999px; }
.cat-order__msg { font-size: 14px; }
.cat-order__msg.ok { color: #5BD38A; }
.cat-order__msg.err { color: #FF6B5A; }
.cat-chat { display: flex; gap: 10px; flex-wrap: wrap; }
.cat-chat .btn { flex: 1; }
.cat-src { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.cat-src a { color: inherit; }

@media (max-width: 900px) {
  /* Телефон: главное фото → название, цена и заказ → остальные фото → характеристики */
  .cat-detail { display: flex; flex-direction: column; gap: 16px; }
  .cat-detail > div:first-child { display: contents; }
  .cat-gallery { order: 1; }
  .cat-detail > div:last-child { order: 2; }
  .cat-thumbs { order: 3; margin-top: 0; }
  .cat-detail > div:first-child > .cat-box { order: 4; margin-top: 0; }
  .cat-count { margin-left: 0; width: 100%; }
  .cat-thumbs img:nth-child(n+9) { display: none; }
}
@media (max-width: 560px) {
  .cat-filters { position: relative; z-index: 20; }
  /* Фильтры свёрнуты: видны кнопка «Фильтры», сортировка и счётчик */
  .cat-ftoggle { display: inline-flex; align-items: center; justify-content: center; flex: 1; font: inherit; font-weight: 700; color: #111; background: var(--yellow); border: 0; border-radius: 999px; padding: 11px 16px; cursor: pointer; }
  .cat-filters:not(.open) .cat-select:not(#catSort), .cat-filters:not(.open) .cat-toggle, .cat-filters:not(.open) .cat-seg, .cat-filters:not(.open) .cat-combo { display: none; }
  .cat-combo { width: 100%; }
  .cat-combo__input { width: 100%; }
  .cat-combo__list { width: 100%; max-width: none; }
  .cat-filters #catSort { width: auto; flex: 1; }
  .cat-filters.open #catSort { width: 100%; flex: auto; }
  .cat-card__img { aspect-ratio: 16/10; }
  .cat-card__body { padding: 14px 16px 16px; gap: 8px; }
  .cat-filters .cat-select, .cat-filters .cat-seg { width: 100%; }
  .cat-filters .cat-select--sm { width: calc(50% - 5px); }
  .cat-seg button { flex: 1; padding: 8px; }
  .cat-grid { grid-template-columns: 1fr; }
  .cat-sheet { padding: 16px; }
  .cat-modal { padding: 10px 6px; }
  .cat-box { padding: 14px; }
  .cat-rows { font-size: 13.5px; gap: 8px 10px; }
}
/* Узкие экраны (iPhone): длинное название комплектации не должно растягивать сетку шире экрана */
.cat-grid { grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }
.cat-grid > *, .cat-card__body, .cat-card__body > div { min-width: 0; }
.cat-card { max-width: 100%; }
.cat-price { flex-wrap: wrap; }
.cat-price > div { min-width: 0; }
@media (max-width: 560px) { .cat-grid { grid-template-columns: minmax(0, 1fr); } .cat-price strong { font-size: 19px; } }
a.cat-card { text-decoration: none; -webkit-tap-highlight-color: transparent; }
/* Страница одной машины /avto/<id>/ */
.car-page { padding-top: calc(var(--header-h) + 24px); }
.car-page .cat-detail { margin: 10px 0 30px; }
.car-page .cat-d-title { padding-right: 0; }

/* Длинные кнопки на страницах марок и моделей переносятся, а не вылезают за экран на телефоне */
.country p > .btn { white-space: normal; max-width: 100%; text-align: center; }

/* Быстрая заявка в карточке машины: цена и кнопки сразу под названием */
.cat-quick { margin: 16px 0 4px; padding: 16px; border-radius: 16px; background: rgba(255,213,0,.07); border: 1px solid rgba(255,213,0,.35); display: grid; gap: 10px; }
.cat-quick__price small { display: block; color: var(--muted); font-size: 13px; }
.cat-quick__price strong { font-family: var(--font-head); font-size: clamp(24px, 3vw, 30px); color: var(--yellow); }
.cat-quick__order { width: 100%; }
.cat-quick__chat { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cat-quick__chat .btn { width: 100%; }
.cat-quick__note { margin: 0; color: var(--muted); font-size: 13px; }
/* Панель внизу карточки: всегда под рукой, пока листаешь фото и расчёт */
.cat-sticky { position: sticky; bottom: -1px; z-index: 3; margin: 18px -26px -26px; transform: translateY(110%); opacity: 0; pointer-events: none; transition: transform .3s, opacity .3s; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 8px; background: rgba(14,14,14,.96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
.cat-sticky.is-on { transform: none; opacity: 1; pointer-events: auto; }
@media (min-width: 901px) { .cat-sticky { display: none; } } /* на компьютере цена и кнопки и так видны справа */
.cat-modal { overscroll-behavior: contain; }
html.cat-locked, html.cat-locked body { overflow: hidden !important; }
.cat-sticky__price { margin-right: auto; line-height: 1.15; }
.cat-sticky__price small { display: block; color: var(--muted); font-size: 12px; }
.cat-sticky__price strong { font-size: 17px; color: var(--yellow); white-space: nowrap; }
.cat-sticky__icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.08); color: var(--text); flex: none; }
.cat-sticky__icon svg { width: 20px; height: 20px; fill: currentColor; }
.cat-sticky__icon--wa:hover { background: #25D366; color: #fff; }
.cat-sticky__icon--tg:hover { background: #2AABEE; color: #fff; }
.cat-sticky__order { flex: none; padding: 12px 20px; }
.car-page .cat-sticky { margin: 18px 0 0; border-radius: var(--radius); }
@media (max-width: 760px) {
  .cat-sticky { margin: 14px -16px -16px; }
}

/* Шапка каталога: меню как на всех страницах, справа вместо «Расчёт» — «Консультация».
   На телефоне мессенджеры — в нижней панели, в шапке остаются «Консультация» и «бургер» */
.header--catalog .header__consult { display: inline-flex !important; }
@media (max-width: 900px) {
  .header--catalog .header__consult { padding: 10px 14px; font-size: 14px; }
}

/* Окно «Бесплатная консультация» */
.consult { width: min(440px, calc(100vw - 24px)); padding: 28px 24px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--ink, #141414); color: var(--text); }
.consult::backdrop { background: rgba(0,0,0,.7); backdrop-filter: blur(4px); }
.consult h2 { font-size: 22px; margin: 0 30px 8px 0; }
.consult p { color: var(--muted); font-size: 15px; margin: 0 0 16px; }
.consult__close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255,255,255,.08); color: var(--text); font-size: 16px; cursor: pointer; }
.consult__form { display: grid; gap: 12px; }
.consult__form input[type=tel] { width: 100%; padding: 15px 16px; border-radius: 12px; border: 1.5px solid rgba(255,255,255,.14); background: #0e0e0e; color: var(--text); font: inherit; font-size: 20px; font-weight: 700; }
.consult__form input[type=tel]:focus { outline: none; border-color: var(--yellow); }
.consult__form input.is-error { border-color: #E5484D; }
.consult__form .consent { color: var(--muted); font-size: 13px; }
.consult__form .consent__box { border-color: rgba(255,255,255,.35); }
.consult__form .consent input:checked + .consent__box { background: var(--yellow); border-color: var(--yellow); }
.consult__form .consent input:checked + .consent__box::after { border-color: #111; }
.consult__form .hp { position: absolute; left: -9999px; }
.consult__msg { font-size: 14px; }
.consult__msg.ok { color: #5BD38A; }
.consult__msg.err { color: #FF6B5A; }
.consult__or { margin: 18px 0 10px; text-align: center; color: var(--muted); font-size: 13px; }
.consult__chat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.consult__chat .btn { width: 100%; }

/* Фото в карточке машины: стрелки, счётчик, свайп */
.cat-gallery { position: relative; }
.cat-gallery img { cursor: pointer; user-select: none; -webkit-user-drag: none; }
.cat-gal-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding-bottom: 3px; transition: background .2s; }
.cat-gal-nav:hover { background: var(--yellow); color: #111; }
.cat-gal-nav--prev { left: 10px; }
.cat-gal-nav--next { right: 10px; }
.cat-gal-count { position: absolute; right: 10px; bottom: 10px; padding: 4px 10px; border-radius: 999px; background: rgba(0,0,0,.6); color: #fff; font-size: 13px; font-weight: 700; }
@media (hover: none) { .cat-gal-nav { width: 38px; height: 38px; font-size: 24px; background: rgba(0,0,0,.4); } }

/* Панель фильтров больше не прилипает при прокрутке (раньше уезжала под шапку и обрезалась) — вернуться к ней помогает «Наверх» */
.cat-filters { position: relative; z-index: 20; } /* выше карточек: иначе список марок и моделей уходит под машины */
.cat-combo { min-width: 170px; }

/* Кнопка «Наверх» */
.to-top { position: fixed; right: 20px; bottom: 24px; z-index: 40; width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--line); background: var(--yellow); color: #111; cursor: pointer; display: grid; place-items: center; box-shadow: 0 10px 30px rgba(0,0,0,.45); transition: transform .2s; }
.to-top:hover { transform: translateY(-3px); }
.to-top svg { width: 24px; height: 24px; fill: currentColor; }
.to-top[hidden] { display: none; }
@media (max-width: 900px) { .to-top { right: 14px; bottom: calc(96px + env(safe-area-inset-bottom)); width: 46px; height: 46px; } }
@media (min-width: 901px) { .cat-filters .cat-select:not(.cat-combo__input) { max-width: 230px; } }

/* Пикапы как грузовые N1: бейдж, выгода, пояснения */
.cat-badge--n1 { background: #2E7D4F; color: #fff; }
.cat-gain { font-size: 12.5px; color: #4ADE80; font-weight: 700; }
.cat-n1 { font-size: 12.5px; color: rgba(255,255,255,.6); font-weight: 600; }
.cat-n1box { margin: 12px 0 0; padding: 12px 14px; border-radius: 12px; background: rgba(74,222,128,.08); border: 1px solid rgba(74,222,128,.3); font-size: 13.5px; line-height: 1.5; color: rgba(255,255,255,.85); }
.cat-n1box b { color: #fff; }
.cat-n1box a { color: var(--yellow); }
.cat-n1banner { grid-column: 1 / -1; display: flex; gap: 20px; align-items: center; justify-content: space-between; padding: 18px 22px; border-radius: 18px; background: linear-gradient(120deg, rgba(74,222,128,.14), rgba(255,213,0,.08)); border: 1px solid rgba(74,222,128,.35); }
.cat-n1banner b { font-size: 17px; }
.cat-n1banner p { margin: 6px 0 0; font-size: 14px; color: rgba(255,255,255,.75); max-width: 720px; }
.cat-n1banner__act { display: flex; gap: 10px; flex-wrap: wrap; flex-shrink: 0; }
@media (max-width: 760px) { .cat-n1banner { flex-direction: column; align-items: flex-start; padding: 16px; } }
.cat-badge--hot { background: #E10600; color: #fff; }
