/* MuscleCare Shop View — grid / list switch, product cards, grid and list views. */

/* Switch ------------------------------------------------------------------- */

/* Needs JavaScript; hidden until the <head> script marks that it runs. */
.mcsv-switch {
	display: none;
}

html.mcsv-js .mcsv-switch {
	display: flex;
	float: right;
	align-items: center;
	gap: 6px;
	height: 54px; /* As tall as the result count and sorting menu beside it. */
	margin: 0 0 30px 16px;
}

/* Two classes beat Gymnax's generic [type="button"] styles (yellow, uppercase,
   overflow hidden), which would also cut off the tooltip. */
.mcsv-switch .mcsv-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	overflow: visible;
	background: var(--white-color, #fff);
	border: 1px solid #d6d6d6;
	border-radius: 0;
	color: var(--dark-color, #0a0c00);
	font-size: 0;
	line-height: 1;
	letter-spacing: 0;
	text-transform: none;
	cursor: pointer;
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.mcsv-switch .mcsv-btn svg {
	display: block;
	pointer-events: none;
}

/* Gymnax paints every focused button dark; keep the off button looking off. */
.mcsv-switch .mcsv-btn:focus {
	background: var(--white-color, #fff);
	color: var(--dark-color, #0a0c00);
}

.mcsv-switch .mcsv-btn:hover {
	background: var(--grey-color, #f6f5f3);
	border-color: var(--dark-color, #0a0c00);
	color: var(--dark-color, #0a0c00);
}

.mcsv-switch .mcsv-btn[aria-pressed="true"],
.mcsv-switch .mcsv-btn[aria-pressed="true"]:hover,
.mcsv-switch .mcsv-btn[aria-pressed="true"]:focus {
	background: var(--dark-color, #0a0c00);
	border-color: var(--dark-color, #0a0c00);
	color: var(--primary-color, #e3ff04);
}

.mcsv-switch .mcsv-btn:focus-visible {
	outline: 2px solid var(--dark-color, #0a0c00);
	outline-offset: 2px;
}

/* Tooltip: on mouse hover and keyboard focus. */
.mcsv-switch .mcsv-btn::after,
.mcsv-switch .mcsv-btn::before {
	position: absolute;
	left: 50%;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
	z-index: 30;
}

.mcsv-switch .mcsv-btn::after {
	content: attr(data-mcsv-tip);
	bottom: calc(100% + 9px);
	padding: 6px 10px;
	background: var(--dark-color, #0a0c00);
	border-radius: 0;
	color: var(--white-color, #fff);
	font-family: var(--body-fonts, sans-serif);
	font-size: 13px;
	font-weight: 400;
	line-height: 1.2;
	white-space: nowrap;
	transform: translate(-50%, 4px);
}

.mcsv-switch .mcsv-btn::before {
	content: "";
	bottom: calc(100% + 3px);
	width: 0;
	height: 0;
	border: 6px solid transparent;
	border-bottom: 0;
	border-top-color: var(--dark-color, #0a0c00);
	transform: translate(-50%, 4px);
}

.mcsv-switch .mcsv-btn:hover::after,
.mcsv-switch .mcsv-btn:hover::before,
.mcsv-switch .mcsv-btn:focus-visible::after,
.mcsv-switch .mcsv-btn:focus-visible::before {
	opacity: 1;
	visibility: visible;
	transform: translate(-50%, 0);
}

@media (max-width: 767px) {
	/* The theme stacks the result count and sorting menu full width here. */
	html.mcsv-js .mcsv-switch {
		float: none;
		clear: both;
		justify-content: center;
		height: auto;
		margin: 0 0 15px;
	}
}

/* Product grid --------------------------------------------------------------
   Cards come from templates/content-product.php. Everything is scoped to
   body.mcsv-cards (shop, category, tag, product search, product pages for
   related products / up-sells, and the home page's product sections) and is
   specific enough to beat WooCommerce's float layout and Gymnax's 25% / 33% /
   50% / 100% card widths at every breakpoint. The list view further down is
   for listings only. */

/* Gymnax makes the home page's product lists flex rows
   (body.home .woocommerce ul.products), hence html + body here. Only the
   display: the column counts below stay easy to override per breakpoint. */
html body.mcsv-cards ul.products[class*="columns-"] {
	display: grid;
}

.mcsv-cards ul.products[class*="columns-"] {
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 18px;
	margin: 0 0 30px;
	padding: 0;
	list-style: none;
}

/* Related products and the home page sections: full-width rows of 4. */
.mcsv-cards ul.products.columns-4 {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

.mcsv-cards ul.products.columns-2 {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* WooCommerce's clearfix pseudo-elements would each take a grid cell. */
.mcsv-cards ul.products[class*="columns-"]::before,
.mcsv-cards ul.products[class*="columns-"]::after {
	content: none;
	display: none;
}

/* Card --------------------------------------------------------------------- */

.mcsv-cards ul.products[class*="columns-"] li.product.mcsv-card {
	--mcsv-ink: var(--dark-color, #0a0c00);
	--mcsv-accent: var(--primary-color, #e3ff04);
	--mcsv-line: #e8e8e4;
	--mcsv-muted: #6b6e66;
	--mcsv-media: #f7f7f5;
	--mcsv-in: #15803d;
	--mcsv-out: #c81e1e;
	--mcsv-backorder: #b45309;
	--mcsv-radius: 0; /* Square corners, like the rest of the site. */
	--mcsv-btn: 34px;
	position: relative;
	display: flex;
	flex-direction: column;
	float: none;
	clear: none;
	width: auto;
	min-width: 0;
	margin: 0;
	padding: 0;
	background: var(--white-color, #fff);
	border: 1px solid var(--mcsv-line);
	border-radius: var(--mcsv-radius);
	color: var(--mcsv-ink);
	font-family: var(--body-fonts, "Jost", sans-serif);
	font-size: 14px;
	line-height: 1.6;
	text-align: left;
	transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.mcsv-cards ul.products li.product.mcsv-card:hover {
	border-color: #d9d9d3;
	box-shadow: 0 20px 38px rgba(10, 12, 0, 0.1);
}

/* Image: contained on a light square, so packs of any shape line up. */
.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__media {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: var(--mcsv-media);
	border-radius: var(--mcsv-radius);
}

.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__media img {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 16px;
	object-fit: contain;
	border-radius: 0;
	box-shadow: none;
	mix-blend-mode: multiply; /* White photo backgrounds blend into the grey square. */
	transition: transform 0.35s ease;
}

.mcsv-cards ul.products li.product.mcsv-card:hover .mcsv-card__media img {
	transform: scale(1.04);
}

.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__badge {
	position: absolute;
	top: 12px;
	left: 12px;
	z-index: 2;
	padding: 4px 10px;
	background: var(--mcsv-ink);
	border-radius: var(--mcsv-radius);
	color: var(--mcsv-accent);
	font-family: var(--title-fonts, "Oswald", sans-serif);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: 0.6px;
	text-transform: uppercase;
}

.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-width: 0;
	padding: 15px 16px 17px;
}

.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__meta {
	overflow: hidden;
	color: var(--mcsv-muted);
	font-size: 11.5px;
	font-weight: 600;
	line-height: 1.6;
	letter-spacing: 0.4px;
	text-overflow: ellipsis;
	text-transform: uppercase;
	white-space: nowrap;
}

/* Title: the site's heading style (Oswald, uppercase, 500) at 16px. Two lines
   reserved so cards in a row line up. */
.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__title {
	min-height: calc(2em * 1.3);
	margin: 5px 0 0;
	padding: 0;
	color: var(--mcsv-ink);
	font-family: var(--title-fonts, "Oswald", sans-serif);
	font-size: 16px;
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: normal;
	text-transform: uppercase;
	transition: none;
}

.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__title a {
	color: inherit;
	text-decoration: none;
}

.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__title a:hover,
.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__title a:focus-visible {
	color: var(--mcsv-ink);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__stock {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 8px;
	color: var(--mcsv-in);
	font-size: 12.5px;
	font-weight: 600;
	line-height: 1.6;
}

.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__stock.is-out {
	color: var(--mcsv-out);
}

.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__stock.is-backorder {
	color: var(--mcsv-backorder);
}

.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__dot {
	flex: none;
	width: 7px;
	height: 7px;
	background: currentColor;
	border-radius: 50%;
}

/* Short description: list view only. */
.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__excerpt {
	display: none;
}

/* Footer: price on the left, WhatsApp + Add to cart on the right, kept at the
   bottom of the card so rows of cards line up. Wraps (buttons under the price)
   if a card is ever too narrow for both. */
.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-top: auto;
	padding-top: 12px;
}

/* Price: the site's body font (Jost), as on the theme's product cards. */
.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__price {
	min-width: 0;
	color: var(--mcsv-ink);
	font-family: var(--body-fonts, "Jost", sans-serif);
	font-size: 22px;
	font-weight: 500;
	line-height: 1.15;
	letter-spacing: normal;
	white-space: nowrap;
}

/* Sale: the old price sits small above the new one. */
.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__price del {
	display: block;
	color: var(--mcsv-muted);
	font-size: 13.5px;
	font-weight: 400;
	opacity: 1;
}

.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__price ins {
	background: none;
	color: inherit;
	font-weight: inherit;
	text-decoration: none;
}

.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__actions {
	display: flex;
	flex: none;
	align-items: center;
	gap: 8px;
	margin-left: auto;
}

/* WhatsApp icon (MuscleCare WhatsApp Order plugin): same size and corners as
   Add to cart. Also covers an icon that plugin's script adds itself. */
.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__actions .mcwo-btn.mcwo-btn--icon {
	--mcwo-ink: var(--mcsv-ink);
	--mcwo-icon-size: var(--mcsv-btn);
	flex: none;
	order: 0;
	width: var(--mcsv-btn);
	height: var(--mcsv-btn);
	min-height: 0;
	margin: 0 !important; /* The plugin's script-added icon has margin-left: auto !important. */
	border-radius: var(--mcsv-radius);
}

.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__actions .mcwo-btn--icon .mcwo-icon {
	width: 20px;
	height: 20px;
}

/* Its tooltip: right-aligned like Add to cart's, so it stays inside the card. */
.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__actions .mcwo-btn--icon[data-mcwo-tip]::after {
	bottom: calc(100% + 10px); /* Same height as Add to cart's tooltip. */
	left: auto;
	right: calc(-8px - var(--mcsv-btn)); /* Ends where Add to cart (and the card's buttons) end. */
	border-radius: var(--mcsv-radius);
	font-family: var(--body-fonts, "Jost", sans-serif);
	letter-spacing: normal;
	text-transform: none;
	transform: translateY(4px);
}

.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__actions .mcwo-btn--icon:hover::after,
.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__actions .mcwo-btn--icon:focus-visible::after {
	transform: none;
}

/* Its arrow, lined up with Add to cart's (WhatsApp plugin draws it centred). */
.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__actions .mcwo-btn--icon[data-mcwo-tip]::before {
	bottom: calc(100% + 4px);
}

/* Add to cart: dark square with a lime cart icon; lime with a dark cart on hover. */
.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add {
	position: relative;
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: var(--mcsv-btn);
	height: var(--mcsv-btn);
	margin: 0;
	padding: 0;
	background: var(--mcsv-ink);
	border: 0;
	border-radius: var(--mcsv-radius);
	box-shadow: 0 8px 18px rgba(10, 12, 0, 0.22);
	color: var(--mcsv-accent);
	font-family: var(--body-fonts, "Jost", sans-serif);
	font-size: 14.5px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	text-transform: none;
	white-space: nowrap;
	transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add:hover,
.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add:focus-visible {
	background: var(--mcsv-accent);
	box-shadow: 0 8px 18px rgba(10, 12, 0, 0.18);
	color: var(--mcsv-ink);
	transform: translateY(-2px);
}

.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add:focus-visible {
	outline: 2px solid var(--mcsv-ink);
	outline-offset: 2px;
}

/* Out of stock (or options to choose): an arrow to the product page. */
.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add--link {
	background: var(--white-color, #fff);
	box-shadow: inset 0 0 0 1.5px #cfcfc8;
	color: var(--mcsv-ink);
}

.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add--link:hover,
.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add--link:focus-visible {
	background: var(--mcsv-ink);
	box-shadow: none;
	color: var(--white-color, #fff);
}

.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add .mcsv-i {
	display: block;
	flex: none;
	pointer-events: none;
}

/* WooCommerce adds .loading while it adds to the cart, then .added. */
.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add.loading {
	opacity: 0.6;
	cursor: wait;
	pointer-events: none;
}

.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add .mcsv-i--check,
.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add.added .mcsv-i--cart {
	display: none;
}

.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add.added .mcsv-i--check {
	display: block;
}

/* WooCommerce's "View cart" link after an AJAX add: the header cart shows it.
   (The store currently goes straight to the cart page anyway.) */
.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__actions .added_to_cart {
	display: none;
}

/* The label is for the list view; the grid shows it as a tooltip. */
.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add-label {
	display: none;
}

.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add::before,
.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add::after {
	position: absolute;
	bottom: 100%;
	z-index: 5;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translateY(4px);
	transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
}

.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add::after {
	content: attr(data-mcsv-tip);
	right: 0;
	margin-bottom: 10px;
	padding: 6px 10px;
	background: var(--mcsv-ink);
	border-radius: var(--mcsv-radius);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.2;
	white-space: nowrap;
}

.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add::before {
	content: "";
	right: calc(var(--mcsv-btn) / 2 - 6px);
	margin-bottom: 4px;
	border: 6px solid transparent;
	border-top-color: var(--mcsv-ink);
	border-bottom-width: 0;
}

@media (hover: hover) {
	.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add:hover::before,
	.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add:hover::after {
		opacity: 1;
		visibility: visible;
		transform: none;
		transition-delay: 0s;
	}
}

.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add:focus-visible::before,
.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add:focus-visible::after {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition-delay: 0s;
}

/* Grid columns. Listings: 3, then 2 below 1200px (the products column gets
   narrow beside the sidebar). Related products and home page (full width): 4,
   then 2 below 1120px, where a quarter of the row gets too narrow for a
   5-digit price and both buttons (cards need ~245px with the price in Jost;
   the home page's Best Selling box is a little narrower than the others).
   Both: 1 on phones. */
@media (max-width: 1199px) {
	.mcsv-listing ul.products[class*="columns-"] {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 1119px) {
	.mcsv-cards ul.products[class*="columns-"] {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 575px) {
	.mcsv-cards ul.products[class*="columns-"] {
		grid-template-columns: minmax(0, 1fr);
		gap: 16px;
	}
}

/* List view ---------------------------------------------------------------- */

html.mcsv-list .mcsv-listing ul.products[class*="columns-"] {
	grid-template-columns: minmax(0, 1fr);
	gap: 14px;
}

html.mcsv-list .mcsv-listing ul.products[class*="columns-"] li.product.mcsv-card {
	--mcsv-btn: 40px;
	flex-direction: row;
	gap: 18px;
	padding: 14px;
}

html.mcsv-list .mcsv-listing ul.products li.product.mcsv-card .mcsv-card__media {
	flex: none;
	width: 150px;
	height: 150px;
	aspect-ratio: auto;
	border-radius: var(--mcsv-radius);
}

html.mcsv-list .mcsv-listing ul.products li.product.mcsv-card .mcsv-card__media img {
	padding: 12px;
}

html.mcsv-list .mcsv-listing ul.products li.product.mcsv-card .mcsv-card__badge {
	top: 8px;
	left: 8px;
	padding: 3px 8px;
	font-size: 11px;
}

html.mcsv-list .mcsv-listing ul.products li.product.mcsv-card .mcsv-card__body {
	padding: 4px 4px 4px 0;
}

html.mcsv-list .mcsv-listing ul.products li.product.mcsv-card .mcsv-card__title {
	min-height: 0;
}

html.mcsv-list .mcsv-listing ul.products li.product.mcsv-card .mcsv-card__excerpt {
	display: -webkit-box;
	margin-top: 6px;
	overflow: hidden;
	color: var(--mcsv-muted);
	font-size: 14px;
	line-height: 1.5;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

html.mcsv-list .mcsv-listing ul.products li.product.mcsv-card .mcsv-card__foot {
	flex-wrap: wrap;
	gap: 12px 14px;
}

html.mcsv-list .mcsv-listing ul.products li.product.mcsv-card .mcsv-card__price {
	font-size: 24px;
}

/* A labelled button instead of the cart-icon square. */
html.mcsv-list .mcsv-listing ul.products li.product.mcsv-card .mcsv-card__add {
	gap: 8px;
	width: auto;
	padding: 0 20px;
}

html.mcsv-list .mcsv-listing ul.products li.product.mcsv-card .mcsv-card__add .mcsv-i {
	width: 18px;
	height: 18px;
}

html.mcsv-list .mcsv-listing ul.products li.product.mcsv-card .mcsv-card__add-label {
	display: inline;
}

html.mcsv-list .mcsv-listing ul.products li.product.mcsv-card .mcsv-card__add::before,
html.mcsv-list .mcsv-listing ul.products li.product.mcsv-card .mcsv-card__add::after {
	content: none;
}

html.mcsv-list .mcsv-listing ul.products li.product.mcsv-card .mcsv-card__actions .mcwo-btn--icon[data-mcwo-tip]::after {
	right: 0;
}

@media (max-width: 575px) {
	html.mcsv-list .mcsv-listing ul.products[class*="columns-"] li.product.mcsv-card {
		gap: 12px;
		padding: 12px;
	}

	html.mcsv-list .mcsv-listing ul.products li.product.mcsv-card .mcsv-card__media {
		width: 104px;
		height: 104px;
	}

	html.mcsv-list .mcsv-listing ul.products li.product.mcsv-card .mcsv-card__media img {
		padding: 8px;
	}

	html.mcsv-list .mcsv-listing ul.products li.product.mcsv-card .mcsv-card__price {
		font-size: 20px;
	}

	html.mcsv-list .mcsv-listing ul.products li.product.mcsv-card .mcsv-card__add {
		padding: 0 14px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mcsv-cards ul.products li.product.mcsv-card,
	.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__media img,
	.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add,
	.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add::before,
	.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add::after {
		transition: none;
	}

	.mcsv-cards ul.products li.product.mcsv-card:hover .mcsv-card__media img,
	.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add:hover,
	.mcsv-cards ul.products li.product.mcsv-card .mcsv-card__add:focus-visible {
		transform: none;
	}
}

/* Sidebar category list ------------------------------------------------------ */

/* The category being viewed (and, for a subcategory, its parent): the theme's
   hover green, a little heavier. Classes added by mcsv_current_category(). */
.widget .wc-block-product-categories-list-item.is-current > a,
.widget .wc-block-product-categories-list-item.is-current > .wc-block-product-categories-list-item-count {
	color: var(--bs-green);
	font-weight: 500;
}

.widget .wc-block-product-categories-list-item.is-current-parent > a {
	color: var(--bs-green);
}
