/* =====================================================================
   Тег-фильтр «как у DNS» над тест-каталогами 8 и 9 (задача владельца 25.10).
   Разметка — template-parts/catalog-filter-q.php, поведение — assets/js/catalog-filter-q.js.
   Панель несёт класс .qcards — подложка и скругление из токенов страницы (тест 8 — Б, тест 9 — графит),
   без рамки, с мягкой тенью, как карточки. Чипы — графитовые «таблетки» (у бейджей карточек — тонкий контур,
   чтобы фильтр и бейдж не путались); выбранный — белая заливка, красный оставлен за «Заказать».
   ===================================================================== */

/* --- Сетка и скрытие ---
   auto-fit растягивает оставшиеся карточки на всю строку, когда фильтр оставил в линейке 1–3 сборки, —
   на страницах с фильтром колонки держим через auto-fill (при 4+ карточках в ряд разницы нет). Телефон (≤ 620)
   остаётся на одной колонке из cards-q.css. */
@media (min-width: 621px) {
  .qp-cfilter-page .qcards .q-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}
/* [hidden] сам по себе проигрывает display из cards-q.css (.q-card — flex) и main.css (.qp-shop-line — grid) */
.qp-cfilter-page .qcards .q-card[hidden],
.qp-cfilter-page .qp-shop-line[hidden] { display: none; }

/* --- Панель --- */
/* Отступ до шапки первой линейки (правка владельца по скрину 25.10 ночь, «норм так увеличить»):
   42 + 22 px верхнего поля секции (main.css .qp-shop-line) = 64 px, было 6 + 22 = 28; телефон — 22 + 22 = 44 */
.qp-cfilter {
  margin: 0 0 42px;
  border-radius: var(--q-radius);
  background: var(--qp-plate); /* 28.10.2026: единая палитра — градиент карточки */
  box-shadow: var(--qp-plate-shadow);
}
/* Строка «Бюджет:» (владелец 25.10: отдельной строкой сверху, всегда раскрыта) — те же чипы, черта отделяет её
   от облака остальных */
.qp-cfilter__budget {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 16px 18px 14px;
}
.qp-cfilter__budget + .qp-cfilter__top { border-top: 1px solid rgba(255, 255, 255, 0.07); }
.qp-cfilter__top {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 18px;
}
/* Свёрнуто — один ряд (высота чипа); выбранные чипы встают в начало, чтобы не спрятаться за «Показать ещё».
   Высота ряда — переменная --qf-row: варианты оформления меняют только её. ⚠️ Не задавать в вариантах max-height
   самим правилом: «.qp-cfilter--… .qp-cfilter__chips» той же силы, что «.is-open», и идёт ниже — облако переставало
   раскрываться (25.10 ночь, «почему не все фильтры»). */
.qp-cfilter__chips {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: var(--qf-row, 34px);
  overflow: hidden;
}
.qp-cfilter__chips.is-open { max-height: none; }
.qp-cfilter__chips:not(.is-open) .qp-cfilter__chip.is-active { order: -1; }
.qp-cfilter__chip {
  height: 34px;
  padding: 0 15px;
  border: 0;
  border-radius: 17px;
  background: var(--qp-control-bg); /* 28.10.2026: элементы внутри подложки — лёгкий объём, main.css --qp-control-* */
  box-shadow: var(--qp-control-shadow);
  color: #d6d7df;
  font: 400 13px/34px "Roboto", Arial, sans-serif;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.qp-cfilter__chip:hover:not(:disabled) { background: var(--qp-control-bg-hover); color: #ffffff; }
.qp-cfilter__chip.is-active,
.qp-cfilter__chip.is-active:hover { background: #f1f1f4; color: #111214; font-weight: 500; }
/* С этим чипом ничего не найдётся при текущем выборе */
.qp-cfilter__chip:disabled { opacity: 0.35; cursor: default; }
/* Чип-ссылка на посадочную «Подборки» (26.10, тест-каталог 11 и посадочные): выглядит как кнопка; погашенный —
   класс, а не :disabled (у ссылки его нет) */
a.qp-cfilter__chip { display: inline-block; text-decoration: none; }
.qp-cfilter__chip.is-disabled { opacity: 0.35; pointer-events: none; }

.qp-cfilter__more {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 2px;
  border: 0;
  background: none;
  color: #c7cbd5;
  font: 400 13px "Roboto", Arial, sans-serif;
  white-space: nowrap;
  cursor: pointer;
}
.qp-cfilter__more:hover { color: #ffffff; }
.qp-cfilter__more svg { transition: transform 0.18s; }
/* Раскрыто — «Свернуть ⌃» внизу справа, как у DNS */
.qp-cfilter__more[aria-expanded="true"] { align-self: flex-end; }
.qp-cfilter__more[hidden] { display: none; } /* display: inline-flex выше перебивает атрибут — кнопка не пряталась, когда чипы влезают */
.qp-cfilter__more[aria-expanded="true"] svg { transform: rotate(180deg); }

/* --- Нижняя строка: найдено, сбросить (сортировку и группировку владелец убрал 25.10 ночь) --- */
.qp-cfilter__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 28px;
  padding: 12px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  color: #9da2b0;
  font-size: 13px;
}
.qp-cfilter__found { margin-left: auto; white-space: nowrap; }
.qp-cfilter__found b { color: #f1f1f4; font-weight: 500; }
.qp-cfilter__reset {
  padding: 0;
  border: 0;
  background: none;
  color: #f1f1f4;
  font: 400 13px "Roboto", Arial, sans-serif;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.qp-cfilter__reset:hover { color: #ffffff; text-decoration-color: rgba(255, 255, 255, 0.5); }

.qp-cfilter-empty { margin: 28px 0 0; color: #9da2b0; font-size: 15px; text-align: center; }

@media (max-width: 680px) {
  .qp-cfilter { margin-bottom: 22px; }
  .qp-cfilter__budget { padding: 14px 14px 12px; }
  .qp-cfilter__top { padding: 14px; gap: 10px; }
  .qp-cfilter__chip { padding: 0 13px; }
  .qp-cfilter__bar { padding: 12px 14px; gap: 8px 18px; }
  .qp-cfilter__found { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .qp-cfilter__chip,
  .qp-cfilter__more svg { transition: none; }
}

/* Стрелка плитки бюджета — только в варианте bento. ⚠️ Специфичность 0,2,0: у панели класс .qcards, и правило
   .qcards svg { display: block } из cards-q.css (0,1,1) перебивало одиночный класс — стрелка вылезала под текстом
   бюджетных чипов во всех вариантах (замечание владельца 25.10 ночь). Правило bento ниже — той же силы, идёт позже. */
.qp-cfilter .qp-cfilter__arrow { display: none; }

/* =====================================================================
   ВАРИАНТЫ ОФОРМЛЕНИЯ ПАНЕЛИ на сравнение (владелец 25.10 ночь: «довести до современной красоты веб-дизайна»,
   четыре референса). Включаются параметром страницы — template-parts/catalog-filter-q.php:
     ?fv=outline — контурные таблетки (реф. 2: белый контур на тёмном, выбранная — белая заливка, капслок);
     ?fv=slant   — плашки со скошенным правым краем (реф. 1: узкий капслок, выбранная — красная);
     ?fv=bento   — бенто (реф. 3–4: бюджет плитками с крупной цифрой и стрелкой, ячейки с большим скруглением).
   Без параметра — прежний вид выше (графитовые таблетки на подложке). Ширина чипа у выбранного не меняется
   (начертание то же) — иначе облако «прыгает» при нажатии.
   ===================================================================== */

/* --- outline --- */
.qp-cfilter--outline { background: none; box-shadow: none; border-radius: 0; }
.qp-cfilter--outline .qp-cfilter__budget { padding: 0 0 18px; gap: 10px; }
.qp-cfilter--outline .qp-cfilter__top { padding: 18px 0; }
.qp-cfilter--outline .qp-cfilter__bar { padding: 14px 0 0; }
.qp-cfilter--outline .qp-cfilter__budget + .qp-cfilter__top,
.qp-cfilter--outline .qp-cfilter__bar { border-top-color: rgba(255, 255, 255, 0.12); }
.qp-cfilter--outline { --qf-row: 40px; }
.qp-cfilter--outline .qp-cfilter__chips { gap: 10px; }
.qp-cfilter--outline .qp-cfilter__chip,
.qp-cfilter--outline .qp-cfilter__more {
  height: 40px;
  padding: 0 20px;
  border-radius: 20px;
  background: transparent;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.55);
  color: #ffffff;
  font: 500 12px/40px "Roboto", Arial, sans-serif;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.qp-cfilter--outline .qp-cfilter__chip:hover:not(:disabled),
.qp-cfilter--outline .qp-cfilter__more:hover { background: rgba(255, 255, 255, 0.04); box-shadow: inset 0 0 0 1.5px #ffffff; color: #ffffff; }
.qp-cfilter--outline .qp-cfilter__chip.is-active,
.qp-cfilter--outline .qp-cfilter__chip.is-active:hover { background: #ffffff; box-shadow: none; color: #0d0e11; font-weight: 500; }
.qp-cfilter--outline .qp-cfilter__bar { font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; }
.qp-cfilter--outline .qp-cfilter__reset { font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; }

/* --- slant: правый край скошен — фон чипа рисуют два псевдоэлемента одного цвета: ::before — прямоугольник
       со скруглением слева, ::after — узкая полоса справа, наклонённая skewX от нижнего левого угла
       (верх уходит вправо на 36 × tg 14° ≈ 9 px, поэтому сама полоса стоит на 9 px левее края) --- */
.qp-cfilter--slant { --qf-row: 36px; }
.qp-cfilter--slant .qp-cfilter__chips { gap: 6px; }
.qp-cfilter--slant .qp-cfilter__chip,
.qp-cfilter--slant .qp-cfilter__more {
  --chip: #2a2d34;
  position: relative;
  z-index: 0;
  height: 36px;
  padding: 0 25px 0 15px;
  border-radius: 0;
  background: none;
  color: #e9eaee;
  font: 500 13px/36px "Roboto Condensed", "Arial Narrow", Arial, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.qp-cfilter--slant .qp-cfilter__chip::before,
.qp-cfilter--slant .qp-cfilter__chip::after,
.qp-cfilter--slant .qp-cfilter__more::before,
.qp-cfilter--slant .qp-cfilter__more::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: -1;
  background: var(--chip);
  transition: background-color 0.15s;
}
.qp-cfilter--slant .qp-cfilter__chip::before,
.qp-cfilter--slant .qp-cfilter__more::before { left: 0; right: 16px; border-radius: 9px 0 0 9px; }
.qp-cfilter--slant .qp-cfilter__chip::after,
.qp-cfilter--slant .qp-cfilter__more::after { right: 9px; width: 30px; border-radius: 0 9px 9px 0; transform: skewX(-14deg); transform-origin: 0 100%; }
.qp-cfilter--slant .qp-cfilter__chip:hover:not(:disabled),
.qp-cfilter--slant .qp-cfilter__more:hover { --chip: #353841; background: none; color: #ffffff; }
.qp-cfilter--slant .qp-cfilter__chip.is-active,
.qp-cfilter--slant .qp-cfilter__chip.is-active:hover { --chip: #d51c32; background: none; color: #ffffff; font-weight: 500; }
.qp-cfilter--slant .qp-cfilter__more { gap: 8px; }
.qp-cfilter--slant .qp-cfilter__bar { font-family: "Roboto Condensed", "Arial Narrow", Arial, sans-serif; letter-spacing: 0.08em; text-transform: uppercase; }

/* --- bento: вместо одной подложки — ячейки с большим скруглением; бюджет — пять плиток --- */
.qp-cfilter--bento { display: grid; gap: 10px; background: none; box-shadow: none; border-radius: 0; }
.qp-cfilter--bento .qp-cfilter__top,
.qp-cfilter--bento .qp-cfilter__bar,
.qp-cfilter--bento .qp-cfilter__budget .qp-cfilter__chip {
  border-radius: 22px;
  background: var(--qp-plate);
  box-shadow: var(--qp-plate-shadow);
}
.qp-cfilter--bento .qp-cfilter__budget + .qp-cfilter__top,
.qp-cfilter--bento .qp-cfilter__bar { border-top: 0; }
.qp-cfilter--bento .qp-cfilter__budget {
  display: grid;
  grid-auto-flow: column; /* столько колонок, сколько плиток (с 26.10 их 4 — «до N тыс.») */
  grid-auto-columns: minmax(0, 1fr);
  gap: 10px;
  padding: 0;
}
.qp-cfilter--bento .qp-cfilter__budget .qp-cfilter__chip {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  height: 104px;
  padding: 16px 18px;
  color: #f1f1f4;
  line-height: 1.1;
  text-align: left;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.qp-cfilter--bento .qp-cfilter__num { font: 600 26px/1.05 "Roboto Condensed", "Arial Narrow", Arial, sans-serif; letter-spacing: 0.01em; }
.qp-cfilter--bento .qp-cfilter__unit { margin-top: 5px; color: #9da2b0; font-size: 12px; }
.qp-cfilter--bento .qp-cfilter__unit::after { content: " ₽"; }
.qp-cfilter--bento .qp-cfilter__arrow {
  display: block;
  position: absolute;
  right: 16px;
  bottom: 16px;
  color: #9da2b0;
  transition: transform 0.2s, color 0.2s;
}
.qp-cfilter--bento .qp-cfilter__budget .qp-cfilter__chip:hover:not(:disabled) { color: #ffffff; background: var(--qp-plate-hover); }
.qp-cfilter--bento .qp-cfilter__budget .qp-cfilter__chip:hover:not(:disabled) .qp-cfilter__arrow { color: #ffffff; transform: translate(2px, -2px); }
.qp-cfilter--bento .qp-cfilter__budget .qp-cfilter__chip.is-active,
.qp-cfilter--bento .qp-cfilter__budget .qp-cfilter__chip.is-active:hover { background: #f1f1f4; box-shadow: none; color: #0d0e11; }
.qp-cfilter--bento .qp-cfilter__budget .qp-cfilter__chip.is-active .qp-cfilter__unit { color: #4b4f5a; }
.qp-cfilter--bento .qp-cfilter__budget .qp-cfilter__chip.is-active .qp-cfilter__arrow { color: #0d0e11; transform: rotate(90deg); }
.qp-cfilter--bento .qp-cfilter__top { padding: 18px; }
.qp-cfilter--bento { --qf-row: 38px; }
.qp-cfilter--bento .qp-cfilter__top .qp-cfilter__chip,
.qp-cfilter--bento .qp-cfilter__more {
  height: 38px;
  padding: 0 16px;
  border-radius: 12px;
  font: 500 13px/38px "Roboto", Arial, sans-serif;
}
.qp-cfilter--bento .qp-cfilter__more { background: var(--qp-control-bg); box-shadow: var(--qp-control-shadow); color: #e9eaee; }
.qp-cfilter--bento .qp-cfilter__more:hover { background: var(--qp-control-bg-hover); }
.qp-cfilter--bento .qp-cfilter__bar { padding: 14px 20px; }

@media (max-width: 680px) {
  .qp-cfilter--outline .qp-cfilter__budget { padding-bottom: 14px; }
  .qp-cfilter--outline .qp-cfilter__top { padding: 14px 0; }
  .qp-cfilter--bento .qp-cfilter__budget { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); } /* 16.11 (владелец): по 2 в ряд (было auto-fit от 104 px — 3 + 1) */
  .qp-cfilter--bento .qp-cfilter__budget .qp-cfilter__chip { height: 84px; padding: 12px 14px; border-radius: 18px; }
  .qp-cfilter--bento .qp-cfilter__num { font-size: 21px; }
  .qp-cfilter--bento .qp-cfilter__arrow { right: 12px; bottom: 12px; width: 18px; height: 18px; }
  .qp-cfilter--bento .qp-cfilter__top { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .qp-cfilter--slant .qp-cfilter__chip::before,
  .qp-cfilter--slant .qp-cfilter__chip::after,
  .qp-cfilter--bento .qp-cfilter__budget .qp-cfilter__chip,
  .qp-cfilter--bento .qp-cfilter__arrow { transition: none; }
}
