/* Bottles for Earth — unified product card, "quiet tile" style.
   A soft photo tile with rounded corners, then a left-aligned light title and the price straight underneath.
   No card box, border or shadow. On hover (desktop) the photo eases in 10% and a small brand-green button
   slides up over the bottom of the tile; on touch screens, which cannot hover, the button is always there.
   Same design on every screen size; only the column count changes (3 desktop, 4 with the filter hidden,
   2 on narrow desktop windows and on phones).
   Applies to shop, product category/tag and search pages (body.bfe-cards), including products appended by
   infinite scroll. Targets the theme's loop markup:
   li.product > .mk-product-warp > a.woocommerce-LoopProduct-link (.mk-product-thumbnail-warp, h2, .price) + a.button.
   The selector repeats .bfe-cards to out-rank the theme's "li.product { width: calc(...) !important }" rules.
   The button sits over the tile, so its position is worked out from the tile height (width x 4/3, the shape
   of the product photos) with container units. */

body.bfe-cards.bfe-cards ul.products {
	display: grid !important;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 28px 16px;
	margin: 0 !important;
	padding: 0 !important;
	list-style: none;
	align-items: stretch;
}

body.bfe-cards.bfe-cards ul.products::before,
body.bfe-cards.bfe-cards ul.products::after {
	display: none !important;
}

body.bfe-cards.bfe-cards ul.products li.product {
	float: none !important;
	width: auto !important;
	max-width: none !important;
	margin: 0 !important;
	padding: 0 !important;
	display: flex;
	flex-direction: column;
	position: relative;
	text-align: left;
	background: none;
	border-radius: 0;
	box-shadow: none;
	overflow: visible;
}

/* The theme wraps link + button in .mk-product-warp; it fills the card and is the size reference for the button. */
body.bfe-cards.bfe-cards ul.products li.product .mk-product-warp {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	position: relative;
	width: 100%;
	margin: 0;
	padding: 0;
	container-type: inline-size;
}

/* Photo + title + price share one link. */
body.bfe-cards.bfe-cards ul.products li.product a.woocommerce-LoopProduct-link {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	padding: 0;
	color: inherit;
	text-decoration: none;
}

body.bfe-cards.bfe-cards ul.products li.product .mk-product-thumbnail-warp {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 3 / 4;
	margin: 0 0 12px;
	overflow: hidden;
	border-radius: 8px;
	background: #f2f2f2;
}

body.bfe-cards.bfe-cards ul.products li.product .mk-product-thumbnail-warp img {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0 !important;
	object-fit: cover;
	transition: transform 1s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease; /* opacity: the theme's second-photo fade on hover */
	will-change: transform;
}

body.bfe-cards.bfe-cards ul.products li.product .woocommerce-loop-product__title {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	margin: 0 !important;
	padding: 0 !important;
	font-family: "Montserrat", "Inter", sans-serif;
	font-size: 14.4px !important;
	line-height: 1.5;
	font-weight: 300;
	letter-spacing: 0;
	text-align: left;
	text-transform: none;
	color: #1d1d1b;
}

/* Older plugin builds printed a split title; show only the plain one. */
body.bfe-cards.bfe-cards ul.products li.product .bfe-title__split {
	display: none;
}

body.bfe-cards.bfe-cards ul.products li.product .price {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0 8px;
	margin: auto 0 0 !important;
	padding: 2px 0 0;
	font-family: "Montserrat", "Inter", sans-serif;
	font-size: 14.4px;
	font-weight: 400;
	line-height: 1.5;
	text-align: left;
	color: #1d1d1b !important;
}

/* The theme sizes the amount and the currency symbol itself (18px / 500); follow the price line instead. */
body.bfe-cards.bfe-cards ul.products li.product .price .amount,
body.bfe-cards.bfe-cards ul.products li.product .price bdi,
body.bfe-cards.bfe-cards ul.products li.product .price .woocommerce-Price-currencySymbol {
	margin: 0 !important;
	font-family: inherit !important;
	font-size: inherit !important;
	font-weight: inherit !important;
	line-height: inherit;
	color: inherit;
}

body.bfe-cards.bfe-cards ul.products li.product .price del {
	font-size: 0.9em;
	font-weight: 300;
	opacity: 0.55;
}

body.bfe-cards.bfe-cards ul.products li.product .price ins {
	background: none;
	text-decoration: none;
	font-weight: 400;
}

/* ---- The button. Fallback (no container units): a plain outlined button under the price. ---- */
body.bfe-cards.bfe-cards ul.products li.product .button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	align-self: flex-start;
	flex: 0 0 auto;
	width: auto;
	height: 28px;
	margin: 10px 0 0 !important;
	padding: 0 10px !important;
	border: 1px solid #17824f;
	border-radius: 4px;
	background: #17824f;
	color: #fff;
	font-family: "Inter", "Montserrat", sans-serif;
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 0;
	line-height: 1;
	text-decoration: none;
	text-transform: none;
	white-space: nowrap;
	transition: background 0.35s cubic-bezier(0.22, 1, 0.36, 1), color 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1), transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Keep the theme's cart icon, sized to match the label. */
body.bfe-cards.bfe-cards ul.products li.product .button svg.mk-svg-icon {
	width: 13px !important;
	height: 13px !important;
	flex: 0 0 13px;
	margin: 0 !important;
	fill: currentColor;
}

body.bfe-cards.bfe-cards ul.products li.product .button .button-text {
	display: inline;
	margin: 0;
	padding: 0;
	font-family: inherit;
	font-size: inherit;
	font-weight: inherit;
	letter-spacing: inherit;
	color: inherit;
}

body.bfe-cards.bfe-cards ul.products li.product .button:hover,
body.bfe-cards.bfe-cards ul.products li.product .button:focus-visible {
	border-color: #0f6b3f;
	background: #0f6b3f;
	color: #fff;
}

body.bfe-cards.bfe-cards ul.products li.product .button:focus-visible {
	outline: 2px solid #2bb573;
	outline-offset: 2px;
}

body.bfe-cards.bfe-cards ul.products li.product .button.loading {
	opacity: 0.75;
	pointer-events: none;
}

/* WooCommerce adds its own spinner/check glyphs; the theme icon and label stay. */
body.bfe-cards.bfe-cards ul.products li.product .button.loading::after,
body.bfe-cards.bfe-cards ul.products li.product .button.added::after {
	display: none !important;
}

/* Confirmation state (set by the cards script for a couple of seconds after an add). */
body.bfe-cards.bfe-cards ul.products li.product .button.is-added {
	border-color: #0f6b3f;
	background: #0f6b3f;
	color: #fff;
}

/* "View cart" link WooCommerce inserts after a successful AJAX add. */
body.bfe-cards.bfe-cards ul.products li.product a.added_to_cart {
	align-self: flex-start;
	margin: 6px 0 0;
	padding: 0;
	font-size: 12px;
	font-weight: 400;
	text-decoration: underline;
	color: #1d1d1b;
}

/* ---- With container units: the button floats over the bottom-left of the tile. ---- */
@supports (width: 1cqw) {
	body.bfe-cards.bfe-cards ul.products li.product .button {
		position: absolute;
		left: 8px;
		top: calc(100cqw * 4 / 3 - 36px);
		margin: 0 !important;
		z-index: 2;
	}

	body.bfe-cards.bfe-cards ul.products li.product a.added_to_cart {
		position: absolute;
		right: 8px;
		top: calc(100cqw * 4 / 3 - 36px);
		margin: 0;
		padding: 0 10px;
		height: 28px;
		line-height: 26px;
		border: 1px solid #17824f;
		border-radius: 4px;
		background: #fff;
		color: #0f6b3f;
		text-decoration: none;
		z-index: 2;
	}

	@media (hover: hover) {
		body.bfe-cards.bfe-cards ul.products li.product .button:not(.loading):not(.is-added) {
			opacity: 0;
			transform: translateY(8px);
			pointer-events: none;
		}

		body.bfe-cards.bfe-cards ul.products li.product:hover .button,
		body.bfe-cards.bfe-cards ul.products li.product:focus-within .button {
			opacity: 1 !important;
			transform: translateY(0) !important;
			pointer-events: auto !important;
		}

		body.bfe-cards.bfe-cards ul.products li.product:hover .mk-product-thumbnail-warp img,
		body.bfe-cards.bfe-cards ul.products li.product:focus-within .mk-product-thumbnail-warp img {
			transform: scale(1.1);
		}
	}
}

/* Sale badge: a small horizontal pill in the top-left corner of the photo. */
body.bfe-cards.bfe-cards ul.products li.product .onsale {
	position: absolute;
	top: 8px;
	left: 8px;
	right: auto;
	z-index: 3;
	width: auto;
	min-width: 0;
	min-height: 0;
	height: 22px;
	margin: 0;
	padding: 0 8px;
	border: 0;
	box-shadow: none;
	border-radius: 4px;
	background: #17824f;
	color: #fff;
	font-size: 11px;
	font-weight: 500;
	line-height: 22px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	white-space: nowrap;
	transform: none;
}

@media (min-width: 992px) and (max-width: 1100px) {
	body.bfe-cards.bfe-cards ul.products {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* Filter column folded away (Hide filters): use the freed width for a fourth column. */
@media (min-width: 1200px) {
	body.bfe-cards.bfe-cards .bfe-shop.is-filters-hidden ul.products {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

@media (min-width: 992px) and (max-width: 1100px) {
	body.bfe-cards.bfe-cards .bfe-shop.is-filters-hidden ul.products {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 767px) {
	body.bfe-cards.bfe-cards ul.products {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 24px 12px;
	}
}

/* Related products on a product page: 4 across on desktop, a swipeable row on phones. */
@media (min-width: 992px) {
	body.single-product.bfe-cards.bfe-cards ul.products {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

@media (max-width: 767px) {
	body.single-product.bfe-cards.bfe-cards ul.products {
		grid-template-columns: none;
		grid-auto-flow: column;
		grid-auto-columns: 78%;
		gap: 16px;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		padding-bottom: 8px !important;
		-webkit-overflow-scrolling: touch;
	}

	body.single-product.bfe-cards.bfe-cards ul.products li.product {
		scroll-snap-align: start;
	}
}

@media (prefers-reduced-motion: reduce) {
	body.bfe-cards.bfe-cards ul.products li.product .mk-product-thumbnail-warp img,
	body.bfe-cards.bfe-cards ul.products li.product .button {
		transition: none;
	}

	body.bfe-cards.bfe-cards ul.products li.product:hover .mk-product-thumbnail-warp img,
	body.bfe-cards.bfe-cards ul.products li.product:focus-within .mk-product-thumbnail-warp img {
		transform: none;
	}
}

/* "Related products" heading: same family and ink as the cards under it (the theme uses Inter / #333). */
body.single-product.bfe-cards.bfe-cards section.related > h2,
body.single-product.bfe-cards.bfe-cards section.upsells > h2 {
	font-family: "Montserrat", "Inter", sans-serif;
	font-weight: 600;
	color: #1d1d1b;
}
