/**
 * Similar Products section (replaces WooCommerce related products).
 *
 * Rendered by inc/similar-products.php via
 * template-parts/woocommerce/similar-products.php on
 * woocommerce_after_single_product (priority 20), i.e. OUTSIDE `div.product`.
 * None of Konte's layout-vN or loop-card CSS reaches this markup, so everything
 * here is self-contained - including the wishlist heart, which Konte normally
 * positions with `div.product`-scoped rules.
 *
 * @package Konte Child
 */

.konte-similar-products {
	clear: both;
	width: 100%;
	box-sizing: border-box;
	padding: 48px 0 64px;
}

.konte-similar-products__title {
	margin: 0 0 24px;
	padding: 0 32px;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

/* ------------------------------------------------------------------ *
 * Grid: flush 5-up on desktop, degrading to a 2-up scroller on mobile.
 * ------------------------------------------------------------------ */

.konte-similar-products__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0;
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 768px) {
	.konte-similar-products__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (min-width: 1200px) {
	.konte-similar-products__grid {
		grid-template-columns: repeat(5, minmax(0, 1fr));
	}
}

.konte-similar-card {
	position: relative;
	margin: 0;
	padding: 0;
	list-style: none;
	min-width: 0;
}

/* ------------------------------------------------------------------ *
 * Media: images stack, only the active one is shown.
 * ------------------------------------------------------------------ */

.konte-similar-card__media {
	position: relative;
	overflow: hidden;
}

.konte-similar-card__link {
	display: block;
	position: relative;
	/* Reserve the image box so swapping colours never shifts the layout. */
	aspect-ratio: 3 / 4;
	background-color: #f4f2ee;
}

.konte-similar-card__img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0;
	transition: opacity 0.25s ease;
}

.konte-similar-card__img.is-active {
	opacity: 1;
}

/* Browsers without aspect-ratio: fall back to natural flow for the first image. */
@supports not (aspect-ratio: 3 / 4) {
	.konte-similar-card__link {
		height: 0;
		padding-bottom: 133.33%;
	}
}

/* ------------------------------------------------------------------ *
 * Hover / focus affordances: arrows + size overlay.
 * Revealed on :focus-within too, so keyboard users are not excluded.
 * ------------------------------------------------------------------ */

.konte-similar-card__nav,
.konte-similar-card__sizes {
	opacity: 0;
	transition: opacity 0.2s ease;
	pointer-events: none;
}

.konte-similar-card:hover .konte-similar-card__nav,
.konte-similar-card:hover .konte-similar-card__sizes,
.konte-similar-card:focus-within .konte-similar-card__nav,
.konte-similar-card:focus-within .konte-similar-card__sizes {
	opacity: 1;
	pointer-events: auto;
}

/* Touch devices have no hover: keep the controls permanently visible rather
   than unreachable. */
@media (hover: none) {
	.konte-similar-card__nav,
	.konte-similar-card__sizes {
		opacity: 1;
		pointer-events: auto;
	}
}

.konte-similar-card__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	background: none;
	color: #1d1d1d;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
}

.konte-similar-card__nav.is-hidden {
	display: none;
}

.konte-similar-card__nav--prev {
	left: 4px;
}

.konte-similar-card__nav--next {
	right: 4px;
}

.konte-similar-card__nav:focus-visible {
	outline: 2px solid #1d1d1d;
	outline-offset: 2px;
}

/* Full-width size selector overlay, pinned to the bottom of the image. */
.konte-similar-card__sizes {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 2;
	display: flex;
	justify-content: space-around;
	align-items: center;
	gap: 4px;
	padding: 14px 8px;
	background: rgba(255, 255, 255, 0.92);
}

.konte-similar-card__size {
	flex: 1 1 0;
	padding: 4px 2px;
	border: 0;
	background: none;
	color: #1d1d1d;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	cursor: pointer;
}

.konte-similar-card__size:hover:not(:disabled) {
	text-decoration: underline;
}

.konte-similar-card__size:disabled {
	color: #b6b6b6;
	cursor: default;
}

.konte-similar-card__size.is-busy {
	opacity: 0.5;
	cursor: wait;
}

.konte-similar-card__size:focus-visible {
	outline: 2px solid #1d1d1d;
	outline-offset: 1px;
}

/* ------------------------------------------------------------------ *
 * Name row: title left, wishlist heart right.
 * ------------------------------------------------------------------ */

.konte-similar-card__info {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 8px;
	margin-top: 12px;
}

.konte-similar-card__name {
	color: #1d1d1d;
	font-size: 13px;
	line-height: 1.4;
	text-decoration: none;
}

.konte-similar-card__name:hover {
	text-decoration: underline;
}

.konte-similar-card__wishlist {
	flex: 0 0 auto;
	line-height: 1;
}

/* Konte's `soo_wishlist_button` filter emits an icon-only heart SVG plus a
   screen-reader label. Strip the button chrome the parent theme would otherwise
   have applied inside `div.product`. */
.konte-similar-card__wishlist .add-to-wishlist-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: auto;
	min-width: 0;
	height: auto;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: #1d1d1d;
	line-height: 1;
}

.konte-similar-card__wishlist .add-to-wishlist-button svg {
	width: 16px;
	height: 16px;
}

.konte-similar-card__wishlist .adding-to-wishlist {
	display: none;
}

/* Keep the screen-reader label available; never `display: none`. */
.konte-similar-card__wishlist .button-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	white-space: nowrap;
}

.konte-similar-card__price {
	margin-top: 2px;
	color: #6b6b6b;
	font-size: 13px;
}

.konte-similar-card__price del {
	margin-right: 6px;
	opacity: 0.7;
}

/* ------------------------------------------------------------------ *
 * Colour swatches.
 * ------------------------------------------------------------------ */

.konte-similar-card__swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 10px 0 0;
	padding: 0;
	list-style: none;
}

.konte-similar-card__swatch-item {
	margin: 0;
	padding: 0;
	list-style: none;
}

.konte-similar-card__swatch {
	display: block;
	width: 12px;
	height: 12px;
	padding: 0;
	border: 1px solid rgba(0, 0, 0, 0.18);
	border-radius: 50%;
	background-color: #e6e6e6;
	cursor: pointer;
}

.konte-similar-card__swatch.is-active {
	box-shadow: 0 0 0 2px #fff, 0 0 0 3px #1d1d1d;
}

.konte-similar-card__swatch:focus-visible {
	outline: 2px solid #1d1d1d;
	outline-offset: 2px;
}

/* ------------------------------------------------------------------ *
 * Section separators (You May Also Like reference).
 * Full-width hairline; vertical spacing is owned by the adjacent
 * sections' padding (.konte-similar-products has 48px/64px), so the
 * separator itself carries no margin.
 * ------------------------------------------------------------------ */

.konte-section-separator {
	height: 0;
	margin: 0;
	border: 0;
	border-top: 1px solid rgba(0, 0, 0, 0.12);
	width: 100%;
}

/* You May Also Like reuses the Similar Products layout verbatim. */
.konte-you-may-also-like {
	/* placeholder hook for future YMAL-only tweaks */
}
