/* Списки товаров: разделы, бренды, метки, весь каталог и поиск.
   Дополняет макет: сетка и карточки (.shop-grid, .shop-card*), пагинация (.shop__pagination) и колонка фильтров
   (.shop-filters, .shop-filter*, .shop-toggle) описаны в main.css — здесь только то, чего там нет:
   шапка списка с порядком и кнопкой «Фильтры», плитки подразделов, текст раздела, пустая выдача, карточки брендов,
   шторка фильтров на телефоне. Каждый новый класс есть в макете (design/index.html → «Списки и поиск»). */

/* ---------- Шапка списка ---------- */
.shop__head { flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 10px 14px; }
.shop__title { min-width: 0; overflow-wrap: anywhere; }
.shop__count { margin-right: auto; }
.shop__brandmark { display: flex; align-items: center; height: 40px; padding: 0 12px; border-radius: var(--radius-md); background: var(--surface-2); }
.shop__brandmark img { width: auto; height: auto; max-width: 110px; max-height: 28px; object-fit: contain; }
.shop__tools { display: flex; align-items: center; gap: 8px; }

/* Порядок выдачи — выпадающий список в языке полей: серая заливка, без рамки */
.shop-sort { position: relative; display: block; }
.shop-sort select {
	appearance: none; -webkit-appearance: none; height: 36px; padding: 0 34px 0 12px; border: 0; border-radius: var(--radius-sm);
	background: var(--surface-2) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e93a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>") no-repeat right 10px center / 14px;
	color: var(--ink-2); font: 500 13px/1 var(--font-sans); cursor: pointer; transition: background-color .15s ease;
}
.shop-sort select:hover { background-color: var(--surface-3); }
.shop-sort select:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }

/* Кнопка «Фильтры»: только там, где колонка стала шторкой */
.shop-fbtn {
	display: none; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border: 0; border-radius: var(--radius-sm);
	background: var(--surface-2); color: var(--ink); font: 600 13px/1 var(--font-sans); cursor: pointer; transition: background-color .15s ease;
}
.shop-fbtn:hover { background: var(--surface-3); }
.shop-fbtn svg { width: 16px; height: 16px; flex: none; }
.shop-fbtn__n { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--ink); color: var(--dark-ink); font: 700 10px/1 var(--font-sans); font-style: normal; }

/* ---------- Текст раздела, строка поиска ---------- */
.shop__description { max-width: 760px; margin: -4px 0 24px; color: var(--ink-2); font-size: 14px; line-height: 1.65; }
.shop__description > :last-child { margin-bottom: 0; }
.shop__description p { margin: 0 0 .8em; }
.shop__description a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.shop__description ul, .shop__description ol { margin: 0 0 .8em; padding-left: 1.3em; }
.shop__description h2, .shop__description h3, .shop__description h4 { margin: 1.1em 0 .4em; font-size: 15px; font-weight: 600; letter-spacing: -.005em; color: var(--ink); }
.shop__description table { border-collapse: collapse; margin: 0 0 .8em; font-size: 13px; }
.shop__description th, .shop__description td { padding: 6px 12px 6px 0; text-align: left; vertical-align: top; }
.shop__query { margin: -4px 0 20px; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.shop__query b { color: var(--ink); font-weight: 600; }
.shop__query a { margin-left: 10px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.shop__query a:hover { color: var(--ink); }
.shop__subhead { margin: 0 0 12px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* ---------- Плитки подразделов ---------- */
.shop-subs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 112px)); gap: 14px 12px; margin: 0 0 26px; }
.shop-sub { display: flex; flex-direction: column; gap: 4px; min-width: 0; color: var(--ink); }
.shop-sub__img { display: block; aspect-ratio: 3 / 4; border-radius: var(--radius-md); overflow: hidden; background: var(--surface-2); }
.shop-sub__img img { display: block; width: 100%; height: 100%; object-fit: contain; transition: transform .3s ease; }
.shop-sub:hover .shop-sub__img img { transform: scale(1.04); }
.shop-sub__name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 12.5px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.shop-sub:hover .shop-sub__name { text-decoration: underline; text-underline-offset: 2px; }
.shop-sub__count { margin-top: -1px; font-size: 11px; color: var(--muted); }

/* ---------- Выдача ---------- */
.shop-card__noimg { position: absolute; inset: 0; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.shop-card__noimg svg { width: 44px; height: 44px; opacity: .4; }
#results { transition: opacity .12s ease; }
#results.is-busy { opacity: .45; pointer-events: none; }

/* Пустая выдача — не тупик: подсказка и ссылки на разделы */
.shop__empty { max-width: 620px; margin: 0 auto; padding: 44px 0 64px; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.shop__empty p { margin: 0 0 .7em; }
.shop__empty-title { font-size: 17px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
.shop__empty-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 18px 0; }
.shop__empty-links a, .shop__empty-reset {
	display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: var(--radius-sm);
	background: var(--surface-2); color: var(--ink); font-size: 13px; font-weight: 500; transition: background-color .15s ease;
}
.shop__empty-links a:hover, .shop__empty-reset:hover { background: var(--surface-3); }

/* ---------- Карточки брендов ---------- */
.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.brand-card { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 12px 12px 14px; border-radius: var(--radius-md); background: var(--surface-2); color: var(--ink); transition: background-color .15s ease; }
.brand-card:hover { background: var(--surface-3); }
.brand-card__mark { display: flex; align-items: center; justify-content: center; height: 64px; border-radius: var(--radius-sm); background: var(--surface); }
.brand-card__mark img { width: auto; height: auto; max-width: 78%; max-height: 36px; object-fit: contain; }
.brand-card__mark b { max-width: 100%; padding: 0 10px; font-size: 16px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; text-align: center; color: var(--ink-2); overflow-wrap: anywhere; }
.brand-card__count { font-size: 12px; color: var(--muted); }

/* ---------- Колонка фильтров ---------- */
.shop-filters__form { display: flex; flex-direction: column; gap: 22px; }
.shop-filters__reset { font-size: 11px; font-weight: 500; letter-spacing: -.005em; color: var(--muted); transition: color .15s ease; }
.shop-filters__reset:hover { color: var(--ink); }
.shop-filters__reset.is-idle { visibility: hidden; pointer-events: none; }
.shop-filters__close, .shop-filters__foot, .shop-filters-veil { display: none; }
.shop-filters__apply { height: 36px; padding: 0 18px; border: 0; border-radius: var(--radius-sm); background: var(--ink); color: var(--dark-ink); font: 600 12.5px/1 var(--font-sans); cursor: pointer; }

/* Наличие — переключатель из радио: работает и без сценария */
label.shop-toggle__btn { position: relative; display: block; text-align: center; }
.shop-toggle__btn input { position: absolute; opacity: 0; pointer-events: none; }
.shop-toggle__btn:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 1px; }

/* Строка раздела: флажок, имя, число; у раздела с подразделами справа стрелка */
.shop-filter__row { position: relative; }
.shop-filter__row[hidden] { display: none; }
.shop-filter__row .shop-filter__item { padding-right: 30px; padding-left: calc(8px + var(--depth, 0) * 14px); }
.shop-filter__fold {
	position: absolute; top: 50%; right: 2px; transform: translateY(-50%); display: grid; place-items: center; width: 26px; height: 26px;
	border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted); cursor: pointer; transition: color .12s ease, background-color .12s ease;
}
.shop-filter__fold:hover { color: var(--ink); background: var(--surface-3); }
.shop-filter__fold svg { width: 14px; height: 14px; transition: transform .15s ease; }
.shop-filter__row.is-open > .shop-filter__fold svg { transform: rotate(180deg); }
.shop-filter__list--scroll { max-height: 300px; overflow-y: auto; margin-right: -6px; padding-right: 4px; overscroll-behavior: contain; }

/* ---------- Шторка фильтров: планшет и телефон ---------- */
@media (max-width: 1100px) {
	.shop-fbtn { display: inline-flex; }
	body.bruleur-has-shop-filters .shop-filters {
		position: fixed; z-index: 41; top: 0; right: 0; bottom: 0; left: auto; grid-column: auto; width: min(360px, 92vw); max-height: none; margin: 0;
		padding: 18px 18px 0; gap: 22px; background: var(--surface); border-radius: var(--radius-lg) 0 0 var(--radius-lg);
		box-shadow: 0 18px 50px rgba(15, 17, 22, .16), 0 0 0 1px rgba(15, 17, 22, .06); overflow-y: auto;
		transform: translateX(104%); visibility: hidden; transition: transform .24s cubic-bezier(.4, 0, .2, 1), visibility .24s;
	}
	body.shop-filters-open.bruleur-has-shop-filters .shop-filters { transform: none; visibility: visible; }
	.shop-filters__close { display: grid; place-items: center; width: 32px; height: 32px; margin-left: 4px; border: 0; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink); cursor: pointer; }
	.shop-filters__close svg { width: 16px; height: 16px; }
	.shop-filters__foot { display: block; position: sticky; bottom: 0; margin: 0 -18px; padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); background: var(--surface); }
	.shop-filters__show { width: 100%; height: 44px; border: 0; border-radius: var(--radius-sm); background: var(--ink); color: var(--dark-ink); font: 600 14px/1 var(--font-sans); cursor: pointer; }
	.shop-filters-veil { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(252, 252, 252, .8); opacity: 0; visibility: hidden; transition: opacity .18s ease, visibility .18s; }
	body.shop-filters-open .shop-filters-veil { opacity: 1; visibility: visible; }
	body.shop-filters-open { overflow: hidden; }
	body.is-modal-open .shop-filters { transform: translateX(104%); }
	body.shop-filters-open.is-modal-open .shop-filters { transform: none; }
	.shop-filter__list--scroll { max-height: 240px; }
}

/* Телефон: шторка снизу над нижней панелью, как шторки меню; порядок и «Фильтры» — второй строкой шапки */
@media (max-width: 960px) {
	.shop__title { font-size: 20px; }
	.shop__count { margin-right: 0; }
	.shop__tools { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
	.shop-fbtn, .shop-sort select { height: 44px; }
	.shop-sort select { width: 100%; font-size: 16px; }
	body.bruleur-has-shop-filters .shop-filters {
		top: auto; left: 0; right: 0; bottom: var(--vvb, 0px); width: auto; max-height: 86vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
		padding: 18px 18px 0; transform: translateY(104%);
	}
	body.shop-filters-open.bruleur-has-shop-filters .shop-filters { transform: none; }
	body.is-modal-open .shop-filters { transform: translateY(104%); }
	body.shop-filters-open.is-modal-open .shop-filters { transform: none; }
	.shop-filters__foot { padding-bottom: calc(14px + var(--mbar, 56px) + env(safe-area-inset-bottom)); }
	.shop-filter__item { min-height: 40px; }
	.shop-filter__price-num input { font-size: 16px; }
	.shop-toggle__btn { padding: 11px 4px; font-size: 13px; }
	.shop-filter__fold { width: 36px; height: 36px; }
	/* Плитки подразделов на телефоне — лента в один ряд: двенадцать разделов бренда не вытесняют товары */
	.shop-subs { display: flex; gap: 10px; margin: 0 -14px 22px; padding: 0 14px; overflow-x: auto; scroll-snap-type: x proximity; scroll-padding: 0 14px; scrollbar-width: none; }
	.shop-subs::-webkit-scrollbar { display: none; }
	.shop-sub { flex: 0 0 96px; scroll-snap-align: start; }
	.shop-sub__name { font-size: 12px; }
	.brand-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.shop__empty { padding: 28px 0 48px; }
}
@media (prefers-reduced-motion: reduce) {
	body.bruleur-has-shop-filters .shop-filters, .shop-filters-veil { transition: none; }
}
