/* SPDX-License-Identifier: AGPL-3.0-or-later */
/* Product Filter: neutral styles that take the theme's fonts and colours. Themes override the variables. */
.omg-pf,
.omg-pf-search {
	--omg-pf-accent: currentColor;
	--omg-pf-border: rgba(0, 0, 0, .15);
	--omg-pf-muted: rgba(0, 0, 0, .55);
	--omg-pf-bg: #fff;
	--omg-pf-chip: rgba(0, 0, 0, .06);
	--omg-pf-radius: 4px;
	font-size: .95em;
}

.omg-pf .screen-reader-text,
.omg-pf-search .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

/* !important: theme and WooCommerce button styles (e.g. `.woocommerce button.button`) set display too. */
.omg-pf .omg-pf__open,
.omg-pf .omg-pf__close {
	display: none !important;
}

.omg-pf__head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: .5em;
}

.omg-pf__title {
	font-weight: 700;
	font-size: 1.1em;
}

.omg-pf__filter {
	border: 0;
	border-top: 1px solid var(--omg-pf-border);
	margin: 0;
	padding: .6em 0;
	min-width: 0;
}

.omg-pf__legend {
	padding: 0;
	width: 100%;
	float: left;
}

.omg-pf__legend + * {
	clear: both;
}

.omg-pf__toggle {
	all: unset;
	box-sizing: border-box;
	display: flex;
	justify-content: space-between;
	width: 100%;
	cursor: pointer;
	font-weight: 600;
	padding: .2em 0;
}

.omg-pf__toggle::after {
	content: "";
	width: .5em;
	height: .5em;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	margin: .2em .2em 0 0;
	transition: transform .15s;
}

.omg-pf__filter.is-collapsed .omg-pf__toggle::after {
	transform: rotate(-45deg);
}

.omg-pf__toggle:focus-visible,
.omg-pf a:focus-visible,
.omg-pf input:focus-visible,
.omg-pf select:focus-visible,
.omg-pf button:focus-visible {
	outline: 2px solid var(--omg-pf-accent);
	outline-offset: 2px;
}

.omg-pf__body {
	padding-top: .4em;
}

.omg-pf__list {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 18em;
	overflow-y: auto;
}

.omg-pf__item label {
	display: flex;
	align-items: center;
	gap: .45em;
	padding: .15em 0;
	cursor: pointer;
}

.omg-pf__item.is-empty {
	opacity: .5;
}

.omg-pf__item--depth-1 { padding-left: 1em; }
.omg-pf__item--depth-2 { padding-left: 2em; }
.omg-pf__item--depth-3,
.omg-pf__item--depth-4,
.omg-pf__item--depth-5 { padding-left: 3em; }

.omg-pf__count {
	margin-left: auto;
	color: var(--omg-pf-muted);
	font-size: .85em;
}

/* Buttons and swatches: the checkbox stays (keyboard and screen readers) but is drawn as the chip itself. */
.omg-pf__list--buttons,
.omg-pf__list--swatches {
	display: flex;
	flex-wrap: wrap;
	gap: .35em;
	max-height: none;
}

.omg-pf__list--buttons label,
.omg-pf__list--swatches label {
	position: relative;
	border: 1px solid var(--omg-pf-border);
	border-radius: var(--omg-pf-radius);
	padding: .3em .65em;
	min-width: 2.2em;
	justify-content: center;
}

.omg-pf__list--buttons input,
.omg-pf__list--swatches input {
	position: absolute;
	opacity: 0;
	inset: 0;
	margin: 0;
	cursor: pointer;
}

.omg-pf__list--buttons input:checked + .omg-pf__name,
.omg-pf__list--buttons label:has(input:checked) {
	font-weight: 700;
}

.omg-pf__list--buttons label:has(input:checked),
.omg-pf__list--swatches label:has(input:checked) {
	border-color: var(--omg-pf-accent);
	box-shadow: inset 0 0 0 1px var(--omg-pf-accent);
}

.omg-pf__list--buttons label:has(input:focus-visible),
.omg-pf__list--swatches label:has(input:focus-visible) {
	outline: 2px solid var(--omg-pf-accent);
	outline-offset: 2px;
}

.omg-pf__list--buttons .omg-pf__count,
.omg-pf__list--swatches .omg-pf__count {
	margin-left: .25em;
}

.omg-pf__list--swatches label {
	padding: .2em;
	border-radius: 50%;
	min-width: 0;
}

.omg-pf__swatch {
	display: block;
	width: 1.6em;
	height: 1.6em;
	border-radius: 50%;
	background: var(--omg-pf-chip) center / cover;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}

.omg-pf__list--swatches .omg-pf__count {
	display: none;
}

/* Colour families: a swatch with its name and count, two to a row. */
.omg-pf__list--families {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: .3em .6em;
}

.omg-pf__list--swatches.omg-pf__list--families label {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: .5em;
	border: 0;
	border-radius: var(--omg-pf-radius);
	padding: .2em .3em;
	box-shadow: none;
}

.omg-pf__list--families .omg-pf__swatch {
	flex: none;
	width: 1.4em;
	height: 1.4em;
}

.omg-pf__list--swatches.omg-pf__list--families label:has(input:checked) {
	box-shadow: none;
}

.omg-pf__list--families label:has(input:checked) .omg-pf__swatch {
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--omg-pf-accent);
}

.omg-pf__list--families label:has(input:checked) .omg-pf__name {
	font-weight: 700;
}

.omg-pf__list--families .omg-pf__name {
	line-height: 1.25;
}

.omg-pf__list--swatches.omg-pf__list--families .omg-pf__count {
	display: inline;
	margin-left: auto;
	opacity: .6;
	font-size: .85em;
}

.omg-pf__select,
.omg-pf__text,
.omg-pf__list-search {
	width: 100%;
	box-sizing: border-box;
	max-width: 100%;
}

.omg-pf__list-search {
	margin-bottom: .4em;
}

.omg-pf__more {
	all: unset;
	cursor: pointer;
	text-decoration: underline;
	font-size: .9em;
	margin-top: .3em;
}

/* Two-handle slider: two range inputs over one track. */
.omg-pf__track {
	position: relative;
	height: 1.6em;
}

.omg-pf__track::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: 50%;
	height: 4px;
	margin-top: -2px;
	border-radius: 2px;
	background: linear-gradient(to right, var(--omg-pf-border) var(--lo, 0%), var(--omg-pf-accent) var(--lo, 0%), var(--omg-pf-accent) var(--hi, 100%), var(--omg-pf-border) var(--hi, 100%));
}

.omg-pf__range {
	position: absolute;
	inset: 0;
	width: 100%;
	margin: 0;
	background: none;
	pointer-events: none;
	-webkit-appearance: none;
	appearance: none;
}

.omg-pf__range::-webkit-slider-thumb {
	pointer-events: auto;
	-webkit-appearance: none;
	width: 1.1em;
	height: 1.1em;
	border-radius: 50%;
	background: var(--omg-pf-bg);
	border: 2px solid var(--omg-pf-accent);
	cursor: pointer;
}

.omg-pf__range::-moz-range-thumb {
	pointer-events: auto;
	width: 1em;
	height: 1em;
	border-radius: 50%;
	background: var(--omg-pf-bg);
	border: 2px solid var(--omg-pf-accent);
	cursor: pointer;
}

.omg-pf__inputs {
	display: flex;
	align-items: center;
	gap: .4em;
	margin-top: .3em;
}

.omg-pf__inputs label {
	display: flex;
	align-items: center;
	gap: .15em;
	flex: 1;
}

.omg-pf__num {
	width: 100%;
	min-width: 0;
}

.omg-pf__chips {
	display: flex;
	flex-wrap: wrap;
	gap: .35em;
	margin: .2em 0 .6em;
}

.omg-pf__chip {
	display: inline-flex;
	align-items: center;
	gap: .3em;
	background: var(--omg-pf-chip);
	border-radius: 999px;
	padding: .2em .7em;
	text-decoration: none;
	color: inherit;
	font-size: .9em;
}

.omg-pf__chip-label {
	color: var(--omg-pf-muted);
}

.omg-pf__chip-x {
	font-size: 1.2em;
	line-height: 1;
}

.omg-pf__sisters {
	font-size: .9em;
	margin: 0 0 .6em;
}

.omg-pf__actions {
	display: flex;
	align-items: center;
	gap: 1em;
	padding-top: .8em;
	border-top: 1px solid var(--omg-pf-border);
}

.omg-pf__clear {
	color: inherit;
}

/* With JavaScript and live choices, the button is only needed in the mobile drawer. */
.omg-pf[data-omg-pf*='"autoApply":true'][data-omg-pf-ready] .omg-pf__apply {
	display: none;
}

.omg-pf.is-loading,
.omg-pf-results.is-loading {
	opacity: .55;
	transition: opacity .15s;
	pointer-events: none;
}

.omg-pf__switch {
	display: flex;
	align-items: center;
	gap: .45em;
	cursor: pointer;
}

/* Narrow screens (below the set's breakpoint, see filter.js): the form becomes a drawer opened by "Search". */
.omg-pf.omg-pf--drawer .omg-pf__open {
	display: inline-flex !important;
	align-items: center;
	gap: .4em;
	margin-bottom: 1em;
}


.omg-pf--drawer .omg-pf__form {
	position: fixed;
	z-index: 100000;
	inset: 0 auto 0 0;
	width: min(88vw, 360px);
	overflow-y: auto;
	background: var(--omg-pf-bg);
	padding: 1em 1.2em 6em;
	box-shadow: 0 0 40px rgba(0, 0, 0, .25);
	transform: translateX(-105%);
	transition: transform .2s;
	box-sizing: border-box;
}

.omg-pf--drawer.is-open .omg-pf__form {
	transform: none;
}

.omg-pf.omg-pf--drawer .omg-pf__close {
	all: unset;
	display: block !important;
	cursor: pointer;
	font-size: 1.8em;
	line-height: 1;
	padding: 0 .2em;
}

.omg-pf--drawer .omg-pf__actions {
	position: sticky;
	bottom: -6em;
	background: var(--omg-pf-bg);
	padding-bottom: 1em;
}

.omg-pf--drawer .omg-pf__apply {
	display: inline-block !important;
}

.omg-pf-locked,
.omg-pf-locked body {
	overflow: hidden;
}

/* Header search. */
.omg-pf-search--menu {
	position: relative;
}

.omg-pf-search__toggle {
	cursor: pointer;
	display: inline-flex !important;
	align-items: center;
	gap: .35em;
}

.omg-pf-search {
	--omg-pf-panel-text: #222;
}

.omg-pf-search .omg-pf-search__panel a.omg-pf-search__mine {
	color: var(--omg-pf-panel-text) !important;
	background: none !important;
	padding: 0 !important;
	text-decoration: underline;
	font-size: .9em;
}

.omg-pf-search__field input[type="search"] {
	border: 1px solid var(--omg-pf-border);
	padding: .5em .7em;
}

.omg-pf-search__panel {
	position: absolute;
	right: 0;
	top: 100%;
	z-index: 9999;
	background: var(--omg-pf-bg);
	color: var(--omg-pf-panel-text);
	padding: .8em;
	border-radius: var(--omg-pf-radius);
	box-shadow: 0 8px 30px rgba(0, 0, 0, .18);
	min-width: 280px;
	text-align: left;
}

.omg-pf-search__form {
	display: flex;
	flex-wrap: wrap;
	gap: .4em;
	align-items: center;
}

.omg-pf-search__field {
	flex: 1 1 6em;
}

.omg-pf-search__field--text {
	flex-basis: 100%;
}

.omg-pf-search__field select,
.omg-pf-search__field input {
	width: 100%;
	box-sizing: border-box;
}

.omg-pf-search__go {
	flex: 0 0 auto;
}

.omg-pf-search__mine {
	flex-basis: 100%;
	font-size: .9em;
}

@media (max-width: 768px) {
	.omg-pf-search__panel {
		position: static;
		box-shadow: none;
		min-width: 0;
		padding: .6em 0;
		background: transparent;
		color: inherit;
	}
}
