/*
 * ArtX filters: the filter bar (a 50px pill row from sm, the 44px row of two
 * outlined controls at xs), the facet popovers, the sort menu, the active chips and the
 * drawer, at the measured geometry (tokens.md: Buttons; Filter bar). Reads
 * tokens.css and base.css. Breakpoints: xs < 768, sm from 768.
 */

/* Bar: sticky under the top of the viewport, the pill row on its top edge */
.artx-filter-bar {
	position: sticky;
	top: 0;
	z-index: 10;
	height: var(--artx-filter-row-height);
	margin-top: var(--artx-space-2);
	background: var(--artx-color-white-100);
}

/* Paint through the page gutters without clipping fixed popovers. */
.artx-filter-bar::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: -2px;
	left: calc(50% - 50vw);
	width: 100vw;
	z-index: -1;
	background: var(--artx-color-white-100);
	pointer-events: none;
}

.artx-filter-bar__row {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
}

.artx-filter-bar__row--sm {
	display: none;
}

.artx-filter-bar__row--xs {
	height: var(--artx-filter-row-height);
	align-items: center;
}

.artx-filter-bar__group {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: var(--artx-filter-gap);
}

/* Reserve the measured auxiliary action slot even when that feature is omitted. */
.artx-filter-bar__row--sm {
	position: relative;
	gap: var(--artx-space-2);
	--artx-filter-right-width: 375.55px;
}

.artx-filter-bar__group--right {
	width: var(--artx-filter-right-width);
	justify-content: flex-end;
}

.artx-filter-bar__row--sm:has([data-artx-overflow-right="true"])::after {
	content: "";
	position: absolute;
	top: 0;
	right: calc(var(--artx-filter-right-width) + var(--artx-space-2));
	width: 60px;
	height: var(--artx-filter-pill-height);
	background: linear-gradient(to right, transparent, var(--artx-color-white-100));
	pointer-events: none;
}

.artx-filter-bar__group--left {
	min-width: 0;
	flex-wrap: nowrap;
	/* Keep the bottom border inside the scroll clip at fractional page positions. */
	padding-bottom: 2px;
	overflow-x: auto;
	scrollbar-width: none;
}

.artx-filter-bar__group--left::-webkit-scrollbar {
	display: none;
}

.artx-filter-bar__group--left > *,
.artx-filter-bar__group--right {
	flex-shrink: 0;
}

.artx-sort__toggle {
	min-width: 193.41px;
}

.artx-filter-bar__scroll {
	display: flex;
	gap: 2px;
}

.artx-filter-bar__scroll[hidden] {
	display: none;
}

.artx-filter-bar__scroll button {
	width: 26px;
	height: var(--artx-filter-pill-height);
	border: var(--artx-hairline);
	border-radius: var(--artx-pill-radius);
	background: var(--artx-color-white-100);
	font-size: 22px;
	line-height: 1;
}

.artx-filter-bar__scroll button:disabled {
	opacity: 0.35;
	cursor: default;
}

.artx-sort__label {
	font-size: var(--artx-type-xs-size);
	line-height: var(--artx-type-xs-size);
}

.artx-filter-bar__icon {
	display: block;
	flex: 0 0 auto;
	width: var(--artx-card-icon-size);
	height: var(--artx-card-icon-size);
	fill: none;
	stroke: currentColor;
}

.artx-filter-bar__enquire .artx-filter-bar__icon,
.artx-filter-bar__row--xs .artx-filter-bar__icon {
	margin-right: var(--artx-space-0-5);
}

/* The sort pill: the arrows 2px inside the padding, 3px before the label (measured ink) */
.artx-sort__toggle .artx-filter-bar__icon {
	width: var(--artx-sort-icon-size);
	height: var(--artx-sort-icon-size);
	margin: 0 var(--artx-sort-icon-gap) 0 var(--artx-sort-icon-lead);
}

/* The sliders icon: a 14px box whose 10px of ink start at the content edge, the label 18px in */
.artx-filter-bar__icon--sliders {
	width: var(--artx-filter-icon-size);
	height: var(--artx-filter-icon-size);
	margin: 0 var(--artx-filter-icon-gap) 0 var(--artx-filter-icon-lead);
}

.artx-filter-bar__row--xs .artx-filter-bar__icon--sliders {
	margin: 0 calc(var(--artx-filter-icon-gap-xs) - 3px) 0 var(--artx-filter-icon-lead-xs);
}

.artx-filter-bar__enquire {
	font-size: var(--artx-type-xs-size);
	line-height: var(--artx-type-xs-size);
	min-width: var(--artx-filter-lead-width);
}

.artx-filter-bar__divider {
	display: block;
	width: 1px;
	height: var(--artx-filter-pill-height);
	margin: 0 calc(var(--artx-filter-divider-gap) - var(--artx-filter-gap)) 0 calc(var(--artx-filter-divider-gap) - var(--artx-filter-gap));
	background: var(--artx-color-black-30);
}

.artx-filter-bar__all .artx-filter-bar__icon {
	stroke: currentColor;
}

.artx-pill__count {
	display: inline-flex;
	align-items: center;
	margin-left: var(--artx-space-0-5);
	color: var(--artx-color-blue-100);
}

.artx-pill__dot {
	margin-right: var(--artx-space-0-5);
}

/* The facet pill's chevron: 12px wide on the pill's content edge, 8px after the label */
.artx-pill__chevron {
	display: block;
	width: var(--artx-pill-chevron-size);
	height: var(--artx-pill-chevron-size);
	margin-left: var(--artx-pill-chevron-gap);
	fill: none;
	stroke: currentColor;
}

.artx-filter,
.artx-sort {
	position: relative;
}

.artx-filter__toggle[aria-expanded="true"] .artx-pill__chevron {
	transform: rotate(180deg);
}

/* The xs row: two controls with icons (outlined as pills in the phone block below) */
.artx-filter-bar__row--xs .artx-button--text {
	display: inline-flex;
	align-items: center;
	color: var(--artx-color-black-100);
}

.artx-filter-bar__row--xs .artx-pill__count {
	font-size: var(--artx-type-xs-size);
}

/* Popovers */
.artx-filter__popover {
	position: fixed;
	top: 0;
	left: 0;
	overflow-y: auto;
	z-index: 30;
	width: var(--artx-filter-popover-width);
	max-width: calc(100vw - 2 * var(--artx-page-padding));
	padding: var(--artx-space-2);
	border: var(--artx-hairline);
	background: var(--artx-color-white-100);
	box-shadow: 0 2px 10px var(--artx-color-shadow-8);
}

.artx-filter__popover[hidden] {
	display: none;
}

.artx-filter-bar__group--right .artx-filter__popover {
	right: auto;
}

.artx-filter__options {
	margin: 0;
	padding: 0;
	border: 0;
}

.artx-filter__option,
.artx-drawer__option {
	display: flex;
	align-items: center;
	min-height: var(--artx-type-sm-line);
	padding: var(--artx-space-0-5) 0;
	font-size: var(--artx-type-sm-size);
	line-height: var(--artx-type-sm-line);
	cursor: pointer;
}

.artx-filter__option input,
.artx-drawer__option input {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	margin: 0 var(--artx-space-1) 0 0;
	accent-color: var(--artx-color-black-100);
}

.artx-filter__option-label,
.artx-drawer__option-label {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.artx-filter__option-count,
.artx-drawer__option-count {
	flex: 0 0 auto;
	margin-left: var(--artx-space-1);
	color: var(--artx-color-black-60);
	font-size: var(--artx-type-xs-size);
	line-height: var(--artx-type-xs-line);
}

.artx-filter__empty,
.artx-drawer__hint {
	color: var(--artx-color-black-60);
	font-size: var(--artx-type-xs-size);
	line-height: var(--artx-type-xs-line);
}

.artx-filter__range {
	flex-wrap: wrap;
	display: flex;
	gap: var(--artx-space-1);
}

.artx-filter__range-field {
	display: block;
	flex: 1 1 0;
	min-width: 0;
}

.artx-filter__range-field--wide {
	flex-basis: 100%;
}

.artx-filter__range-label {
	display: block;
	margin-bottom: var(--artx-space-0-5);
	color: var(--artx-color-black-60);
	font-size: var(--artx-type-xs-size);
	line-height: var(--artx-type-xs-line);
}

.artx-filter__custom {
	margin-top: var(--artx-space-2);
	padding-top: var(--artx-space-2);
	border-top: var(--artx-hairline);
}

.artx-filter__custom .artx-filter__range + .artx-filter__range {
	margin-top: var(--artx-space-1);
}

.artx-filter__custom-heading {
	margin-bottom: var(--artx-space-1);
	font-size: var(--artx-type-xs-size);
	line-height: var(--artx-type-xs-line);
}

.artx-filter__actions {
	display: flex;
	justify-content: space-between;
	gap: var(--artx-space-1);
	margin-top: var(--artx-space-2);
}

/* Sort menu */
.artx-sort__menu {
	min-width: 220px;
	padding: var(--artx-space-1) 0;
	list-style: none;
}

.artx-sort__option {
	display: block;
	padding: var(--artx-space-0-5) var(--artx-space-2);
	color: var(--artx-color-black-60);
	font-size: var(--artx-type-sm-size);
	line-height: var(--artx-type-sm-line);
}

.artx-sort__option.is-current,
.artx-sort__option:hover,
.artx-sort__option:focus-visible {
	color: var(--artx-color-black-100);
}

/* Active chips: a 30px row 20px below the bar */
.artx-chips {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--artx-space-1) var(--artx-chip-gap);
	min-height: var(--artx-chip-height);
	margin-top: var(--artx-space-2);
}

.artx-chip {
	display: inline-flex;
	align-items: center;
	height: var(--artx-chip-height);
	padding: var(--artx-chip-padding);
	border-radius: var(--artx-chip-radius);
	background: var(--artx-color-black-5);
	color: var(--artx-color-black-100);
	font-size: var(--artx-type-xs-size);
	line-height: var(--artx-type-xs-line);
	white-space: nowrap;
}

.artx-chip:hover,
.artx-chip:focus-visible {
	background: var(--artx-color-black-10);
	color: var(--artx-color-black-100);
}

.artx-chip__icon {
	display: block;
	width: var(--artx-pagination-chevron);
	height: var(--artx-pagination-chevron);
	margin-left: var(--artx-space-1);
	fill: none;
	stroke: currentColor;
}

.artx-chips__clear {
	display: inline-flex;
	align-items: center;
	height: var(--artx-chip-height);
	padding: 0 var(--artx-space-2);
	color: var(--artx-color-black-100);
	font-size: var(--artx-type-xs-size);
	line-height: var(--artx-type-xs-line);
}

/* Drawer: full screen at xs, a left panel from sm */
.artx-drawer {
	position: fixed;
	inset: 0;
	z-index: 60;
}

.artx-drawer[hidden] {
	display: none;
}

.artx-drawer__backdrop {
	position: absolute;
	inset: 0;
	background: var(--artx-color-overlay);
}

.artx-drawer__panel {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	width: 100%;
	margin: 0;
	background: var(--artx-color-white-100);
}

.artx-drawer__header {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: space-between;
	height: var(--artx-header-height);
	padding: 0 var(--artx-page-padding);
	border-bottom: var(--artx-hairline);
}

.artx-drawer__title {
	font-size: var(--artx-type-lg-size);
	line-height: var(--artx-type-lg-line);
	letter-spacing: var(--artx-type-lg-tracking);
}

.artx-drawer__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--artx-header-toggle-size);
	height: var(--artx-header-toggle-size);
	margin-right: calc(var(--artx-space-1) * -1);
	color: var(--artx-color-black-100);
}

.artx-drawer__close svg {
	width: var(--artx-header-toggle-icon);
	height: var(--artx-header-toggle-icon);
	fill: none;
	stroke: currentColor;
}

.artx-drawer__body {
	flex: 1 1 auto;
	min-height: 0;
	padding: 0 var(--artx-page-padding);
	overflow-y: auto;
}

.artx-drawer__section {
	border-bottom: var(--artx-hairline);
}

.artx-drawer__summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: var(--artx-disclosure-row-height);
	padding: var(--artx-space-1) 0;
	font-size: var(--artx-type-sm-size);
	line-height: var(--artx-type-sm-line);
	list-style: none;
	cursor: pointer;
}

.artx-drawer__summary::-webkit-details-marker {
	display: none;
}

/* Disclosure geometry belongs to shared ui-controls.css. */

.artx-drawer__options {
	padding: 0 0 var(--artx-space-2);
}

.artx-drawer__options--scroll {
	max-height: 260px;
	overflow-y: auto;
}

.artx-drawer__footer {
	display: flex;
	flex: 0 0 auto;
	gap: var(--artx-space-1);
	padding: var(--artx-space-2) var(--artx-page-padding);
	border-top: var(--artx-hairline);
}

.artx-drawer__clear,
.artx-drawer__submit {
	flex: 1 1 0;
}

body.artx.artx-drawer-open {
	overflow: hidden;
}

@media (min-width: 768px) {
	.artx-filter-bar__row--sm {
		display: flex;
	}

	.artx-filter-bar__row--xs {
		display: none;
	}

	.artx-drawer__panel {
		right: auto;
		width: var(--artx-drawer-width);
		box-shadow: 0 0 30px var(--artx-color-shadow-8);
	}
}

@media (min-width: 768px) and (max-width: 1279px) {
	.artx-filter-bar__row--sm {
		--artx-filter-right-width: 260px;
	}
}

/* On a phone the row's two controls, Enquire and Sort & Filter, are outlined pills with a 44px tap target. */
@media (max-width: 767px) {
	.artx-filter-bar {
		--artx-filter-row-height: 44px;
	}

	.artx-filter-bar__row--xs .artx-filter-bar__enquire-xs,
	.artx-filter-bar__row--xs .artx-filter-bar__sort-filter {
		min-height: 44px;
		padding: 0 var(--artx-space-1);
		border: 1px solid currentColor;
		border-radius: var(--artx-pill-radius);
	}
}

.artx-filter-bar__label {
	display: flex;
	align-items: center;
	height: var(--artx-filter-pill-height);
	color: var(--artx-color-black-60);
	font-size: var(--artx-type-sm-size);
	line-height: var(--artx-type-sm-line);
}

.artx-filter__currency { flex: 0 0 100%; min-width: 0; }
.artx-filter__currency select { width: 100%; }
