/*
 * Шапка callme.by: ПК (≥1025) и телефон/планшет (≤1024).
 * Мега-меню и боковое меню работают на CSS (hover, :focus-within, :target); JS только улучшает доступность.
 */

.cm-header,
.cm-drawer {
	font-family: var(--cm-font);
	font-size: 14px;
	line-height: 1.4;
	color: var(--cm-title);
}

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

:where(.cm-header, .cm-drawer) :is(ul, p) {
	margin: 0;
	padding: 0;
	list-style: none;
}

.cm-header a,
.cm-drawer a {
	color: inherit;
	text-decoration: none;
}

.cm-skip {
	position: absolute;
	left: -9999px;
	top: 8px;
}

.cm-skip:focus {
	left: 8px;
	z-index: 200;
	padding: 8px 14px;
	background: #fff;
	border-radius: 8px;
	box-shadow: var(--cm-shadow);
}

/* ---------- Каркас ---------- */

.cm-header {
	--cm-top-h: 72px;
	--cm-nav-h: 56px;
	position: sticky;
	top: calc(var(--cm-top-h) * -1); /* верхний ряд уезжает, меню остаётся */
	z-index: 50;
	background: #fff;
	box-shadow: 0 1px 0 var(--cm-line);
}

.cm-header__top {
	height: var(--cm-top-h);
}

.cm-header__row {
	display: flex;
	align-items: center;
	gap: 24px;
	height: 100%;
}

.cm-logo {
	flex: 0 0 auto;
	display: block;
}

.cm-logo img {
	display: block;
	width: 160px;
	height: auto;
}

.cm-header__search {
	position: relative;
	z-index: 6;
	flex: 1 1 auto;
	max-width: 680px;
	margin-inline: auto;
}

.cm-burger {
	display: none;
}

/* ---------- Поиск ---------- */

.cm-search {
	position: relative;
	display: flex;
	align-items: center;
	height: 46px;
	padding-left: 20px;
	background: var(--cm-bg-soft);
	border: 1.5px solid transparent;
	border-radius: 999px;
	transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.cm-search:focus-within {
	background: #fff;
	border-color: var(--cm-orange);
	box-shadow: 0 0 0 4px var(--cm-orange-soft);
}

.cm-search__input {
	flex: 1 1 auto;
	min-width: 0;
	height: 100%;
	padding: 0;
	border: 0;
	outline: 0;
	background: transparent;
	color: var(--cm-title);
	font: inherit;
	font-size: 15px;
	appearance: none;
}

.cm-search__input::placeholder {
	color: #8a8f98;
}

.cm-search__input::-webkit-search-cancel-button {
	appearance: none;
}

.cm-search__cat {
	flex: 0 0 auto;
	max-width: 190px;
	height: 26px;
	padding: 0 30px 0 16px;
	border: 0;
	border-left: 1px solid #dcdfe4;
	border-radius: 0;
	outline: 0;
	background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23777' 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 8px center / 16px;
	color: var(--cm-dark-grey);
	font: inherit;
	font-size: 13px;
	text-overflow: ellipsis;
	appearance: none;
	cursor: pointer;
}

.cm-search__btn {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	margin: 3px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--cm-orange);
	color: #fff;
	font-size: 20px;
	cursor: pointer;
	transition: background 0.2s;
}

.cm-search__btn:hover,
.cm-search__btn:focus-visible {
	background: var(--cm-dark-grey);
}

/* Подсказки под полем: появляются по мере набора. */
.cm-suggest {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	z-index: 8;
	max-height: min(70vh, 420px);
	overflow: auto;
	border: 1px solid var(--cm-line);
	border-radius: 16px;
	background: #fff;
	box-shadow: var(--cm-shadow);
}

.cm-suggest[hidden] {
	display: none;
}

.cm-suggest__item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 8px 12px;
	color: inherit;
	text-decoration: none;
}

.cm-suggest__item:hover,
.cm-suggest__item:focus-visible {
	background: var(--cm-bg-soft);
}

.cm-suggest__media {
	flex: 0 0 auto;
	width: 52px;
	height: 52px;
}

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

.cm-suggest__text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.cm-suggest__title {
	color: var(--cm-black);
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
}

.cm-suggest__note {
	color: var(--cm-orange);
	font-size: 12px;
	font-weight: 700;
}

.cm-suggest__price {
	color: var(--cm-text);
	font-size: 13px;
}

.cm-suggest__empty,
.cm-suggest__more {
	margin: 0;
	padding: 12px 14px;
	text-align: center;
}

.cm-suggest__empty {
	color: var(--cm-text);
	font-size: 14px;
}

.cm-suggest__more {
	display: block;
	border-top: 1px solid var(--cm-line);
	color: var(--cm-orange);
	font-size: 13px;
	font-weight: 700;
	text-decoration: none;
}

.cm-suggest__more:hover,
.cm-suggest__more:focus-visible {
	background: var(--cm-orange-soft);
}

/* ---------- Иконки справа и ссылка-реклама ---------- */

.cm-tools {
	display: flex;
	align-items: center;
	gap: 4px;
	flex: 0 0 auto;
}

.cm-promo {
	margin-right: 8px;
	padding: 8px 16px;
	border: 1.5px solid var(--cm-orange);
	border-radius: 999px;
	color: var(--cm-orange);
	font-size: 13px;
	font-weight: 700;
	line-height: 1.2;
	white-space: nowrap;
	transition: background 0.2s, color 0.2s;
}

.cm-header .cm-promo:hover,
.cm-header .cm-promo:focus-visible {
	background: var(--cm-orange);
	color: #fff;
}

.cm-tool {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	font-size: 24px;
	transition: background 0.2s, color 0.2s;
}

.cm-header .cm-tool:hover,
.cm-header .cm-tool:focus-visible {
	background: var(--cm-bg-soft);
	color: var(--cm-orange);
}

.cm-tool > .cm-tool__count {
	position: absolute;
	top: 3px;
	right: 1px;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	border-radius: 9px;
	background: var(--cm-orange);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
}

.cm-tool > .cm-tool__count[data-count="0"],
.cm-drawer__link > .cm-tool__count[data-count="0"] {
	display: none;
}

.cm-drawer__link > .cm-tool__count {
	margin-left: auto;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	border-radius: 11px;
	background: var(--cm-orange);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 22px;
	text-align: center;
}

/* ---------- Ряд меню ---------- */

.cm-header__nav {
	height: var(--cm-nav-h);
}

.cm-navrow {
	position: relative;
	display: flex;
	align-items: center;
	gap: 28px;
	height: 100%;
}

.cm-nav {
	flex: 1 1 auto;
	align-self: stretch;
}

.cm-nav__list {
	display: flex;
	align-items: stretch;
	gap: 4px;
	height: 100%;
}

.cm-nav__item {
	display: flex;
}

.cm-nav__link {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 0 14px;
	font-family: var(--cm-font-title);
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.01em;
	transition: color 0.2s;
}

.cm-nav__link .cm-icon {
	font-size: 14px;
	color: var(--cm-text);
}

.cm-header .cm-nav__item:hover > .cm-nav__link,
.cm-header .cm-nav__link:focus-visible {
	color: var(--cm-orange);
}

/* Кнопка и панель «Категории» */

.cm-cats {
	position: relative;
	flex: 0 0 250px;
	height: 44px;
}

.cm-cats__btn {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	height: 100%;
	padding: 0 16px;
	border: 0;
	border-radius: 10px;
	background: var(--cm-black);
	color: #fff;
	font-family: var(--cm-font-title);
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
	cursor: pointer;
}

.cm-cats__btn .cm-icon {
	font-size: 20px;
}

.cm-cats__btn .cm-icon--chevron {
	margin-left: auto;
	font-size: 16px;
	transition: transform 0.2s;
}

.cm-cats:hover .cm-cats__btn .cm-icon--chevron,
.cm-cats:focus-within .cm-cats__btn .cm-icon--chevron {
	transform: rotate(180deg);
}

.cm-cats__panel {
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 60;
	width: 100%;
	padding: 8px;
	border-radius: 0 0 14px 14px;
	background: #fff;
	box-shadow: var(--cm-shadow);
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	transition: opacity 0.15s, transform 0.15s, visibility 0s 0.15s;
}

.cm-cats:hover .cm-cats__panel,
.cm-cats:focus-within .cm-cats__panel {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition-delay: 0s;
}

.cm-cats__link {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	border-radius: 10px;
	font-family: var(--cm-font-title);
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
	transition: background 0.15s, color 0.15s;
}

.cm-cats__link img {
	flex: 0 0 auto;
	width: 24px;
	height: 24px;
}

.cm-cats__link .cm-icon {
	margin-left: auto;
	font-size: 14px;
	color: var(--cm-text);
	transform: rotate(-90deg);
}

.cm-header .cm-cats__item:hover > .cm-cats__link,
.cm-header .cm-cats__item:focus-within > .cm-cats__link {
	background: var(--cm-bg-soft);
	color: var(--cm-orange);
}

/* ---------- Мега-панели ---------- */

.cm-mega {
	position: absolute;
	z-index: 61;
	padding: 20px 24px 18px;
	background: #fff;
	box-shadow: var(--cm-shadow);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.15s, visibility 0s 0.15s;
}

.cm-mega--side {
	top: 0;
	left: 100%;
	width: min(900px, calc(100vw - 250px - 30px));
	min-height: 100%;
	border-radius: 0 14px 14px 0;
}

.cm-mega--wide {
	top: 100%;
	left: 15px;
	right: 15px;
	border-radius: 0 0 14px 14px;
}

.cm-cats__item:hover > .cm-mega,
.cm-cats__item:focus-within > .cm-mega,
.cm-nav__item:hover > .cm-mega,
.cm-nav__item:focus-within > .cm-mega {
	opacity: 1;
	visibility: visible;
	transition-delay: 0s;
}

.cm-mega__grid {
	display: grid;
	grid-template-columns: repeat(var(--cm-cols, 4), minmax(0, 1fr));
	gap: 8px 28px;
}

.cm-mega__block + .cm-mega__block {
	margin-top: 18px;
}

.cm-mega__title {
	display: block;
	margin-bottom: 8px;
	color: var(--cm-black);
	font-family: var(--cm-font-title);
	font-size: 13px;
	font-weight: 700;
	line-height: 1.3;
	text-transform: uppercase;
}

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

.cm-mega__list li + li {
	margin-top: 6px;
}

.cm-mega__list a {
	color: var(--cm-dark-grey);
	font-size: 13px;
	transition: color 0.15s;
}

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

.cm-label {
	display: inline-block;
	padding: 1px 6px;
	border-radius: 4px;
	background: var(--cm-dark-grey);
	color: #fff;
	font-family: var(--cm-font);
	font-size: 10px;
	font-weight: 700;
	line-height: 1.5;
	text-transform: uppercase;
	vertical-align: 1px;
}

.cm-label--red {
	background: #e53935;
}

.cm-label--orange {
	background: var(--cm-orange);
}

.cm-label--primary {
	background: #16a34a;
}

/* «Предложение для вас» */

.cm-offer__item {
	display: flex;
	align-items: flex-start;
	gap: 10px;
}

.cm-offer__item + .cm-offer__item {
	margin-top: 12px;
}

.cm-offer__img {
	flex: 0 0 56px;
	width: 56px;
	height: 56px;
	overflow: hidden;
	border-radius: 8px;
	background: var(--cm-bg-soft);
}

.cm-offer__img img {
	display: block;
	width: 56px;
	height: 56px;
	object-fit: cover;
}

.cm-offer__title {
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	color: var(--cm-dark-grey);
	font-size: 13px;
	line-height: 1.35;
}

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

/* Ряд логотипов и плашка внизу панели */

.cm-mega__brands {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px 16px;
	margin-top: 14px;
	padding-top: 14px;
	border-top: 1px solid var(--cm-line);
}

.cm-mega__brands img {
	display: block;
	width: auto;
	height: 28px;
	filter: grayscale(1);
	opacity: 0.65;
	transition: opacity 0.2s, filter 0.2s;
}

.cm-mega__brands a:hover img,
.cm-mega__brands a:focus-visible img {
	filter: none;
	opacity: 1;
}

.cm-mega__promo {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	margin-top: 16px;
	padding: 12px 18px;
	border-radius: 12px;
	background: #fff4ec;
}

.cm-mega__promo strong {
	display: block;
	font-size: 14px;
}

.cm-mega__promo span {
	color: var(--cm-text);
	font-size: 13px;
}

.cm-header .cm-btn:hover,
.cm-header .cm-btn:focus-visible {
	background: var(--cm-dark-grey);
	color: #fff;
}

/* ---------- Боковое меню (телефон) ---------- */

.cm-drawer,
.cm-overlay {
	visibility: hidden;
}

.cm-drawer {
	position: fixed;
	top: 0;
	bottom: 0;
	left: 0;
	z-index: 100;
	display: flex;
	flex-direction: column;
	width: min(84vw, 360px);
	overflow: hidden;
	overscroll-behavior: contain;
	background: #fff;
	box-shadow: var(--cm-shadow);
	transform: translateX(-102%);
	transition: transform 0.25s ease, visibility 0s 0.25s;
}

.cm-overlay {
	position: fixed;
	inset: 0;
	z-index: 90;
	background: rgb(0 0 0 / 45%);
	opacity: 0;
	transition: opacity 0.25s, visibility 0s 0.25s;
}

.cm-menu-open .cm-drawer,
.cm-drawer:target {
	visibility: visible;
	transform: none;
	transition-delay: 0s;
}

.cm-menu-open .cm-drawer + .cm-overlay,
.cm-drawer:target + .cm-overlay {
	visibility: visible;
	opacity: 1;
	transition-delay: 0s;
}

html.cm-menu-open {
	overflow: hidden;
}

.cm-drawer__head {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 8px;
	min-width: 0;
	padding: 14px 12px 8px 16px;
}

.cm-drawer__head .cm-search {
	flex: 1 1 0;
	box-sizing: border-box;
	min-width: 0;
	max-width: 100%;
	height: 44px;
}

.cm-drawer__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 40px;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	font-size: 24px;
	color: var(--cm-dark-grey);
}

.cm-drawer__nav {
	flex: 1 1 auto;
	min-height: 0;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.cm-drawer__list {
	padding: 8px 12px 32px;
}

.cm-drawer__link {
	display: flex;
	align-items: center;
	padding: 13px 14px;
	border-radius: 12px;
	color: var(--cm-black);
	font-family: var(--cm-font);
	font-size: 17px;
	font-weight: 500;
	line-height: 1.3;
	transition: background 0.15s, color 0.15s;
}

.cm-drawer .cm-drawer__link:hover,
.cm-drawer .cm-drawer__link:focus-visible,
.cm-drawer .cm-drawer__link:active {
	background: var(--cm-bg-soft);
	color: var(--cm-orange);
}

/* ---------- Телефон и планшет ---------- */

@media (min-width: 1025px) {
	.cm-drawer,
	.cm-overlay {
		display: none;
	}
}

@media (max-width: 1024px) {
	.cm-header {
		--cm-top-h: 56px;
		top: 0;
	}

	.cm-header__row {
		display: grid;
		grid-template-columns: 1fr auto 1fr;
		gap: 8px;
	}

	.cm-header__nav,
	.cm-header__search,
	.cm-promo,
	.cm-tool--wishlist {
		display: none;
	}

	.cm-burger {
		display: inline-flex;
		align-items: center;
		gap: 8px;
		justify-self: start;
		padding: 8px 10px 8px 0;
		border-radius: 10px;
		font-size: 24px;
	}

	.cm-burger__text {
		font-size: 15px;
		font-weight: 600;
	}

	.cm-logo img {
		width: 132px;
	}

	.cm-tools {
		justify-self: end;
	}
}
