/*
 * Catalog: filter tiles, product cards, specs, variants, calculator.
 */

.k-empty {
	padding: var(--k-space-4);
	border-radius: var(--k-radius);
	background: var(--k-bg);
	text-align: center;
	color: var(--k-text-muted);
}

/* ---------- Product cards ---------- */

.k-product-card {
	display: flex;
	flex-direction: column;
	text-decoration: none;
	color: inherit;
	transition: transform 0.15s ease;
}

.k-product-card:hover { transform: translateY(-2px); }

.k-product-card img {
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
}

.k-product-card__body {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	padding: var(--k-space-2);
}

.k-product-card__title { font-size: var(--k-fs-md); line-height: 1.25; }

.k-product-card__price {
	font-size: var(--k-fs-sm);
	color: var(--k-brand);
}

/* ---------- Product page ---------- */

/* ---------- Gallery ---------- */

.k-gallery__stage {
	position: relative;
	border-radius: var(--k-radius);
	overflow: hidden;
	background: var(--k-bg);
}

.k-gallery__slide {
	display: none;
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
}

.k-gallery__slide.is-active { display: block; }

.k-gallery__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: var(--k-radius-round);
	background: rgba(255, 255, 255, 0.9);
	color: var(--k-dark);
	font-size: 1.8rem;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.k-gallery__arrow:hover { background: #fff; }
.k-gallery__arrow--prev { left: 0.75rem; }
.k-gallery__arrow--next { right: 0.75rem; }

.k-gallery__counter {
	position: absolute;
	right: 0.75rem;
	bottom: 0.75rem;
	padding: 0.3rem 0.7rem;
	border-radius: var(--k-radius-round);
	background: rgba(20, 16, 14, 0.65);
	color: #fff;
	font-size: var(--k-fs-xs);
}

.k-gallery__thumbs {
	display: grid;
	gap: 0.5rem;
	grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
	margin-top: 0.5rem;
}

.k-gallery__thumb {
	padding: 0;
	border: 2px solid transparent;
	border-radius: var(--k-radius-sm);
	background: none;
	overflow: hidden;
	cursor: pointer;
	line-height: 0;
}

.k-gallery__thumb img {
	width: 100%;
	aspect-ratio: 1;
	object-fit: cover;
}

.k-gallery__thumb.is-active { border-color: var(--k-brand); }

.k-product__lead { color: var(--k-text-muted); }

.k-product__price {
	font-size: var(--k-fs-xl);
	color: var(--k-brand);
}

.k-product__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-top: var(--k-space-3);
}

.k-product__block { margin-top: var(--k-space-5, 4rem); }

/* ---------- Variants ---------- */

.k-variants { margin-bottom: var(--k-space-3); }

.k-variants__label {
	display: block;
	margin-bottom: 0.5rem;
	font-size: var(--k-fs-sm);
	color: var(--k-text-soft);
}

.k-variants__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.k-variants__btn {
	padding: 0.55rem 1.05rem;
	border: 1px solid var(--k-border);
	border-radius: var(--k-radius-round);
	background: var(--k-bg);
	font: inherit;
	font-size: var(--k-fs-sm);
	cursor: pointer;
}

.k-variants__btn.is-active {
	background: var(--k-dark);
	border-color: var(--k-dark);
	color: var(--k-text-invert);
}

/* ---------- Calculator ---------- */

.k-calc {
	margin-block: var(--k-space-3);
	padding: var(--k-space-3);
	border-radius: var(--k-radius);
	background: var(--k-bg);
}

.k-calc__title {
	display: block;
	margin-bottom: var(--k-space-2);
	font-weight: 600;
}

.k-calc__row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
	margin-bottom: var(--k-space-2);
}

.k-calc__label {
	min-width: 7rem;
	font-size: var(--k-fs-sm);
	color: var(--k-text-soft);
}

.k-calc__fields {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
}

.k-calc__fields .k-field { margin: 0; }
.k-calc__fields input { min-width: 9rem; }

.k-calc__options {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.k-chip {
	padding: 0.5rem 1rem;
	border: 1px solid var(--k-border);
	border-radius: var(--k-radius-round);
	background: var(--k-bg-alt);
	font: inherit;
	font-size: var(--k-fs-sm);
	color: var(--k-text);
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.k-chip:hover { border-color: var(--k-brand); }

.k-chip.is-active {
	background: var(--k-dark);
	border-color: var(--k-dark);
	color: var(--k-text-invert);
}

.k-product__lead--empty {
	padding: 0.75rem 1rem;
	border: 1px dashed var(--k-border);
	border-radius: var(--k-radius-sm);
	color: var(--k-text-soft);
	font-size: var(--k-fs-sm);
}

.k-calc__result {
	margin: var(--k-space-2) 0 0;
	font-size: var(--k-fs-lg);
	color: var(--k-brand);
	min-height: 1.4em;
}

.k-calc__note {
	margin: 0.4rem 0 0;
	font-size: var(--k-fs-xs);
	color: var(--k-text-soft);
}

/* ---------- Specs ---------- */

/* Full-width rows put label and value at opposite edges; one-line tiles left
   most of the card empty. Two columns of pairs keep them together and still
   fill the width. */
.k-specs--rows {
	display: grid;
	gap: 0 var(--k-space-4);
	margin: 0;
	padding: var(--k-space-2) var(--k-space-3);
	border-radius: var(--k-radius);
	background: var(--k-bg);
}

@media (min-width: 760px) {
	.k-specs--rows { grid-template-columns: 1fr 1fr; }
}

.k-specs--rows .k-specs__row {
	display: grid;
	grid-template-columns: minmax(0, 8.5rem) minmax(0, 1fr);
	gap: 0.35rem 1rem;
	align-items: baseline;
	padding: 0.85rem 0;
	border-bottom: 1px solid var(--k-border);
}

/* The last row of each column, whichever it is, carries no rule. */
.k-specs--rows .k-specs__row:last-child,
.k-specs--rows .k-specs__row:nth-last-child(2):nth-child(odd) {
	border-bottom: 0;
}

.k-specs--rows dt {
	color: var(--k-text-soft);
	font-size: var(--k-fs-sm);
}

.k-specs--rows dd {
	margin: 0;
	font-size: var(--k-fs-sm);
	line-height: 1.35;
}

/* The name has to read as a heading, not as the first line of the copy. */
.k-product__name {
	margin: 0 0 0.75rem;
	font-family: var(--k-font-display);
	font-size: var(--k-fs-xl);
	font-weight: 600;
	line-height: 1.15;
	letter-spacing: -0.015em;
	color: var(--k-heading);
}

/* Two cards to a row on a phone: at 167px the desktop type does not fit, and
   «электроприводом» is longer than the card is wide. */
@media (max-width: 639px) {
	.k-product-card__body { padding: 0.7rem; }

	.k-product-card__title {
		font-size: var(--k-fs-sm);
		overflow-wrap: anywhere;
		hyphens: auto;
	}

	.k-product-card__price { font-size: var(--k-fs-xs); }
}
