/**
 * Habesha Market - Product cards
 * ------------------------------------------------------------------
 * One card design on every product listing:
 *   - Shop page (/shop/)                       body.woocommerce-shop
 *   - Product category archives                body.tax-product_cat
 *   - Category landing pages (Smykker etc.)    .hm-cat-grid
 *   - Homepage product rows                    .hm-home-products
 * Single product, cart and checkout are NOT affected.
 *
 * Loaded by wp-content/novamira-sandbox/hm-site-styles.php (theme-independent).
 * Added 2026-11-15. Roll back: delete this file (or disable the loader).
 */

/* 1. Tokens ------------------------------------------------------- */
:root {
	--hm-list-bg: #F8F2EA;   /* ivory band behind the grid */
	--hm-card-bg: #FCFAF7;   /* near-white card */
	--hm-card-radius: 12px;
	--hm-card-img-radius: 8px;
	--hm-card-shadow: 0 1px 2px rgba(46, 51, 32, 0.04), 0 6px 18px rgba(46, 51, 32, 0.06);
}

/* 2. Ivory band (full width, no horizontal scroll) ---------------- */
:is(.woocommerce-shop, .tax-product_cat) .site-main ul.products {
	background: var(--hm-list-bg);
	box-shadow: 0 0 0 100vmax var(--hm-list-bg);
	clip-path: inset(-32px -100vmax);
	margin-top: 32px;
	margin-bottom: 48px;
}
/* Homepage 'Vores produkter' section: same ivory band, drawn 32px past the section edges (inside its margins) so the page rhythm is unchanged. */
.hm-section:has(.hm-home-products) {
	background: var(--hm-list-bg);
	box-shadow: 0 0 0 100vmax var(--hm-list-bg);
	clip-path: inset(-32px -100vmax);
}
.hm-cat-grid {
	background: var(--hm-list-bg);
	box-shadow: 0 0 0 100vmax var(--hm-list-bg);
	clip-path: inset(0 -100vmax);
	padding-top: 32px;
	padding-bottom: 48px;
}

/* 3. Grid --------------------------------------------------------- */
:is(.woocommerce-shop, .tax-product_cat, .hm-cat-grid, .hm-home-products) ul.products {
	gap: 24px;
}

/* 4. Card --------------------------------------------------------- */
:is(.woocommerce-shop, .tax-product_cat, .hm-cat-grid, .hm-home-products) ul.products li.product {
	display: flex;
	flex-direction: column;
	float: none;
	width: auto;
	margin: 0;
	padding: 10px;
	overflow: hidden;
	background: var(--hm-card-bg);
	border: 0;
	border-radius: var(--hm-card-radius);
	box-shadow: var(--hm-card-shadow);
}

/* 5. Image: square, whole product visible ------------------------- */
:is(.woocommerce-shop, .tax-product_cat, .hm-cat-grid, .hm-home-products) ul.products li.product .woocommerce-loop-image-link {
	display: block;
}
:is(.woocommerce-shop, .tax-product_cat, .hm-cat-grid, .hm-home-products) ul.products li.product img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	object-fit: contain;
	background: #FFFFFF;
	border-radius: var(--hm-card-img-radius);
	margin: 0;
}

/* 6. Text: name and price ----------------------------------------- */
/* .content-bg in the selector: Kadence paints .product-details white with a 4-class rule; this keeps the text area the same warm white as the card. */
:is(.woocommerce-shop, .tax-product_cat, .hm-cat-grid, .hm-home-products) ul.products li.product .product-details.content-bg {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	margin: 0;
	padding: 14px 6px 6px;
	background: transparent;
}
:is(.woocommerce-shop, .tax-product_cat, .hm-cat-grid, .hm-home-products) ul.products li.product .woocommerce-loop-product__title {
	margin: 0 0 6px;
	padding: 0;
	color: var(--global-palette3);
}
:is(.woocommerce-shop, .tax-product_cat, .hm-cat-grid, .hm-home-products) ul.products li.product .price {
	margin: 0 0 14px;
	padding: 0;
	color: var(--global-palette3);
	font-size: 15px;
	font-weight: 600;
}

/* 7. Button: full width, pinned to the bottom, cart icon ---------- */
:is(.woocommerce-shop, .tax-product_cat, .hm-cat-grid, .hm-home-products) ul.products li.product .product-action-wrap {
	position: static;
	opacity: 1;
	visibility: visible;
	transform: none;
	margin-top: auto;
	padding: 0;
	width: auto;
}
:is(.woocommerce-shop, .tax-product_cat, .hm-cat-grid, .hm-home-products) ul.products li.product a.button {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	margin: 0;
	padding: 12px 16px;
	box-sizing: border-box;
}
:is(.woocommerce-shop, .tax-product_cat, .hm-cat-grid, .hm-home-products) ul.products li.product a.add_to_cart_button::before {
	content: '';
	width: 18px;
	height: 18px;
	background-color: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4h2l2.4 11h10.2L20 7H6.2'/%3E%3Ccircle cx='9' cy='19.5' r='1.3'/%3E%3Ccircle cx='17' cy='19.5' r='1.3'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4h2l2.4 11h10.2L20 7H6.2'/%3E%3Ccircle cx='9' cy='19.5' r='1.3'/%3E%3Ccircle cx='17' cy='19.5' r='1.3'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* 8. Mobile ------------------------------------------------------- */
@media (max-width: 767px) {
	:is(.woocommerce-shop, .tax-product_cat, .hm-cat-grid, .hm-home-products) ul.products {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 12px;
	}
	:is(.woocommerce-shop, .tax-product_cat, .hm-cat-grid, .hm-home-products) ul.products li.product a.button {
		padding: 10px 8px;
		gap: 6px;
	}
	:is(.woocommerce-shop, .tax-product_cat, .hm-cat-grid, .hm-home-products) ul.products li.product {
		padding: 8px;
	}
	:is(.woocommerce-shop, .tax-product_cat, .hm-cat-grid, .hm-home-products) ul.products li.product .product-details {
		padding: 10px 4px 4px;
	}
}
