/**
 * TheWebCart — WooCommerce overrides.
 * Loaded only when WooCommerce is active (see inc/enqueue.php).
 * Brand tokens come from theme.json presets.
 */

/* Product grid cards (product-collection / product-template) */
.wp-block-woocommerce-product-template {
	gap: var(--wp--preset--spacing--40);
}

/* Homepage section grids (Popular / Top Rated / Category): one stretched row.
   WooCommerce renders these as a flex container that wraps with the gap; force a
   CSS grid with auto-fit so the products fill a single row and degrade responsively. */
.twc-sec .wc-block-product-template.is-flex-container {
	display: grid !important;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: var(--wp--preset--spacing--40);
}
.twc-sec .wc-block-product-template.is-flex-container > .wc-block-product {
	flex: initial;
	width: 100% !important;
	max-width: 100% !important;
	min-width: 0;
	margin: 0;
	justify-self: stretch;
	list-style: none;
}
.wc-block-product,
.wp-block-woocommerce-product-template .wc-block-product {
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 12px;
	overflow: hidden;
	background: var(--wp--preset--color--background);
	padding: 0 0 var(--wp--preset--spacing--40);
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.wc-block-product:hover {
	box-shadow: var(--wp--preset--shadow--raised);
	transform: translateY(-3px);
}
.wc-block-product .wp-block-woocommerce-product-image,
.wc-block-product .wc-block-components-product-image {
	margin: 0 0 var(--wp--preset--spacing--30);
}

/* Uniform product images — every thumbnail is cropped to one standard square,
   regardless of the source image's real dimensions. */
.wc-block-product .wc-block-components-product-image,
.wc-block-product .wp-block-woocommerce-product-image,
.wc-block-product .wc-block-components-product-image a,
.wc-block-product .wp-block-woocommerce-product-image a {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	background: var(--wp--preset--color--surface);
	overflow: hidden;
}
.wc-block-product .wc-block-components-product-image img,
.wc-block-product .wp-block-woocommerce-product-image img {
	width: 100% !important;
	height: 100% !important;
	object-fit: cover;
	object-position: center;
	border-radius: 0;
}
/* Single-product main gallery image: consistent 4:3 frame */
.wp-block-woocommerce-product-image-gallery img {
	aspect-ratio: 4 / 3;
	object-fit: cover;
	width: 100%;
}
.wc-block-product :where(.wp-block-post-title, .wc-block-components-product-name) {
	padding-inline: var(--wp--preset--spacing--40);
	font-weight: 500;
}
.wc-block-product :where(.wp-block-post-title, .wc-block-components-product-name) a {
	color: var(--wp--preset--color--ink);
}
.wc-block-product :where(.wp-block-post-title, .wc-block-components-product-name) a:hover {
	color: var(--wp--preset--color--primary-dark);
}
.wc-block-product .wp-block-woocommerce-product-price,
.wc-block-product .wp-block-woocommerce-product-rating,
.wc-block-product .wp-block-woocommerce-product-button {
	padding-inline: var(--wp--preset--spacing--40);
}

/* Price + sale */
.woocommerce-Price-amount,
.wc-block-components-product-price__value {
	color: var(--wp--preset--color--primary-dark);
	font-weight: 700;
}
.wc-block-components-product-price__regular {
	color: var(--wp--preset--color--muted);
	font-weight: 400;
}

/* Sale badge -> brand orange */
.wc-block-components-product-sale-badge {
	background: var(--wp--preset--color--cta);
	color: var(--wp--preset--color--background);
	border-radius: 6px;
	font-weight: 700;
}

/* Add-to-cart buttons */
.wc-block-components-product-button .wp-block-button__link,
.woocommerce a.button,
.woocommerce button.button.alt,
.wc-block-cart__submit-button,
.wc-block-components-checkout-place-order-button {
	background: var(--wp--preset--color--primary-dark);
	color: var(--wp--preset--color--background);
	border-radius: var(--twc-radius);
	font-weight: 600;
}
.wc-block-components-product-button .wp-block-button__link:hover,
.woocommerce a.button:hover,
.woocommerce button.button.alt:hover,
.wc-block-cart__submit-button:hover,
.wc-block-components-checkout-place-order-button:hover {
	background: #006130;
}

/* Star ratings */
.star-rating span::before,
.wc-block-components-product-rating .star-rating span::before {
	color: #f5a623;
}

/* Breadcrumbs */
.wc-block-breadcrumbs,
.woocommerce-breadcrumb {
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
	margin-block: var(--wp--preset--spacing--40);
}

/* On-sale / notices */
.woocommerce-message,
.wc-block-components-notice-banner.is-success {
	border-inline-start-color: var(--wp--preset--color--primary);
}

/* Single product gallery rounding */
.wp-block-woocommerce-product-image-gallery img {
	border-radius: 12px;
}
