/*
 * Public-facing minimal styles for the Shop/Archive "Customise" button.
 */

/* 1. Loop Button Layout (Standard) */
.scf-loop-buttons-wrapper--blocks {
	display: flex;
	flex-wrap: nowrap;
	gap: 0.5rem;
	align-items: stretch;
	justify-content: flex-start;
	margin: 0.35rem 0 0 0;
}

.scf-loop-buttons-wrapper--blocks > .wp-block-button,
.scf-loop-buttons-wrapper--blocks > .scf-loop-customise-wrap {
	align-self: stretch;
	margin: 0 !important;
	flex: 1 1 0;
	min-width: 0;
	width: auto !important;
}

.scf-loop-buttons-wrapper--blocks .scf-loop-customise-form {
	margin: 0;
	display: none;
}

.scf-loop-buttons-wrapper--blocks .wc-block-components-product-button__button,
.scf-loop-buttons-wrapper--blocks .scf-loop-customise-btn {
	margin-bottom: 0 !important;
	width: 100% !important;
	box-sizing: border-box;
}

@media (max-width: 480px) {
	.scf-loop-buttons-wrapper--blocks {
		flex-wrap: wrap;
		justify-content: center;
	}
	.scf-loop-buttons-wrapper--blocks > .wp-block-button,
	.scf-loop-buttons-wrapper--blocks > .scf-loop-customise-wrap {
		flex: 1 1 100%;
	}
}

.scf-loop-buttons-wrapper--classic {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	justify-content: center;
	margin: 0.35rem 0 1rem 0;
}

.scf-loop-buttons-wrapper--classic .scf-loop-customise-btn {
	margin: 0;
}

.scf-loop-customise-btn[disabled],
.scf-loop-customise-btn.disabled,
.scf-loop-customise-btn[aria-disabled="true"] {
	opacity: 0.55;
	cursor: not-allowed;
	pointer-events: none;
}

/* * 2. Uniform Product Card Layout 
 * These rules only apply if the "Enforce uniform layout" setting is enabled 
 */
body.scf-card-layout-active.woocommerce-shop .wc-block-components-product-loop__item,
body.scf-card-layout-active.post-type-archive-product .wc-block-components-product-loop__item,
body.scf-card-layout-active.tax-product_cat .wc-block-components-product-loop__item,
body.scf-card-layout-active.tax-product_tag .wc-block-components-product-loop__item,
body.scf-card-layout-active.woocommerce-shop .wc-block-components-product-grid__item,
body.scf-card-layout-active.post-type-archive-product .wc-block-components-product-grid__item,
body.scf-card-layout-active.tax-product_cat .wc-block-components-product-grid__item,
body.scf-card-layout-active.tax-product_tag .wc-block-components-product-grid__item {
	display: flex;
	flex-direction: column;
	height: 100%;
}

body.scf-card-layout-active.woocommerce-shop .wp-block-woocommerce-product-price,
body.scf-card-layout-active.post-type-archive-product .wp-block-woocommerce-product-price,
body.scf-card-layout-active.tax-product_cat .wp-block-woocommerce-product-price,
body.scf-card-layout-active.tax-product_tag .wp-block-woocommerce-product-price,
body.scf-card-layout-active.woocommerce-shop .wc-block-components-product-price,
body.scf-card-layout-active.post-type-archive-product .wc-block-components-product-price,
body.scf-card-layout-active.tax-product_cat .wc-block-components-product-price,
body.scf-card-layout-active.tax-product_tag .wc-block-components-product-price {
	margin-top: 0.25rem !important;
	margin-bottom: 0 !important;
}

body.scf-card-layout-active.woocommerce-shop .wp-block-woocommerce-product-button,
body.scf-card-layout-active.post-type-archive-product .wp-block-woocommerce-product-button,
body.scf-card-layout-active.tax-product_cat .wp-block-woocommerce-product-button,
body.scf-card-layout-active.tax-product_tag .wp-block-woocommerce-product-button,
body.scf-card-layout-active.woocommerce-shop .wc-block-components-product-button,
body.scf-card-layout-active.post-type-archive-product .wc-block-components-product-button,
body.scf-card-layout-active.tax-product_cat .wc-block-components-product-button,
body.scf-card-layout-active.tax-product_tag .wc-block-components-product-button {
	margin-top: 0.35rem !important;
	margin-bottom: 0 !important;
}

/* Clamp titles to 2 lines */
body.scf-card-layout-active.woocommerce-shop .wc-block-components-product-title__link,
body.scf-card-layout-active.post-type-archive-product .wc-block-components-product-title__link,
body.scf-card-layout-active.tax-product_cat .wc-block-components-product-title__link,
body.scf-card-layout-active.tax-product_tag .wc-block-components-product-title__link,
body.scf-card-layout-active.woocommerce-shop .wp-block-post-title a,
body.scf-card-layout-active.post-type-archive-product .wp-block-post-title a,
body.scf-card-layout-active.tax-product_cat .wp-block-post-title a,
body.scf-card-layout-active.tax-product_tag .wp-block-post-title a {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	line-height: 1.25;
	max-height: 2.5em;
}

body.scf-card-layout-active.woocommerce-shop .wc-block-components-product-title,
body.scf-card-layout-active.post-type-archive-product .wc-block-components-product-title,
body.scf-card-layout-active.tax-product_cat .wc-block-components-product-title,
body.scf-card-layout-active.tax-product_tag .wc-block-components-product-title,
body.scf-card-layout-active.woocommerce-shop .wp-block-post-title,
body.scf-card-layout-active.post-type-archive-product .wp-block-post-title,
body.scf-card-layout-active.tax-product_cat .wp-block-post-title,
body.scf-card-layout-active.tax-product_tag .wp-block-post-title {
	margin-bottom: 0.15rem !important;
	min-height: 2.5em;
}
/* =========================================================
   2. Uniform Images (Block Themes & Classic)
   Forces images to a square (1:1) aspect ratio so the grid aligns.
   ========================================================= */

/* Block Themes (WooCommerce Blocks) */
body.scf-card-layout-active .wc-block-grid__product-image img,
body.scf-card-layout-active .wc-block-components-product-image img,
/* Classic Themes */
body.scf-card-layout-active ul.products li.product a img,
body.scf-card-layout-active .woocommerce-loop-product__link img {
    aspect-ratio: 1 / 1;  /* Forces a perfect square */
    width: 100%;
    height: auto;
    object-fit: cover;    /* Crops the image so it fills the square without squashing */
}

/* Optional: If you prefer Portrait (tall) images, change 1 / 1 to 3 / 4 */