/* Product Card (canonical)
 * Unified across front page, shop, and single-product related grids.
 * Maintains backward compatibility via legacy class aliases.
 */

:root {
	--ds-product-card-bg: var(--ds-surface);
	--ds-product-card-border: var(--ds-border);
	--ds-product-card-shadow: var(--ds-shadow-soft);
	--ds-product-card-shadow-hover: var(--ds-shadow-soft-lg);
	--ds-product-card-radius: 12px;
	--ds-product-card-image-bg: var(--ds-surface-subtle);
	--ds-product-card-text: var(--ds-text);
	--ds-product-card-muted: var(--ds-text-subtle);
	--ds-product-card-price: var(--ds-primary);
	--ds-product-card-cta: var(--ds-primary);
	--ds-product-card-cta-hover: var(--ds-primary-dark);
}

/* WC OVERRIDE
   Selector:  .products-grid / .products-grid > .product
   Reason:    Custom Woo loops render div.products-grid > article.product-card instead of
              the native ul.products > li.product structure. These resets keep the custom
              wrapper in grid mode and neutralize legacy Woo list-item sizing on children.
   WC ver:    9.x */
.products-grid {
	display: grid;
	min-width: 0;
}

.products-grid > .product,
.products-grid > .product-card,
.products-grid > * {
	float: none;
	width: auto;
	max-width: none;
	min-width: 0;
	margin: 0;
}

/* Grid layout for product-card wrappers is Tailwind-first.
	Wrapper utilities own gap; this shared class owns container-width columns
	for shop/search/related/up-sells/cross-sells loops that reuse the same cards. */
.products-grid--auto-5 {
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}





.product-card__badge,
.badge {
	/* Positioning handled by the absolute flex container in the template */
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	flex-shrink: 0;
	width: fit-content;
	padding: 3px 7px;
	border-radius: 6px;
	font-size: 0.68rem;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	white-space: nowrap;
	color: #fff;
	background: var(--ds-error);
	box-shadow: 0 1px 4px rgba(34, 34, 59, 0.2);
}

.badge--sale {
	background: var(--ds-error);
}

.badge--featured {
	background: var(--ds-primary);
}

.badge--new {
	background: var(--ds-accent);
}

.badge--popular,
.badge--best-seller,
.badge--bestseller {
	background: var(--ds-primary-dark);
}

.badge--out-of-stock,
.badge--deal,
.badge--deals {
	background: var(--ds-muted);
}



.product-card__placeholder,
.product-placeholder {
	width: 100%;
	height: 100%;
	background: linear-gradient(180deg, #f7f8f6 0%, #ecefe9 100%);
}

/* Ensure product card overlay link and positioning for full-card clickability */
.product-card {
	position: relative;
}

/* Strip UA button border — preflight is disabled so browser defaults bleed through */
.product-card .add-to-cart-btn {
	border: 0;
	cursor: pointer;
}

.product-card__link {
	position: absolute;
	inset: 0;
	z-index: 0;
	display: block;
	text-decoration: none;
	color: inherit;
}



.product-rating-count {
	margin-left: 0.2rem;
}

.product-card__title,
.product-title,
.product-name {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	overflow: hidden;
}

.product-card__description,
.product-description {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	overflow: hidden;
}


.product-card .add-to-cart-btn.loading,
.product-card .product-card__add-to-cart.loading {
	opacity: 0.92;
}

.product-card .add-to-cart-btn.loading::before,
.product-card .add-to-cart-btn.loading::after,
.product-card .product-card__add-to-cart.loading::before,
.product-card .product-card__add-to-cart.loading::after,
.product-card .add-to-cart-btn.is-loading-ui::before,
.product-card .add-to-cart-btn.is-loading-ui::after,
.product-card .product-card__add-to-cart.is-loading-ui::before,
.product-card .product-card__add-to-cart.is-loading-ui::after {
	content: none !important;
	display: none !important;
}

.add-to-cart-spinner {
	display: none;
	width: 20px;
	height: 20px;
	border: 2.5px solid currentColor;
	border-right-color: transparent;
	border-radius: 999px;
	flex: 0 0 auto;
	animation: ds-card-btn-spin 0.75s linear infinite;
}

/* Suppress text label while the cart button is in a loading state */
.product-card .add-to-cart-btn.loading .add-to-cart-btn__label,
.product-card .product-card__add-to-cart.loading .add-to-cart-btn__label,
.product-card .add-to-cart-btn.is-loading-ui .add-to-cart-btn__label,
.product-card .product-card__add-to-cart.is-loading-ui .add-to-cart-btn__label {
	display: none;
}

.product-card .add-to-cart-btn.loading .add-to-cart-spinner,
.product-card .product-card__add-to-cart.loading .add-to-cart-spinner,
.product-card .add-to-cart-btn.is-loading-ui .add-to-cart-spinner,
.product-card .product-card__add-to-cart.is-loading-ui .add-to-cart-spinner {
	display: inline-block;
}

/* Scoped to .product-card to avoid overriding global .ds-cart-icon size (18px in components.css) */
.product-card .product-card__add-to-cart-icon,
.product-card .ds-cart-icon {
	width: 16px;
	height: 16px;
}

@keyframes ds-card-btn-spin {
	to {
		transform: rotate(360deg);
	}
}

.product-card__add-to-cart-label,
.add-to-cart-btn__label {
	display: inline;
}

@media (prefers-reduced-motion: reduce) {
	.product-card {
		transition: none !important;
	}

	.product-card:hover,
	.product-card:focus-within {
		transform: none !important;
	}

	.product-image img,
	.product-card__img {
		transition: none !important;
	}

	.product-card:hover .product-image img,
	.product-card:hover .product-card__img {
		transform: none !important;
	}
}
