/* Сравнение плитки — Ярстрой */

.ytc-app {
	--ytc-bg: #1c1c1c;
	--ytc-fg: #f5f3f1;
	--ytc-muted: #a9a39d;
	--ytc-accent: #e41d32;
	--ytc-accent-dark: #b81625;

	position: relative;
	min-height: 340px;
	background: var(--ytc-bg);
	color: var(--ytc-fg);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	box-sizing: border-box;
	border-radius: 4px;
	line-height: 1.4;
	font-family: 'Montserrat', Arial, Helvetica, sans-serif;
	transition: height .25s ease;
}

.ytc-app *,
.ytc-app *::before,
.ytc-app *::after {
	box-sizing: border-box;
}

.ytc-app button {
	font-family: inherit;
}

.ytc-app ul,
.ytc-app ol {
	margin: 0;
	padding: 0;
}

.ytc-btn {
	cursor: pointer;
	border: 2px solid var(--ytc-fg);
	background: rgba(28, 28, 28, .55);
	color: var(--ytc-fg);
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .03em;
	padding: 9px 14px;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	line-height: 1;
	border-radius: 2px;
}

.ytc-btn:hover {
	background: rgba(245, 243, 241, .18);
}

.ytc-btn-icon {
	padding: 8px;
}

.ytc-close-drawer {
	border: none;
	border-radius: 50%;
	background: var(--ytc-accent);
	color: #fff;
	width: 32px !important;
	height: 32px !important;
	min-width: 0 !important;
	min-height: 0 !important;
	max-width: 32px !important;
	max-height: 32px !important;
	padding: 0;
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
}

.ytc-close-drawer:hover {
	background: var(--ytc-accent-dark);
}

.ytc-toolbar .ytc-btn {
	/*
	 * Ширина не фиксированная, а минимальная: кнопки визуально
	 * одинаковые, но растягиваются под более длинный текст (например,
	 * «Основной цвет: <название>»), чтобы текст не переносился на
	 * вторую строку. Если суммарно кнопки не помещаются в одну строку,
	 * flex-wrap на .ytc-toolbar аккуратно переносит вторую кнопку
	 * целиком на новую строку, а не ломает текст внутри кнопки.
	 */
	min-width: 190px;
	width: auto;
	justify-content: center;
	white-space: nowrap;
}

.ytc-main {
	position: relative;
	flex: 1;
	min-height: 0;
}

.ytc-stage {
	position: absolute;
	inset: 0;
	background: #111;
}

.ytc-stage-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.ytc-scrim {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .55);
	opacity: 0;
	pointer-events: none;
	transition: opacity .2s ease;
	z-index: 1;
}

.ytc-app.is-open .ytc-scrim,
.ytc-app.is-bg-open .ytc-scrim {
	opacity: 1;
	pointer-events: auto;
}

.ytc-toolbar {
	position: absolute;
	top: 21px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 4;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
	max-width: calc(100% - 32px);
	padding: 8px;
	background: rgba(28, 28, 28, .5);
	border-radius: 4px;
	backdrop-filter: blur(3px);
	transition: opacity .2s ease;
}

.ytc-app.is-open .ytc-toolbar,
.ytc-app.is-bg-open .ytc-toolbar {
	opacity: 0;
	pointer-events: none;
}

.ytc-drawer {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 460px;
	max-width: 88vw;
	background: var(--ytc-bg);
	padding: 20px;
	overflow-y: auto;
	box-shadow: 2px 0 24px rgba(0, 0, 0, .4);
	z-index: 2;
	transition: transform .25s ease;
	display: flex;
	flex-direction: column;
}

.ytc-drawer-left {
	left: 0;
	border-right: 2px solid rgba(245, 243, 241, .2);
	transform: translateX(-105%);
}

.ytc-app.is-open .ytc-drawer-colors {
	transform: translateX(0);
}

.ytc-app.is-bg-open .ytc-drawer-bg {
	transform: translateX(0);
}

.ytc-drawer-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 8px;
}

.ytc-drawer-title {
	font-weight: 600;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: .05em;
}

.ytc-palette-block {
	border-top: 1px solid rgba(245, 243, 241, .16);
	padding-top: 10px;
	margin-top: 12px;
}

.ytc-palette-block:first-of-type {
	border-top: none;
	margin-top: 16px;
	padding-top: 0;
}

.ytc-palette-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 6px;
	gap: 8px;
}

.ytc-palette-name {
	font-weight: 600;
	font-size: 12px;
}

.ytc-tag {
	border: 1px solid var(--ytc-accent);
	color: var(--ytc-accent);
	font-size: 10px;
	padding: 1px 7px;
	border-radius: 20px;
	flex: none;
}

.ytc-colorgrid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 6px 8px;
}

.ytc-color-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	border: 1px solid rgba(245, 243, 241, .3);
	background: transparent;
	color: var(--ytc-fg);
	font-size: 11px;
	font-weight: 600;
	padding: 8px 4px;
	cursor: pointer;
	text-align: center;
	text-transform: uppercase;
	letter-spacing: .02em;
	line-height: 1.25;
	border-radius: 2px;
	transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.ytc-color-toggle:hover {
	border-color: var(--ytc-fg);
}

.ytc-color-toggle.is-selected {
	background: var(--ytc-accent);
	border-color: var(--ytc-accent);
	color: #fff;
}

.ytc-color-toggle.is-selected:hover {
	background: var(--ytc-accent-dark);
	border-color: var(--ytc-accent-dark);
}

.ytc-apply-btn {
	margin-top: 16px;
	width: 100%;
	justify-content: center;
	background: var(--ytc-accent);
	border-color: var(--ytc-accent);
	color: #fff;
}

.ytc-apply-btn:hover {
	background: var(--ytc-accent-dark);
	border-color: var(--ytc-accent-dark);
	color: var(--ytc-fg);
}

.ytc-bg-optionlist {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 4px;
}

.ytc-bg-option {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	border: 1px solid rgba(245, 243, 241, .16);
	background: transparent;
	color: var(--ytc-fg);
	font-size: 11px;
	padding: 7px 4px;
	cursor: pointer;
	text-align: center;
	border-radius: 2px;
	line-height: 1.25;
}

.ytc-bg-option:hover {
	background: rgba(245, 243, 241, .1);
}

.ytc-bg-option.is-current {
	background: rgba(228, 29, 50, .18);
	border-color: var(--ytc-accent);
	color: var(--ytc-accent);
}

.ytc-bg-option-name {
	text-transform: uppercase;
	letter-spacing: .02em;
	word-break: break-word;
}

.ytc-carousel-wrap {
	position: absolute;
	left: 0;
	right: 0;
	top: 100px;
	bottom: 60px;
	padding: 0 15px;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
}

.ytc-carousel {
	display: flex;
	align-items: stretch;
	justify-content: center;
	gap: 10px;
	width: 100%;
	flex: 1;
	min-height: 0;
}

.ytc-arrow {
	align-self: center;
	width: 56px;
	height: 56px;
	border: none;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 26px;
	flex: none;
	background: var(--ytc-accent);
	color: #fff;
	cursor: pointer;
	padding: 0;
	border-radius: 50%;
	outline: none;
	box-shadow: none;
}

.ytc-arrow:hover {
	background: var(--ytc-accent-dark);
}

.ytc-arrow[disabled] {
	background: rgba(245, 243, 241, .12);
	color: rgba(245, 243, 241, .35);
	opacity: 1;
	cursor: default;
	pointer-events: none;
}

.ytc-arrow.is-hidden {
	display: none;
}

.ytc-tiles {
	flex: 1 1 auto;
	min-width: 0;
	max-width: 1222px;
	height: 100%;
	overflow: hidden;
	touch-action: pan-y;
}

.ytc-tiles-track {
	display: flex;
	gap: 24px;
	height: 100%;
	transition: transform .4s ease;
	will-change: transform;
}

.ytc-tile {
	position: relative;
	flex: 1 1 0;
	height: 100%;
	padding: 0;
	cursor: default;
	overflow: hidden;
	border-radius: 4px;
	opacity: 1;
}

.ytc-tile[hidden] {
	display: none;
}

.ytc-tile img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

.ytc-tile-color {
	width: 100%;
	height: 100%;
	display: block;
}

.ytc-empty {
	color: var(--ytc-muted);
	font-size: 13px;
	text-align: center;
}

@media (max-width: 640px) {
	.ytc-app {
		min-height: 300px;
	}

	.ytc-toolbar {
		top: 12px;
		left: 12px;
		right: 12px;
		transform: none;
		flex-direction: column;
		align-items: stretch;
		justify-content: flex-start;
		gap: 8px;
		padding: 10px;
	}

	.ytc-toolbar .ytc-btn {
		width: 100%;
		min-width: 0;
		justify-content: center;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	/*
	 * На мобильных боковая выезжающая панель заменяется лайтбоксом
	 * по центру экрана — так удобнее пользоваться на маленьком экране.
	 * position: fixed (а не absolute) нужен, чтобы панель не обрезалась
	 * блоком .ytc-app, у которого overflow: hidden и небольшая высота.
	 */
	.ytc-drawer-left {
		position: fixed;
		left: 50%;
		right: auto;
		top: 50%;
		bottom: auto;
		width: 92vw;
		max-width: 92vw;
		max-height: 82vh;
		border-right: none;
		border-radius: 10px;
		box-shadow: 0 16px 48px rgba(0, 0, 0, .55);
		padding: 16px;
		opacity: 0;
		pointer-events: none;
		transform: translate(-50%, -50%) scale(.96);
		transition: opacity .22s ease, transform .22s ease;
		/* Выше, чем панель админки WP (99999) и sticky-шапка темы. */
		z-index: 999999;
	}

	.ytc-app.is-open .ytc-drawer-colors,
	.ytc-app.is-bg-open .ytc-drawer-bg {
		opacity: 1;
		pointer-events: auto;
		transform: translate(-50%, -50%) scale(1);
	}

	/*
	 * Затемнение фона тоже переводим на fixed, чтобы оно перекрывало
	 * весь экран (включая шапку сайта), а не только область .ytc-app.
	 */
	.ytc-scrim {
		position: fixed;
		inset: 0;
		z-index: 999998;
	}

	.ytc-colorgrid {
		grid-template-columns: repeat(2, 1fr);
		gap: 8px 10px;
	}

	.ytc-bg-optionlist {
		grid-template-columns: repeat(2, 1fr);
		gap: 8px;
	}

	.ytc-carousel-wrap {
		top: 130px;
		bottom: 24px;
		padding: 0 10px;
	}

	.ytc-carousel {
		gap: 6px;
	}

	.ytc-tiles-track {
		gap: 12px;
	}

	.ytc-arrow {
		width: 40px;
		height: 40px;
		font-size: 18px;
	}
}
