/**
 * ZYMARG OS — WooCommerce: Product
 * -----------------------------------------------------------------------------
 * Shop archive grid, product loop cards, single-product page, the Quick View
 * button, the Quick View content layout (the modal SHELL comes from
 * ui/modal.css) and the sticky add-to-cart bar. Loaded only on WooCommerce
 * contexts (see inc/enqueue.php).
 */

/* ---- General Woo buttons --------------------------------------------- */
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce #respond input#submit,
.woocommerce a.button.alt,
.woocommerce button.button.alt {
	background-color: var(--color-primary);
	color: var(--color-on-primary);
	border-radius: var(--zymarg-radius-sm);
	font-family: var(--zymarg-font-body);
	font-weight: 600;
	padding: 0.7em 1.3em;
	transition: background-color var(--zymarg-transition), transform var(--zymarg-transition);
}

.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.woocommerce a.button.alt:hover,
.woocommerce button.button.alt:hover {
	background-color: var(--color-primary-container);
	color: var(--color-on-primary);
	transform: translateY(-1px);
}

.woocommerce .star-rating span::before,
.woocommerce p.stars a::before {
	color: var(--color-primary);
}

.woocommerce span.onsale {
	background-color: var(--color-primary-container);
	color: var(--color-on-primary);
	border-radius: 999px;
}

/* ---- Product grid ---------------------------------------------------- */
.woocommerce ul.products,
.woocommerce-page ul.products {
	display: grid;
	grid-template-columns: repeat(var(--zymarg-shop-columns, 5), minmax(0, 1fr));
	/* --zymarg-card-gap is a plain CSS variable fallback; a child theme or a
	   plugin can set it on :root to change the gap without editing this file.
	   Was var(--zymarg-space-md) = a fixed 24px at every width. */
	gap: var(--zymarg-card-gap, 20px);
	margin: 0;
	padding: 0;
	list-style: none;
}

/* WooCommerce core ships `ul.products li.product { margin-bottom: 2.992em }`,
   which stacks on top of the grid gap and is the single biggest source of the
   "too much space around cards" look. Grid owns spacing here. */
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
	margin: 0;
	padding: 0;
	width: auto;
	float: none;
}

/* Kill WooCommerce clearfix pseudo-elements that break CSS grid */
.woocommerce ul.products::before,
.woocommerce ul.products::after,
.woocommerce-page ul.products::before,
.woocommerce-page ul.products::after {
	content: none !important;
	display: none !important;
}

@media (max-width: 1024px) {
	.woocommerce ul.products,
	.woocommerce-page ul.products {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 767px) {
	.woocommerce ul.products,
	.woocommerce-page ul.products {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		/* Phones: cards are only ~160px wide, so a 24px gutter ate ~15% of the
		   row. Tighter default, still overridable from the admin screen. */
		gap: var(--zymarg-card-gap-mobile, 10px);
	}
}

.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
	width: auto;
	margin: 0;
	float: none;
	background: var(--color-surface-lowest);
	border: 1px solid var(--color-outline-variant);
	border-radius: var(--zymarg-radius);
	padding: var(--zymarg-space-sm);
	transition: transform var(--zymarg-transition), box-shadow var(--zymarg-transition);
	display: flex;
	flex-direction: column;
}

.woocommerce ul.products li.product:hover {
	transform: translateY(-4px);
	box-shadow: var(--zymarg-shadow);
}

.woocommerce ul.products li.product img {
	border-radius: var(--zymarg-radius-sm);
	margin-bottom: var(--zymarg-space-sm);
}

.woocommerce ul.products li.product .woocommerce-loop-product__title {
	font-family: var(--zymarg-font-heading);
	font-size: 1.05rem;
	color: var(--color-on-primary-fixed);
	padding: 0;
}

.woocommerce ul.products li.product .price {
	color: var(--color-primary);
	font-weight: 600;
}

.woocommerce ul.products li.product .price del {
	color: var(--color-text-muted);
	font-weight: 400;
}

/*
 * NOTE: the duplicate `max-width: 1024px` (2 cols) and `max-width: 600px`
 * (1 col) blocks that used to sit here were removed in 5.20.10. They repeated
 * the same selectors at the same specificity later in the file, so they
 * silently overrode the 3 / 2 column rules above -- collapsing the shop grid
 * to a single full-width column below 600px. Column counts now live in ONE
 * place: the tablet/mobile rules above, driven by --zymarg-shop-columns on
 * desktop.
 */

/* ---- Seller avatar guard (5.20.11) ----------------------------------- *
 *
 * This sheet loads on every WooCommerce context, and the selector below is
 * container-agnostic -- it only needs the card itself. Three classes plus one
 * element (0,3,1) outranks WooCommerce's
 * `.woocommerce ul.products li.product img` (0,2,3) on class count alone, so
 * it wins wherever the card renders, in any load order, with no !important.
 */
.zymarg-wcpg__card--zymarg .zymarg-zc__vendor img.zymarg-zc__vendor-avatar,
.zymarg-wcpg__card--zymarg .zymarg-zc__row--vendor img.zymarg-zc__vendor-avatar {
	width: 20px;
	height: 20px;
	min-width: 20px;
	max-width: 20px;
	flex: 0 0 20px;
	margin: 0;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	border-radius: 50%;
}

/* ---- Single product -------------------------------------------------- */
.single-product div.product .product_title {
	font-family: var(--zymarg-font-heading);
	color: var(--color-on-primary-fixed);
}

.single-product div.product p.price,
.single-product div.product span.price {
	color: var(--color-primary);
	font-weight: 700;
}

/* ---- Quick View button ----------------------------------------------- */
.zymarg-quick-view {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	margin-top: 0.5em;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--color-secondary);
	background: var(--color-surface-container);
	border: 1px solid var(--color-outline-variant);
	border-radius: 999px;
	padding: 0.4em 0.9em;
	cursor: pointer;
	transition: all var(--zymarg-transition);
}

.zymarg-quick-view:hover {
	color: var(--color-on-primary);
	background: var(--color-primary);
	border-color: var(--color-primary);
}

/* ---- Quick View content layout --------------------------------------- *
 * The modal shell (overlay, dialog, close button, loading state) is provided
 * by ui/modal.css. This only styles the product content injected via AJAX.    */
.zymarg-quick-view-content {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--zymarg-space-lg);
}

.zymarg-quick-view-content .price {
	color: var(--color-primary);
	font-weight: 700;
	font-size: 1.25rem;
	margin-bottom: var(--zymarg-space-sm);
}

@media (max-width: 700px) {
	.zymarg-quick-view-content {
		grid-template-columns: 1fr;
	}
}
