/**
 * Product filter, pager and phone panel (was FacetWP and FacetWP Flyout, PLAN.md Phase 4).
 * Sizes and spacing copy FacetWP's front.css and Flyout's, so the sidebar looks as before.
 */

/* Filter: FacetWP's checkbox tree */
.rt-filter {
	margin-bottom: 40px;
}

.rt-filter.is-loading {
	opacity: 0.6;
	pointer-events: none;
}

.rt-filter__list,
.rt-filter__children {
	margin: 0;
	padding: 0;
	list-style: none;
}

.rt-filter__children {
	margin-left: 12px;
}

.rt-filter__children.is-collapsed {
	display: none;
}

.rt-filter__item {
	margin: 0;
}

/* A row is FacetWP's .facetwp-checkbox: the box in a 20px margin, then the name and count,
   then the [+] floated right. */
.rt-filter__row {
	position: relative;
	margin-bottom: 4px;
	padding-left: 20px;
	cursor: pointer;
}

.rt-filter__choice {
	margin: 0;
	font-weight: inherit;
	cursor: pointer;
}

/* Clicking anywhere on the row ticks the box, as on FacetWP's rows. */
.rt-filter__choice::after {
	position: absolute;
	inset: 0;
	content: "";
}

/* FacetWP's checkbox.png and checkbox-on.png, drawn: a grey 1px square, filled grey when ticked. */
.rt-filter__check {
	position: absolute;
	top: 50%;
	left: 0;
	box-sizing: border-box;
	width: 14px;
	height: 14px;
	margin: -7px 0 0;
	padding: 0;
	border: 1px solid #6d6d6d;
	border-radius: 0;
	background: linear-gradient(#fff, #f3f3f3);
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.rt-filter__check:checked {
	background: #757575;
	box-shadow: inset 0 0 0 1.4px #fff;
}

.rt-filter__check:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.rt-filter__label {
	padding-right: 5px;
}

.rt-filter .rt-filter__expand,
.rt-filter .rt-filter__expand:hover,
.rt-filter .rt-filter__expand:focus {
	position: relative;
	z-index: 1;
	float: right;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	color: inherit;
	font: inherit;
	line-height: inherit;
	cursor: pointer;
}

.rt-filter__clear {
	display: inline-block;
	margin-top: 6px;
}

/* For visitors without JavaScript only; the noscript style in the form shows it. Three classes,
   to outweigh WooCommerce's ".woocommerce button.button { display: inline-block }". */
.rt-filter .rt-filter__apply.button {
	display: none;
	margin-top: 10px;
	border-radius: 25px;
}

/* Pager: FacetWP's numbers */
.rt-pager {
	margin-bottom: 40px;
}

.rt-pager__page {
	display: inline-block;
	margin-right: 6px;
	padding: 0 4px;
	cursor: pointer;
}

.rt-pager__page.active {
	font-weight: bold;
	cursor: default;
}

.rt-pager__page.dots {
	cursor: default;
}

/* The product list while a new one loads. */
.woocommerce-archive-wrapper.is-loading {
	opacity: 0.6;
}

/* Phone "Filter Products" button, where the sidebar is hidden */
.woocommerce .rt-filter-open {
	display: none;
	margin: 0 auto 20px;
	padding: 10px 26px;
	border-radius: 25px;
}

@media (max-width: 768px) {
	.woocommerce .rt-filter-open {
		display: block;
	}
}

/* Phone panel: FacetWP Flyout's, 300px wide from the left, over a half-dark page */
.rt-filter-panel {
	position: fixed;
	top: 0;
	bottom: 0;
	left: 0;
	box-sizing: border-box;
	width: 300px;
	max-width: 100%;
	height: 100%;
	max-height: none;
	margin: 0;
	padding: 0;
	overflow: hidden;
	border: 0;
	border-right: 1px solid #eee;
	background: #fff;
	color: inherit;
	transform: translateX(-100%);
	transition: transform 400ms ease-in-out;
}

.rt-filter-panel.is-open {
	transform: none;
}

.rt-filter-panel::backdrop {
	background: #000;
	opacity: 0.5;
}

.rt-filter-panel:not(.is-open)::backdrop {
	opacity: 0;
}

.rt-filter-panel .rt-filter-panel__close,
.rt-filter-panel .rt-filter-panel__close:hover,
.rt-filter-panel .rt-filter-panel__close:focus {
	display: block;
	width: 100%;
	margin: 0;
	padding: 10px;
	border: 0;
	border-radius: 0;
	background: none;
	color: inherit;
	font: inherit;
	line-height: 20px;
	text-align: right;
	cursor: pointer;
}

.rt-filter-panel__wrap {
	height: calc(100% - 40px);
	overflow: auto;
}

.rt-filter-panel__content {
	padding: 10px;
}

.rt-filter-locked,
.rt-filter-locked body {
	overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
	.rt-filter-panel {
		transition: none;
	}
}
