/* Product card — the single shared card (Figma: Card in 04-Offers / 06-BestSells).
   One <article>; layout by grid areas, no wrappers. The title link covers the card via ::after. */
.product-card {
	position: relative;
	display: grid;
	--pad: var(--sp-16);
	/* Outer columns are the side padding, so the image can span the full width. */
	grid-template-columns: var(--pad) minmax(0, 1fr) auto var(--pad);
	grid-template-areas:
		"image image  image  image"
		".     cat    cat    ."
		".     title  title  ."
		".     colors colors ."
		".     price  buy    .";
	/* Swatches row absorbs spare height, so price + buy always sit at the card bottom
	   whether or not a product has swatches. */
	grid-template-rows: auto auto auto 1fr auto;
	align-items: center;
	height: 100%;
	padding-bottom: var(--sp-24);
	overflow: clip; /* keeps the hover-zoomed image inside the rounded card */
	border-radius: var(--r-16);
	background: var(--n-100);
	box-shadow: 0 4px 14px rgb(0 0 0 / .07); /* side spread must stay within 16px (slider clip, slider.css) */
	transition: box-shadow .2s;
}
.product-card:hover { box-shadow: 0 10px 20px -4px rgb(0 0 0 / .12); } /* must fit the slider's shadow room (slider.css) */
.product-card::before { /* hover indicator along the bottom edge (Figma hover state) */
	content: "";
	position: absolute;
	bottom: 0;
	left: 50%;
	width: 40%;
	height: 3px;
	border-radius: 3px 3px 0 0;
	background: var(--blue);
	transform: translateX(-50%) scaleX(0);
	transition: transform .25s;
}
.product-card:hover::before { transform: translateX(-50%) scaleX(1); }

/* Badge and wishlist float over the image corners. */
.product-card__badge {
	position: absolute;
	z-index: 1;
	top: var(--sp-12);
	inset-inline-start: var(--sp-12);
	display: inline-flex;
	align-items: center;
	gap: 4px;
	height: 32px;
	padding-inline: var(--sp-8) var(--sp-12);
	/* Tag shape: rounded end side, near-square start side (toward the card corner). */
	border-start-start-radius: var(--r-8);
	border-end-start-radius: 2px;
	border-start-end-radius: var(--r-16); /* = half the 32px height: a full round end. A larger value */
	border-end-end-radius: var(--r-16);   /* would make the browser scale every corner down to ~0. */
	color: var(--n-100);
	background: var(--orange);
	font-size: var(--fs-label-l);
	line-height: 1;
	font-weight: 700;
}
.product-card__badge::before { /* icon as a mask: one cached file instead of inline SVG per card */
	content: "";
	width: 18px;
	height: 18px;
	background: currentColor;
	mask: url("../../icons/sale-badge.svg") center / contain no-repeat;
}

.product-card__wish {
	position: absolute;
	z-index: 1;
	top: var(--sp-8);
	inset-inline-end: var(--sp-8);
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: var(--r-pill);
	color: var(--n-10);
	background: rgb(255 255 255 / .8);
	cursor: pointer;
	transition: color .15s, background-color .15s;
}
.product-card__wish:hover { color: var(--orange); background: var(--orange-light); }
.product-card__wish .icon { font-size: 22px; }

/* Image: full card width (edge to edge), square. */
.product-card__image {
	grid-area: image;
	width: 100%;
	aspect-ratio: 1;
	height: auto;
	margin-bottom: var(--sp-16);
	border-radius: var(--r-16) var(--r-16) 0 0;
	object-fit: cover;
	transition: scale .3s;
}
.product-card:hover .product-card__image { scale: 1.04; }

.product-card__cat { grid-area: cat; color: var(--n-50); font-size: var(--fs-body-s); line-height: var(--lh-body-s); }

body .product-card__title { /* outranks Elementor's kit h3 colour while it is active */
	grid-area: title;
	margin-top: var(--sp-8);
	color: var(--n-10);
	font-size: var(--fs-body-l);
	line-height: var(--lh-body-l);
	font-weight: 500;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: calc(var(--lh-body-l) * 2);
}
.product-card .product-card__link,
.product-card .product-card__link:hover { color: inherit; } /* :hover too: Elementor's kit a:hover would win while it is active */
.product-card__link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; } /* whole card clickable */
.product-card__link:focus-visible { outline: none; }
.product-card:has(.product-card__link:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }

.product-card__swatches { grid-area: colors; align-self: start; display: flex; justify-content: flex-end; gap: var(--sp-8); margin-top: var(--sp-16); }
.product-card__swatches li {
	width: 16px;
	height: 16px;
	border-radius: var(--r-pill);
	background: var(--swatch);
	box-shadow: inset 0 0 0 1px rgb(0 0 0 / .06); /* very faint edge, keeps white visible */
}

/* Price: old price always on top. Its line is reserved even without a discount,
   so every card's price sits at the same height. */
.product-card__price {
	grid-area: price;
	display: grid;
	grid-template-rows: var(--lh-body-m) auto;
	justify-items: start;
	margin-top: var(--sp-16);
	color: var(--n-10);
	font-size: var(--fs-title-m);
	line-height: var(--lh-title-m);
	font-weight: 700;
}
.product-card__price del { color: var(--n-60); font-size: var(--fs-body-m); line-height: var(--lh-body-m); font-weight: 400; }
.product-card__price ins { text-decoration: none; }
.product-card__price small { font-size: var(--fs-label-m); font-weight: 500; color: var(--n-30); }
.product-card__price ins, .product-card__price small { grid-row: 2; display: inline; }
.product-card__price:has(ins) { grid-template-columns: auto auto; justify-content: start; column-gap: 6px; align-items: baseline; }
.product-card__price del { grid-row: 1; grid-column: 1 / -1; }
.product-card__stock { grid-row: 2; color: var(--n-50); font-size: var(--fs-label-l); font-weight: 500; }

.product-card .product-card__buy {
	grid-area: buy;
	align-self: end;
	position: relative;
	z-index: 1;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 44px;
	padding-inline: var(--sp-16);
	border: 1px solid var(--n-90);
	border-radius: var(--r-16);
	color: var(--n-20);
	background: var(--n-100);
	font-size: var(--fs-label-l);
	font-weight: 500;
	transition: color .15s, background-color .15s, border-color .15s;
}
.product-card .product-card__buy .icon { font-size: 20px; }
.product-card:hover .product-card__buy { color: var(--n-100); background: var(--blue); border-color: var(--blue); }
.product-card .product-card__buy.loading { opacity: .6; pointer-events: none; }
.product-card .added_to_cart { display: none; } /* WooCommerce "View cart" link; the header badge updates instead */

/* Out of stock: the photo stays as it is; a small «ناموجود» tag on the image instead */
.product-card__out { position: absolute; top: var(--sp-12); inset-inline-start: var(--sp-12); z-index: 2; display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px 3px 8px; border-radius: var(--r-pill); color: var(--n-30); background: rgb(255 255 255 / .92); box-shadow: inset 0 0 0 1px var(--n-90); font-size: 12px; font-weight: 500; }
.product-card__out::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--n-60); }

@media (max-width: 769px) {
	.product-card { --pad: var(--sp-12); padding-bottom: var(--sp-16); }
	.product-card__image { margin-bottom: var(--sp-12); }
	body .product-card__title { font-size: var(--fs-body-s); line-height: var(--lh-body-s); min-height: calc(var(--lh-body-s) * 2); }
	.product-card__price { grid-template-rows: var(--lh-body-s) auto; margin-top: var(--sp-12); font-size: var(--fs-title-s); line-height: var(--lh-title-s); }
	.product-card__price del { font-size: var(--fs-label-s); line-height: var(--lh-body-s); }
	.product-card__price small { font-size: var(--fs-label-s); }
	.product-card__badge { top: var(--sp-8); inset-inline-start: var(--sp-8); height: 24px; padding-inline: 6px var(--sp-8); font-size: var(--fs-label-m); border-start-end-radius: var(--r-12); border-end-end-radius: var(--r-12); }
	.product-card__badge::before { width: 14px; height: 14px; }
	.product-card__wish { top: 4px; inset-inline-end: 4px; width: 32px; height: 32px; }
	.product-card__wish .icon { font-size: 18px; }
	/* Mobile: no category or swatches; buy is an icon-only square button. */
	.product-card__cat,
	.product-card__swatches { display: none; }
	body .product-card__title { margin-top: 0; }
	.product-card .product-card__buy { justify-content: center; width: 34px; height: 34px; padding: 0; border-radius: var(--r-8); }
	.product-card .product-card__buy .icon { font-size: 18px; }
	.product-card__buy-label { display: none; }
}
.product-card__wish[aria-pressed="true"] { color: var(--orange); }
.product-card__wish:disabled { opacity: .6; cursor: progress; }

/* Deal card: sold / left with a progress bar (in the swatches row). */
.product-card__sold {
	grid-area: colors;
	align-self: start;
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 4px var(--sp-8);
	margin-top: var(--sp-16);
	color: var(--n-30);
	font-size: var(--fs-label-m);
	line-height: var(--lh-label-m);
}
.product-card__sold::after {
	content: "";
	flex-basis: 100%;
	height: 4px;
	margin-top: 4px;
	border-radius: var(--r-pill);
	background: linear-gradient(to left, var(--c-danger) var(--sold, 0%), var(--n-93) var(--sold, 0%)); /* RTL: fills from the right */
}

/* Mini variant — small vertical card (new products): image, title, price only.
   The image takes whatever height the grid row leaves, so cards can stretch to any row height. */
.product-card--mini {
	grid-template-rows: minmax(0, 1fr) auto auto;
	grid-template-areas:
		"image image image image"
		".     title title ."
		".     price price .";
	padding-bottom: var(--sp-16);
}
.product-card--mini::before { display: none; }
.product-card--mini .product-card__image {
	height: 100%;
	min-height: 0;
	aspect-ratio: auto;
	margin-bottom: var(--sp-8);
	object-fit: contain;
}
body .product-card--mini .product-card__title { margin-top: 0; font-size: var(--fs-body-m); line-height: var(--lh-body-m); min-height: calc(var(--lh-body-m) * 2); }
.product-card--mini .product-card__price { margin-top: var(--sp-8); }

@media (max-width: 1024px) { /* stacked layouts: natural square image */
	.product-card--mini .product-card__image { aspect-ratio: 1; height: auto; }
}
@media (max-width: 769px) {
	body .product-card--mini .product-card__title { font-size: var(--fs-body-s); line-height: var(--lh-body-s); min-height: calc(var(--lh-body-s) * 2); }
}

/* Row variant — compact horizontal card (lists, sidebars): image at the start; title and price beside it. */
.product-card--row {
	--pad: var(--sp-12);
	grid-template-columns: 72px minmax(0, 1fr);
	grid-template-rows: auto 1fr;
	grid-template-areas:
		"image title"
		"image price";
	column-gap: var(--sp-12);
	align-items: start;
	padding: var(--pad);
}
.product-card--row::before { display: none; }
.product-card--row .product-card__image { align-self: center; width: 72px; aspect-ratio: 1; margin: 0; border-radius: var(--r-8); object-fit: contain; }
body .product-card--row .product-card__title { margin-top: 0; font-size: var(--fs-body-s); line-height: var(--lh-body-s); min-height: calc(var(--lh-body-s) * 2); }
.product-card--row .product-card__price { align-self: end; margin-top: var(--sp-8); grid-template-rows: auto auto; font-size: var(--fs-title-s); line-height: var(--lh-title-s); }
.product-card--row .product-card__price del { font-size: var(--fs-label-s); }


/* «قیمت جهانی» (special offer: approximate price at official stores abroad) above the store price */
.product-card__ref { grid-row: 1; grid-column: 1 / -1; display: flex; align-items: baseline; gap: 6px; }
.product-card__ref > span { color: var(--n-60); font-size: 11px; line-height: var(--lh-body-m); font-weight: 400; }
.product-card__ref > span, .product-card__ref del { white-space: nowrap; }

/* Mobile: the card is narrow (~150px), so the buy button moves onto the image's bottom corner and the price gets the
   full width — otherwise «قیمت جهانی» wraps and long prices run under the button. Mini and row cards keep their layout. */
@media (max-width: 769px) {
	.product-card:not(.product-card--mini):not(.product-card--row) .product-card__price { grid-area: 5 / 2 / 6 / 4; }
	.product-card:not(.product-card--mini):not(.product-card--row) .product-card__buy {
		grid-area: 1 / 1 / 2 / -1;
		align-self: end;
		justify-self: end;
		margin: 0 var(--sp-8) var(--sp-12);
		background: rgb(255 255 255 / .94);
		box-shadow: 0 2px 8px rgb(0 0 0 / .08);
	}
	.product-card__ref { gap: 4px; }
}
