/*
 * RahkarTheme — shared product card stylesheet.
 *
 * One file, one look, one source of truth. Loaded only on pages whose
 * markup contains a block that registered this style as a dependency
 * (see rahkar_product_card_register_style() in inc/product-card.php).
 *
 * Class prefix `.rpc-*` is intentionally block-agnostic — the same card
 * can sit inside an archive grid, a horizontal slider, a single-product
 * "related" rail, or any future container.
 *
 * Design: clean European luxury fashion aesthetic — no border, no hover lift,
 * edge-to-edge image, subtle image zoom on hover, minimal type spacing.
 */

.rpc-card {
	margin: 0;
	background: #fff;
	border: none;
	border-radius: 2px;
	overflow: hidden;
	min-width: 0;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.rpc-card:hover {
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
	transform: none;
}

/* Flex column: image → title → price, all edge-to-edge */
.rpc-card__link {
	display: flex;
	flex-direction: column;
	gap: 0;
	padding: 0;
	color: inherit;
	text-decoration: none;
	height: 100%;
}
.rpc-card__link:hover { text-decoration: none; }

/* Media slot */
.rpc-card__media {
	display: block;
	position: relative;
	aspect-ratio: 3 / 4;
	background: var(--wp--preset--color--surface, #f7f7f8);
	border-radius: 0;
	overflow: hidden;
}
.rpc-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
/* WooCommerce/WordPress global resets (e.g. `.woocommerce img { height:auto }`)
   have specificity 0,1,1 and can override height:100% above (0,1,0).
   This parent+child selector (0,2,0) wins and keeps the image filling the container
   regardless of the source image's own aspect ratio. */
.rpc-card__media > .rpc-card__img {
	height: 100%;
}

/* ─── Top-corner badges ─────────────────────────────────────────────── */
.rpc-card__badges {
	position: absolute;
	top: 8px;
	inset-inline-start: 8px;
	display: flex;
	gap: 4px;
	z-index: 1;
}
.rpc-badge {
	display: inline-flex;
	align-items: center;
	height: 20px;
	padding-inline: 7px;
	font-size: 0.7rem;
	font-weight: var(--wp--custom--fw--strong);
	border-radius: 3px;
	color: #fff;
	letter-spacing: 0.03em;
}
.rpc-badge--new { background: var(--wp--preset--color--primary, #0a66c2); }
.rpc-badge--oos {
	background: rgba(26, 29, 35, 0.72);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
}

/* ─── Out-of-stock card state ────────────────────────────────────────── */
.rpc-card--oos .rpc-card__img {
	filter: grayscale(0.55);
	opacity: 0.65;
	transition: filter 0.3s ease, opacity 0.3s ease, transform 0.55s ease;
}
.rpc-card--oos .rpc-card__title {
	color: var(--wp--preset--color--text-muted, #5b6271);
}
@media (hover: hover) {
	.rpc-card--oos:hover .rpc-card__img {
		filter: grayscale(0);
		opacity: 0.85;
	}
}

/* ─── Color swatches row (overlaid on image, bottom-left) ──────────── */
.rpc-card__swatches {
	position: absolute;
	bottom: 8px;
	inset-inline-end: 8px;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	direction: ltr;
	padding: 4px 6px;
	background: rgba(255, 255, 255, 0.88);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	border-radius: 9999px;
	z-index: 1;
}
.rpc-swatch-dot {
	width: 11px;
	height: 11px;
	border-radius: 50%;
	border: 1px solid rgba(0, 0, 0, 0.10);
	display: inline-block;
	flex-shrink: 0;
}
.rpc-swatch-more {
	display: inline-flex;
	align-items: center;
	height: 13px;
	padding: 0 5px;
	margin-inline-start: 1px;
	font-size: 0.65rem;
	font-weight: var(--wp--custom--fw--strong);
	color: var(--wp--preset--color--text-muted, #5b6271);
	background: var(--wp--preset--color--surface, #f7f7f8);
	border-radius: 9999px;
	line-height: 1;
}

/* ─── Title ────────────────────────────────────────────────────────── */
.rpc-card__title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 0.85rem;
	font-weight: var(--wp--custom--fw--base);
	line-height: 1.45;
	color: var(--wp--preset--color--text-muted, #5b6271);
	padding: 8px 10px 2px;
	letter-spacing: 0.01em;
	text-align: right;
}

/* ─── Price — right-aligned below title ─────────────────────────────── */
.rpc-card__price {
	display: flex;
	flex-direction: column;
	align-items: flex-start;   /* flex-start = right side in RTL */
	gap: 2px;
	padding: 3px 10px 10px;
	text-align: right;
}
.rpc-price-stack {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 1px;
	min-width: 0;
}
.rpc-price-row {
	display: flex;
	align-items: center;
	flex-wrap: nowrap;
	gap: 5px;
	white-space: nowrap;
}
.rpc-price-original {
	color: var(--wp--preset--color--text-muted, #5b6271);
	font-size: 0.75rem;
	font-weight: var(--wp--custom--fw--base);
	text-decoration: line-through;
	line-height: 1.2;
}
.rpc-price-current,
.rpc-price-default {
	color: var(--wp--preset--color--contrast, #0f1115);
	font-size: 0.875rem;
	font-weight: var(--wp--custom--fw--base);
	line-height: 1.25;
}
.rpc-price-stack .woocommerce-Price-amount,
.rpc-price-stack bdi {
	font-size: inherit;
	font-weight: inherit;
	color: inherit;
}

.rpc-pct-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 34px;
	height: 20px;
	padding-inline: 7px;
	border-radius: 3px;
	background: var(--wp--preset--color--contrast, #0f1115);
	color: #fff;
	font-size: 0.65rem;
	font-weight: var(--wp--custom--fw--strong);
	line-height: 1;
	letter-spacing: 0.02em;
	flex-shrink: 0;
}

/* Mobile: image already edge-to-edge, slightly tighter type */
@media (max-width: 768px) {
	.rpc-card__title {
		font-size: 0.8rem;
		padding: 6px 8px 1px;
		min-height: unset;
	}
	.rpc-card__price {
		padding: 2px 8px 8px;
		align-items: flex-start;
	}
	.rpc-price-current,
	.rpc-price-default { font-size: 0.825rem; }
	.rpc-price-original { font-size: 0.72rem; }
	.rpc-pct-badge { min-width: 30px; height: 18px; padding-inline: 5px; font-size: 0.6rem; }
	.rpc-badge { height: 17px; padding-inline: 6px; font-size: 0.62rem; border-radius: 2px; }
	.rpc-card__badges { top: 6px; inset-inline-start: 6px; }
	.rpc-card__swatches { gap: 3px; padding: 2px 4px; }
	.rpc-swatch-dot { width: 8px; height: 8px; }
	.rpc-swatch-more { font-size: 0.58rem; height: 11px; padding: 0 3px; }
}
