/*!
 * PMA Shop Filters v3 — minimal / architectural filter UI.
 * Light + dark themes, RTL/LTR aware, no gradients, no heavy shadows.
 * Author: Saeed Salimi Shad <saeedsalimi.ir@gmail.com>
 *
 * SPECIFICITY NOTE
 * Nearly every rule below is written as `.pma-sf .pma-sf__thing` rather than
 * `.pma-sf__thing`. That is deliberate. This panel is dropped into a sidebar
 * owned by a commercial theme (Woodmart and friends) whose stylesheets target
 * `.widget button`, `.widget ul li`, `.widget input` and so on with two-class
 * specificity. A single-class rule loses that fight, and the symptoms are
 * exactly the ones this panel used to show: theme grey bands on headings,
 * missing checkbox ticks, doubled chevrons. Two classes wins cleanly without
 * a single !important.
 */

/* =====================================================================
 * 1. Design tokens
 *
 * Every value here is a fallback. The real values arrive as inline custom
 * properties from PHP (PMA_SF_Helpers::css_vars), which is what lets the
 * shop owner repaint the whole panel from the settings screen without a
 * hard-coded colour anywhere in this file.
 * ================================================================== */

.pma-sf,
.pma-sf-bar {
	--pma-panel: #ffffff;
	--pma-surface: #f7f7f7;
	--pma-text: #222222;
	--pma-muted: #737373;
	--pma-line: #e6e6e6;
	--pma-hover: #f3f3f3;
	--pma-accent: #222222;
	--pma-on-accent: #ffffff;

	--pma-radius: 8px;
	--pma-radius-sm: 6px;
	--pma-radius-lg: 12px;
	--pma-radius-sheet: 20px;
	--pma-swatch: 34px;
	--pma-swatch-radius: 6px;

	/* Fallbacks for browsers without color-mix(). */
	--pma-track: #d4d4d4;
	--pma-ring: rgba(34, 34, 34, 0.16);
	--pma-veil: rgba(34, 34, 34, 0.05);

	/* Horizontal breathing room between the panel content and the sidebar
	   edge. One number so every element lines up on the same optical margin. */
	--pma-gut: 14px;
	--pma-tap: 42px;

	/*
	 * Inner spacing, set from the settings screen.
	 *
	 * "start" is the side labels and checkboxes sit on (right in Persian);
	 * "end" is the side chevrons and counts sit on. Both breakpoints arrive
	 * inline from PHP and the media query further down picks which pair is
	 * live — an inline style can't carry a media query of its own.
	 */
	--pma-pad-s: 6px;
	--pma-pad-e: 6px;
	--pma-pad-s-m: 8px;
	--pma-pad-e-m: 8px;

	--pma-ps: var(--pma-pad-s);
	--pma-pe: var(--pma-pad-e);

	--pma-ease: cubic-bezier(0.32, 0.72, 0, 1);
	--pma-fast: 130ms;
	--pma-mid: 200ms;
	--pma-slow: 260ms;
}

@supports (color: color-mix(in srgb, red 50%, blue)) {
	.pma-sf,
	.pma-sf-bar {
		--pma-track: color-mix(in srgb, var(--pma-line) 60%, var(--pma-text) 16%);
		--pma-ring: color-mix(in srgb, var(--pma-text) 16%, transparent);
		--pma-veil: color-mix(in srgb, var(--pma-text) 5%, transparent);
	}
}

/* "auto" theme: swap to the dark palette when the OS asks for it. Each
   surface has its own dark value from PHP — this is never a plain invert. */
@media (prefers-color-scheme: dark) {
	.pma-sf--auto,
	.pma-sf-bar--auto {
		--pma-panel: var(--pma-panel-d, #222222);
		--pma-surface: var(--pma-surface-d, #292929);
		--pma-text: var(--pma-text-d, #f5f5f5);
		--pma-muted: var(--pma-muted-d, #a5a5a5);
		--pma-line: var(--pma-line-d, #3a3a3a);
		--pma-hover: var(--pma-hover-d, #333333);
		--pma-accent: var(--pma-accent-d, #f2eee8);
		--pma-on-accent: var(--pma-on-accent-d, #222222);
	}
}

/* =====================================================================
 * 2. Shell + defensive reset
 * ================================================================== */

.pma-sf {
	box-sizing: border-box;
	position: relative;
	display: block;
	padding: 0 var(--pma-gut);
	font-size: 14px;
	line-height: 1.7;
	color: var(--pma-text);
	-webkit-font-smoothing: antialiased;
	-webkit-tap-highlight-color: transparent;
}

.pma-sf *,
.pma-sf *::before,
.pma-sf *::after,
.pma-sf-bar *,
.pma-sf-bar *::before,
.pma-sf-bar *::after {
	box-sizing: border-box;
}

.pma-sf [hidden],
.pma-sf-bar [hidden] {
	display: none !important;
}

/*
 * No `display` or `align-items` in this blanket reset. `.pma-sf button` is
 * specificity (0,1,1) — higher than a single component class — so putting
 * layout properties here meant the reset quietly beat every component that
 * tried to lay itself out. Each button declares its own display below.
 */
.pma-sf button,
.pma-sf-bar button {
	all: unset;
	box-sizing: border-box;
	cursor: pointer;
	font-family: inherit;
	color: inherit;
}

.pma-sf ul,
.pma-sf li,
.pma-sf-bar ul,
.pma-sf-bar li {
	list-style: none;
	background: none;
	margin: 0;
	padding: 0;
}

.pma-sf li::before,
.pma-sf li::after {
	content: none;
}

.pma-sf svg,
.pma-sf-bar svg {
	display: inline-block;
	vertical-align: middle;
	flex-shrink: 0;
	overflow: visible;
}

.pma-sf input,
.pma-sf-bar input {
	box-sizing: border-box;
	font-family: inherit;
	color: inherit;
}

.pma-sf button:focus-visible,
.pma-sf-bar button:focus-visible {
	outline: 2px solid var(--pma-accent);
	outline-offset: 2px;
	border-radius: var(--pma-radius-sm);
}

.pma-sf--rtl {
	direction: rtl;
	text-align: right;
}

.pma-sf--ltr {
	direction: ltr;
	text-align: left;
}

/*
 * Sidebar width awareness.
 *
 * The script measures the panel's real width with a ResizeObserver and tags
 * it, because a filter panel does not know in advance whether it landed in a
 * 220px Woodmart rail, a 340px sidebar or a full-width phone drawer. A media
 * query can only see the viewport, which is the wrong number entirely — a
 * narrow sidebar on a wide desktop still needs tight spacing.
 */
.pma-sf.is-narrow {
	--pma-gut: 10px;
}

.pma-sf.is-narrow .pma-sf__grouphead,
.pma-sf.is-narrow .pma-sf__row {
	font-size: 13px;
}

.pma-sf.is-wide {
	--pma-gut: 18px;
}

/* =====================================================================
 * 3. Progress bar
 *
 * Two-segment indeterminate pattern: two bars of different width and
 * speed, offset in time, so the loop reset is always masked by the other
 * bar. That is what makes it read as smooth rather than a block sliding
 * back and forth.
 * ================================================================== */

.pma-sf .pma-sf__progress {
	position: absolute;
	inset-inline: 0;
	top: 0;
	height: 2px;
	overflow: hidden;
	background: transparent;
	opacity: 0;
	transition: opacity var(--pma-fast) ease;
	pointer-events: none;
	z-index: 3;
}

.pma-sf--rtl .pma-sf__progress {
	transform: scaleX(-1);
}

.pma-sf.is-loading .pma-sf__progress {
	opacity: 1;
	background: var(--pma-veil);
}

.pma-sf .pma-sf__bar {
	position: absolute;
	top: 0;
	bottom: 0;
	background: var(--pma-accent);
	border-radius: 2px;
	left: -30%;
	width: 30%;
	will-change: left, right;
}

.pma-sf.is-loading .pma-sf__bar--1 {
	animation: pma-indeterminate-1 2s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
}

.pma-sf.is-loading .pma-sf__bar--2 {
	animation: pma-indeterminate-2 2s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;
	animation-delay: 1.1s;
}

@keyframes pma-indeterminate-1 {
	0%   { left: -35%; right: 100%; }
	60%  { left: 100%; right: -90%; }
	100% { left: 100%; right: -90%; }
}

@keyframes pma-indeterminate-2 {
	0%   { left: -200%; right: 100%; }
	60%  { left: 107%;  right: -8%; }
	100% { left: 107%;  right: -8%; }
}

.pma-sf.is-loading .pma-sf__body {
	opacity: 0.55;
	pointer-events: none;
}

.pma-sf .pma-sf__body {
	transition: opacity var(--pma-mid) ease;
}

/* =====================================================================
 * 4. Topbar
 * ================================================================== */

.pma-sf .pma-sf__topbar {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 0 12px;
}

/* No title printed: the row exists only for the reset button, so it stays
   tight and pushes that button to the far edge. */
.pma-sf .pma-sf__topbar.is-untitled {
	justify-content: flex-end;
	padding-top: 12px;
}

.pma-sf .pma-sf__topbar:has(.pma-sf__reset[hidden]):not(:has(.pma-sf__title)):not(:has(.pma-sf__close:not([hidden]))) {
	display: none;
}

.pma-sf .pma-sf__title {
	flex: 1 1 auto;
	min-width: 0;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.6;
	color: var(--pma-text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/*
 * "Clear all" is a real button, not a text link. It sits next to the filter
 * chips and does the same class of job, so it uses the same pill language —
 * a shopper shouldn't have to work out that one of them is clickable.
 */
.pma-sf .pma-sf__reset {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 32px;
	padding: 4px 12px;
	border: 1px solid var(--pma-line);
	border-radius: var(--pma-radius-sm);
	background: var(--pma-panel);
	font: inherit;
	font-size: 12px;
	line-height: 1.6;
	color: var(--pma-muted);
	cursor: pointer;
	transition: background var(--pma-fast) ease, border-color var(--pma-fast) ease,
		color var(--pma-fast) ease;
}

.pma-sf .pma-sf__reset::after {
	content: "";
	width: 9px;
	height: 9px;
	flex: 0 0 auto;
	background: currentColor;
	-webkit-mask: no-repeat center / 9px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1 1l8 8M9 1l-8 8' stroke='%23000' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
	mask: no-repeat center / 9px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1 1l8 8M9 1l-8 8' stroke='%23000' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}

.pma-sf .pma-sf__reset:hover {
	background: var(--pma-hover);
	border-color: var(--pma-track);
	color: var(--pma-text);
}

.pma-sf .pma-sf__close {
	flex: 0 0 auto;
	display: none;
	place-items: center;
	width: 34px;
	height: 34px;
	margin-inline-end: -6px;
	border-radius: var(--pma-radius-sm);
	color: var(--pma-text);
	transition: background var(--pma-fast) ease;
}

.pma-sf .pma-sf__close:hover {
	background: var(--pma-hover);
}

.pma-sf .pma-sf__close svg {
	width: 17px;
	height: 17px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.6;
	stroke-linecap: round;
}

/* Only ever shown inside an off-canvas drawer (the script unhides it). */
.pma-sf .pma-sf__close:not([hidden]) {
	display: inline-grid;
}

/* =====================================================================
 * 5. Active filter chips
 * ================================================================== */

.pma-sf .pma-sf__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 0 0 14px;
	border-bottom: 1px solid var(--pma-line);
	margin-bottom: 2px;
}

.pma-sf .pma-sf__chip,
.pma-sf-bar .pma-sf__chip {
	appearance: none;
	display: inline-flex;
	align-items: center;
	gap: 7px;
	max-width: 100%;
	min-height: 32px;
	padding: 4px 11px;
	border: 1px solid var(--pma-track);
	border-radius: var(--pma-radius-sm);
	background: var(--pma-panel);
	color: var(--pma-text);
	font: inherit;
	font-size: 12px;
	line-height: 1.6;
	cursor: pointer;
	transition: background var(--pma-fast) ease, color var(--pma-fast) ease,
		border-color var(--pma-fast) ease;
}

.pma-sf .pma-sf__chip:hover,
.pma-sf-bar .pma-sf__chip:hover {
	background: var(--pma-hover);
	border-color: var(--pma-text);
}

.pma-sf .pma-sf__chip > span,
.pma-sf-bar .pma-sf__chip > span {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pma-sf .pma-sf__chip::after,
.pma-sf-bar .pma-sf__chip::after {
	content: "";
	width: 10px;
	height: 10px;
	flex: 0 0 auto;
	opacity: 0.55;
	background: currentColor;
	transition: opacity var(--pma-fast) ease;
	-webkit-mask: no-repeat center / 10px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1 1l8 8M9 1l-8 8' stroke='%23000' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
	mask: no-repeat center / 10px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1 1l8 8M9 1l-8 8' stroke='%23000' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}

.pma-sf .pma-sf__chip:hover::after,
.pma-sf-bar .pma-sf__chip:hover::after {
	opacity: 1;
}

/* A chip carrying a colour shows the colour instead of repeating the word. */
.pma-sf .pma-sf__chipdot,
.pma-sf-bar .pma-sf__chipdot {
	width: 12px;
	height: 12px;
	flex: 0 0 auto;
	border-radius: 3px;
	background: var(--pma-dot, transparent);
	box-shadow: inset 0 0 0 1px var(--pma-ring);
}

/* =====================================================================
 * 6. Groups / accordion
 * ================================================================== */

.pma-sf .pma-sf__group {
	border-bottom: 1px solid var(--pma-line);
}

.pma-sf .pma-sf__group:last-child {
	border-bottom: 0;
}

.pma-sf .pma-sf__grouphead-wrap {
	display: block;
	width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	color: inherit;
}

/*
 * The one place !important is earned.
 *
 * Woodmart (and several other commercial themes) hang their own collapse
 * chevron off a ::after on sidebar widget headings, drawn with an icon font.
 * When that font is blocked — a CDN without the right CORS header is the
 * usual cause — the browser falls back to the literal character in the code
 * point, which is why a raw "^" showed up next to our own SVG arrow. There is
 * no specificity that reliably beats every theme's rule for a property that
 * only ever has one correct value here, so this is stated flatly. It is
 * scoped to our own header, so nothing outside the panel is affected.
 */
.pma-sf .pma-sf__grouphead-wrap::before,
.pma-sf .pma-sf__grouphead-wrap::after,
.pma-sf .pma-sf__grouphead::before,
.pma-sf .pma-sf__grouphead::after,
.pma-sf .pma-sf__grouplabel::before,
.pma-sf .pma-sf__grouplabel::after,
.pma-sf .pma-sf__groupmeta::before,
.pma-sf .pma-sf__groupmeta::after {
	content: none !important;
	display: none !important;
}

/* Same reasoning for the grey band themes paint behind a widget heading. */
.pma-sf .pma-sf__group .pma-sf__grouphead-wrap,
.pma-sf .pma-sf__group .pma-sf__grouphead {
	background: transparent !important;
	box-shadow: none !important;
}

.pma-sf .pma-sf__grouphead {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	width: 100%;
	min-height: 48px;
	padding: 14px 0;
	padding-inline-start: var(--pma-ps);
	padding-inline-end: var(--pma-pe);
	border: 0;
	font: inherit;
	font-size: 13.5px;
	/* Headers carry the weight; everything inside them stays regular, so the
	   panel reads as a set of sections rather than a wall of options. */
	font-weight: 600;
	line-height: 1.5;
	color: var(--pma-text);
	cursor: pointer;
	text-align: inherit;
	transition: color var(--pma-fast) ease;
}

.pma-sf .pma-sf__grouphead:hover {
	color: var(--pma-muted);
}

.pma-sf .pma-sf__grouplabel {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pma-sf .pma-sf__groupmeta {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	flex: 0 0 auto;
}

/* Flat counter: a number, not a badge. Reads as information rather than
   another coloured control competing with the options below. */
.pma-sf .pma-sf__groupcount {
	display: inline-block;
	min-width: 0;
	height: auto;
	padding: 0;
	border-radius: 0;
	background: none;
	color: var(--pma-text);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.5;
	font-variant-numeric: tabular-nums;
}

.pma-sf .pma-sf__caret {
	flex: 0 0 auto;
	width: 11px;
	height: 11px;
	fill: none;
	stroke: var(--pma-muted);
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
	transform: rotate(180deg);
	transition: transform var(--pma-slow) var(--pma-ease), stroke var(--pma-fast) ease;
}

.pma-sf .pma-sf__group.is-collapsed .pma-sf__caret {
	transform: rotate(0deg);
}

.pma-sf .pma-sf__grouphead:hover .pma-sf__caret {
	stroke: var(--pma-text);
}

/*
 * Collapse without measuring anything in JavaScript: the body is a grid
 * whose single row animates from 1fr to 0fr. Browsers that don't animate
 * that still get a correct open/closed state, just without the glide.
 */
.pma-sf .pma-sf__groupbody {
	display: grid;
	grid-template-rows: 1fr;
	transition: grid-template-rows var(--pma-slow) var(--pma-ease),
		opacity var(--pma-mid) ease;
	opacity: 1;
}

.pma-sf .pma-sf__groupinner {
	min-height: 0;
	overflow: hidden;
	padding-bottom: 18px;
	visibility: visible;
	transition: visibility 0s;
}

.pma-sf .pma-sf__group.is-collapsed > .pma-sf__groupbody {
	grid-template-rows: 0fr;
	opacity: 0;
}

/* Clipped content stays focusable, so hide it from the tab order once the
   collapse animation has finished. */
.pma-sf .pma-sf__group.is-collapsed .pma-sf__groupinner {
	padding-bottom: 0;
	visibility: hidden;
	transition: visibility 0s linear var(--pma-slow);
}

.pma-sf .pma-sf__group.is-empty-facet {
	display: none;
}

/* =====================================================================
 * 7. Option search
 * ================================================================== */

.pma-sf .pma-sf__search {
	position: relative;
	margin-bottom: 12px;
}

.pma-sf .pma-sf__searchicon {
	position: absolute;
	top: 50%;
	width: 13px;
	height: 13px;
	margin-top: -6.5px;
	opacity: 0.45;
	background: currentColor;
	pointer-events: none;
	-webkit-mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='5' fill='none' stroke='%23000' stroke-width='1.7'/%3E%3Cpath d='M11 11l4 4' stroke='%23000' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E");
	mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='5' fill='none' stroke='%23000' stroke-width='1.7'/%3E%3Cpath d='M11 11l4 4' stroke='%23000' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E");
}

/*
 * Explicit physical left/right per direction rather than logical
 * properties: this is the one spot where inset-inline actually broke (the
 * icon and the placeholder ended up on the same side in the LTR panel).
 */
.pma-sf--rtl .pma-sf__searchicon {
	right: 12px;
	left: auto;
}

.pma-sf--ltr .pma-sf__searchicon {
	left: 12px;
	right: auto;
}

.pma-sf .pma-sf__searchinput {
	width: 100%;
	height: 38px;
	border: 1px solid var(--pma-line);
	border-radius: var(--pma-radius-sm);
	background: var(--pma-surface);
	color: var(--pma-text);
	font: inherit;
	font-size: 13px;
	outline: none;
	box-shadow: none;
	transition: border-color var(--pma-fast) ease, background var(--pma-fast) ease;
	-webkit-appearance: none;
	appearance: none;
}

.pma-sf--rtl .pma-sf__searchinput {
	padding: 0 33px 0 12px;
}

.pma-sf--ltr .pma-sf__searchinput {
	padding: 0 12px 0 33px;
}

.pma-sf .pma-sf__searchinput:focus {
	border-color: var(--pma-text);
	background: var(--pma-panel);
	box-shadow: none;
}

.pma-sf .pma-sf__searchinput::placeholder {
	color: var(--pma-muted);
}

.pma-sf .pma-sf__searchinput::-webkit-search-cancel-button {
	-webkit-appearance: none;
}

/* =====================================================================
 * 8. Option lists — shared
 * ================================================================== */

.pma-sf .pma-sf__list,
.pma-sf .pma-sf__sublist {
	list-style: none;
	margin: 0;
	padding: 0;
}

.pma-sf .pma-sf__list {
	max-height: 300px;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	scrollbar-color: var(--pma-line) transparent;
	scroll-padding: 4px;
}

.pma-sf .pma-sf__list::-webkit-scrollbar {
	width: 4px;
}

.pma-sf .pma-sf__list::-webkit-scrollbar-thumb {
	background: var(--pma-line);
	border-radius: 4px;
}

.pma-sf .pma-sf__sublist {
	padding-inline-start: 18px;
}

.pma-sf .pma-sf__item,
.pma-sf .pma-sf__subwrap {
	list-style: none;
	margin: 0;
	padding: 0;
}

.pma-sf .pma-sf__item.is-hidden,
.pma-sf .pma-sf__item.is-filtered,
.pma-sf .pma-sf__item.is-unavailable {
	display: none;
}

.pma-sf .pma-sf__nomatch {
	margin: 8px 0 0;
	font-size: 12.5px;
	color: var(--pma-muted);
}

/* The hidden native checkbox every option style shares. Locked down hard —
   themes love to re-show or restyle raw checkbox inputs. */
.pma-sf .pma-sf__cb {
	position: absolute;
	width: 1px;
	height: 1px;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	opacity: 0;
	pointer-events: none;
	appearance: none;
	-webkit-appearance: none;
	background: none;
}

.pma-sf .pma-sf__cb::before,
.pma-sf .pma-sf__cb::after {
	content: none;
}

/* =====================================================================
 * 9. Checkbox list
 * ================================================================== */

.pma-sf .pma-sf__row {
	position: relative;
	display: flex;
	align-items: center;
	gap: 11px;
	width: auto;
	min-height: var(--pma-tap);
	margin: 0 -10px;
	padding: 6px 10px;
	padding-inline-start: calc(10px + var(--pma-ps));
	padding-inline-end: calc(10px + var(--pma-pe));
	border: 0;
	border-radius: var(--pma-radius-sm);
	background: none;
	cursor: pointer;
	font-size: 13.5px;
	font-weight: 400;
	line-height: 1.6;
	color: var(--pma-text);
	transition: background var(--pma-fast) ease;
	user-select: none;
	-webkit-user-select: none;
}

/* A whisper of a tint, not a grey slab — the row should feel touched, not
   highlighted. The checkbox border darkening does most of the work. */
.pma-sf .pma-sf__row:hover {
	background: var(--pma-veil);
}

/* Perfectly centred tick, built from an SVG path so it never drifts. */
.pma-sf .pma-sf__box {
	position: relative;
	flex: 0 0 auto;
	display: grid;
	place-items: center;
	width: 18px;
	height: 18px;
	margin: 0;
	padding: 0;
	border: 1.5px solid var(--pma-track);
	border-radius: 4px;
	background: var(--pma-panel);
	transition: background var(--pma-fast) ease, border-color var(--pma-fast) ease,
		transform var(--pma-fast) ease;
}

.pma-sf .pma-sf__box svg {
	width: 12px;
	height: 12px;
	display: block;
	fill: none;
	stroke: var(--pma-on-accent);
	stroke-width: 2.4;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-dasharray: 16;
	stroke-dashoffset: 16;
	transition: stroke-dashoffset var(--pma-mid) var(--pma-ease);
}

.pma-sf .pma-sf__row:hover .pma-sf__box {
	border-color: var(--pma-text);
}

.pma-sf .pma-sf__cb:checked + .pma-sf__box {
	background: var(--pma-accent);
	border-color: var(--pma-accent);
}

.pma-sf .pma-sf__cb:checked + .pma-sf__box svg {
	stroke-dashoffset: 0;
}

.pma-sf .pma-sf__cb:active + .pma-sf__box {
	transform: scale(0.9);
}

.pma-sf .pma-sf__cb:focus-visible + .pma-sf__box {
	outline: 2px solid var(--pma-accent);
	outline-offset: 2px;
}

.pma-sf .pma-sf__swatch {
	flex: 0 0 auto;
	width: 15px;
	height: 15px;
	border: 0;
	border-radius: 3px;
	box-shadow: inset 0 0 0 1px var(--pma-ring);
}

.pma-sf .pma-sf__swatch.is-pale {
	box-shadow: inset 0 0 0 1px var(--pma-track);
}

.pma-sf .pma-sf__name {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pma-sf .pma-sf__cb:checked ~ .pma-sf__name {
	font-weight: 600;
}

.pma-sf .pma-sf__count {
	flex: 0 0 auto;
	font-size: 11.5px;
	color: var(--pma-muted);
	font-variant-numeric: tabular-nums;
}

/* =====================================================================
 * 10. Colour swatches
 *
 * Squares by default: in a ceramics catalogue a square chip reads as a
 * tile sample, which a circle never does. The corner radius is a setting,
 * so a shop can go from hard square to full circle without touching CSS.
 * ================================================================== */

.pma-sf .pma-sf__list--swatch {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	padding: 4px 0 2px;
	max-height: none;
	overflow: visible;
}

.pma-sf .pma-sf__item--swatch {
	display: block;
}

.pma-sf .pma-sf__row--swatch {
	position: relative;
	display: grid;
	place-items: center;
	width: var(--pma-swatch);
	height: var(--pma-swatch);
	min-height: 0;
	margin: 0;
	padding: 0;
	border-radius: var(--pma-swatch-radius);
	background: none;
	transition: transform var(--pma-fast) var(--pma-ease);
}

.pma-sf .pma-sf__row--swatch:hover {
	background: none;
	transform: translateY(-1px);
}

.pma-sf .pma-sf__row--swatch:active {
	transform: scale(0.96);
}

/*
 * The chip carries every visual state itself — fill, outline and the
 * selected ring — driven by a plain sibling selector off the checkbox.
 * Deliberately not :has() on the label, so the selected state is correct in
 * every browser that has ever shipped, with no fallback branch to maintain.
 */
.pma-sf .pma-sf__dot {
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
	border-radius: inherit;
	background: var(--pma-dot, var(--pma-surface));
	box-shadow: inset 0 0 0 1px var(--pma-ring);
	font-size: 12px;
	font-weight: 600;
	color: var(--pma-muted);
	transition: box-shadow var(--pma-mid) var(--pma-ease);
}

/* White / off-white needs a real outline or it vanishes on a white panel. */
.pma-sf .pma-sf__row--swatch.is-pale .pma-sf__dot {
	box-shadow: inset 0 0 0 1px var(--pma-track);
}

/* Selected: a ring standing clear of the chip. The gap is a second shadow
   painted in the panel colour, so nothing around it shifts. */
.pma-sf .pma-sf__row--swatch .pma-sf__cb:checked + .pma-sf__dot {
	box-shadow: 0 0 0 2px var(--pma-panel), 0 0 0 3.5px var(--pma-accent),
		inset 0 0 0 1px var(--pma-ring);
}

.pma-sf .pma-sf__row--swatch.is-pale .pma-sf__cb:checked + .pma-sf__dot {
	box-shadow: 0 0 0 2px var(--pma-panel), 0 0 0 3.5px var(--pma-accent),
		inset 0 0 0 1px var(--pma-track);
}

.pma-sf .pma-sf__row--swatch .pma-sf__cb:focus-visible + .pma-sf__dot {
	outline: 2px solid var(--pma-accent);
	outline-offset: 4px;
}

/* =====================================================================
 * 11. Compact pills — sizes, thicknesses, finishes
 * ================================================================== */

.pma-sf .pma-sf__list--pill {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 4px 0 2px;
	max-height: none;
	overflow: visible;
}

.pma-sf .pma-sf__item--pill {
	display: block;
}

/* The label is a positioning wrapper; the pill itself is the text span, so
   the same sibling-selector trick as the swatches applies. */
.pma-sf .pma-sf__row--pill {
	display: inline-flex;
	width: auto;
	min-height: 0;
	margin: 0;
	padding: 0;
	border-radius: var(--pma-radius-sm);
	background: none;
}

.pma-sf .pma-sf__row--pill:hover {
	background: none;
}

.pma-sf .pma-sf__pilltext {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 36px;
	padding: 5px 14px;
	border: 1px solid var(--pma-line);
	border-radius: var(--pma-radius-sm);
	background: var(--pma-panel);
	font-size: 12.5px;
	font-weight: 500;
	line-height: 1.5;
	color: var(--pma-text);
	white-space: nowrap;
	transition: background var(--pma-fast) ease, border-color var(--pma-fast) ease,
		color var(--pma-fast) ease, transform var(--pma-fast) ease;
}

.pma-sf .pma-sf__row--pill:hover .pma-sf__pilltext {
	border-color: var(--pma-text);
	background: var(--pma-panel);
}

.pma-sf .pma-sf__row--pill:active .pma-sf__pilltext {
	transform: scale(0.97);
}

.pma-sf .pma-sf__cb:checked + .pma-sf__pilltext {
	background: var(--pma-accent);
	border-color: var(--pma-accent);
	color: var(--pma-on-accent);
}

.pma-sf .pma-sf__cb:focus-visible + .pma-sf__pilltext {
	outline: 2px solid var(--pma-accent);
	outline-offset: 2px;
}

/* Dimensions read left-to-right in every language: "۶۰×۱۲۰" must not flip. */
.pma-sf .pma-sf__pilltext.is-numeric {
	direction: ltr;
	unicode-bidi: isolate;
	font-variant-numeric: tabular-nums;
}

/* =====================================================================
 * 12. Show more
 * ================================================================== */

.pma-sf .pma-sf__more {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	margin-top: 14px;
	min-height: 34px;
	padding: 5px 14px;
	border: 1px solid var(--pma-line);
	border-radius: var(--pma-radius-sm);
	background: var(--pma-panel);
	font: inherit;
	font-size: 12.5px;
	font-weight: 500;
	color: var(--pma-text);
	cursor: pointer;
	transition: background var(--pma-fast) ease, border-color var(--pma-fast) ease;
}

.pma-sf .pma-sf__more:hover {
	background: var(--pma-hover);
	border-color: var(--pma-track);
}

.pma-sf .pma-sf__morecaret {
	width: 11px;
	height: 11px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
	transition: transform var(--pma-mid) var(--pma-ease);
}

.pma-sf .pma-sf__more[data-expanded="1"] .pma-sf__morecaret {
	transform: rotate(180deg);
}

/* =====================================================================
 * 13. Price slider
 * ================================================================== */

.pma-sf .pma-sf__price {
	padding-top: 4px;
}

.pma-sf .pma-sf__slider {
	position: relative;
	height: 22px;
	margin: 0 9px 4px;
	direction: ltr;
	touch-action: pan-y;
}

/*
 * In Persian the panel reads right-to-left, so the slider is mirrored: the
 * minimum thumb sits on the RIGHT and dragging it leftwards raises the
 * minimum, exactly like the rest of the interface.
 */
.pma-sf--rtl .pma-sf__slider {
	transform: scaleX(-1);
}

/* Hairline rail. The control should read as a line with two markers, not a
   chunky bar with two knobs. */
.pma-sf .pma-sf__track {
	position: absolute;
	top: 50%;
	inset-inline: -9px;
	height: 2px;
	margin-top: -1px;
	background: var(--pma-line);
	border-radius: 0;
}

.pma-sf .pma-sf__range {
	position: absolute;
	top: 0;
	height: 100%;
	background: var(--pma-accent);
	border-radius: 0;
}

.pma-sf .pma-sf__thumb {
	position: absolute;
	inset-inline: -9px;
	top: 0;
	width: calc(100% + 18px);
	height: 22px;
	margin: 0;
	padding: 0;
	background: none;
	border: 0;
	appearance: none;
	-webkit-appearance: none;
	pointer-events: none;
	direction: ltr;
}

.pma-sf .pma-sf__thumb:focus {
	outline: none;
}

.pma-sf .pma-sf__thumb::-webkit-slider-thumb {
	-webkit-appearance: none;
	pointer-events: auto;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: var(--pma-accent);
	border: 0;
	box-shadow: 0 0 0 3px var(--pma-panel);
	cursor: grab;
	transition: transform var(--pma-fast) ease;
}

.pma-sf .pma-sf__thumb::-webkit-slider-thumb:active {
	transform: scale(1.15);
	cursor: grabbing;
}

.pma-sf .pma-sf__thumb::-moz-range-thumb {
	pointer-events: auto;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: var(--pma-accent);
	border: 0;
	box-shadow: 0 0 0 3px var(--pma-panel);
	cursor: grab;
}

.pma-sf .pma-sf__thumb::-moz-range-track {
	background: none;
	height: 0;
	border: 0;
}

/*
 * No boxes. Two values at the two ends of the rail they belong to read as
 * part of the slider; two bordered cards read as two more form fields.
 */
.pma-sf .pma-sf__pricevals {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
	margin-top: 16px;
}

.pma-sf .pma-sf__pricebox {
	flex: 0 1 auto;
	min-width: 0;
	display: flex;
	align-items: baseline;
	gap: 6px;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
}

.pma-sf .pma-sf__pricebox small {
	flex: 0 0 auto;
	font-size: 11px;
	color: var(--pma-muted);
	line-height: 1.5;
}

.pma-sf .pma-sf__pricebox b {
	font-size: 13px;
	font-weight: 500;
	line-height: 1.5;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	font-variant-numeric: tabular-nums;
	direction: ltr;
	unicode-bidi: plaintext;
}

/* =====================================================================
 * 14. Flag switches
 * ================================================================== */

.pma-sf .pma-sf__switches {
	display: flex;
	flex-direction: column;
	padding: 6px 0 4px;
	border-top: 1px solid var(--pma-line);
}

.pma-sf .pma-sf__switch {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	min-height: 48px;
	margin: 0 -10px;
	padding: 4px 10px;
	padding-inline-start: calc(10px + var(--pma-ps));
	padding-inline-end: calc(10px + var(--pma-pe));
	cursor: pointer;
	font-size: 13.5px;
	font-weight: 400;
	border-radius: var(--pma-radius-sm);
	transition: background var(--pma-fast) ease;
}

.pma-sf .pma-sf__switch:hover {
	background: var(--pma-veil);
}

.pma-sf .pma-sf__switch input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
	appearance: none;
	-webkit-appearance: none;
}

/* Label first, control last — the reading order of a settings screen. */
.pma-sf .pma-sf__slide {
	order: 2;
}

.pma-sf .pma-sf__switchlabel {
	order: 1;
	flex: 1 1 auto;
	min-width: 0;
}

.pma-sf .pma-sf__slide {
	position: relative;
	flex: 0 0 auto;
	width: 34px;
	height: 19px;
	border-radius: 999px;
	background: var(--pma-track);
	transition: background var(--pma-mid) ease;
}

.pma-sf .pma-sf__slide::after {
	content: "";
	position: absolute;
	top: 2.5px;
	inset-inline-start: 2.5px;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
	transition: transform var(--pma-mid) var(--pma-ease);
}

.pma-sf .pma-sf__switch input:checked + .pma-sf__slide {
	background: var(--pma-accent);
}

.pma-sf .pma-sf__switch input:checked + .pma-sf__slide::after {
	background: var(--pma-on-accent);
}

.pma-sf--ltr .pma-sf__switch input:checked + .pma-sf__slide::after {
	transform: translateX(15px);
}

.pma-sf--rtl .pma-sf__switch input:checked + .pma-sf__slide::after {
	transform: translateX(-15px);
}

.pma-sf .pma-sf__switch input:focus-visible + .pma-sf__slide {
	outline: 2px solid var(--pma-accent);
	outline-offset: 2px;
}

/* =====================================================================
 * 15. Apply button + sticky footer
 * ================================================================== */

.pma-sf .pma-sf__actions {
	padding: 16px 0 4px;
}

.pma-sf .pma-sf__apply,
.pma-sf .pma-sf__stickybtn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 48px;
	padding: 12px 16px;
	border: 0;
	border-radius: var(--pma-radius);
	background: var(--pma-accent);
	color: var(--pma-on-accent);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	text-align: center;
	cursor: pointer;
	transition: opacity var(--pma-fast) ease, transform var(--pma-fast) ease;
}

.pma-sf .pma-sf__apply:hover,
.pma-sf .pma-sf__stickybtn:hover {
	opacity: 0.88;
}

.pma-sf .pma-sf__apply:active,
.pma-sf .pma-sf__stickybtn:active {
	transform: scale(0.99);
}

.pma-sf .pma-sf__stickybtn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.pma-sf .pma-sf__stickyghost {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 40px;
	margin-top: 8px;
	border: 1px solid var(--pma-line);
	border-radius: var(--pma-radius-sm);
	background: none;
	font: inherit;
	font-size: 13px;
	color: var(--pma-muted);
	cursor: pointer;
	transition: color var(--pma-fast) ease, border-color var(--pma-fast) ease;
}

.pma-sf .pma-sf__stickyghost:hover {
	color: var(--pma-text);
	border-color: var(--pma-track);
}

.pma-sf .pma-sf__sticky {
	display: none;
}

/* =====================================================================
 * 16. Quick filter bar (rendered above the product grid by the script)
 * ================================================================== */

.pma-sf-bar {
	box-sizing: border-box;
	display: block;
	margin: 0 0 22px;
	font-size: 14px;
	line-height: 1.7;
	color: var(--pma-text);
	-webkit-font-smoothing: antialiased;
}

.pma-sf-bar--rtl {
	direction: rtl;
	text-align: right;
}

.pma-sf-bar--ltr {
	direction: ltr;
	text-align: left;
}

.pma-sf-bar__top {
	display: flex;
	align-items: center;
	gap: 14px;
}

.pma-sf-bar__meta {
	flex: 0 0 auto;
	font-size: 13px;
	color: var(--pma-muted);
	font-variant-numeric: tabular-nums;
}

.pma-sf-bar__spacer {
	flex: 1 1 auto;
}

.pma-sf-bar__chips {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
}

.pma-sf-bar__top + .pma-sf-bar__chips:not([hidden]) {
	margin-top: 14px;
}

.pma-sf-bar__quick {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 22px;
	padding-top: 16px;
	margin-top: 14px;
	border-top: 1px solid var(--pma-line);
}

.pma-sf-bar__group {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.pma-sf-bar__glabel {
	flex: 0 0 auto;
	font-size: 12px;
	color: var(--pma-muted);
}

.pma-sf-bar__opts {
	display: inline-flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px;
}

.pma-sf-bar__opt {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 32px;
	padding: 3px 12px;
	border: 1px solid var(--pma-line);
	border-radius: var(--pma-radius-sm);
	background: var(--pma-panel);
	font-size: 12.5px;
	line-height: 1.5;
	white-space: nowrap;
	transition: background var(--pma-fast) ease, border-color var(--pma-fast) ease,
		color var(--pma-fast) ease;
}

.pma-sf-bar__opt:hover {
	border-color: var(--pma-text);
}

.pma-sf-bar__opt.is-on {
	background: var(--pma-accent);
	border-color: var(--pma-accent);
	color: var(--pma-on-accent);
}

.pma-sf-bar__opt.is-numeric {
	direction: ltr;
	unicode-bidi: isolate;
	font-variant-numeric: tabular-nums;
}

.pma-sf-bar__opt--dot {
	position: relative;
	min-height: 0;
	width: 26px;
	height: 26px;
	padding: 0;
	border: 0;
	border-radius: var(--pma-swatch-radius);
	background: var(--pma-dot, var(--pma-surface));
	box-shadow: inset 0 0 0 1px var(--pma-ring);
}

.pma-sf-bar__opt--dot.is-pale {
	box-shadow: inset 0 0 0 1px var(--pma-track);
}

.pma-sf-bar__opt--dot:hover,
.pma-sf-bar__opt--dot.is-on {
	background: var(--pma-dot, var(--pma-surface));
}

.pma-sf-bar__opt--dot.is-on {
	box-shadow: 0 0 0 2px var(--pma-panel), 0 0 0 3.5px var(--pma-accent),
		inset 0 0 0 1px var(--pma-ring);
}

.pma-sf-bar__opt--rest {
	color: var(--pma-muted);
	font-variant-numeric: tabular-nums;
}

.pma-sf-bar__all {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	min-height: 34px;
	padding: 0 14px;
	margin-inline-start: auto;
	border: 1px solid var(--pma-line);
	border-radius: var(--pma-radius-sm);
	font-size: 12.5px;
	color: var(--pma-text);
	transition: background var(--pma-fast) ease, border-color var(--pma-fast) ease;
}

.pma-sf-bar__all:hover {
	background: var(--pma-hover);
	border-color: var(--pma-track);
}

.pma-sf-bar__all svg {
	width: 14px;
	height: 14px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.6;
	stroke-linecap: round;
}

.pma-sf-bar__clear {
	display: inline-flex;
	align-items: center;
	min-height: 32px;
	padding: 4px 12px;
	border: 1px solid var(--pma-line);
	border-radius: var(--pma-radius-sm);
	font-size: 12px;
	color: var(--pma-muted);
	transition: color var(--pma-fast) ease, background var(--pma-fast) ease,
		border-color var(--pma-fast) ease;
}

.pma-sf-bar__clear:hover {
	color: var(--pma-text);
	background: var(--pma-hover);
	border-color: var(--pma-track);
}

/* Brief highlight when "more filters" points the shopper at the panel. */
.pma-sf.is-flash {
	animation: pma-flash 1.1s ease;
}

@keyframes pma-flash {
	0%, 100% { background: transparent; }
	22%      { background: var(--pma-veil); }
}

/* =====================================================================
 * 17. Results area
 *
 * Just a wrapper the script can swap the contents of. How the products
 * themselves are laid out — columns, gaps, pagination or none — stays
 * entirely with the theme.
 * ================================================================== */

.pma-sf-results {
	position: relative;
	min-height: 120px;
	transition: opacity var(--pma-mid) ease;
}

.pma-sf-grid-loading {
	opacity: 0.45;
	pointer-events: none;
}

.pma-sf-empty {
	width: 100%;
	padding: 56px 20px;
	text-align: center;
	font-size: 15px;
	color: #8a8a8a;
}

.pma-sf-empty b {
	display: block;
	margin-bottom: 6px;
	font-size: 16px;
	color: inherit;
}

.pma-sf-empty small {
	display: block;
	font-size: 13px;
	opacity: 0.8;
}

.pma-sf-count {
	font-variant-numeric: tabular-nums;
}

/* =====================================================================
 * 18. Tablet & mobile
 * ================================================================== */

@media (max-width: 1024px) {
	.pma-sf {
		--pma-tap: 48px;
		--pma-gut: 16px;
		/* Swap in the mobile half of the spacing settings. */
		--pma-ps: var(--pma-pad-s-m);
		--pma-pe: var(--pma-pad-e-m);
		font-size: 15px;
	}

	/* Inside an off-canvas drawer the whole panel scrolls, not each list —
	   otherwise touch scrolling gets trapped in a sub-scroller. */
	.pma-sf .pma-sf__list {
		max-height: none;
		overflow: visible;
	}

	.pma-sf .pma-sf__row {
		padding: 8px 10px;
		font-size: 14.5px;
	}

	.pma-sf .pma-sf__box {
		width: 20px;
		height: 20px;
	}

	.pma-sf .pma-sf__box svg {
		width: 13px;
		height: 13px;
	}

	.pma-sf .pma-sf__pilltext {
		min-height: 42px;
		padding: 6px 16px;
		font-size: 13.5px;
	}

	.pma-sf .pma-sf__grouphead {
		font-size: 14.5px;
		min-height: 56px;
		padding: 16px 0;
	}

	.pma-sf .pma-sf__switch {
		min-height: 56px;
	}

	.pma-sf .pma-sf__caret {
		width: 13px;
		height: 13px;
	}

	/* =================================================================
	 * Flat mobile mode (settings: "حذف فلش و باکس تیک در موبایل")
	 *
	 * An escape hatch for themes whose icon font doesn't survive a CDN or a
	 * minifier. Nothing decorative is drawn at all — no chevron, no tick box
	 * — and the selected row simply keeps the hover tint. Every behaviour
	 * stays identical; only the ornaments go.
	 * ============================================================== */

	.pma-sf--flat .pma-sf__caret,
	.pma-sf--flat .pma-sf__box,
	.pma-sf--flat .pma-sf__morecaret {
		display: none;
	}

	.pma-sf--flat .pma-sf__row {
		gap: 8px;
	}

	/* Works everywhere: the label alone carries the selected state. */
	.pma-sf--flat .pma-sf__cb:checked ~ .pma-sf__name {
		font-weight: 600;
		color: var(--pma-text);
	}

	/* And where :has() is available, the whole row locks to the hover tint —
	   which is the affordance the tick box used to provide. */
	.pma-sf--flat .pma-sf__row:has(.pma-sf__cb:checked) {
		background: var(--pma-hover);
	}

	.pma-sf--flat .pma-sf__group:not(.is-collapsed) > .pma-sf__grouphead-wrap .pma-sf__grouphead {
		color: var(--pma-muted);
	}

	.pma-sf .pma-sf__slider {
		height: 34px;
		margin-inline: 12px;
	}

	.pma-sf .pma-sf__thumb {
		height: 34px;
	}

	.pma-sf .pma-sf__thumb::-webkit-slider-thumb {
		width: 18px;
		height: 18px;
	}

	.pma-sf .pma-sf__thumb::-moz-range-thumb {
		width: 18px;
		height: 18px;
	}

	/* The quick-filter rows are a desktop convenience; on a phone they would
	   push the products below the fold. Chips and the counter stay. */
	.pma-sf-bar__quick {
		display: none;
	}

	.pma-sf-bar {
		margin-bottom: 16px;
	}

	.pma-sf-bar__chips {
		flex-wrap: nowrap;
		overflow-x: auto;
		overscroll-behavior-x: contain;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		padding-bottom: 2px;
		margin-inline: -14px;
		padding-inline: 14px;
		scroll-padding-inline: 14px;
	}

	.pma-sf-bar__chips::-webkit-scrollbar {
		display: none;
	}

	.pma-sf-bar__chips > * {
		flex: 0 0 auto;
	}
}

/*
 * Drawer mode. The .pma-sf-drawer class is added by the script to whichever
 * off-canvas container the panel ends up in — these rules only apply on
 * small screens, where that container really is a drawer.
 */
@media (max-width: 1024px) {
	.pma-sf-drawer {
		-webkit-overflow-scrolling: touch;
		overscroll-behavior: contain;
	}

	.pma-sf-drawer .pma-sf {
		padding: 0 var(--pma-gut) calc(96px + env(safe-area-inset-bottom, 0px));
	}

	/* Header pinned while the options scroll under it. */
	.pma-sf-drawer .pma-sf__topbar {
		position: sticky;
		position: -webkit-sticky;
		top: 2px;
		z-index: 4;
		margin: 0 calc(var(--pma-gut) * -1);
		padding: 14px var(--pma-gut) 13px;
		background: var(--pma-panel);
		border-bottom: 1px solid var(--pma-line);
	}

	.pma-sf-drawer .pma-sf__chips {
		position: sticky;
		position: -webkit-sticky;
		top: 62px;
		z-index: 3;
		margin: 0 calc(var(--pma-gut) * -1);
		padding: 12px var(--pma-gut);
		background: var(--pma-panel);
		border-bottom: 1px solid var(--pma-line);
		flex-wrap: nowrap;
		overflow-x: auto;
		scrollbar-width: none;
	}

	.pma-sf-drawer .pma-sf__chips::-webkit-scrollbar {
		display: none;
	}

	.pma-sf-drawer .pma-sf__chips > * {
		flex: 0 0 auto;
	}

	/* Footer pinned to the bottom edge, always reachable. */
	.pma-sf-drawer .pma-sf__sticky {
		position: sticky;
		position: -webkit-sticky;
		bottom: 0;
		display: block;
		margin: 20px calc(var(--pma-gut) * -1) 0;
		padding: 12px var(--pma-gut) calc(12px + env(safe-area-inset-bottom, 0px));
		background: var(--pma-panel);
		border-top: 1px solid var(--pma-line);
		box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.06);
		z-index: 4;
	}

	.pma-sf-drawer .pma-sf__progress {
		position: sticky;
		position: -webkit-sticky;
		top: 0;
		margin: 0 calc(var(--pma-gut) * -1);
		width: auto;
		inset-inline: 0;
		z-index: 6;
	}

	/*
	 * Bottom-sheet feel: rounded top corners and a drag handle, applied only
	 * when the theme's drawer actually sits on the bottom edge.
	 *
	 * Deliberately no `overflow: hidden` — on most themes this element is the
	 * scroll container and clipping it would silently kill scrolling. The
	 * sticky header rounds its own corners instead.
	 */
	.pma-sf-drawer.pma-sf-sheet,
	.pma-sf-drawer.pma-sf-sheet .pma-sf__topbar {
		border-start-start-radius: var(--pma-radius-sheet, 20px);
		border-start-end-radius: var(--pma-radius-sheet, 20px);
	}

	.pma-sf-drawer.pma-sf-sheet .pma-sf__topbar::before {
		content: "";
		position: absolute;
		top: 6px;
		left: 50%;
		width: 38px;
		height: 4px;
		margin-left: -19px;
		border-radius: 999px;
		background: var(--pma-line);
	}

	.pma-sf-drawer.pma-sf-sheet .pma-sf__topbar {
		padding-top: 20px;
	}
}

/* Small phones */
@media (max-width: 400px) {
	.pma-sf {
		--pma-gut: 14px;
	}

	.pma-sf .pma-sf__pricevals {
		gap: 8px;
	}

	.pma-sf .pma-sf__pricebox {
		flex-direction: column;
		align-items: flex-start;
		gap: 1px;
	}

	.pma-sf .pma-sf__pricebox:last-child {
		align-items: flex-end;
	}

	.pma-sf .pma-sf__pricebox b {
		font-size: 12px;
	}

	.pma-sf .pma-sf__count {
		font-size: 11px;
	}

	.pma-sf .pma-sf__list--swatch {
		gap: 9px;
	}
}

/* =====================================================================
 * 19. Accessibility
 * ================================================================== */

@media (prefers-reduced-motion: reduce) {
	.pma-sf *,
	.pma-sf-bar *,
	.pma-sf-results,
	.pma-sf-grid-loading {
		transition: none !important;
		animation: none !important;
	}

	.pma-sf .pma-sf__groupbody {
		transition: none !important;
	}
}

.pma-sf__sr,
.pma-sf-bar__sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Forced colours (Windows high contrast): keep selection state visible. */
@media (forced-colors: active) {
	.pma-sf .pma-sf__cb:checked + .pma-sf__pilltext,
	.pma-sf-bar__opt.is-on {
		forced-color-adjust: none;
		background: Highlight;
		color: HighlightText;
	}

	.pma-sf .pma-sf__cb:checked + .pma-sf__dot {
		forced-color-adjust: none;
		outline: 2px solid Highlight;
		outline-offset: 2px;
	}

	.pma-sf .pma-sf__cb:checked + .pma-sf__box {
		forced-color-adjust: none;
		background: Highlight;
	}
}
