/* Controls, typography, colours and containers inherit the active theme. */

.puf-filter-grid {
	display: grid;
	gap: 1rem;
}

.puf-filter {
	min-inline-size: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.puf-filter > legend {
	padding: 0;
}

.puf-responsive-variant[hidden] {
	display: none !important;
}

.puf-filter :where(input, select, textarea, button) {
	box-sizing: border-box;
	font: inherit;
}

.puf-filter :where(select, input[type="text"], input[type="search"], input[type="number"], input[type="date"]) {
	max-inline-size: 100%;
	vertical-align: middle;
}

.puf-options {
	display: grid;
	gap: 0.5rem;
}

.puf-options-labels,
.puf-options-color {
	display: flex;
	flex-wrap: wrap;
}

.puf-options-labels {
	flex-direction: row;
	align-items: center;
	gap: 0.5rem;
}

.puf-option,
.puf-toggle,
.puf-range-bound {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.puf-option,
.puf-toggle {
	cursor: pointer;
}

.puf-option :where(input[type="checkbox"], input[type="radio"]),
.puf-toggle input[type="checkbox"] {
	flex: 0 0 auto;
	margin: 0;
	vertical-align: middle;
}

.puf-range {
	display: grid;
	gap: 0.5rem;
}

.puf-range-input {
	min-inline-size: 0;
	flex: 1 1 auto;
}

.puf-option-labels,
.puf-option-color {
	inline-size: max-content;
	max-inline-size: 100%;
}

.puf-option-labels {
	position: relative;
	display: inline-flex;
	flex: 0 0 auto;
	min-block-size: 2.25em;
	padding: 0.45em 0.8em;
	border: 1px solid currentColor;
	border-radius: 0.25em;
	line-height: 1.2;
	white-space: nowrap;
}

.puf-option-labels:hover {
	opacity: 0.85;
}

.puf-option-labels:focus-within {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.puf-option-labels .puf-choice-input {
	position: absolute;
	inline-size: 1px;
	block-size: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

.puf-option-labels.is-selected,
.puf-option-labels:has(.puf-choice-input:checked) {
	box-shadow: inset 0 0 0 2px currentColor;
	font-weight: 600;
}

.puf-swatch {
	display: inline-block;
	inline-size: 1.25em;
	block-size: 1.25em;
	flex: 0 0 auto;
	border: 1px solid currentColor;
	border-radius: 50%;
}

/* Selected filters shortcode: one compact pill for every selected value. */
.puf-chips {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
}

.puf-chip,
.puf-chips-reset {
	-webkit-appearance: none;
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5em;
	min-block-size: 2.5em;
	max-inline-size: 100%;
	margin: 0;
	padding: 0.5em 1em;
	border: 1px solid currentColor;
	border-radius: 999px;
	background: transparent;
	font: inherit;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
}

.puf-chip {
	color: var(--ultrafilter-selected-color, #2388b4);
}

.puf-chips-reset {
	color: var(--ultrafilter-reset-color, #cf7477);
}

.puf-chip:hover,
.puf-chips-reset:hover {
	opacity: 0.82;
}

.puf-chip:focus-visible,
.puf-chips-reset:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.puf-chip-label {
	min-inline-size: 0;
	overflow-wrap: anywhere;
}

.puf-chip-remove {
	flex: 0 0 auto;
	font-size: 1.15em;
	font-weight: 600;
	line-height: 1;
}

@media (max-width: 767px) {
	.puf-filter :where(select, input[type="text"], input[type="search"], input[type="number"], input[type="date"]) {
		width: 100%;
		inline-size: 100%;
	}
}

@media (max-width: 480px) {
	.puf-chips {
		gap: 0.5rem;
	}

	.puf-chip,
	.puf-chips-reset {
		padding: 0.45em 0.8em;
	}
}
