/* The same card components sit inside different frames: WooCommerce list items
   in the shortcodes, Porto's inner cards inside its column gutters on archives. */
:where(body.bss-porto-listen, .bullauge-shopstart, .bss-discovery) {
	--bsc-ink: #102d3d;
	--bsc-muted: #52636a;
	--bsc-sale: #78462e;
	--bsc-paper: #fffcf6;
	--bsc-sand: #f5efe2;
	--bsc-line: #d9cdb6;
	--bsc-hover: #284a59;
	--bsc-focus: #8e642c;
	--bsc-inset: clamp(8px, 1.2vw, 15px);
	--bsc-radius: 8px;
	--bsc-image-radius: 4px;
	--bsc-button-radius: 5px;
	--bsc-title: var(--bss-user-card-desktop, 1.125rem);
	--bsc-section: var(--bss-user-section-desktop, clamp(1.5rem, 1.2rem + 1vw, 2rem));
	--bsc-price: var(--bss-user-price-desktop, 1.125rem);
	--bsc-control: var(--bss-user-control-desktop, 1rem);
	--bsc-meta: var(--bss-user-meta-desktop, .875rem);
}
body.bss-porto-listen,
:where(.theme-porto, .wp-theme-porto, .wp-parent-theme-porto) :where(.bullauge-shopstart, .bss-discovery) {
	--bsc-family: var(--porto-body-ff, system-ui), Arial, sans-serif;
}
@media (max-width: 650px) {
	:where(body.bss-porto-listen, .bullauge-shopstart, .bss-discovery) {
		--bsc-title: var(--bss-user-card-mobile, var(--bss-user-card-desktop, 1.125rem));
		--bsc-section: var(--bss-user-section-mobile, var(--bss-user-section-desktop, clamp(1.5rem, 1.2rem + 1vw, 2rem)));
		--bsc-price: var(--bss-user-price-mobile, var(--bss-user-price-desktop, 1.125rem));
		--bsc-control: var(--bss-user-control-mobile, var(--bss-user-control-desktop, 1rem));
		--bsc-meta: var(--bss-user-meta-mobile, var(--bss-user-meta-desktop, .875rem));
	}
}

/* Limit text and image rules to product listings. On-image toolbars, the
   product detail page and the customer's order summary have separate markup. */
:is(.bullauge-shopstart .bss-loop, .bss-discovery .bsd-grid,
	body.bss-porto-listen :is(ul.products, ol.products, .products-slider, .porto-products .products-container,
		.porto-products .swiper-wrapper, .wc-block-product-template, .wc-block-grid__products),
	.bullauge-shopstart .bss-area-bkka, body.bss-porto-listen .bkka-widget)
	:is(.product-col.product-outimage > .product-inner, li.product:not(.product-col, .product-category),
		.wc-block-product, .wc-block-grid__product, .bkka-product):not(:where(
	.widget_shopping_cart *, .widget_shopping_cart_content *, .woocommerce-mini-cart *,
	.wc-block-mini-cart__drawer *, .wishlist-popup *, .woocommerce-checkout-review-order *,
	.woocommerce-order-details *, .shop_table *, .wc-block-components-order-summary *
)) {
	& :is(.product-loop-title, .woocommerce-loop-product__title, .wp-block-post-title,
		.wp-block-post-title a, .wc-block-components-product-title, .wc-block-grid__product-title,
		.bkka-product-name) {
		color: var(--bsc-ink);
		font-family: var(--bsc-family, inherit);
		font-size: var(--bsc-title);
		font-weight: var(--bss-user-heading-weight, 650);
		line-height: 1.3;
		letter-spacing: -.015em;
		text-transform: none;
		text-decoration: none;
		white-space: normal;
		overflow-wrap: anywhere;
	}
	& :is(.product-loop-title, .woocommerce-loop-product__link, .wp-block-post-title a, .bkka-product-name):hover
		:is(.woocommerce-loop-product__title, .wc-block-grid__product-title) {
		color: var(--bsc-hover);
		text-decoration: underline;
		text-underline-offset: .15em;
	}
	& :is(.price, .wc-block-components-product-price, .wc-block-grid__product-price, .bkka-price) {
		color: var(--bsc-ink);
		font-family: var(--bsc-family, inherit);
		font-size: var(--bsc-price);
		font-weight: 650;
		font-variant-numeric: tabular-nums;
		line-height: 1.35;
		& :is(.amount, bdi, .woocommerce-Price-currencySymbol) { color: inherit; font: inherit; }
		& del { color: var(--bsc-muted); opacity: 1; font: inherit; font-weight: 400; }
		& ins { color: var(--bsc-sale); font: inherit; text-decoration: none; }
	}
	/* Classic Woo offsets the sale badge beyond both card edges. Keep it over
	   the picture within the frame; the compact ranking has its own badge. */
	&:is(li.product:not(.product-col, :where(.bss-style-list *)))
		> .woocommerce-loop-product__link > .onsale {
		inset-block-start: var(--bsc-inset);
		inset-inline: auto var(--bsc-inset);
		margin: 0;
	}
	& :is(.category-list, .category-list a, .loop-rank-badge, .bkka-badge, .wc-gzd-additional-info) {
		font-family: var(--bsc-family, inherit);
		font-size: var(--bsc-meta);
	}
	& .category-list { color: var(--bsc-muted); }
	& :is(.wc-block-grid__product-image img, .wc-block-components-product-image img, .bkka-image-link,
		.product-image > a > .inner,
		.woocommerce-loop-product__link > img, .woocommerce-loop-product__link > picture) {
		box-sizing: border-box;
		border: 1px solid var(--bsc-line);
		border-radius: var(--bsc-image-radius);
	}
	& :is(a, button, [role="button"]):focus-visible {
		outline: 2px solid var(--bsc-focus) !important;
		outline-offset: 2px;
	}
}

/* The subgrid separates rows with a bottom margin on each card. When the
   collection ends the panel, count the final row's margin only once. */
@supports (grid-template-rows: subgrid) {
	.bullauge-shopstart .bss-style-standard > .bss-box-body > .bss-loop:not(.bss-reel):last-child:has(
		> .woocommerce:last-child > ul.products:last-child > li.product
	) {
		--bss-product-row-space: clamp(10px, 1.4vw, 18px);
		margin-block-end: calc(0px - var(--bss-product-row-space));
	}
}

/* Shortcode cards already carry their inset on the list item. Porto's photo
   wrapper can have its own padding as well as an inner frame. Paint one frame. */
:is(.bullauge-shopstart .bss-loop, .bss-discovery .bsd-grid,
	body.bss-porto-listen :is(ul.products, ol.products, .products-slider, .porto-products .products-container, .porto-products .swiper-wrapper))
	.product-col.product-outimage > .product-inner > .product-image:has(> a > .inner):not(:where(
	.widget_shopping_cart *, .woocommerce-mini-cart *, .wc-block-mini-cart__drawer *,
	.wishlist-popup *, .shop_table *, .woocommerce-order-details *, .woocommerce-checkout-review-order *, .wc-block-components-order-summary *
)) {
	padding: 0;
	border: 0;
	background: transparent;
}

/* The photo owns the square on ordinary archive cards. Porto's rollover
   pictures retain their original positioning, opacity and transition. */
body.bss-porto-listen :is(ul.products, ol.products, .products-slider,
	.porto-products .products-container, .porto-products .swiper-wrapper):not(:where(
	.bullauge-shopstart *, .bss-discovery *, .widget_shopping_cart *, .widget_shopping_cart_content *,
	.woocommerce-mini-cart *, .wc-block-mini-cart__drawer *, .wishlist-popup *, .shop_table *,
	.woocommerce-order-details *, .woocommerce-checkout-review-order *, .wc-block-components-order-summary *,
	.wp-block-woocommerce-product-collection *, .wc-block-grid *
)) {
	& .product-col.product-outimage > .product-inner > .product-image > a > .inner,
	& li.product:not(.product-col, .product-category) > .woocommerce-loop-product__link > :is(img, picture) {
		display: block;
		box-sizing: border-box;
		width: 100%;
		height: auto;
		aspect-ratio: 1;
		overflow: hidden;
		background-color: #fff;
		object-fit: contain;
		object-position: center;
	}
	& .product-col.product-outimage > .product-inner > .product-image > a > .inner { padding: 0; }
	& .product-col.product-outimage .product-image > a > .inner > :is(img, picture),
	& .product-col.product-outimage .product-image > a > .inner > picture > img,
	& li.product:not(.product-col, .product-category) > .woocommerce-loop-product__link > picture > img {
		width: 100%;
		height: 100%;
		max-height: none;
		object-fit: contain;
		object-position: center;
	}
}
body.bss-porto-listen :is(.wc-block-product-template, .wc-block-grid__products):not(:where(
	.widget_shopping_cart *, .woocommerce-mini-cart *, .wc-block-mini-cart__drawer *, .wishlist-popup *,
	.shop_table *, .woocommerce-order-details *, .woocommerce-checkout-review-order *, .wc-block-components-order-summary *
)) :is(.wc-block-components-product-image, .wc-block-grid__product-image) img {
	object-fit: contain;
	background-color: #fff;
}

/* Labeled purchase controls keep the theme's markup, state icons and actions. */
:is(body.bss-porto-listen, .bullauge-shopstart, .bss-discovery) :is(
	:is(ul.products, ol.products, .products-slider, .porto-products .products-container, .porto-products .swiper-wrapper)
		:is(li, div).product-col.product-outimage > .product-inner > .product-content > .add-links-wrap > .add-links >
		:is(.button.viewcart-style-3, :is(.add_to_cart_button, .add_to_cart_read_more):not([class*="viewcart-style-"])),
	:is(ul.products, ol.products):not(.product_list_widget) > li.product:not(.product-col, .product-category) >
		:is(.button[class*="product_type_"], .add_to_cart_button, .add_to_cart_read_more),
	:is(.wc-block-product-template > .wc-block-product, .wc-block-grid__products > .wc-block-grid__product)
		:is(.wp-block-woocommerce-product-button, .wc-block-components-product-button, .wc-block-grid__product-add-to-cart)
		:is(.wp-block-button__link, .wp-element-button, .wc-block-components-product-button__button),
	.bkka-widget .bkka-products > .bkka-product .bkka-button,
	.bkka-widget .bkka-bundle > button.bkka-button
):not(:where(
	.widget_shopping_cart *, .widget_shopping_cart_content *,
	.wishlist-popup *, .woocommerce-mini-cart *, .wc-block-mini-cart__drawer *, .shop_table *,
	.woocommerce-checkout-review-order *, .woocommerce-order-details *, .wc-block-components-order-summary *,
	[hidden], .screen-reader-text, .is-icon-only, .icon-only, .wc-block-components-product-button__button--placeholder, :empty
)) {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	gap: .4em;
	min-width: 0;
	max-width: 100%;
	height: auto;
	min-height: 42px;
	padding: .55em .7em;
	border: 1px solid var(--bsc-ink);
	border-radius: var(--bsc-button-radius);
	background: var(--bsc-ink);
	color: #fff;
	font-family: var(--bsc-family, inherit);
	font-size: var(--bsc-control);
	font-weight: 600;
	line-height: 1.25;
	letter-spacing: normal;
	text-align: center;
	text-decoration: none;
	text-transform: none;
	white-space: normal;
	overflow-wrap: anywhere;

	/* Recommendation presets declare their label color important for their
	   own backgrounds. Keep the label legible on this shared navy button. */
	&.bkka-button { color: #fff !important; }
	&:is(:hover, :focus-visible):not(:disabled, [aria-disabled="true"], .disabled, .loading) {
		border-color: var(--bsc-hover);
		background: var(--bsc-hover);
		color: #fff;
	}
	&:focus-visible {
		/* Porto's reset declares outline: none !important on focused links. */
		outline: 2px solid var(--bsc-focus) !important;
		outline-offset: 2px;
	}
}

/* The Tagesprodukt provider writes button colors and sizes inline. Its
   lighthouse and lazy fragment are the two identifiable native containers. */
:is(.bullauge-shopstart .bss-area-podt, body.bss-porto-listen .podt-lighthouse-offer,
	body.bss-porto-listen .podt-ajax-placeholder) a[style*="background"]:not(:where(
	.widget_shopping_cart *, .woocommerce-mini-cart *, .wc-block-mini-cart__drawer *, .shop_table *,
	.woocommerce-checkout-review-order *, .woocommerce-order-details *, .wc-block-components-order-summary *,
	[hidden], .screen-reader-text, :empty
)) {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-height: 42px;
	max-width: 100%;
	padding: .55em .7em !important;
	border: 1px solid var(--bsc-ink) !important;
	border-radius: var(--bsc-button-radius) !important;
	background: var(--bsc-ink) !important;
	color: #fff !important;
	font-family: var(--bsc-family, inherit);
	font-size: var(--bsc-control) !important;
	font-weight: 600;
	line-height: 1.25;
	text-align: center;
	text-decoration: none;
	white-space: normal;
	overflow-wrap: anywhere;
}
:is(.bullauge-shopstart .bss-area-podt, body.bss-porto-listen .podt-lighthouse-offer,
	body.bss-porto-listen .podt-ajax-placeholder) a[style*="background"]:is(:hover, :focus-visible):not(
	.widget_shopping_cart *, .woocommerce-mini-cart *, .wc-block-mini-cart__drawer *, .shop_table *,
	.woocommerce-checkout-review-order *, .woocommerce-order-details *, .wc-block-components-order-summary *
) {
	background: var(--bsc-hover) !important;
}
