/**
 * Advanced Product Filter Pro — stili front-end.
 * Il layout base arriva dal plugin gratuito: qui solo swatch e drawer.
 */

/* Swatch ---------------------------------------------------------------- */

/* La lista diventa una griglia solo se contiene swatch. */
.wcaf__list:has(.wcaf__item-wrap--swatch) {
	display: flex;
	flex-wrap: wrap;
	gap: .5em;
	max-height: none;
}

.wcaf__item-wrap--swatch {
	margin: 0;
}

.wcafp-swatch {
	display: block;
	line-height: 0;
	border-radius: 4px;
	padding: 2px;
	border: 1px solid var(--wcaf-border, rgba(0, 0, 0, .12));
	text-decoration: none;
}

.wcafp-swatch:hover,
.wcafp-swatch:focus-visible {
	border-color: currentColor;
}

.wcafp-swatch.is-selected {
	border-color: currentColor;
	box-shadow: 0 0 0 1px currentColor;
}

.wcafp-swatch.is-empty {
	opacity: .35;
}

.wcafp-swatch__chip {
	display: block;
	width: 1.75em;
	height: 1.75em;
	border-radius: 3px;
	overflow: hidden;
	background-size: cover;
	background-position: center;
	/* I colori chiari devono restare visibili su fondo bianco. */
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}

.wcafp-swatch__chip img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.wcafp-swatch--image .wcafp-swatch__chip {
	width: 2.5em;
	height: 2.5em;
}

/* Valutazione ----------------------------------------------------------- */

.wcafp-stars {
	letter-spacing: .1em;
	color: #e0a70b;
}

/* Drawer mobile --------------------------------------------------------- */

/* Nascosti di default: le regole che li mostrano stanno nella media query
   inline generata da PHP, perché il breakpoint è configurabile. */
.wcafp-drawer-trigger,
.wcafp-drawer-close,
.wcafp-drawer-done {
	display: none;
}

.wcafp-drawer-trigger {
	align-items: center;
	justify-content: center;
	gap: .5em;
	width: 100%;
	margin: 0 0 1em;
	padding: .75em 1em;
	border: 1px solid var(--wcaf-border, rgba(0, 0, 0, .12));
	border-radius: 6px;
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

.wcafp-drawer-trigger .wcafp-count {
	min-width: 1.5em;
	padding: 0 .4em;
	border-radius: 999px;
	background: currentColor;
	font-size: .8em;
	line-height: 1.6;
}

.wcafp-drawer-trigger .wcafp-count span {
	color: #fff;
	mix-blend-mode: normal;
}

.wcafp-backdrop {
	position: fixed;
	inset: 0;
	z-index: 99998;
	background: rgba(0, 0, 0, .5);
	opacity: 0;
	pointer-events: none;
	transition: opacity .25s ease;
	border: 0;
	padding: 0;
	margin: 0;
}

.wcafp-drawer-close {
	position: absolute;
	top: .5em;
	right: .5em;
	z-index: 1;
	width: 2em;
	height: 2em;
	border: 0;
	border-radius: 50%;
	background: rgba(127, 127, 127, .18);
	color: inherit;
	font-size: 1.1em;
	line-height: 1;
	cursor: pointer;
}

.wcafp-drawer-done {
	position: fixed;
	z-index: 100000;
	left: 0;
	bottom: 0;
	width: min(86vw, 340px);
	max-width: 340px;
	padding: .9em 1em;
	border: 0;
	background: #111;
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
	.wcafp-backdrop {
		transition: none;
	}
}
