/* ============================================================================
   Каталог — выезжающее двухпанельное меню (off-canvas).
   Порт поведения и стиля с stromsteel.ru; палитра та же (#0e7e50 / #0a5e3b).
   Разметка — inc/strom-catalog-drawer.php, логика — assets/js/catalog-drawer.js.
   Классы cat-drawer* в woodmart и плагинах не встречаются, конфликта нет.
   ============================================================================ */

body.cat-drawer-open {
	overflow: hidden;
}

.cat-drawer {
	position: fixed;
	inset: 0;
	z-index: 3000;
	visibility: hidden;
}

.cat-drawer[hidden] {
	display: none;
}

.cat-drawer.is-open {
	visibility: visible;
}

.cat-drawer__overlay {
	position: absolute;
	inset: 0;
	background: rgba(8, 26, 18, .5);
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
	opacity: 0;
	transition: opacity .32s ease;
}

.cat-drawer.is-open .cat-drawer__overlay {
	opacity: 1;
}

.cat-drawer__panel {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	width: min(700px, 94vw);
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: 0 18px 18px 0;
	box-shadow: 0 24px 70px rgba(0, 0, 0, .3);
	overflow: hidden;
	transform: translateX(-102%);
	transition: transform .36s cubic-bezier(.22, .61, .36, 1);
}

.cat-drawer.is-open .cat-drawer__panel {
	transform: none;
}

/* ----- Шапка панели ----- */

.cat-drawer__head {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 60px;
	padding: 0 20px;
	background: linear-gradient(135deg, #0e7e50 0%, #0a5e3b 100%);
	color: #fff;
}

.cat-drawer__title {
	font-size: 20px;
	font-weight: 700;
	letter-spacing: .02em;
}

.cat-drawer__close {
	width: 36px;
	height: 36px;
	/* тема задаёт кнопкам min-height, из-за него круг вытягивался */
	min-height: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .14);
	color: #fff;
	cursor: pointer;
	transition: background .2s ease, transform .2s ease;
}

.cat-drawer__close:hover {
	background: rgba(255, 255, 255, .26);
	transform: rotate(90deg);
}

.cat-drawer__close svg {
	width: 18px;
	height: 18px;
}

.cat-drawer__body {
	flex: 1 1 auto;
	display: flex;
	min-height: 0;
}

/* ----- Левая колонка: корневые категории ----- */

.cat-drawer__cats {
	flex: 0 0 300px;
	margin: 0;
	padding: 10px 0;
	list-style: none;
	overflow-y: auto;
	border-right: 1px solid #edf0ee;
	background: #fafcfb;
}

.cat-drawer__cat {
	margin: 0;
}

.cat-drawer__cat-link {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 12px 20px;
	color: #2c3330 !important;
	text-decoration: none !important;
	border-left: 3px solid transparent;
	transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.cat-drawer__cat-icon {
	flex: 0 0 auto;
	width: 52px;
	height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #0e7e50;
}

/* Иконки берём из миниатюры терма (у всех 6 категорий это серая линейная SVG). */
.cat-drawer__cat-icon img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

.cat-drawer__cat-name {
	flex: 1 1 auto;
	font-size: 15px;
	line-height: 1.25;
}

.cat-drawer__cat-arrow {
	flex: 0 0 auto;
	display: inline-flex;
	color: #b8c2bd;
	transition: transform .2s ease, color .2s ease;
}

.cat-drawer__cat-arrow svg {
	width: 16px;
	height: 16px;
}

.cat-drawer__cat:hover .cat-drawer__cat-link,
.cat-drawer__cat.is-active .cat-drawer__cat-link {
	background: #eef7f1;
	border-left-color: #0e7e50;
	color: #0e7e50 !important;
}

.cat-drawer__cat.is-active .cat-drawer__cat-arrow,
.cat-drawer__cat:hover .cat-drawer__cat-arrow {
	color: #0e7e50;
	transform: translateX(3px);
}

/* ----- Правая колонка: превью подкатегорий ----- */

.cat-drawer__preview {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 22px 26px;
	min-width: 0;
}

.cat-drawer__sub {
	display: none;
	animation: catDrawerFade .28s ease;
}

.cat-drawer__sub.is-active {
	display: block;
}

@keyframes catDrawerFade {
	from { opacity: 0; transform: translateY(4px); }
	to   { opacity: 1; transform: none; }
}

.cat-drawer__sub-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	padding-bottom: 14px;
	margin-bottom: 16px;
	border-bottom: 1px solid #edf0ee;
	color: #1c2320 !important;
	text-decoration: none !important;
	font-size: 19px;
	font-weight: 700;
}

.cat-drawer__sub-head:hover {
	color: #0e7e50 !important;
}

.cat-drawer__sub-all {
	flex: 0 0 auto;
	font-size: 22px;
	line-height: 1;
	font-weight: 400;
	color: #0e7e50;
	white-space: nowrap;
	transition: transform .16s ease;
}

.cat-drawer__sub-head:hover .cat-drawer__sub-all {
	transform: translateX(4px);
}

.cat-drawer__sub-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.cat-drawer__sub-list li {
	break-inside: avoid;
	margin-bottom: 2px;
}

.cat-drawer__sub-list a {
	display: block;
	padding: 7px 0;
	color: #45514c !important;
	text-decoration: none !important;
	font-size: 14.5px;
	line-height: 1.3;
	transition: color .16s ease, padding-left .16s ease;
}

.cat-drawer__sub-list a:hover {
	color: #0e7e50 !important;
	padding-left: 6px;
}

.cat-drawer__sub-empty {
	color: #8a938e;
	font-size: 14px;
}

/* Кнопка «Назад» — только на мобильных, показывает её .is-sub-open. */
.cat-drawer__back {
	display: none;
	align-items: center;
	gap: 6px;
	margin-bottom: 16px;
	padding: 8px 4px;
	border: 0;
	background: none;
	color: #0e7e50;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
}

.cat-drawer__back svg {
	width: 18px;
	height: 18px;
}

/* ----- До 900px: две колонки превращаются в два экрана ----- */

@media (max-width: 900px) {
	.cat-drawer__panel {
		width: 100%;
		border-radius: 0;
	}

	.cat-drawer__cats {
		flex: 1 1 auto;
		width: 100%;
		border-right: 0;
	}

	.cat-drawer__preview {
		position: absolute;
		top: 60px;
		left: 0;
		right: 0;
		bottom: 0;
		background: #fff;
		transform: translateX(100%);
		transition: transform .3s cubic-bezier(.22, .61, .36, 1);
	}

	.cat-drawer.is-sub-open .cat-drawer__preview {
		transform: none;
	}

	.cat-drawer.is-sub-open .cat-drawer__back {
		display: inline-flex;
	}

	/* На тач-устройствах hover «залипает» — подсветку оставляем только выбранной. */
	.cat-drawer__cat:hover .cat-drawer__cat-link {
		background: transparent;
		border-left-color: transparent;
		color: #2c3330 !important;
	}

	.cat-drawer__cat:hover .cat-drawer__cat-arrow {
		color: #b8c2bd;
		transform: none;
	}
}

@media (max-width: 600px) {
	.cat-drawer__head {
		height: 54px;
	}

	.cat-drawer__preview {
		top: 54px;
		padding: 18px 16px;
	}

	.cat-drawer__sub-head {
		font-size: 17px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cat-drawer__panel,
	.cat-drawer__overlay,
	.cat-drawer__preview,
	.cat-drawer__sub {
		transition: none;
		animation: none;
	}
}

/* ============================================================================
   Кнопка-триггер в шапке — существующий элемент Woodmart «Sticky navigation».
   Внешний вид не трогаем, только показываем кнопку на мобильных: колонка
   whb-column11 (в ней только эта кнопка) скрыта темой ниже lg, а в референсе
   пилюля каталога видна на всех разрешениях. Не нужна на мобиле — убрать @media.
   ============================================================================ */

@media (max-width: 1024px) {
	.whb-header .whb-column11.whb-visible-lg {
		display: flex !important;
	}

	/* Поиск в том же ряду сжимается, чтобы кнопка встала рядом. */
	.whb-header .whb-column_mobile5 {
		min-width: 0;
	}
}
