/**
 * Facetten-Filter auf Kategorie-/Markenseiten (archive-filters.php).
 * Design-System v1.1: ruhig, wertig; Token --zcf-* (Fallbacks = Sollwerte §3).
 *
 * Redesign 2026-07-20 (Axel): weg vom Text-Dropdown, hin zu OFFENEN, visuellen
 * Facettenblöcken — Farbe als Swatch-Kreise, „Für wen"/„Einsatzbereich" als
 * Piktogramm-Kacheln, Rest als Text-Chips. Alles mit sichtbarem Häkchen/Ring,
 * additiv. Mobile-first: Blöcke stapeln, Optionen brechen um. Touch >= 44px.
 */

.zwcl-filters {
	margin: 0 0 1.2rem;
}

/* --- Schnellfilter-Chips (kuratierte Einstiege) --- */

.zwcl-filters__presets {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin: 0 0 0.7rem;
}

.zwcl-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	min-height: 38px;
	padding: 0.42rem 0.85rem;
	border-radius: var(--radius-pill, 999px);
	border: 1px solid var(--zcf-border, #E3DCCF);
	background: var(--zcf-white, #FFFFFF);
	color: var(--zcf-petrol, #23434A);
	font-weight: 600;
	font-size: 0.88rem;
	text-decoration: none;
	line-height: 1.2;
}

.zwcl-chip:hover {
	border-color: var(--zcf-petrol, #23434A);
	color: var(--zcf-petrol, #23434A);
}

.zwcl-chip.is-active {
	background: var(--zcf-petrol, #23434A);
	border-color: var(--zcf-petrol, #23434A);
	color: var(--zcf-white, #FFFFFF);
}

.zwcl-chip--reset {
	border-style: dashed;
	color: var(--zcf-muted, #5B6570);
	font-weight: 500;
}

.zwcl-chip__x {
	font-size: 1.1em;
	line-height: 1;
}

/* --- Offene Filterleiste (Karte) --- */

.zwcl-filterbar {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	padding: 0.6rem 0.8rem;
	border: 1px solid var(--zcf-border, #E3DCCF);
	border-radius: var(--radius-lg, 18px);
	background: var(--zcf-cream, #FCFAF5);
}

/* --- Ein Facettenblock: Titel + Optionsreihe --- */

/*
 * Filtergruppen sind <details> (2026-07-21, standardmäßig eingeklappt).
 * Wichtig: KEIN display:flex auf dem <details> — das bricht in einigen
 * Browsern das Auf-/Zuklappen. Block-Layout, Abstand über die Optionsliste.
 */
.zwcl-facetblock {
	display: block;
	padding: 0.4rem 0;
}

.zwcl-facetblock + .zwcl-facetblock {
	border-top: 1px solid var(--zcf-border, #E3DCCF);
}

.zwcl-facetblock__title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	min-height: 40px; /* bequemes Tippziel auf dem Handy */
	font-weight: 700;
	font-size: 0.82rem;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--zcf-muted, #5B6570);
	cursor: pointer;
	user-select: none;
	list-style: none; /* Standard-Dreieck entfernen */
}

.zwcl-facetblock__title::-webkit-details-marker {
	display: none;
}

/* Eigener Klapp-Pfeil rechts; dreht sich beim Öffnen. */
.zwcl-facetblock__title::after {
	content: "";
	flex: 0 0 auto;
	width: 0.5rem;
	height: 0.5rem;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transform-origin: center;
	margin-bottom: 2px;
	transition: transform 0.15s ease;
}

.zwcl-facetblock[open] > .zwcl-facetblock__title::after {
	transform: rotate(-135deg);
	margin-bottom: -2px;
}

.zwcl-facetblock__title:focus-visible {
	outline: 2px solid var(--zcf-petrol, #23434A);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.zwcl-facetblock__title::after { transition: none; }
}

.zwcl-facetblock__options {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin: 0.4rem 0 0;
	padding: 0;
	list-style: none;
}

/* Gemeinsame Option-Basis */
.zwcl-opt {
	position: relative;
	display: inline-flex;
	text-decoration: none;
	color: var(--zcf-ink, #1E252D);
	line-height: 1.2;
	-webkit-tap-highlight-color: transparent;
}

/* Häkchen-Badge (Swatch + Icon), oben rechts */
.zwcl-opt--swatch.is-active::after,
.zwcl-opt--icon.is-active::after {
	content: "";
	position: absolute;
	top: -3px;
	right: -3px;
	width: 1.15rem;
	height: 1.15rem;
	border-radius: 50%;
	background: var(--zcf-petrol, #23434A) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 0.72rem no-repeat;
	box-shadow: 0 0 0 2px var(--zcf-cream, #FCFAF5);
}

/* --- Stil: Farb-Swatch --- */

.zwcl-opt--swatch {
	flex-direction: column;
	align-items: center;
	gap: 0.25rem;
	width: 2.8rem;
	padding: 0.15rem 0;
}

.zwcl-opt__swatch {
	width: 1.75rem;
	height: 1.75rem;
	border-radius: 50%;
	border: 1px solid rgba(30, 37, 45, 0.18);
	box-shadow: inset 0 0 0 3px var(--zcf-white, #FFFFFF), inset 0 0 0 4px rgba(30, 37, 45, 0.06);
	transition: transform 0.12s ease;
}

.zwcl-opt--swatch:hover .zwcl-opt__swatch {
	transform: scale(1.08);
}

.zwcl-opt--swatch.is-active .zwcl-opt__swatch {
	box-shadow: 0 0 0 2px var(--zcf-white, #FFFFFF), 0 0 0 4px var(--zcf-petrol, #23434A);
}

.zwcl-opt--swatch .zwcl-opt__label {
	font-size: 0.72rem;
	text-align: center;
	color: var(--zcf-muted, #5B6570);
}

.zwcl-opt--swatch.is-active .zwcl-opt__label {
	color: var(--zcf-petrol, #23434A);
	font-weight: 600;
}

/* --- Stil: Icon-Kachel --- */

.zwcl-opt--icon {
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.25rem;
	min-width: 3.8rem;
	min-height: 3.8rem;
	padding: 0.45rem 0.55rem;
	border: 1px solid var(--zcf-border, #E3DCCF);
	border-radius: var(--radius, 10px);
	background: var(--zcf-white, #FFFFFF);
	text-align: center;
	transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.zwcl-opt--icon:hover {
	border-color: var(--zcf-petrol, #23434A);
}

.zwcl-opt--icon.is-active {
	background: var(--zcf-petrol, #23434A);
	border-color: var(--zcf-petrol, #23434A);
	color: var(--zcf-white, #FFFFFF);
}

.zwcl-opt__icon {
	width: 22px;
	height: 22px;
	color: var(--zcf-petrol, #23434A);
}

.zwcl-opt--icon.is-active .zwcl-opt__icon {
	color: var(--zcf-white, #FFFFFF);
}

.zwcl-opt--icon .zwcl-opt__label {
	font-size: 0.78rem;
	font-weight: 600;
	line-height: 1.15;
}

.zwcl-opt--icon .zwcl-opt__count {
	font-size: 0.72rem;
	opacity: 0.7;
}

/* Häkchen-Badge auf aktiver (petrol) Kachel weiß hinterlegen */
.zwcl-opt--icon.is-active::after {
	background-color: var(--zcf-white, #FFFFFF);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2323434A' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
	box-shadow: 0 0 0 2px var(--zcf-petrol, #23434A);
}

/* --- Stil: Text-Chip --- */

.zwcl-opt--chip {
	align-items: center;
	gap: 0.4rem;
	min-height: 34px;
	padding: 0.3rem 0.7rem;
	border: 1px solid var(--zcf-border, #E3DCCF);
	border-radius: var(--radius-pill, 999px);
	background: var(--zcf-white, #FFFFFF);
	font-size: 0.86rem;
}

.zwcl-opt--chip:hover {
	border-color: var(--zcf-petrol, #23434A);
}

.zwcl-opt--chip.is-active {
	background: var(--zcf-petrol, #23434A);
	border-color: var(--zcf-petrol, #23434A);
	color: var(--zcf-white, #FFFFFF);
}

.zwcl-opt__check {
	width: 1.05em;
	height: 1.05em;
	border: 1.5px solid currentColor;
	border-radius: 4px;
	position: relative;
	flex: none;
	opacity: 0.5;
}

.zwcl-opt--chip.is-active .zwcl-opt__check {
	opacity: 1;
	background: var(--zcf-white, #FFFFFF);
	border-color: var(--zcf-white, #FFFFFF);
}

.zwcl-opt--chip.is-active .zwcl-opt__check::after {
	content: "";
	position: absolute;
	inset: 12% 26% 20% 26%;
	border-right: 2px solid var(--zcf-petrol, #23434A);
	border-bottom: 2px solid var(--zcf-petrol, #23434A);
	transform: rotate(45deg);
}

.zwcl-opt--chip .zwcl-opt__count {
	font-size: 0.8rem;
	color: var(--zcf-muted, #5B6570);
}

.zwcl-opt--chip.is-active .zwcl-opt__count {
	color: inherit;
	opacity: 0.85;
}

/* --- „Weitere Filter" (eingeklappt) --- */

.zwcl-morefilters {
	margin-top: 0.2rem;
	border-top: 1px solid var(--zcf-border, #E3DCCF);
}

.zwcl-morefilters__summary {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	min-height: 44px;
	padding: 0.5rem 0;
	cursor: pointer;
	font-weight: 600;
	font-size: 0.9rem;
	color: var(--zcf-petrol, #23434A);
	list-style: none;
}

.zwcl-morefilters__summary::-webkit-details-marker {
	display: none;
}

.zwcl-morefilters__summary::after {
	content: "";
	width: 0.5em;
	height: 0.5em;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg) translateY(-2px);
	transition: transform 0.15s ease;
}

.zwcl-morefilters[open] .zwcl-morefilters__summary::after {
	transform: rotate(-135deg);
}

.zwcl-morefilters__body .zwcl-facetblock:first-child {
	border-top: 0;
}

/* --- Aktive Filter unter der Leiste --- */

.zwcl-filters__active {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0.9rem 0 0;
}

.zwcl-chip.is-removable {
	background: var(--zcf-sand, #F6F1E8);
}

/* Zählwert-Basisklasse (auch von Unterkategorie-Chips im Header genutzt). */
.zwcl-facet__count {
	color: var(--zcf-muted, #5B6570);
	font-size: 0.82rem;
}

/* --- Ab Tablet: Titel links, Optionen daneben --- */

@media (min-width: 768px) {
	.zwcl-facetblock {
		flex-direction: row;
		align-items: flex-start;
		gap: 1rem;
	}

	.zwcl-facetblock__title {
		flex: 0 0 7.5rem;
		padding-top: 0.4rem;
	}

	.zwcl-facetblock__options {
		flex: 1;
	}
}

/* Fokus sichtbar (Tastaturbedienung, WCAG 2.4.7). */
.zwcl-filters a:focus-visible,
.zwcl-filters summary:focus-visible {
	outline: 2px solid var(--zcf-camel, #B88A5B);
	outline-offset: 2px;
	border-radius: var(--radius, 10px);
}

@media (prefers-reduced-motion: reduce) {
	.zwcl-opt, .zwcl-opt__swatch { transition: none; }
}
