/*
 * Поиск по каталогу. Карточки — общие (.cm-card), сетка своя:
 * на главной .cm-grid после шестой карточки скрывает лишнее.
 */

.cm-shop,
.cm-shop * {
	box-sizing: border-box;
}

.cm-shop .cm-section {
	padding-top: 20px;
}

.cm-shop__head {
	margin-bottom: 18px;
}

.cm-shop__lead,
.cm-shop__also {
	max-width: 68ch;
	margin: 10px 0 0;
	color: var(--cm-text);
	font-size: 15px;
	line-height: 1.5;
}

.cm-shop__also a {
	color: var(--cm-black);
	font-weight: 700;
}

.cm-shop__title {
	margin: 0;
	max-width: 100%;
	color: var(--cm-black);
	font-size: clamp(26px, 4vw, 40px);
	font-weight: 800;
	letter-spacing: -0.02em;
	line-height: 1.2;
	overflow-wrap: anywhere;
}

.cm-shop__count {
	margin: 8px 0 0;
	color: var(--cm-text);
	font-size: 14px;
}

.cm-shop-side__check {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
}

.cm-shop__main {
	display: grid;
	grid-template-columns: 240px minmax(0, 1fr);
	/* Последний ряд забирает лишнюю высоту фильтра, когда карточек мало.
	   Иначе пустота появляется между «Показать» и товарами. */
	grid-template-rows: auto auto auto 1fr;
	column-gap: 32px;
	row-gap: 18px;
	align-items: start;
	container-type: inline-size;
	container-name: cmshop;
}

.cm-shop__main:has(.cm-shop__compares) {
	grid-template-rows: auto auto auto auto 1fr;
}

.cm-shop__main--full {
	grid-template-columns: minmax(0, 1fr);
}

.cm-shop__bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 18px;
	grid-column: 2;
	grid-row: 1;
}

.cm-shop__main--full .cm-shop__bar,
.cm-shop__main--full .cm-shop__grid,
.cm-shop__main--full .cm-shop__compares,
.cm-shop__main--full .cm-shop-empty,
.cm-shop__main--full .cm-pages,
.cm-shop__main--full .cm-shop__note {
	grid-column: 1;
}

.cm-shop__note {
	grid-column: 2;
	grid-row: 4;
	max-width: none;
	margin-top: 12px;
}

.cm-shop__note .cm-shop__lead,
.cm-shop__note .cm-shop__also {
	max-width: none;
}

.cm-shop-side__open {
	display: none;
}

.cm-shop-side__when-open {
	display: none;
}

.cm-shop-per {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px;
	min-width: 0;
	max-width: 100%;
	color: var(--cm-text);
	font-size: 14px;
}

.cm-shop-per__label {
	margin-right: 4px;
}

.cm-shop-per a,
.cm-shop-per .is-current {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 32px;
	height: 32px;
	padding: 0 8px;
	border-radius: 999px;
	color: var(--cm-title);
	font-weight: 700;
	text-decoration: none;
}

.cm-shop-per a:hover,
.cm-shop-per a:focus-visible {
	color: var(--cm-orange);
}

.cm-shop-per .is-current {
	background: var(--cm-orange);
	color: #fff;
}

.cm-shop-sort {
	position: relative;
	margin-left: auto;
}

.cm-shop-sort summary {
	padding: 8px 36px 8px 14px;
	border: 1px solid var(--cm-line);
	border-radius: 999px;
	background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 16px;
	color: var(--cm-title);
	font-size: 14px;
	font-weight: 700;
	list-style: none;
	cursor: pointer;
}

.cm-shop-sort summary::-webkit-details-marker {
	display: none;
}

.cm-shop-sort__menu {
	position: absolute;
	z-index: 5;
	top: calc(100% + 6px);
	right: 0;
	min-width: 230px;
	padding: 6px;
	border: 1px solid var(--cm-line);
	border-radius: 14px;
	background: #fff;
	box-shadow: var(--cm-shadow);
}

.cm-shop-sort__menu a {
	display: block;
	padding: 8px 12px;
	border-radius: 10px;
	color: var(--cm-title);
	font-size: 14px;
	text-decoration: none;
}

.cm-shop-sort__menu a:hover,
.cm-shop-sort__menu a:focus-visible,
.cm-shop-sort__menu a[aria-current="true"] {
	background: var(--cm-orange-soft);
	color: var(--cm-orange);
}

.cm-shop-sort__menu a[aria-current="true"] {
	font-weight: 700;
}

.cm-shop-side {
	grid-column: 1;
	grid-row: 1 / -1;
	padding: 18px 16px 8px;
	border: 1px solid var(--cm-line);
	border-radius: 16px;
	background: #fff;
}

.cm-shop-side__title {
	margin: 0 0 8px;
	color: var(--cm-black);
	font-size: 13px;
	font-weight: 800;
	letter-spacing: 0.08em;
	line-height: 1.3;
	text-transform: uppercase;
}

.cm-shop-side__title--next {
	margin-top: 22px;
}

.cm-shop-side__note {
	margin: 0 0 12px;
	color: var(--cm-text);
	font-size: 13px;
	line-height: 1.4;
}

.cm-shop-side__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.cm-shop-side__list a {
	display: block;
	padding: 8px 10px;
	border-radius: 10px;
	color: var(--cm-title);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
}

.cm-shop-side__list a:hover,
.cm-shop-side__list a:focus-visible,
.cm-shop-side__list a[aria-current="page"] {
	background: var(--cm-orange-soft);
	color: var(--cm-orange);
}

.cm-shop-side__list--filter {
	max-height: 220px;
	margin-bottom: 8px;
	overflow: auto;
}

.cm-shop-side__reset {
	margin-top: 8px;
}

.cm-shop-pop {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 12px;
	color: var(--cm-title);
	text-decoration: none;
}

.cm-shop-pop:hover .cm-shop-pop__title,
.cm-shop-pop:focus-visible .cm-shop-pop__title {
	color: var(--cm-orange);
}

.cm-shop-pop__media {
	display: flex;
	flex: 0 0 56px;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	overflow: hidden;
	border-radius: 10px;
	background: var(--cm-bg-soft);
}

.cm-shop-pop__media img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.cm-shop-pop__title {
	font-size: 13px;
	font-weight: 700;
	line-height: 1.35;
}

.cm-shop__compares {
	grid-column: 2;
	grid-row: 2;
}

.cm-shop__compares h2 {
	margin: 0 0 8px;
	color: var(--cm-black);
	font-size: 18px;
	font-weight: 800;
}

.cm-shop__compares ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.cm-shop__compares a {
	display: block;
	padding: 10px 0;
	border-bottom: 1px solid var(--cm-line);
	color: var(--cm-black);
	font-weight: 700;
}

.cm-shop__compares a:hover,
.cm-shop__compares a:focus-visible {
	color: var(--cm-orange);
}

.cm-shop__main:has(.cm-shop__compares) .cm-shop__grid,
.cm-shop__main:has(.cm-shop__compares) .cm-shop-empty {
	grid-row: 3;
}

.cm-shop__main:has(.cm-shop__compares) .cm-pages {
	grid-row: 4;
}

.cm-shop__main:has(.cm-shop__compares) .cm-shop__note {
	grid-row: 5;
}

.cm-shop__main:has(.cm-shop__compares) .cm-shop-side {
	grid-row: 1 / -1;
}

.cm-shop__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 16px;
	grid-column: 2;
	grid-row: 2;
	container-type: inline-size;
}

.cm-shop .cm-pages {
	grid-column: 2;
	grid-row: 3;
	margin-top: 6px;
}

.cm-shop .cm-card:not(.cm-card--device) .cm-card__media {
	aspect-ratio: 400 / 220;
	background: var(--cm-bg-soft);
}

.cm-shop .cm-card:not(.cm-card--device) .cm-card__media img {
	object-fit: cover;
	padding: 0;
}

.cm-shop .cm-card__title {
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
}

.cm-card__actions {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.cm-card__action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 1px solid var(--cm-line);
	border-radius: 50%;
	background: #fff;
	color: var(--cm-dark-grey);
	font-size: 18px;
	cursor: pointer;
}

.cm-card__action:hover,
.cm-card__action:focus-visible {
	border-color: var(--cm-orange);
	color: var(--cm-orange);
}

.cm-card__action.is-on {
	border-color: var(--cm-orange);
	background: var(--cm-orange);
	color: #fff;
}

.cm-card__action--wish.is-on .cm-icon {
	fill: currentColor;
}

.cm-shop-empty {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 12px;
	grid-column: 2;
	grid-row: 2;
	padding: 28px 24px;
	border: 1px solid var(--cm-line);
	border-radius: 16px;
	background: var(--cm-bg-soft);
}

.cm-shop-empty__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: #fff;
	color: var(--cm-orange);
	font-size: 26px;
}

.cm-shop-empty__title {
	margin: 0;
	color: var(--cm-black);
	font-size: 24px;
	font-weight: 800;
	line-height: 1.2;
}

.cm-shop-empty__text {
	max-width: 46ch;
	margin: 0;
	color: var(--cm-text);
	font-size: 15px;
	line-height: 1.5;
}

.cm-shop-empty__search {
	width: min(100%, 560px);
	margin-top: 6px;
	container-type: inline-size;
}

.cm-shop-empty__label {
	display: block;
	margin-bottom: 8px;
	color: var(--cm-title);
	font-size: 14px;
	font-weight: 700;
}

.cm-shop-empty .cm-search {
	width: 100%;
	background: #fff;
	border-color: var(--cm-line);
}

/* Узкая сетка: цена и «Подробнее» не помещаются в один ряд. */
@container (max-width: 560px) {
	.cm-card__foot {
		flex-wrap: wrap;
		align-items: flex-start;
	}

	.cm-price__now {
		font-size: 18px;
	}
}

@container (max-width: 460px) {
	.cm-search {
		height: auto;
		flex-wrap: wrap;
		padding-top: 4px;
		padding-bottom: 4px;
		border-radius: 16px;
	}

	.cm-search__input {
		flex: 1 1 auto;
		min-width: 0;
		min-height: 40px;
	}

	.cm-search__btn {
		order: 1;
	}

	.cm-search__cat {
		order: 2;
		flex: 1 1 100%;
		max-width: none;
		height: 36px;
		border-left: 0;
		border-top: 1px solid #dcdfe4;
	}
}

.cm-shop-plain {
	margin: 22px 0 0;
	padding: 0;
	list-style: none;
}

.cm-shop-plain a {
	display: inline-block;
	padding: 10px 0;
	color: var(--cm-black);
	font-weight: 700;
	text-decoration: none;
}

.cm-shop-plain a:hover,
.cm-shop-plain a:focus-visible {
	color: var(--cm-orange);
}

@media (min-width: 901px) {
	.cm-shop__main--empty .cm-shop__bar {
		display: none;
	}

	.cm-shop__main--empty .cm-shop-empty {
		grid-row: 1;
	}
}

@media (max-width: 1100px) {
	.cm-shop__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 900px) {
	.cm-shop__main,
	.cm-shop__main:has(.cm-shop__compares) {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: none;
	}

	.cm-shop__bar,
	.cm-shop-side,
	.cm-shop__grid,
	.cm-shop__compares,
	.cm-shop-empty,
	.cm-shop .cm-pages,
	.cm-shop__note {
		grid-column: 1;
		grid-row: auto;
	}

	.cm-shop-side {
		display: none;
	}

	.cm-shop-side__check:checked ~ .cm-shop__main .cm-shop-side {
		display: block;
	}

	.cm-shop-side__check:checked ~ .cm-shop__main .cm-shop-side__when-closed {
		display: none;
	}

	.cm-shop-side__check:checked ~ .cm-shop__main .cm-shop-side__when-open {
		display: inline;
	}

	.cm-shop-side__open {
		display: inline-flex;
		flex: 1 0 100%;
	}

	.cm-shop-per,
	.cm-shop-sort {
		min-width: 0;
		max-width: 100%;
	}

	.cm-shop-sort {
		margin-left: 0;
	}

	.cm-shop-sort__menu {
		right: auto;
		left: 0;
	}
}

@media (max-width: 600px) {
	.cm-shop__grid {
		gap: 12px;
	}

	.cm-shop-empty {
		padding: 22px 16px;
	}

	.cm-shop-empty .cm-search {
		height: auto;
		flex-wrap: wrap;
		padding-top: 4px;
		padding-bottom: 4px;
		border-radius: 16px;
	}

	.cm-shop-empty .cm-search__input {
		min-height: 40px;
	}

	.cm-shop-empty .cm-search__cat {
		flex: 1 1 100%;
		max-width: none;
		height: 36px;
		border-left: 0;
		border-top: 1px solid #dcdfe4;
	}
}

/* Ширина колонки, а не окна: узкий экран складывает сетку и внутри широкого окна. */
@container cmshop (max-width: 720px) {
	.cm-shop__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@container cmshop (max-width: 420px) {
	.cm-shop__grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Фильтр тарифов: кнопки и ползунки. */
.cm-tf__group {
	margin: 0 0 22px;
	padding: 0 0 18px;
	border-bottom: 1px solid #eee;
}

.cm-tf__group:last-of-type {
	margin-bottom: 18px;
	padding-bottom: 0;
	border-bottom: 0;
}

.cm-tf__title {
	margin: 0 0 12px;
	color: #333;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.04em;
	line-height: 1.35;
	text-transform: uppercase;
}

.cm-tf__options {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.cm-tf__chip {
	padding: 6px 14px;
	border: 1px solid #d0d0d0;
	border-radius: 20px;
	background: #fff;
	color: #333;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	cursor: pointer;
}

.cm-tf__chip:hover,
.cm-tf__chip:focus-visible {
	border-color: var(--cm-orange);
	color: var(--cm-orange);
}

.cm-tf__chip.is-on {
	border-color: var(--cm-orange);
	background: var(--cm-orange);
	color: #fff;
}

.cm-tf__scale {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	margin: 0 8px 10px;
	color: #222;
	font-size: 12px;
	font-weight: 700;
}

.cm-tf__scale i {
	color: #ccc;
	font-style: normal;
	font-weight: 400;
}

.cm-tf__scale .cm-byn {
	width: 0.85em;
	height: 0.95em;
	margin-left: 0.2em;
	vertical-align: -0.05em;
}

.cm-tf-range {
	position: relative;
	height: 22px;
	margin: 0 9px;
}

.cm-tf-range__rail,
.cm-tf-range__fill {
	position: absolute;
	top: 50%;
	height: 5px;
	border-radius: 3px;
	transform: translateY(-50%);
	pointer-events: none;
}

.cm-tf-range__rail {
	right: 0;
	left: 0;
	background: #e8e8e8;
}

.cm-tf-range__fill {
	left: 0;
	width: 100%;
	background: var(--cm-orange);
}

.cm-tf-range input[type="range"] {
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: 22px;
	margin: 0;
	background: none;
	pointer-events: none;
	appearance: none;
	-webkit-appearance: none;
}

.cm-tf-range input[type="range"]::-webkit-slider-runnable-track {
	height: 5px;
	background: transparent;
	border: 0;
}

.cm-tf-range input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 18px;
	height: 18px;
	margin-top: -7px;
	border: 2px solid var(--cm-orange);
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
	cursor: pointer;
	pointer-events: auto;
}

.cm-tf-range input[type="range"]::-moz-range-track {
	height: 5px;
	background: transparent;
	border: 0;
}

.cm-tf-range input[type="range"]::-moz-range-thumb {
	width: 18px;
	height: 18px;
	border: 2px solid var(--cm-orange);
	border-radius: 50%;
	background: #fff;
	cursor: pointer;
	pointer-events: auto;
}

.cm-tf__actions {
	display: flex;
	gap: 10px;
	align-items: center;
}

.cm-tf__apply {
	flex: 1;
	padding: 10px 16px;
	border: 0;
	border-radius: 4px;
	background: var(--cm-orange);
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
}

.cm-tf__apply:hover,
.cm-tf__apply:focus-visible {
	background: #e55a00;
}

.cm-tf__reset {
	color: #999;
	font-size: 12px;
	white-space: nowrap;
}

.cm-tf__reset:hover,
.cm-tf__reset:focus-visible {
	color: var(--cm-orange);
}
