/* =============================================================
   PIARNYA — Каталог кейсов (hero + фильтры + сетка + футбар)
   Эталон: handoff/cases-desktop.html.
   Точные значения макета (px, радиусы, отступы) — не подгонять на глаз.
   Отличия от макета — только там, где он несовместим с живым сайтом:
     · горизонтальные поля 80px → штатный .container (у макета фикс 1440 без max-width)
     · .filters top:0 → top:var(--header-total-h) (у сайта фикс-шапка, макет — sticky)
     · цвета → фирменные токены (--brand-solid вместо --magenta и т.д.)
   Десктопные переопределения — в @media (min-width:1101px).
   Зависит от: variables.css, base.css
   ============================================================= */

/* ── HERO ────────────────────────────────────────────────────── */
.hero {
	background: var(--color-bg);
	border-bottom: 1px solid var(--case-line-2);
	padding-block: 12px 14px;
}

.hero > .container {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.crumbs {
	font-weight: 500;
	font-size: 12px;
	color: var(--case-text-4);
}

.crumbs i {
	color: #C6BFD1;
	font-style: normal;
}

/* макет: 900; в теме максимум 800 — синтетический жир не используем */
.hero h1 {
	margin: 0;
	font-weight: 800;
	font-size: 34px;
	line-height: 1;
	letter-spacing: -.04em;
}

.hero p {
	margin: 0;
	font-weight: 500;
	font-size: 14px;
	line-height: 1.35;
	color: var(--case-text-2);
}

.hero p b {
	font-weight: 700;
	color: var(--color-text);
}

/* строка цифр — только десктоп */
.stats {
	display: none;
}

/* ── ФИЛЬТРЫ ────────────────────────────────────────────────── */
.filters {
	position: sticky;
	/* у сайта фикс-шапка: при top:0 бар уехал бы под неё (в макете шапка sticky) */
	top: var(--header-total-h);
	z-index: 30;
	background: rgba(250, 250, 252, .96);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--case-line-2);
}

.filters__list {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	padding-block: 9px;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.filters__list::-webkit-scrollbar {
	display: none;
}

.pill {
	flex: 0 0 auto;
	min-height: 44px;
	display: flex;
	align-items: center;
	gap: 7px;
	padding: 0 15px;
	border-radius: 999px;
	white-space: nowrap;
	background: var(--color-bg);
	border: 1px solid var(--case-pill-line);
	color: #5E5670;
	font-weight: 700;
	font-size: 14px;
	text-decoration: none;
	cursor: pointer;
	transition: all .2s ease;
}

.pill em {
	font-style: normal;
	font-weight: 600;
	font-size: 11px;
	opacity: .55;
}

.pill.is-active {
	background: var(--brand-solid);
	border-color: var(--brand-solid);
	color: #fff;
}

/* на маджентовой заливке .55 не читается */
.pill.is-active em {
	opacity: .75;
}

.filters__count {
	padding-bottom: 8px;
	font-weight: 500;
	font-size: 12px;
	color: var(--case-text-4);
}

/* ── КАТАЛОГ ─────────────────────────────────────────────────── */
.catalog {
	padding-block: 12px 24px;
}

.catalog > .container {
	display: flex;
	flex-direction: column;
	gap: var(--case-gap);
}

.catalog__content {
	display: flex;
	flex-direction: column;
	gap: var(--case-gap);
}

/* Боковой фильтр подуслуг — только десктоп ≥1101px, см. медиа-блок ниже. */
.subfilter {
	display: none;
}

.grid {
	display: flex;
	flex-direction: column;
	gap: var(--case-gap);
}

.guarantee {
	font-weight: 500;
	font-size: 12px;
	line-height: 1.4;
	color: var(--case-text-3);
	text-align: center;
}

.footbar {
	display: flex;
	flex-direction: column-reverse;
	gap: var(--case-gap);
}

/* ── ПАГИНАЦИЯ (у нас реальные ссылки, в макете — кнопки) ────── */
.pager {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	flex-wrap: wrap;
}

.pager__num,
.pager__arrow {
	min-width: 44px;
	height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0 12px;
	border-radius: 999px;
	background: var(--color-bg);
	border: 1px solid var(--case-pill-line);
	color: #5E5670;
	font-weight: 700;
	font-size: 15px;
	text-decoration: none;
	cursor: pointer;
	transition: all .2s ease;
}

.pager__num:hover,
.pager__arrow:hover {
	border-color: var(--brand-solid);
	color: #5E5670;
}

.pager__num.current {
	background: var(--brand-solid);
	border-color: var(--brand-solid);
	color: #fff;
}

.pager__arrow {
	color: var(--hh-text);
	font-weight: 400;
	font-size: 18px;
	padding: 0;
}

.pager__arrow[aria-disabled] {
	opacity: .4;
	cursor: default;
	pointer-events: none;
}

.pager__gap {
	min-width: 20px;
	text-align: center;
	color: var(--case-text-4);
	font-weight: 700;
}

/* ── ПУСТОЕ СОСТОЯНИЕ ───────────────────────────────────────── */
.empty {
	background: var(--color-bg);
	border: 1px dashed #C6BFD1;
	border-radius: var(--case-card-radius);
	padding: 26px 18px 22px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	text-align: center;
}

.empty h2 {
	margin: 0;
	font-weight: 800;
	font-size: 21px;
	line-height: 1.2;
	letter-spacing: -.02em;
}

.empty p {
	margin: 0;
	font-weight: 500;
	font-size: 14px;
	line-height: 1.45;
	color: var(--case-text-3);
}

.btn-solid,
.btn-ghost {
	width: 100%;
	min-height: 52px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 999px;
	font-family: inherit;
	font-weight: 700;
	font-size: 15px;
	text-decoration: none;
	cursor: pointer;
	transition: all .2s ease;
}

.btn-solid {
	background: var(--brand-solid);
	border: 0;
	color: #fff;
	margin-top: 4px;
}

.btn-solid:hover {
	background: var(--brand-solid-hover);
	color: #fff;
}

.btn-ghost {
	background: var(--color-bg);
	border: 1px solid #DCD7E4;
	color: var(--color-text);
}

.btn-ghost:hover {
	border-color: var(--hh-text);
	color: var(--color-text);
}

/* ── МОБИЛЬНЫЕ ЭЛЕМЕНТЫ: скрыты по умолчанию, показываются только ≤767px
   (см. блок ниже) — не должны протекать на планшет 768–1100px. ────── */
.filters__mobile-row,
.filters__subpanel,
.filters__subpanel-head {
	display: none;
}

/* ══ MOBILE ≤767px — брейкпоинт синхронизирован с --header-total-h
   (variables.css), резиново 320–480px, десктоп/планшет не задеты ══ */
@media (max-width: 767px) {

	.hero > .container,
	.catalog > .container {
		padding-inline: 16px;
	}

	/* ── HERO: padding 16/16/18, шаг 10px между всеми строками ──────── */
	.hero {
		padding-block: 16px 18px;
	}

	.hero > .container {
		gap: 10px;
	}

	/* h1/p/цифры лежат внутри .hero__row/.hero__title (обёртки десктопной
	   раскладки, вне ≥1101px они без display) — иначе строки склеивались бы
	   вплотную: у h1/p margin:0, а gap контейнера до них не доходит. */
	.hero__row,
	.hero__title {
		display: flex;
		flex-direction: column;
		gap: 10px;
	}

	.crumbs {
		font-size: 11px;
		line-height: 1;
	}

	.hero p {
		line-height: 1.45;
	}

	/* ── ФИЛЬТРЫ ───────────────────────────────────────────────────── */
	/* В макете это два блока: полноширинный ряд категорий (скролл) и ниже
	   строка «кнопка фильтра + сброс + счётчик». В DOM всё лежит в одном
	   .filters__inner, порядок строк выставлен через order. */
	.filters__inner {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		padding: 0 16px 12px;
	}

	/* Ряд категорий во всю ширину экрана: выходит из 16px-полей контейнера
	   отрицательными margin и возвращает их себе паддингом — скролл-зона
	   упирается в края экрана, как в макете. */
	.filters__list {
		order: 1;
		width: calc(100% + 32px);
		margin-inline: -16px;
		padding: 12px 16px;
		border-bottom: 1px solid var(--case-line-2);
	}

	.pill {
		min-height: 38px;
		font-weight: 600;
		font-size: 13px;
		line-height: 1;
	}

	.pill.is-active {
		font-weight: 700;
	}

	.pill em {
		font-weight: 700;
		opacity: 1;
		color: var(--case-text-4);
	}

	.pill.is-active em {
		opacity: 1;
		color: rgba(255, 255, 255, .72);
	}

	/* Строка фактов: в макете 3 пункта («N объектов · с 2017 года ·
	   от 7 дней под ключ») в одну строку, разделителей нет — пункты
	   разведены gap:6px 14px. Точки <i class="dot"> (десктопный разделитель)
	   прячем: отдельным flex-элементом они оставались бы сиротами при
	   переносе. Пункты 4–5 (гарантия / своё производство) — десктопные,
	   в мобильном макете их нет и они уводили строку на второй ряд. */
	.stats {
		display: flex;
		flex-wrap: wrap;
		gap: 6px 14px;
		font-weight: 500;
		font-size: 12px;
		line-height: 1.2;
		color: var(--case-text-3);
	}

	.stats span:nth-of-type(n + 4) {
		display: none;
	}

	.stats b {
		font-weight: 800;
		color: var(--color-text);
	}

	/* первый пункт макета — цифра маджентой */
	.stats b.accent {
		color: var(--brand-solid);
	}

	.stats .dot {
		display: none;
	}

	/* ── МОБИЛЬНАЯ ПАНЕЛЬ ФИЛЬТРА ПОДУСЛУГ ───────────────────── */
	.filters__mobile-row {
		order: 2;
		display: flex;
		align-items: center;
		gap: 8px;
		margin-top: 12px;
		padding-bottom: 0;
	}

	.filters__mobile-toggle {
		min-height: 44px;
		display: inline-flex;
		align-items: center;
		gap: 8px;
		padding: 0 16px;
		border-radius: 999px;
		background: var(--color-bg);
		border: 1px solid var(--case-pill-line);
		color: var(--hh-text);
		font-weight: 700;
		font-size: 13px;
		line-height: 1;
		cursor: pointer;
	}

	/* Активна и когда панель раскрыта, и когда выбрана подуслуга (панель может
	   быть при этом закрыта) — как в макете: сплошная маджента, не бледная плашка. */
	.filters__mobile-toggle[aria-expanded="true"],
	.filters__mobile-toggle.is-active {
		background: var(--brand-solid);
		border-color: var(--brand-solid);
		color: #fff;
	}

	.filters__mobile-toggle i {
		font-style: normal;
		font-size: 9px;
	}

	.filters__mobile-reset {
		min-height: 44px;
		display: inline-flex;
		align-items: center;
		padding: 0 14px;
		border-radius: 999px;
		border: 1px solid var(--case-pill-line);
		background: var(--color-bg);
		color: var(--hh-text);
		font-weight: 600;
		font-size: 13px;
		line-height: 1;
		text-decoration: none;
	}

	/* Счётчик найденного — в макете в той же строке, что кнопка фильтра,
	   прижат вправо (в DOM он стоит раньше, потому и order). */
	.filters__count {
		order: 3;
		margin-top: 12px;
		margin-left: auto;
		padding-bottom: 0;
		font-weight: 600;
		font-size: 12px;
		line-height: 1;
	}

	.filters__subpanel[hidden] {
		display: none;
	}

	.filters__subpanel {
		order: 4;
		display: flex;
		flex-direction: column;
		gap: 2px;
		width: 100%;
		padding: 8px;
		margin-top: 10px;
		max-height: 264px;
		overflow-y: auto;
		background: var(--color-bg);
		border: 1px solid var(--case-line);
		border-radius: 18px;
	}

	.filters__subpanel-head {
		display: block;
		padding: 8px 10px 6px;
		font-weight: 700;
		font-size: 10px;
		line-height: 1;
		letter-spacing: .14em;
		text-transform: uppercase;
		color: var(--case-text-4);
	}

	.filters__subpanel-item {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 10px;
		min-height: 44px;
		padding: 10px 12px;
		border-radius: 12px;
		font-weight: 600;
		font-size: 14px;
		line-height: 1.3;
		color: var(--hh-text);
		text-decoration: none;
	}

	.filters__subpanel-item em {
		font-style: normal;
		font-weight: 700;
		font-size: 12px;
		color: var(--case-text-4);
	}

	.filters__subpanel-item.is-active {
		background: var(--case-active-bg);
		color: var(--brand-solid);
		font-weight: 800;
	}

	.filters__subpanel-item.is-active em {
		color: var(--brand-solid);
	}

	.filters__subpanel-item.is-empty {
		color: var(--case-empty-text);
	}

	.filters__subpanel-item.is-empty em {
		color: var(--case-empty-count);
	}

	/* ── КАТАЛОГ: серая подложка, поля 16px, шаг между карточками 16px
	   (десктопный --case-gap:28px на этой ширине даёт лишний воздух). ── */
	.catalog {
		padding-block: 16px;
		background: var(--hh-bg-light);
	}

	.catalog > .container,
	.catalog__content,
	.grid,
	.footbar {
		gap: 16px;
	}

	.pager {
		padding: 8px 0 4px;
	}

	.pager__num {
		font-size: 14px;
	}
}

/* ══ DESKTOP ≥1101px — утверждённый макет 1440 ═══════════════ */
@media (min-width: 1101px) {

	.hero {
		padding-block: 22px 24px;
	}

	.hero > .container {
		gap: 16px;
	}

	.hero__row {
		display: flex;
		align-items: baseline;
		justify-content: space-between;
		gap: 60px;
	}

	.hero__title {
		display: flex;
		align-items: baseline;
		gap: 20px;
		flex-wrap: wrap;
	}

	.hero h1 {
		font-size: 52px;
	}

	.hero p {
		font-size: 17px;
		line-height: 1.4;
		max-width: 520px;
	}

	/* на десктопе цифры живут в .stats */
	.hero p b {
		font-weight: 500;
		color: var(--case-text-2);
	}

	.stats {
		display: flex;
		align-items: center;
		gap: 22px;
		white-space: nowrap;
	}

	/* «N объектов» + следующая за ним точка — пункты мобильного макета 3a;
	   на десктопе они спорили бы со счётчиком «Все N» в пилюлях фильтров. */
	.stats span:first-child,
	.stats .dot:nth-of-type(1) {
		display: none;
	}

	.stats span {
		font-weight: 500;
		font-size: 14px;
		color: var(--case-text-3);
	}

	.stats b {
		font-weight: 800;
		color: var(--color-text);
	}

	/* для первого пункта («N объектов сдано»), когда клиент даст цифру */
	.stats b.accent {
		color: var(--brand-solid);
	}

	.stats .dot {
		width: 4px;
		height: 4px;
		border-radius: 50%;
		background: #D8D2E2;
	}

	.filters__inner {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 24px;
		padding-block: 16px;
	}

	.filters__list {
		overflow: visible;
		flex-wrap: wrap;
		padding-block: 0;
	}

	.pill {
		min-height: 0;
		padding: 12px 18px;
	}

	.pill:hover {
		border-color: var(--brand-solid);
	}

	.filters__count {
		padding-bottom: 0;
		font-size: 13px;
		white-space: nowrap;
	}

	.catalog {
		padding-block: 28px 32px;
	}

	/* Контент (карточки+футбар) слева, сайдбар подуслуг 300px справа —
	   ДОМ-порядок и ширины буквально из handoff-макета. */
	.catalog > .container {
		display: grid;
		grid-template-columns: 1fr var(--case-sidebar-w);
		gap: var(--case-gap);
		align-items: start;
	}

	.catalog__content {
		gap: 40px;
	}

	.grid {
		display: grid;
		grid-template-columns: repeat(2, 1fr);
		gap: var(--case-gap);
		/* align-items:start — карточки компакт-каталога высокие по своему контенту,
		   не растягиваются до самой высокой в ряду (дефолт stretch давал «рваный»
		   визуально ровный низ за счёт пустого места в короткой карточке). */
		align-items: start;
	}

	/* ── БОКОВОЙ ФИЛЬТР ПОДУСЛУГ ──────────────────────────────── */
	.subfilter {
		display: flex;
		flex-direction: column;
		background: var(--color-bg);
		border: 1px solid var(--case-line-2);
		border-radius: var(--case-sidebar-radius);
		position: sticky;
		top: calc(var(--header-total-h) + 12px);
	}

	.subfilter__head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 18px 20px 14px;
		border-bottom: 1px solid var(--case-line-2);
	}

	.subfilter__head span {
		font-weight: 800;
		font-size: 15px;
		letter-spacing: -.02em;
	}

	.subfilter__reset {
		font-weight: 700;
		font-size: 12px;
		color: var(--case-text-4);
		text-decoration: none;
	}

	.subfilter__reset:hover {
		color: var(--brand-solid);
	}

	.subfilter__list {
		display: flex;
		flex-direction: column;
		gap: 2px;
		padding: 10px;
		max-height: 420px;
		overflow-y: auto;
	}

	.subfilter__item {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 10px;
		min-height: 42px;
		padding: 9px 12px;
		border-radius: 12px;
		font-weight: 600;
		font-size: 14px;
		line-height: 1.3;
		color: var(--hh-text);
		text-decoration: none;
		cursor: pointer;
	}

	.subfilter__item em {
		font-style: normal;
		font-weight: 700;
		font-size: 12px;
		color: var(--case-text-4);
	}

	.subfilter__item.is-active {
		background: var(--case-active-bg);
		color: var(--brand-solid);
		font-weight: 800;
	}

	.subfilter__item.is-active em {
		color: var(--brand-solid);
	}

	.subfilter__item.is-empty {
		color: var(--case-empty-text);
		cursor: default;
	}

	.subfilter__item.is-empty em {
		color: var(--case-empty-count);
	}

	.subfilter__hint {
		padding: 14px 20px 18px;
		border-top: 1px solid var(--case-line-2);
		font-weight: 500;
		font-size: 12px;
		line-height: 1.4;
		color: var(--case-text-3);
	}

	.footbar {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		gap: 24px;
		border-top: 1px solid var(--case-line);
		padding-top: 24px;
	}

	.footbar .guarantee {
		font-size: 14px;
		text-align: left;
	}

	.pager {
		justify-content: flex-end;
	}

	.empty {
		padding: 70px;
		border-radius: 24px;
	}

	.empty h2 {
		font-size: 30px;
		letter-spacing: -.025em;
	}

	.empty p {
		font-size: 16px;
		line-height: 1.5;
		max-width: 480px;
	}

	.empty__actions {
		display: flex;
		gap: 12px;
		margin-top: 12px;
	}

	.btn-solid,
	.btn-ghost {
		width: auto;
		padding: 15px 26px;
		margin-top: 0;
	}
}
