.filterpress-facets {
	display: flex;
	flex-wrap: wrap;
	gap: 2rem;
	align-items: flex-start;
}

.filterpress-facets__filters {
	flex: 0 0 220px;
}

/*
 * Off-canvas mobile drawer. Desktop (the default): the toggle button,
 * backdrop, and in-drawer close button are all part of the markup on every
 * viewport (see Shortcode::render()'s docblock for why) but serve no
 * purpose above the mobile breakpoint, where .filterpress-facets__filters
 * is already a normal always-visible sidebar column — so all three are
 * hidden here, and only made visible/functional inside the mobile
 * @media block below.
 */
.filterpress-facets__filter-toggle,
.filterpress-facets__backdrop,
.filterpress-facets__drawer-close {
	display: none;
}

.filterpress-facet {
	border: 0;
	padding: 0;
	margin: 0 0 1.5rem;
}

.filterpress-facet legend,
.filterpress-facet__label {
	display: block;
	font-weight: 600;
	margin-bottom: 0.5rem;
	padding: 0;
}

.filterpress-facet__option {
	display: block;
	margin-bottom: 0.25rem;
	cursor: pointer;
}

.filterpress-facet__option.is-disabled {
	opacity: 0.5;
	cursor: default;
}

/* dropdown_checkboxes: a <details> styled to look like the other facets. */
.filterpress-facet--dropdown {
	border: 1px solid #ddd;
	border-radius: 4px;
	padding: 0.5rem 0.75rem;
}

.filterpress-facet--dropdown summary {
	font-weight: 600;
	cursor: pointer;
}

.filterpress-facet--dropdown .filterpress-facet__panel {
	margin-top: 0.5rem;
}

.filterpress-facet__count {
	display: inline-block;
	min-width: 1.25em;
	padding: 0 0.35em;
	margin-left: 0.35em;
	border-radius: 999px;
	background: #eee;
	font-size: 0.75rem;
	text-align: center;
}

/* date_range: two native date-picker inputs side by side. */
.filterpress-facet__range {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.filterpress-facet__range input {
	width: 0;
	flex: 1 1 0;
	min-width: 0;
	box-sizing: border-box;
}

.filterpress-facet--unavailable .filterpress-facet__empty {
	font-size: 0.8125rem;
	color: #777;
	margin: 0;
}

/*
 * range_slider/rating: a real dual-handle slider — two overlapping native
 * <input type="range"> elements sharing one visible track. Each input is
 * invisible and `pointer-events: none` (including its own runnable-track),
 * with `pointer-events: auto` re-enabled only on the thumb pseudo-element —
 * so clicking anywhere on the (invisible) track never steals a click meant
 * for the other input; only grabbing a visible handle does. This is what
 * makes two independently-draggable thumbs possible without a pointer-event
 * math reimplementation: dragging, touch, and keyboard (Tab + arrow keys)
 * are all native <input type="range"> behaviour, not custom JS.
 */
.filterpress-range-slider {
	position: relative;
	height: 1.75rem;
	margin: 0.25rem 0;
}

.filterpress-range-slider__track {
	position: absolute;
	top: 50%;
	left: 0;
	right: 0;
	height: 4px;
	background: #ddd;
	border-radius: 2px;
	transform: translateY(-50%);
	pointer-events: none;
}

.filterpress-range-slider__fill {
	position: absolute;
	top: 0;
	bottom: 0;
	background: #2aa66c;
	border-radius: 2px;
}

.filterpress-range-slider__input {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	background: transparent;
	pointer-events: none;
	-webkit-appearance: none;
	appearance: none;
}

.filterpress-range-slider__input:focus {
	outline: none;
}

.filterpress-range-slider__input::-webkit-slider-runnable-track {
	-webkit-appearance: none;
	background: transparent;
	height: 100%;
}

.filterpress-range-slider__input::-webkit-slider-thumb {
	-webkit-appearance: none;
	pointer-events: auto;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #2aa66c;
	border: 2px solid #fff;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
	cursor: pointer;
}

.filterpress-range-slider__input:focus::-webkit-slider-thumb {
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25), 0 0 0 4px rgba(42, 166, 108, 0.35);
}

.filterpress-range-slider__input::-moz-range-track {
	background: transparent;
	border: none;
	height: 100%;
}

.filterpress-range-slider__input::-moz-range-thumb {
	pointer-events: auto;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #2aa66c;
	border: 2px solid #fff;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
	cursor: pointer;
}

.filterpress-range-slider__input:focus::-moz-range-thumb {
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25), 0 0 0 4px rgba(42, 166, 108, 0.35);
}

.filterpress-range-slider__input::-moz-focus-outer {
	border: 0;
}

.filterpress-range-slider__values {
	display: flex;
	justify-content: space-between;
	font-size: 0.8125rem;
	color: #555;
	margin-top: 0.25rem;
}

.filterpress-facets__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 0.75rem;
}

.filterpress-facets__status {
	font-size: 0.875rem;
	color: #555;
	margin: 0;
}

.filterpress-facets__sort {
	font-size: 0.875rem;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.filterpress-facets__results {
	flex: 1 1 320px;
	min-width: 0;
}

.filterpress-facets__list {
	/*
	 * Sorting never reorders these DOM nodes (see Shortcode::results_markup()
	 * and filterpress-facets.js's renderResults()) — every item keeps a fixed
	 * position in the markup and gets an inline CSS `order` reflecting the
	 * current sort, so a filter/sort round trip only ever toggles [hidden]
	 * and rewrites `order`, never touches innerHTML.
	 */
	display: flex;
	flex-direction: column;
	list-style: none;
	margin: 0;
	padding: 0;
}

.filterpress-facets__list li {
	padding: 0.5rem 0;
	border-bottom: 1px solid #eee;
}

.filterpress-facets__list li[hidden] {
	display: none;
}

/*
 * Off-canvas filter drawer, mobile only. JS (filterpress-facets.js's
 * openDrawer()/closeDrawer()) toggles one class,
 * .filterpress-facets--drawer-open, on the root [data-filterpress-root]
 * element — every visual state below (drawer slide, backdrop, body scroll
 * lock) derives from that one class, so there is exactly one thing to keep
 * in sync between JS and CSS instead of several independently-toggled
 * classes drifting apart.
 */
@media (max-width: 768px) {
	.filterpress-facets__filter-toggle {
		display: inline-flex;
		align-items: center;
		gap: 0.5rem;
		margin-bottom: 1rem;
		padding: 0.5rem 1rem;
		border: 1px solid #ccc;
		border-radius: 4px;
		background: #fff;
		font: inherit;
		cursor: pointer;
	}

	.filterpress-facets__filter-badge {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-width: 1.25em;
		height: 1.25em;
		padding: 0 0.35em;
		border-radius: 999px;
		background: #1d2327;
		color: #fff;
		font-size: 0.75rem;
		line-height: 1;
	}

	.filterpress-facets__filter-badge[hidden] {
		display: none;
	}

	.filterpress-facets__backdrop {
		display: block;
		position: fixed;
		inset: 0;
		background: rgba( 0, 0, 0, 0.4 );
		z-index: 1000;
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.2s ease;
	}

	.filterpress-facets__filters {
		position: fixed;
		top: 0;
		left: 0;
		z-index: 1001;
		width: min( 85vw, 320px );
		height: 100%;
		overflow-y: auto;
		flex-basis: auto;
		margin: 0;
		padding: 3.5rem 1.25rem 1.5rem;
		background: #fff;
		box-shadow: 2px 0 12px rgba( 0, 0, 0, 0.15 );
		transform: translateX( -100% );
		transition: transform 0.25s ease;
	}

	.filterpress-facets__drawer-close {
		display: block;
		position: absolute;
		top: 0.5rem;
		right: 0.75rem;
		width: 2rem;
		height: 2rem;
		border: 0;
		background: transparent;
		font-size: 1.75rem;
		line-height: 1;
		cursor: pointer;
	}

	.filterpress-facets--drawer-open .filterpress-facets__backdrop {
		opacity: 1;
		pointer-events: auto;
	}

	.filterpress-facets--drawer-open .filterpress-facets__filters {
		transform: translateX( 0 );
	}
}
