/**
 * Product card — reused on homepage, shop, category, related/upsell, search.
 * Relies on WooCommerce's own markup for price (.price/del/ins, tokens.css
 * already styles those) and the add-to-cart button (.button, styled below).
 */

/* ---- Product grid (WooCommerce's native ul.products loop wrapper) ----
   Used by the shop/category/search archive and by single-product
   related/upsell sections — one definition, shared everywhere. */
ul.products {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--space-5);
	list-style: none;
	padding: 0;
	margin: 0 0 var(--space-6);
}
li.product-grid-item { list-style: none; }

@media (max-width: 768px) {
	ul.products { grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
}

.product-card {
	display: flex;
	flex-direction: column;
	height: 100%;
	background: var(--color-card);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	overflow: hidden;
	transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-fast);
}
.product-card:hover,
.product-card:focus-within {
	transform: translateY(-4px);
	border-color: var(--color-border-strong);
	box-shadow: var(--shadow-md);
}

.product-card__media {
	position: relative;
	display: block;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: radial-gradient(circle at 50% 42%, var(--color-background) 0%, var(--color-surface) 72%);
}
.product-card__img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	padding: var(--space-5);
	transition: transform var(--transition-base);
}
.product-card:hover .product-card__img { transform: scale(1.05); }

.product-card__badge {
	position: absolute;
	top: var(--space-3);
	inset-inline-start: var(--space-3);
	z-index: 1;
}
.product-card__badge--stock {
	inset-inline-start: auto;
	inset-inline-end: var(--space-3);
}

.product-card__body {
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
	padding: var(--space-4);
	flex: 1;
}

.product-card__title {
	font-size: var(--text-base);
	font-weight: var(--font-weight-bold);
	line-height: var(--line-height-tight);
	color: var(--color-primary);
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	overflow: hidden;
}
.product-card__title a { color: inherit; }
.product-card__title a:hover { color: var(--color-accent-strong); }

/* Secondary (Arabic) part of a bilingual product name: one quiet line. */
.product-card__title-alt {
	margin: 0;
	/* Align with the title (left on French pages) even though the text is RTL. */
	text-align: left;
	font-size: var(--text-xs);
	color: var(--color-text-muted);
	line-height: var(--line-height-tight);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

html[dir="rtl"] .product-card__title-alt { text-align: right; }

.product-card__price {
	margin-block-start: auto;
	padding-block-start: var(--space-3);
	font-size: var(--text-base);
	font-weight: var(--font-weight-bold);
	color: var(--color-primary);
}
.product-card__price .from {
	display: block;
	font-size: var(--text-xs);
	font-weight: var(--font-weight-regular);
	color: var(--color-text-muted);
}
.product-card__price del { font-size: var(--text-sm); font-weight: var(--font-weight-regular); }

.product-card__action { margin-block-start: var(--space-3); }

/* WooCommerce's native add-to-cart / select-options / read-more anchors all
   share class="button" — style that directly instead of re-implementing
   cart logic, so AJAX add-to-cart keeps working out of the box. One look for
   every product type keeps a mixed rail visually even. */
.product-card__action .button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 42px;
	padding: var(--space-2) var(--space-4);
	border-radius: var(--radius-md);
	border: 1px solid var(--color-primary);
	background: var(--color-primary);
	color: var(--color-text-on-primary);
	font-size: var(--text-sm);
	font-weight: var(--font-weight-bold);
	text-align: center;
	transition: background-color var(--transition-fast), border-color var(--transition-fast);
}
.product-card__action .button:hover,
.product-card__action .button:focus-visible {
	background: var(--color-accent);
	border-color: var(--color-accent);
	color: var(--color-text-on-accent);
}
.product-card__action .button.loading { opacity: 0.7; pointer-events: none; }

/* "View cart" link WooCommerce appends after an AJAX add. */
.product-card__action .added_to_cart {
	display: block;
	margin-block-start: var(--space-2);
	font-size: var(--text-xs);
	font-weight: var(--font-weight-bold);
	text-align: center;
	color: var(--color-accent-strong);
}
