/* ==== partial: 03-blocks-filters.css ====
   Store blocks, product filter sidebar and responsive rules.
   ======================================================================== */

/* Store blocks -------------------------------------------------------------- */

/* All Products / product list guard. The cards themselves are styled through
   .demande-product-card, so this only keeps the list on the archive grid
   rhythm (3 columns, then 2 and 1 at the shared breakpoints). */
.wc-block-all-products .wc-block-grid__products {
	display: grid;
	gap: 24px;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	list-style: none;
	margin: 0;
	padding: 0;
}

.wc-block-all-products .wc-block-grid__products > .wc-block-grid__product {
	margin: 0;
	min-width: 0;
	width: auto;
}

/* Featured product panel. */
.wc-block-featured-product {
	border-radius: var(--demande-radius-lg);
	padding-block: clamp(24px, 4vw, 48px);
}

/* Without an image the block still inherits the white text it ships with, which
   disappears on a light page. Fall back to the lavender surface instead.
   Verified against the server render (FeaturedItem::render): a single wrapper
   div carries both .wc-block-featured-product and any picked .has-background,
   so :not(.has-background) on the same element is the right exclusion, and the
   child .wc-block-featured-product__background-image is only printed when the
   product really has an image (get_item_image() returns '' otherwise). */
.wc-block-featured-product:not(.has-background):not(:has(.wc-block-featured-product__background-image)) {
	background-color: var(--demande-lavender);
	color: var(--demande-heading);
}

/* The dim overlay is rendered even with no image: .has-background-dim activates
   its ::before tint, which would darken the lavender fallback and leave the
   heading-coloured text half-over a black wash. Suppress it in the fallback. */
.wc-block-featured-product:not(.has-background):not(:has(.wc-block-featured-product__background-image)) .background-dim__overlay {
	display: none;
}

/* The block hard-codes #fff on these links, so pull every text slot onto the
   panel palette when the fallback is active. */
.wc-block-featured-product:not(.has-background):not(:has(.wc-block-featured-product__background-image)) :is(.wc-block-featured-product__title, .wc-block-featured-product__variation, .wc-block-featured-product__description, .wc-block-featured-product__price) a {
	color: var(--demande-primary);
}

.wc-block-featured-product__title {
	font-size: var(--wp--preset--font-size--heading-3, clamp(1.25rem, 1.1rem + 0.6vw, 1.75rem));
	line-height: 1.2;
}

.wc-block-featured-product__variation {
	color: inherit;
	font-size: var(--wp--preset--font-size--heading-6, 1rem);
}

.wc-block-featured-product__description {
	color: inherit;
	font-size: 1rem;
	line-height: 1.6;
}

.wc-block-featured-product__price {
	color: inherit;
	font-size: var(--wp--preset--font-size--x-large, 1.25rem);
	font-weight: 600;
}

/* Product categories list and dropdown. */
.wc-block-product-categories ul.wc-block-product-categories-list {
	display: grid;
	gap: var(--demande-space-1);
	list-style: none;
	margin: 0;
	padding: 0;
}

.wc-block-product-categories-list-item {
	font-size: 0.9375rem;
	margin: 0;
}

.wc-block-product-categories-list--has-images .wc-block-product-categories-list-item {
	align-items: center;
	display: flex;
	gap: var(--demande-space-2);
	margin: 0;
}

.wc-block-product-categories-list--has-images .wc-block-product-categories-list-item__image {
	flex: 0 0 48px;
	margin: 0;
	width: 48px;
}

.wc-block-product-categories-list--has-images .wc-block-product-categories-list-item__image img {
	border-radius: var(--demande-radius-sm);
	height: 48px;
	width: 48px;
}

.wc-block-product-categories-list-item-count {
	color: var(--demande-muted);
	font-size: 0.8125rem;
}

/* The count is presented as its own muted token, so drop the parentheses. */
.wc-block-product-categories-list-item-count::before,
.wc-block-product-categories-list-item-count::after {
	content: none;
}

.wc-block-product-categories.is-dropdown {
	align-items: flex-end;
	gap: var(--demande-space-1);
}

.wc-block-product-categories__dropdown {
	flex: 1;
	min-width: 0;
}

.wc-block-product-categories select {
	margin: 0;
	min-height: 44px;
	width: 100%;
}

.wc-block-product-categories__button {
	align-items: center;
	background-color: var(--demande-primary);
	border: 1px solid var(--demande-primary);
	border-radius: var(--demande-radius);
	color: var(--demande-surface);
	display: inline-flex;
	justify-content: center;
	min-height: 44px;
	padding: 0 var(--demande-space-2);
	transition: background-color var(--demande-transition), border-color var(--demande-transition);
}

.wc-block-product-categories__button:hover {
	background-color: var(--demande-primary-hover);
	border-color: var(--demande-primary-hover);
}

/* The block ships a bare dashicon whose path has no fill, so it inherits the
   surface colour of the button. */
.wc-block-product-categories__button svg {
	fill: currentColor;
	height: 20px;
	width: 20px;
}

/* Product filter sidebar ---------------------------------------------------- */

.demande-filter-group + .demande-filter-group {
	border-block-start: var(--demande-border-thin);
	margin-block-start: 1rem;
	padding-block-start: 1rem;
}

.demande-filter-group > * + * {
	margin-block-start: 12px;
}

.demande-filter-group .demande-filter-group__title {
	margin-block-end: 0;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.5;
}

.demande-filter-group__title {
	color: var(--demande-heading);
	font-size: 0.9375rem;
	font-weight: 600;
	margin-block: 0 0.5rem;
}

/* Flatten the nested boxes the filter blocks ship with. */
.demande-filter-panel .wp-block-woocommerce-product-filter-taxonomy,
.demande-filter-panel .wp-block-woocommerce-product-filter-price,
.demande-filter-panel .wp-block-woocommerce-product-filter-status {
	border: 0;
	padding: 0;
}

.demande-filter-panel .wp-block-woocommerce-product-filter-checkbox-list,
.demande-filter-panel .wp-block-woocommerce-product-filter-checkbox-list > fieldset,
.demande-filter-panel .wp-block-woocommerce-product-filter-chips,
.demande-filter-panel .wc-block-product-filter-checkbox-list__wrapper,
.demande-filter-panel .wc-block-product-filter-chips__wrapper {
	border: 0;
	background: transparent;
	margin: 0;
	padding: 0;
}

.demande-filter-panel .wc-block-product-filter-checkbox-list__item,
.demande-filter-panel .wc-block-product-filter-chips__item {
	font-size: 0.9375rem;
}

.demande-filter-panel .wc-block-product-filter-checkbox-list__show-more,
.demande-filter-panel .wc-block-product-filter-checkbox-list__show-less {
	color: var(--demande-primary);
	font-size: 0.875rem;
	font-weight: 600;
}

.demande-filter-panel .wc-block-product-filter-price-slider__input,
.demande-filter-panel input[type="number"] {
	min-height: 40px;
}

/* Active filter chips */
.demande-shop .wc-block-product-filter-active {
	margin-block-end: 1rem;
}

.demande-shop .wc-block-product-filter-removable-chips__item {
	background-color: var(--demande-primary-soft);
	border: 0;
	border-radius: var(--demande-radius-pill);
	color: var(--demande-primary);
	font-size: 0.875rem;
	font-weight: 500;
	padding-inline: 1rem;
	transition:
		background-color var(--demande-transition),
		color var(--demande-transition);
}

.demande-shop .wc-block-product-filter-removable-chips__item:hover {
	background-color: var(--demande-primary);
	color: var(--demande-surface);
}

.demande-shop .wc-block-product-filter-clear-button {
	color: var(--demande-primary);
	font-size: 0.875rem;
	font-weight: 600;
	text-decoration: underline;
}

/* Responsive -------------------------------------------------------------- */

.demande-shop__layout > *, .demande-product__top > *,
.woocommerce-MyAccount-content, .wc-block-components-main,
.wc-block-components-sidebar { min-width: 0; }
.wp-site-blocks main:is(.demande-cart, .demande-checkout, .demande-order-confirmation) { padding-inline: var(--demande-gutter); }
.demande-shop .wc-block-product-template {
	display: grid;
	grid-template-columns: repeat(var(--demande-shop-cols, 3), minmax(0, 1fr));
	gap: 1.5rem;
}
.demande-shop .wc-block-product-template > li { width: auto; min-width: 0; }
.demande-products-section .wc-block-product-template,
.demande-related .wc-block-product-template {
	display: grid;
	grid-template-columns: repeat(var(--demande-related-cols, 4), minmax(0, 1fr));
	gap: 1.5rem;
}
.demande-shop__toolbar select { min-height: 44px; max-width: 100%; }
.demande-product__gallery { width: 100%; }
.woocommerce .demande-product__gallery .wp-block-woocommerce-product-image-gallery { max-width: 100%; }
.demande-product__panel { max-width: none; }
.woocommerce :where(address, td, th, .woocommerce-order-overview li) { overflow-wrap: anywhere; }
.woocommerce form :where(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, button) { min-height: 44px; }
.woocommerce form :where(input, select, textarea) { max-width: 100%; }
.woocommerce-MyAccount-navigation a { min-height: 44px; }
.woocommerce .woocommerce-MyAccount-navigation li.is-active a { background: var(--demande-primary-soft); color: var(--demande-primary); }
.wc-block-components-product-name { overflow-wrap: anywhere; }
.wc-block-components-button { min-height: 44px; }

@media (max-width: 1024px) {
	.demande-products-section .wc-block-product-template,
	.demande-related .wc-block-product-template { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.demande-shop__layout { grid-template-columns: 264px minmax(0, 1fr); }
	.demande-shop .wc-block-product-template { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.wc-block-all-products .wc-block-grid__products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.woocommerce-account .woocommerce:has(> .woocommerce-MyAccount-navigation) {
		grid-template-columns: minmax(0, 1fr);
	}
	.woocommerce-account .woocommerce:has(> .woocommerce-MyAccount-navigation) > .woocommerce-MyAccount-content { grid-column: 1; grid-row: auto; }

	.demande-shop__filters {
		position: static;
	}

	.demande-product__top {
		grid-template-columns: minmax(0, 1fr);
	}

	.demande-product__gallery {
		max-width: 640px;
	}

	.demande-product__panel {
		max-width: none;
	}
}

@media (max-width: 782px) {
	.demande-shop__layout { grid-template-columns: minmax(0, 1fr); }
	.demande-shop__filters { width: 100%; }
	.demande-shop__toolbar { align-items: flex-start; gap: 1rem; }
	.wc-block-components-sidebar-layout { flex-direction: column; }
	.wc-block-components-sidebar-layout > .wc-block-components-main,
	.wc-block-components-sidebar-layout > .wc-block-components-sidebar { width: 100%; padding-inline: 0; }
	.woocommerce form .form-row-first, .woocommerce form .form-row-last { width: 100%; float: none; }
	.wc-block-cart__submit-button,
	.wc-block-components-button.wc-block-cart__submit-button {
		min-height: 48px;
	}

	.demande-product__price-row {
		flex-wrap: wrap;
		gap: 0.5rem;
	}

	.woocommerce-Addresses {
		grid-template-columns: minmax(0, 1fr);
	}

	.wc-block-all-products .wc-block-grid__products { grid-template-columns: minmax(0, 1fr); }

	/* Account navigation becomes a horizontal strip, the same scrolling
	   treatment the filter rail uses, and the content stays single column. */
	.woocommerce-MyAccount-navigation {
		padding: 0.75rem;
	}

	.woocommerce-MyAccount-navigation ul,
	.demande-account-nav ul {
		display: flex;
		flex-wrap: nowrap;
		gap: var(--demande-space-1);
		overflow-x: auto;
		overscroll-behavior-inline: contain;
		padding-block-end: 4px;
		scrollbar-width: thin;
	}

	.woocommerce-MyAccount-navigation ul li,
	.demande-account-nav ul li {
		flex: 0 0 auto;
	}

	.woocommerce-MyAccount-navigation ul li a,
	.demande-account-nav ul li a {
		white-space: nowrap;
	}

	body.demande-context-account #customer_login.u-columns {
		grid-template-columns: minmax(0, 1fr);
	}

	.woocommerce-order-overview {
		gap: 1rem;
	}

	.woocommerce-order-overview li {
		flex-basis: calc(50% - 0.5rem);
	}

	/* Stack WooCommerce order tables into label/value rows on small screens. */
	.woocommerce-orders-table thead,
	.woocommerce-table thead {
		display: none;
	}

	.woocommerce-orders-table,
	.woocommerce-orders-table tbody,
	.woocommerce-orders-table tr,
	.woocommerce-orders-table td,
	.woocommerce-table,
	.woocommerce-table tbody,
	.woocommerce-table tr,
	.woocommerce-table td {
		display: block;
		width: 100%;
	}

	.woocommerce-orders-table tr,
	.woocommerce-table tr {
		border-block-end: var(--demande-border-thin);
		padding-block: 0.5rem;
	}

	.woocommerce-orders-table td,
	.woocommerce-table td {
		border: 0;
		padding: 0.375rem 1rem;
	}
}

@media (max-width: 560px) {
	.wc-block-cart .wc-block-cart-items .wc-block-cart-items__row {
		grid-template-columns: 64px minmax(0, 1fr);
		gap: 1rem;
	}
	.wc-block-cart .wc-block-cart-items .wc-block-cart-items__row > td { min-width: 0; padding: 0; }
	.wc-block-cart .wc-block-cart-items .wc-block-cart-item__image { grid-column: 1; grid-row: 1 / span 2; }
	.wc-block-cart .wc-block-cart-items .wc-block-cart-item__product { grid-column: 2; grid-row: 1; }
	.wc-block-cart .wc-block-cart-items .wc-block-cart-item__total { grid-column: 2; grid-row: 2; justify-content: flex-start; }
	.demande-products-section .wc-block-product-template,
	.demande-related .wc-block-product-template { grid-template-columns: minmax(0, 1fr); }
	.demande-shop .wc-block-product-template { grid-template-columns: minmax(0, 1fr); }
	.demande-shop__toolbar select { width: 100%; }
	.variations th, .variations td { display: block; width: 100%; }
	form.cart .single_add_to_cart_button,
	.demande-product__panel form.cart .demande-add-to-list { flex: 1 1 100%; }
	.wc-block-cart__submit-button { width: 100%; }
	.woocommerce-order-overview li {
		flex-basis: 100%;
	}

	.wc-block-components-checkout-step {
		padding: 1.125rem;
	}
}


/* Empty cart ---------------------------------------------------------------- */

.demande-empty-cart {
	align-items: center;
	background: var(--demande-lavender);
	border-radius: var(--demande-radius-lg);
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	margin-block: 1rem 2.5rem;
	padding: clamp(2rem, 5vw, 3.5rem) var(--demande-gutter);
	text-align: center;
}

.demande-empty-cart__icon {
	color: var(--demande-primary);
	display: inline-flex;
}

.demande-empty-cart h2 {
	font-size: var(--wp--preset--font-size--x-large, 1.75rem);
	margin: 0;
}

.demande-empty-cart p {
	color: var(--demande-body);
	margin: 0;
	max-width: 36ch;
}

.demande-empty-cart .wp-element-button {
	margin-block-start: 0.5rem;
}

.wp-block-woocommerce-empty-cart-block .wc-block-grid__products {
	align-items: stretch;
}

.wp-block-woocommerce-empty-cart-block .wc-block-grid__product-image img {
	aspect-ratio: 1 / 1;
	border-radius: var(--demande-radius);
	height: auto;
	object-fit: cover;
	width: 100%;
}

.wp-block-woocommerce-empty-cart-block .wc-block-grid__product-link {
	text-decoration: none;
}

/* Clear-filters affordance emitted by shop-empty-state. */
.demande-clear-filters {
	background: var(--demande-surface);
	border: 1px solid var(--demande-border-input);
	border-radius: var(--demande-radius);
	color: var(--demande-primary);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	font-size: 0.875rem;
	font-weight: 600;
	min-height: var(--demande-control-height-compact);
	padding: 0.25rem 0.75rem;
}

.demande-clear-filters:hover {
	background: var(--demande-lavender);
	border-color: var(--demande-primary);
}
