/**
 * Product Card V1 (patterns/product-card.php).
 *
 * Styles native WooCommerce product blocks only; loaded when a Product Template
 * block renders (inc/assets.php). The current WooCommerce 11.1 component classes
 * are intentionally scoped under .alatinidza-product-card; regression-test after
 * major WooCommerce updates.
 *
 * Mobile-first: phones show two cards per row, so the card is tighter below 600px.
 */

.alatinidza-product-card {
	--alatinidza-product-title-size: 1rem; /* 16px, 17px from 600px (Design System V1). */
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--20);
	height: 100%;
	padding: var(--wp--preset--spacing--30);
	background-color: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--preset--border-radius--card);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.alatinidza-product-card > * {
	margin-block: 0;
}

/* Image: square frame, whole product visible (object-fit: contain comes from the block). */
.alatinidza-product-card .wc-block-components-product-image {
	margin-block-end: var(--wp--preset--spacing--20);
	overflow: hidden;
	border-radius: var(--wp--preset--border-radius--control);
}

.alatinidza-product-card .wc-block-components-product-image img {
	display: block;
	transition: transform 0.2s ease;
}

/*
 * Badge (Design System V1): one per card, top-left on the image, 4px radius.
 * AKCIJA is WooCommerce's native sale badge (rendered only for products on sale):
 * brand orange-red with dark on-accent text (4.83:1; white would be 3.51:1).
 * NOVO / IZDVOJENO have no native badge; alatinidza-core will output
 * .alatinidza-badge--new / --featured in the same slot (deferred).
 */
.alatinidza-product-card .wc-block-components-product-image .wc-block-components-product-sale-badge,
.alatinidza-product-card .alatinidza-badge {
	position: absolute;
	inset-block-start: var(--wp--preset--spacing--20);
	inset-inline-start: var(--wp--preset--spacing--20);
	inset-inline-end: auto;
	z-index: 1;
	margin: 0;
	padding: var(--wp--preset--spacing--10) var(--wp--preset--spacing--20);
	color: var(--wp--preset--color--on-accent);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	line-height: 1.2;
	text-transform: uppercase;
	background-color: var(--wp--preset--color--accent);
	border: 0;
	border-radius: var(--wp--preset--border-radius--badge);
}

.alatinidza-product-card .alatinidza-badge--new {
	color: var(--wp--preset--color--base);
	background-color: var(--wp--preset--color--graphite);
}

.alatinidza-product-card .alatinidza-badge--featured {
	color: var(--wp--preset--color--contrast);
	background-color: var(--wp--preset--color--surface);
}

/* Title: Inter 600, two lines max; the space for two lines is kept so prices line up. */
.alatinidza-product-card .wp-block-post-title {
	min-height: 2.6em; /* 2 lines x line-height 1.3 */
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--alatinidza-product-title-size);
	font-weight: 600;
	line-height: 1.3;
}

/* The clamp sits on the link, so its focus outline is not clipped. */
.alatinidza-product-card .wp-block-post-title a {
	display: -webkit-box;
	overflow: hidden;
	color: inherit;
	text-decoration: none;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

/* Price: current price prominent; the old (regular) price small, muted and struck through. */
.alatinidza-product-card .wc-block-components-product-price {
	color: var(--wp--preset--color--contrast);
	font-size: var(--wp--preset--font-size--x-large);
	font-weight: 700;
	line-height: 1.2;
}

.alatinidza-product-card .wc-block-components-product-price del {
	margin-inline-end: var(--wp--preset--spacing--10);
	color: var(--wp--preset--color--contrast-muted);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 400;
}

/*
 * Stock: WooCommerce's availability text in primary text color with a status dot
 * (success green as text would be 3.1:1 on white). Text and state come from WooCommerce.
 * WooCommerce renders nothing for an in-stock product without stock management,
 * so the approved "● Na stanju" line is not guaranteed yet (verify with real products).
 */
.alatinidza-product-card .wc-block-components-product-stock-indicator {
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
	margin: 0;
	color: var(--wp--preset--color--contrast);
	font-size: var(--wp--preset--font-size--small);
}

.alatinidza-product-card .wc-block-components-product-stock-indicator::before {
	content: "";
	flex: none;
	width: var(--wp--preset--spacing--20);
	height: var(--wp--preset--spacing--20);
	background-color: var(--wp--preset--color--success);
	border-radius: 50%;
}

.alatinidza-product-card .wc-block-components-product-stock-indicator--available-on-backorder::before {
	background-color: var(--wp--preset--color--warning);
}

.alatinidza-product-card .wc-block-components-product-stock-indicator--out-of-stock::before {
	background-color: var(--wp--preset--color--error);
}

/* Add to cart: native WooCommerce button (theme.json button style), full width, at the card bottom. */
.alatinidza-product-card .wc-block-components-product-button {
	gap: var(--wp--preset--spacing--10);
	margin-block-start: auto;
	padding-block-start: var(--wp--preset--spacing--20);
}

.alatinidza-product-card .wc-block-components-product-button__button {
	padding-inline: var(--wp--preset--spacing--20);
}

/* "View cart" link WooCommerce adds after an add to cart. */
.alatinidza-product-card .wc-block-components-product-button .added_to_cart {
	display: inline-flex;
	align-items: center;
	min-height: var(--wp--custom--touch-target);
	font-size: var(--wp--preset--font-size--small);
}

@media (hover: hover) {
	.alatinidza-product-card:hover {
		border-color: var(--wp--preset--color--contrast-muted);
		box-shadow: var(--wp--preset--shadow--card-hover);
	}

	.alatinidza-product-card .wp-block-post-title a:hover {
		text-decoration: underline;
	}
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
	.alatinidza-product-card:hover .wc-block-components-product-image img {
		transform: scale(1.02);
	}
}

@media (min-width: 600px) {
	.alatinidza-product-card {
		--alatinidza-product-title-size: 1.0625rem;
		padding: var(--wp--preset--spacing--40);
	}
}
