/*
 * Shared product-collection presentation.
 *
 * The homepage card captured in docs/product-card-golden-baseline.md is the
 * preservation reference. The legacy selectors bridge existing Elementor and
 * BeTheme markup; new collections should use the subsensor-product-* classes.
 */
:root {
	--subsensor-product-collection-primary: #120fbf;
	--subsensor-product-collection-price: #120fbf;
	--subsensor-product-collection-ink: #0b1a48;
	--subsensor-product-collection-border: #e5e7eb;
	--subsensor-product-rating-empty: #b8c0cc;
	--subsensor-product-previous-price: #667085;
	--subsensor-product-card-height: 404px;
	--subsensor-product-card-media-height: 250px;
	--subsensor-product-card-details-height: 152px;
	--subsensor-product-card-title-height: 36px;
	--subsensor-product-card-title-size: 15px;
	--subsensor-product-card-title-line-height: 18px;
}

.subsensor-product-collection__header,
.subsensor-related-carousel__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 0 0 16px;
}

.subsensor-product-collection__title,
.subsensor-product-collection__header > :where(h2, h3, h4),
.subsensor-product-collection > :where(h2, h3, h4):first-child,
.subsensor-related-carousel__header > :where(h2, h3) {
	min-width: 0;
	flex: 1 1 auto;
	margin: 0 !important;
	color: var(--subsensor-product-collection-primary) !important;
	font-size: 24px !important;
	font-weight: 700 !important;
	line-height: 1.2 !important;
}

.subsensor-product-collection__controls,
.subsensor-related-carousel__controls {
	display: flex;
	flex: 0 0 auto;
	gap: 8px;
	margin: 0;
}

.subsensor-product-collection__control,
.subsensor-related-carousel__control {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: 36px !important;
	height: 36px !important;
	min-width: 36px !important;
	min-height: 36px !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 1px solid var(--subsensor-product-collection-border) !important;
	border-radius: 50% !important;
	background: #fff !important;
	box-shadow: none !important;
	color: #17203a !important;
	line-height: 1 !important;
}

.subsensor-product-collection__control:disabled,
.subsensor-related-carousel__control:disabled {
	opacity: .35;
	cursor: default;
}

:where(.subsensor-product-collection, .custom-swipe-grid, .subsensor-product-page__related) ul.products > li.product,
body.subsensor-catalog-results ul.products > li.product,
li.subsensor-product-card {
	position: relative !important;
	display: flex !important;
	box-sizing: border-box !important;
	height: var(--subsensor-product-card-height) !important;
	min-height: var(--subsensor-product-card-height) !important;
	max-height: var(--subsensor-product-card-height) !important;
	min-width: 0;
	flex-direction: column !important;
	overflow: visible;
	border: 1px solid var(--subsensor-product-collection-border) !important;
	border-radius: 8px !important;
	background: #fff !important;
	box-shadow: none !important;
	text-align: center;
}

/* Archive markup is supplied by BeTheme, but its visible card must use the
 * same 250px + 152px composition as every owned collection. Keep all visual
 * dimensions here so the compatibility adapter does not become a second
 * styling venue. */
body.subsensor-catalog-results ul.products > li.mfn-product-li-item {
	padding: 0 !important;
}

body.subsensor-catalog-results li.mfn-product-li-item > .mfn-li-product-row-image {
	width: 100% !important;
	margin: 0 !important;
}

body.subsensor-catalog-results li.mfn-product-li-item > .mfn-li-product-row-title {
	box-sizing: border-box;
	width: calc(100% - 20px) !important;
	height: var(--subsensor-product-card-title-height) !important;
	min-height: var(--subsensor-product-card-title-height) !important;
	max-height: var(--subsensor-product-card-title-height) !important;
	margin: 15px 10px 0 !important;
}

body.subsensor-catalog-results li.mfn-product-li-item > .mfn-after-shop-loop-item-title {
	box-sizing: border-box;
	width: calc(100% - 20px) !important;
	height: 62px !important;
	min-height: 62px !important;
	max-height: 62px !important;
	margin: 0 10px !important;
	overflow: hidden;
}

body.subsensor-catalog-results li.mfn-product-li-item > .mfn-li-product-row-price {
	display: flex !important;
	box-sizing: border-box;
	width: calc(100% - 20px) !important;
	height: 24px !important;
	min-height: 24px !important;
	max-height: 24px !important;
	align-items: flex-start;
	justify-content: center;
	margin: 0 10px 15px !important;
	text-align: center !important;
}

/* Only the primary product link may grow. Secondary actions and wishlist
 * controls must never inherit the legacy all-anchor flex rule. */
:where(.subsensor-product-collection, .custom-swipe-grid) ul.products > li.product > :where(.woocommerce-LoopProduct-link, .woocommerce-loop-product__link),
:where(.subsensor-product-collection, .custom-swipe-grid) ul.products > li.product > .desc > :where(.woocommerce-LoopProduct-link, .woocommerce-loop-product__link),
.subsensor-product-page__related ul.products li.subsensor-product-card > :where(.woocommerce-LoopProduct-link, .woocommerce-loop-product__link) {
	display: flex !important;
	width: 100% !important;
	flex: 1 1 auto;
	flex-direction: column;
	margin: 0 !important;
	padding: 0 !important;
}

:where(.subsensor-product-collection, .custom-swipe-grid) ul.products > li.product > .mfn-li-product-row-image,
:where(.subsensor-product-collection, .custom-swipe-grid) ul.products > li.product .image_frame,
:where(.subsensor-product-collection, .custom-swipe-grid) ul.products > li.product .image_wrapper,
body.subsensor-catalog-results ul.products > li.product > .mfn-li-product-row-image,
body.subsensor-catalog-results ul.products > li.product .image_frame,
body.subsensor-catalog-results ul.products > li.product .image_wrapper,
.subsensor-product-card__media {
	position: relative;
	display: block;
	box-sizing: border-box;
	width: 100%;
	height: var(--subsensor-product-card-media-height);
	overflow: hidden;
}

:where(.subsensor-product-collection, .custom-swipe-grid) ul.products > li.product .image_wrapper img,
:where(.subsensor-product-collection, .custom-swipe-grid) ul.products > li.product img.attachment-woocommerce_thumbnail,
body.subsensor-catalog-results ul.products > li.product .image_wrapper img,
body.subsensor-catalog-results ul.products > li.product img.attachment-woocommerce_thumbnail,
.subsensor-product-card__media img {
	display: block !important;
	width: 100% !important;
	height: var(--subsensor-product-card-media-height) !important;
	margin: 0 auto !important;
	background: transparent !important;
	object-fit: contain !important;
	object-position: center !important;
	transform: none !important;
	transition: none !important;
}

:where(.subsensor-product-collection, .custom-swipe-grid) ul.products > li.product > .desc,
body.subsensor-catalog-results ul.products > li.product > .desc,
.subsensor-product-card__details {
	box-sizing: border-box;
	width: 100%;
	height: var(--subsensor-product-card-details-height);
	min-height: var(--subsensor-product-card-details-height);
	padding: 15px 10px !important;
	text-align: center;
}

.subsensor-product-card__title,
:where(.subsensor-product-collection, .custom-swipe-grid) ul.products > li.product > .desc > :where(.mfn-woo-product-title, .woocommerce-loop-product__title, h2, h3, h4),
body.subsensor-catalog-results ul.products > li.product :where(.mfn-woo-product-title, .woocommerce-loop-product__title, h2.woocommerce-loop-product__title, h4.mfn-woo-product-title, h5.title),
.subsensor-product-card__details > :where(.woocommerce-loop-product__title, h2, h3, h4) {
	display: -webkit-box !important;
	box-sizing: border-box;
	width: 100% !important;
	height: var(--subsensor-product-card-title-height) !important;
	min-height: var(--subsensor-product-card-title-height) !important;
	max-height: var(--subsensor-product-card-title-height) !important;
	margin: 0 !important;
	padding: 0 !important;
	overflow: hidden !important;
	-webkit-box-orient: vertical !important;
	-webkit-line-clamp: 2 !important;
	line-clamp: 2;
	max-block-size: calc(2 * var(--subsensor-product-card-title-line-height));
	color: var(--subsensor-product-collection-ink) !important;
	font-size: var(--subsensor-product-card-title-size) !important;
	font-weight: 500 !important;
	line-height: var(--subsensor-product-card-title-line-height) !important;
	text-align: center !important;
	text-overflow: ellipsis;
	white-space: normal !important;
}

.subsensor-product-card__title a,
:where(.subsensor-product-collection, .custom-swipe-grid) ul.products > li.product > .desc > :where(.mfn-woo-product-title, .woocommerce-loop-product__title, h2, h3, h4) a,
body.subsensor-catalog-results ul.products > li.product :where(.mfn-woo-product-title, .woocommerce-loop-product__title, h2.woocommerce-loop-product__title, h4.mfn-woo-product-title, h5.title) a,
.subsensor-product-card__details > :where(.woocommerce-loop-product__title, h2, h3, h4) a {
	margin: 0 !important;
	color: inherit !important;
	font: inherit !important;
}

:where(.subsensor-product-collection, .custom-swipe-grid, .subsensor-product-page__related) ul.products > li.product .subsensor-rating-wrapper,
body.subsensor-catalog-results ul.products > li.product .subsensor-rating-wrapper {
	display: flex !important;
	box-sizing: border-box;
	width: 100% !important;
	height: 16px;
	align-items: center !important;
	justify-content: center !important;
	gap: 8px !important;
	margin: 8px 0 !important;
	line-height: 1 !important;
	text-align: center !important;
}

:where(.subsensor-product-collection, .custom-swipe-grid, .subsensor-product-page__related) .subsensor-star-container,
body.subsensor-catalog-results .subsensor-star-container {
	position: relative !important;
	display: inline-flex !important;
	width: 80px !important;
	height: 16px !important;
	flex: 0 0 80px;
	align-items: center !important;
	margin: 0 !important;
	overflow: hidden;
}

:where(.subsensor-product-collection, .custom-swipe-grid, .subsensor-product-page__related) :where(.subsensor-stars-empty, .subsensor-stars-filled),
body.subsensor-catalog-results :where(.subsensor-stars-empty, .subsensor-stars-filled) {
	display: flex !important;
	width: 80px;
	height: 16px;
	align-items: center;
}

:where(.subsensor-product-collection, .custom-swipe-grid, .subsensor-product-page__related) .subsensor-star-container svg,
body.subsensor-catalog-results .subsensor-star-container svg {
	display: block;
	width: 16px;
	height: 16px;
	flex: 0 0 16px;
	overflow: visible;
}

:where(.subsensor-product-collection, .custom-swipe-grid, .subsensor-product-page__related) .subsensor-stars-empty svg,
body.subsensor-catalog-results .subsensor-stars-empty svg {
	fill: none !important;
	stroke: var(--subsensor-product-rating-empty) !important;
}

:where(.subsensor-product-collection, .custom-swipe-grid, .subsensor-product-page__related) .subsensor-stars-filled,
body.subsensor-catalog-results .subsensor-stars-filled {
	position: absolute !important;
	top: 0;
	left: 0;
	display: flex !important;
	width: var(--subsensor-rating-percent, 0%);
	overflow: hidden !important;
}

:where(.subsensor-product-collection, .custom-swipe-grid, .subsensor-product-page__related) .subsensor-stars-filled svg,
body.subsensor-catalog-results .subsensor-stars-filled svg {
	fill: var(--subsensor-product-collection-primary) !important;
	stroke: var(--subsensor-product-collection-primary) !important;
}

:where(.subsensor-product-collection, .custom-swipe-grid, .subsensor-product-page__related) .subsensor-star-container path,
body.subsensor-catalog-results .subsensor-star-container path {
	stroke-width: 1.8;
}

:where(.subsensor-product-collection, .custom-swipe-grid, .subsensor-product-page__related) .subsensor-review-count,
body.subsensor-catalog-results .subsensor-review-count {
	display: inline-block !important;
	margin: 0 !important;
	color: #000 !important;
	font-size: 13px !important;
	font-weight: 600 !important;
	line-height: 16px !important;
	vertical-align: middle !important;
	white-space: nowrap;
}

:where(.subsensor-product-collection, .custom-swipe-grid, .subsensor-product-page__related) ul.products > li.product .subsensor-product-availability--loop,
body.subsensor-catalog-results ul.products > li.product .subsensor-product-availability--loop {
	justify-content: center;
	margin: 8px 0 6px !important;
}

:where(.subsensor-product-collection, .custom-swipe-grid, .subsensor-product-page__related) ul.products > li.product .price,
body.subsensor-catalog-results ul.products > li.product .price {
	display: flex !important;
	width: 100%;
	align-items: center;
	justify-content: center;
	gap: 8px;
	flex-wrap: wrap;
	margin: 0 !important;
	color: var(--subsensor-product-collection-price) !important;
	font-size: 18px !important;
	font-weight: 700 !important;
	line-height: 24px !important;
	text-align: center !important;
}

:where(.subsensor-product-collection, .custom-swipe-grid, .subsensor-product-page__related) ul.products > li.product .price :where(del, ins),
body.subsensor-catalog-results ul.products > li.product .price :where(del, ins) {
	display: inline-block !important;
	margin: 0 !important;
}

:where(.subsensor-product-collection, .custom-swipe-grid, .subsensor-product-page__related) ul.products > li.product .price ins,
:where(.subsensor-product-collection, .custom-swipe-grid, .subsensor-product-page__related) ul.products > li.product .price > .woocommerce-Price-amount,
body.subsensor-catalog-results ul.products > li.product .price ins,
body.subsensor-catalog-results ul.products > li.product .price > .woocommerce-Price-amount {
	font-size: 18px !important;
	line-height: 24px !important;
}

:where(.subsensor-product-collection, .custom-swipe-grid, .subsensor-product-page__related) ul.products > li.product .price del,
:where(.subsensor-product-collection, .custom-swipe-grid, .subsensor-product-page__related) ul.products > li.product .price del :where(.woocommerce-Price-amount, bdi),
body.subsensor-catalog-results ul.products > li.product .price del,
body.subsensor-catalog-results ul.products > li.product .price del :where(.woocommerce-Price-amount, bdi) {
	color: var(--subsensor-product-previous-price) !important;
	font-size: 14px !important;
	font-weight: 400 !important;
	line-height: 20px !important;
	opacity: 1 !important;
}

/* Catalogue routes use a vertical list of horizontal product rows at the
 * shared 820/821 mobile boundary. This translator reuses the retained theme
 * rows; homepage and product-page collection carousels remain untouched. */
@media (max-width: 820px) {
	body.subsensor-catalog-results ul.products > li.product {
		--subsensor-mobile-card-media-width: clamp(108px, 38%, 180px);
		text-align: left;
	}

	body.subsensor-catalog-results li.mfn-product-li-item > .mfn-before-shop-loop-item {
		position: absolute;
		top: 0;
		left: 0;
		z-index: 7;
		box-sizing: border-box;
		width: 0 !important;
		height: 0 !important;
		overflow: hidden;
	}

	body.subsensor-catalog-results li.mfn-product-li-item .subsensor-wishlist-toggle--loop {
		position: static !important;
		width: 44px !important;
		height: 44px !important;
		margin: 0 !important;
	}

	body.subsensor-catalog-results li.mfn-product-li-item > .mfn-li-product-row-image {
		grid-column: 1;
		grid-row: 1 / span 4;
		width: 100% !important;
		height: auto !important;
		aspect-ratio: 1;
		align-self: start;
		margin: 0 !important;
	}

	body.subsensor-catalog-results ul.products > li.product > .mfn-li-product-row-image,
	body.subsensor-catalog-results ul.products > li.product .image_frame,
	body.subsensor-catalog-results ul.products > li.product .image_wrapper,
	body.subsensor-catalog-results ul.products > li.product .image_wrapper img,
	body.subsensor-catalog-results ul.products > li.product img.attachment-woocommerce_thumbnail,
	body.subsensor-catalog-results ul.products > li.product img.attachment-shop_catalog {
		width: 100% !important;
		height: 100% !important;
		min-height: 0 !important;
		max-height: none !important;
		aspect-ratio: 1;
		object-fit: contain !important;
	}

	body.subsensor-catalog-results li.mfn-product-li-item > .mfn-li-product-row-title {
		box-sizing: border-box;
		width: 100% !important;
		height: 38px !important;
		min-height: 38px !important;
		max-height: 38px !important;
		grid-column: 2;
		grid-row: 1;
		margin: 0 !important;
	}

	body.subsensor-catalog-results ul.products > li.product :where(.mfn-woo-product-title, .woocommerce-loop-product__title, h2.woocommerce-loop-product__title, h4.mfn-woo-product-title, h5.title) {
		height: 38px !important;
		min-height: 38px !important;
		max-height: 38px !important;
		font-size: 15px !important;
		line-height: 19px !important;
		text-align: left !important;
	}

	body.subsensor-catalog-results li.mfn-product-li-item > .mfn-after-shop-loop-item-title {
		display: grid;
		box-sizing: border-box;
		width: 100% !important;
		height: 46px !important;
		min-height: 46px !important;
		max-height: 46px !important;
		grid-column: 2;
		grid-row: 2;
		grid-template-rows: 16px 24px;
		row-gap: 6px;
		margin: 0 !important;
		overflow: visible;
		text-align: left;
	}

	body.subsensor-catalog-results ul.products > li.product .subsensor-rating-wrapper {
		justify-content: flex-start !important;
		margin: 0 !important;
		text-align: left !important;
	}

	body.subsensor-catalog-results ul.products > li.product .subsensor-product-availability--loop {
		justify-content: flex-start;
		margin: 0 !important;
	}

	body.subsensor-catalog-results li.mfn-product-li-item > .mfn-li-product-row-price {
		box-sizing: border-box;
		display: flex !important;
		width: 100% !important;
		height: auto !important;
		min-height: 24px !important;
		max-height: none !important;
		grid-column: 2;
		grid-row: 3;
		align-items: flex-start;
		justify-content: flex-start;
		margin: 0 !important;
		text-align: left !important;
	}

	body.subsensor-catalog-results ul.products > li.product > .price,
	body.subsensor-catalog-results ul.products > li.product .price {
		justify-content: flex-start;
		text-align: left !important;
	}

	body.subsensor-catalog-results li.mfn-product-li-item > .mfn-after-shop-loop-item {
		display: contents !important;
	}

	body.subsensor-catalog-results li.mfn-product-li-item > .mfn-after-shop-loop-item > :not(.subsensor-catalog-card-actions) {
		display: none !important;
	}
}

@media (max-width: 767px) {
	.subsensor-product-collection__track,
	.subsensor-product-collection ul.products,
	.custom-swipe-grid ul.products,
	.subsensor-product-page__related ul.products {
		display: flex !important;
		width: 100% !important;
		flex-wrap: nowrap !important;
		gap: 15px !important;
		margin-bottom: 0 !important;
		padding: 0 0 15px !important;
		overflow-x: auto !important;
		overflow-y: hidden !important;
		-webkit-overflow-scrolling: touch !important;
		-ms-overflow-style: none !important;
		overscroll-behavior-inline: contain;
		scrollbar-width: none !important;
	}

	.subsensor-product-collection__track::-webkit-scrollbar,
	.subsensor-product-collection ul.products::-webkit-scrollbar,
	.custom-swipe-grid ul.products::-webkit-scrollbar,
	.subsensor-product-page__related ul.products::-webkit-scrollbar {
		display: none !important;
	}

	.subsensor-product-collection__track > li.product,
	.subsensor-product-collection ul.products > li.product,
	.custom-swipe-grid ul.products > li.product,
	.subsensor-product-page__related ul.products > li.product {
		width: auto !important;
		max-width: 65% !important;
		flex: 0 0 65% !important;
		clear: none !important;
		margin-bottom: 0 !important;
		scroll-snap-align: start;
	}
}

/* PHP-rendered owned cards share the reference minimum; long sale prices may grow.
 * Editor-authored legacy cards retain their fixed preservation contract.
 * Do not reserve an extra empty row on every account card. */
ul.products > li.product.subsensor-related-product-card {
	height: auto !important;
	max-height: none !important;
}
.subsensor-related-product-card .subsensor-product-card__details {
	height: auto;
}
