/*
 * Starfiniti Filters. Colours and fonts come from the theme.
 *
 * A store sets its own look with four custom properties, on `:root` or on `.sffilters-panel`:
 * `--sffilters-accent` (ticked checkboxes, the slider, the main button), `--sffilters-accent-text`
 * (the tick and the text of the main button), `--sffilters-border` (the checkbox outline) and `--sffilters-radius`.
 *
 * Fixed sizes are in pixels and sizes that follow the text in em. None is in rem, because themes set the root
 * font size differently (Bricks uses 10px).
 */

.sffilters-panel {
	display: grid;
	gap: 24px;
	margin: 0 0 24px;
}

.sffilters-filter {
	background: none;
	border: 0;
	margin: 0;
	min-width: 0;
	padding: 0;
}

.sffilters-filter__title {
	background: none;
	font-weight: 600;
	margin: 0 0 8px;
	padding: 0;
}

.sffilters-options {
	list-style: none;
	margin: 0;
	padding: 0;
}

.sffilters-options .sffilters-options {
	margin-left: 24px;
}

.sffilters-option {
	margin: 0;
}

/*
 * A list with options under options is a tree. Every row leaves room for an arrow on its left, and the options
 * under one option fold away behind that arrow. The arrow is the `summary` of a `details` element, so it works
 * without the script. It sits beside the first line of its option.
 */

.sffilters-options--tree .sffilters-option {
	position: relative;
}

.sffilters-options--tree .sffilters-option__control {
	margin-left: 24px;
}

.sffilters-branch__toggle {
	align-items: center;
	border-radius: var(--sffilters-radius, 4px);
	color: inherit;
	cursor: pointer;
	display: flex;
	height: 2em;
	height: calc(1lh + 8px);
	justify-content: center;
	left: 0;
	list-style: none;
	position: absolute;
	top: 0;
	width: 24px;
}

.sffilters-branch__toggle::-webkit-details-marker {
	display: none;
}

.sffilters-branch__toggle::before {
	border-bottom: 1.5px solid;
	border-right: 1.5px solid;
	box-sizing: border-box;
	content: "";
	height: 0.45em;
	transform: translate(-25%, 0) rotate(-45deg);
	transition: transform 0.12s;
	width: 0.45em;
}

.sffilters-branch[open] > .sffilters-branch__toggle::before {
	transform: translate(0, -25%) rotate(45deg);
}

.sffilters-branch__toggle:focus-visible {
	outline: 2px solid var(--sffilters-accent, var(--bde-brand-primary-color, #1a1a1a));
	outline-offset: -2px;
}

.sffilters-option__control {
	align-items: baseline;
	color: inherit;
	cursor: pointer;
	display: flex;
	gap: 9.6px;
	padding: 4px 0;
}

.sffilters-option__control input {
	flex: none;
	margin: 0;
}

/*
 * Checkboxes are drawn here, so they look the same in every browser and take the accent colour of the store.
 * The box sits in the middle of the first line of its label, whatever the font and line height of the store.
 * It stays square where the theme gives every input a padding, and the label takes the colour of the panel.
 */

.sffilters-option__control input[type="checkbox"] {
	-webkit-appearance: none;
	align-self: flex-start;
	appearance: none;
	background: #fff;
	border: 1.5px solid var(--sffilters-border, #767676);
	border-radius: 0.25em;
	box-sizing: border-box;
	cursor: pointer;
	display: inline-grid;
	font-size: inherit;
	height: 1.25em;
	line-height: inherit;
	margin-top: 0.1em;
	margin-top: calc((1lh - 1.25em) / 2);
	min-width: 0;
	padding: 0;
	place-content: center;
	transition: background-color 0.12s, border-color 0.12s, box-shadow 0.12s;
	width: 1.25em;
}

.sffilters-option__control input[type="checkbox"]::before {
	background: var(--sffilters-accent-text, #fff);
	clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0, 43% 62%);
	content: "";
	height: 0.72em;
	transform: scale(0);
	transition: transform 0.12s;
	width: 0.72em;
}

.sffilters-option__control:hover input[type="checkbox"] {
	border-color: var(--sffilters-accent, var(--bde-brand-primary-color, #1a1a1a));
	box-shadow: 0 0 0 3px rgba(128, 128, 128, 0.18);
}

.sffilters-option__control input[type="checkbox"]:checked {
	background: var(--sffilters-accent, var(--bde-brand-primary-color, #1a1a1a));
	border-color: var(--sffilters-accent, var(--bde-brand-primary-color, #1a1a1a));
}

.sffilters-option__control input[type="checkbox"]:checked::before {
	transform: scale(1);
}

.sffilters-option__control input[type="checkbox"]:focus-visible {
	outline: 2px solid var(--sffilters-accent, var(--bde-brand-primary-color, #1a1a1a));
	outline-offset: 2px;
}

.sffilters-option__control:has(input:checked) .sffilters-option__label {
	font-weight: 600;
}

/* Radio buttons are drawn the same way, round, with a dot in the accent colour. */

.sffilters-option__control input[type="radio"] {
	-webkit-appearance: none;
	align-self: flex-start;
	appearance: none;
	background: #fff;
	border: 1.5px solid var(--sffilters-border, #767676);
	border-radius: 50%;
	box-sizing: border-box;
	cursor: pointer;
	display: inline-grid;
	font-size: inherit;
	height: 1.25em;
	line-height: inherit;
	margin-top: 0.1em;
	margin-top: calc((1lh - 1.25em) / 2);
	min-width: 0;
	padding: 0;
	place-content: center;
	transition: border-color 0.12s, box-shadow 0.12s;
	width: 1.25em;
}

.sffilters-option__control input[type="radio"]::before {
	background: var(--sffilters-accent, var(--bde-brand-primary-color, #1a1a1a));
	border-radius: 50%;
	content: "";
	height: 0.65em;
	transform: scale(0);
	transition: transform 0.12s;
	width: 0.65em;
}

.sffilters-option__control:hover input[type="radio"] {
	border-color: var(--sffilters-accent, var(--bde-brand-primary-color, #1a1a1a));
	box-shadow: 0 0 0 3px rgba(128, 128, 128, 0.18);
}

.sffilters-option__control input[type="radio"]:checked {
	border-color: var(--sffilters-accent, var(--bde-brand-primary-color, #1a1a1a));
}

.sffilters-option__control input[type="radio"]:checked::before {
	transform: scale(1);
}

.sffilters-option__control input[type="radio"]:focus-visible {
	outline: 2px solid var(--sffilters-accent, var(--bde-brand-primary-color, #1a1a1a));
	outline-offset: 2px;
}

/* Where the system forces its own colours, the browser draws the checkbox and the radio button. */

@media (forced-colors: active) {
	.sffilters-option__control input[type="radio"] {
		-webkit-appearance: auto;
		appearance: auto;
	}

	.sffilters-option__control input[type="radio"]::before {
		display: none;
	}

	.sffilters-option__control input[type="checkbox"] {
		-webkit-appearance: auto;
		appearance: auto;
	}

	.sffilters-option__control input[type="checkbox"]::before {
		display: none;
	}
}

.sffilters-option__link {
	color: inherit;
	text-decoration: none;
}

.sffilters-option__link:hover .sffilters-option__label,
.sffilters-option__link:focus-visible .sffilters-option__label {
	text-decoration: underline;
}

.sffilters-option__link[aria-current="page"] .sffilters-option__label {
	font-weight: 700;
}

.sffilters-filter__all {
	font-size: 0.875em;
	margin: 0 0 8px;
}

.sffilters-option__label {
	flex: 1;
	min-width: 0;
}

.sffilters-option__count {
	font-size: 0.875em;
	font-variant-numeric: tabular-nums;
	opacity: 0.7;
}

.sffilters-range {
	align-items: center;
	display: flex;
	gap: 8px;
}

.sffilters-range__end {
	flex: 1;
	min-width: 0;
}

.sffilters-range__end input {
	box-sizing: border-box;
	width: 100%;
}

/* Price slider: two range inputs on one track. */

.sffilters-slider {
	color: var(--sffilters-accent, inherit);
	height: 20px;
	margin: 4px 0 12px;
	position: relative;
}

.sffilters-slider::before,
.sffilters-slider::after {
	background: currentColor;
	border-radius: 2px;
	content: "";
	height: 4px;
	margin-top: -2px;
	position: absolute;
	top: 50%;
}

.sffilters-slider::before {
	left: 0;
	opacity: 0.2;
	right: 0;
}

.sffilters-slider::after {
	left: calc(var(--sffilters-from, 0) * (100% - 20px) / 100 + 10px);
	right: calc((100 - var(--sffilters-to, 100)) * (100% - 20px) / 100 + 10px);
}

.sffilters-slider input {
	-webkit-appearance: none;
	appearance: none;
	background: none;
	border: 0;
	color: inherit;
	height: 100%;
	left: 0;
	margin: 0;
	padding: 0;
	pointer-events: none;
	position: absolute;
	top: 0;
	width: 100%;
	z-index: 1;
}

.sffilters-slider input::-webkit-slider-runnable-track {
	-webkit-appearance: none;
	background: none;
	height: 20px;
}

.sffilters-slider input::-moz-range-track {
	background: none;
}

.sffilters-slider input::-webkit-slider-thumb {
	-webkit-appearance: none;
	background: #fff;
	border: 2px solid currentColor;
	border-radius: 50%;
	box-sizing: border-box;
	cursor: pointer;
	height: 20px;
	pointer-events: auto;
	width: 20px;
}

.sffilters-slider input::-moz-range-thumb {
	background: #fff;
	border: 2px solid currentColor;
	border-radius: 50%;
	box-sizing: border-box;
	cursor: pointer;
	height: 20px;
	pointer-events: auto;
	width: 20px;
}

.sffilters-slider input:focus-visible {
	outline: none;
}

.sffilters-slider input:focus-visible::-webkit-slider-thumb {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.sffilters-slider input:focus-visible::-moz-range-thumb {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/*
 * Buttons. A theme that styles `.button` keeps its own look: these rules carry no weight (`:where`),
 * so they only show where the theme has no button style, as in Breakdance or Bricks.
 */

:where(.sffilters-toggle, .sffilters-drawer__show, .sffilters-more__button, .sffilters-apply) {
	appearance: none;
	background: transparent;
	border: 1px solid currentColor;
	border-radius: var(--sffilters-radius, 4px);
	color: inherit;
	cursor: pointer;
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	min-height: 44px;
	padding: 0.6em 1.1em;
	text-decoration: none;
}

:where(.sffilters-drawer__show) {
	background: var(--sffilters-accent, var(--bde-brand-primary-color, #1a1a1a));
	border-color: transparent;
	color: var(--sffilters-accent-text, #fff);
}

/* Bar above the products: the button for small screens and the selected filters. */

.sffilters-bar {
	align-items: center;
	display: none;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 16px;
}

.sffilters-bar--active {
	display: flex;
}

.sffilters-bar .sffilters-toggle {
	display: none;
}

.sffilters-toggle__count {
	border: 1px solid currentColor;
	border-radius: 999px;
	display: inline-block;
	font-size: 0.75em;
	line-height: 1.6;
	min-width: 1.6em;
	padding: 0 0.3em;
	text-align: center;
}

.sffilters-chips {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.sffilters-chips li {
	margin: 0;
}

.sffilters-chip {
	border: 1px solid currentColor;
	border-radius: 999px;
	display: inline-flex;
	font-size: 0.875em;
	gap: 0.4em;
	padding: 0.15em 0.75em;
	text-decoration: none;
}

.sffilters-clear {
	font-size: 0.875em;
}

/* Load more. */

.sffilters-more {
	margin: 24px 0;
	text-align: center;
}

.sffilters-more--busy {
	opacity: 0.6;
	pointer-events: none;
}

.sffilters-hidden {
	display: none !important;
}

/* Small screens: the panel opens as a drawer. */

.sffilters-drawer {
	border: 0;
	bottom: 0;
	box-shadow: 0 0 32px rgba(0, 0, 0, 0.3);
	height: 100%;
	left: 0;
	margin: 0;
	max-height: none;
	max-width: none;
	padding: 0;
	top: 0;
	width: min(384px, 88vw);
}

.sffilters-drawer[open] {
	display: flex;
	flex-direction: column;
}

.sffilters-drawer::backdrop {
	background: rgba(0, 0, 0, 0.5);
}

.sffilters-drawer__head,
.sffilters-drawer__foot {
	flex: none;
	padding: 12px 16px;
}

.sffilters-drawer__head {
	align-items: center;
	border-bottom: 1px solid rgba(128, 128, 128, 0.3);
	display: flex;
	justify-content: space-between;
}

.sffilters-drawer__foot {
	border-top: 1px solid rgba(128, 128, 128, 0.3);
}

.sffilters-drawer__body {
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 16px;
}

.sffilters-drawer__close {
	align-items: center;
	background: none;
	border: 0;
	border-radius: var(--sffilters-radius, 4px);
	color: inherit;
	cursor: pointer;
	display: inline-flex;
	font-size: 28px;
	height: 44px;
	justify-content: center;
	line-height: 1;
	margin: -8px -8px -8px 0;
	padding: 0;
	width: 44px;
}

.sffilters-drawer__show {
	width: 100%;
}

.sffilters-open {
	overflow: hidden;
}

/* The script sets this class below the width where the panel becomes a drawer (768px unless the store changes it). */

.sffilters-mobile .sffilters-bar {
	display: flex;
}

.sffilters-mobile .sffilters-bar .sffilters-toggle {
	align-items: center;
	display: inline-flex;
	gap: 0.4em;
}

.sffilters-mobile .sffilters-panel {
	display: none;
}

.sffilters-mobile .sffilters-drawer .sffilters-panel {
	display: grid;
	margin: 0;
}

.sffilters-results {
	transition: opacity 0.15s;
}

.sffilters-loading .sffilters-results {
	opacity: 0.5;
	pointer-events: none;
}

/*
 * The Breakdance shop element lays the result count, the sorting and the products out itself.
 * The wrapper around them takes that layout over, so they stay where the store put them.
 */

.breakdance-woocommerce > .sffilters-results {
	align-items: inherit;
	display: inherit;
	flex-flow: inherit;
	gap: inherit;
	justify-content: inherit;
	width: 100%;
}

.breakdance-woocommerce > .sffilters-results > :is(.sffilters-bar, .sffilters-more) {
	flex-basis: 100%;
	margin-bottom: 0;
	margin-top: 0;
}

@media (prefers-reduced-motion: reduce) {
	.sffilters-results,
	.sffilters-branch__toggle::before,
	.sffilters-option__control input[type="radio"],
	.sffilters-option__control input[type="radio"]::before,
	.sffilters-option__control input[type="checkbox"],
	.sffilters-option__control input[type="checkbox"]::before {
		transition: none;
	}
}
