/*
 * AG SKIN catalog filters: a sidebar beside the products from 1024px (the theme's layout breakpoint),
 * a "Фільтри" button and a drawer below it. The layout of sesderma-catalog in the theme's look:
 * the ink, hairlines and 20px checkboxes of css/forms.css, Neue Haas Unica headings.
 */

:root {
	--agsc-ink: #201600;
	--agsc-muted: #6f7579;
	--agsc-faint: rgba(144, 150, 154, 0.8);
	--agsc-line: #e6e6e6;
	--agsc-border: rgba(144, 150, 154, 0.6);
	--agsc-chosen: #fff6f1;
	--agsc-side: 260px;
	--agsc-gap: 40px;
	--agsc-row: 48px; /* The sorting field's height (css/forms.css). */
	--agsc-row-gap: 30px; /* Its bottom margin (woocommerce.css): the cards start below it. */
}

/* Page layout: filters and the products (woocommerce.php adds .agsc-layout when there are filters). */

@media (min-width: 1024px) {
	.woo-content-wrapper.agsc-layout {
		display: grid;
		grid-template-columns: var(--agsc-side) minmax(0, 1fr);
		align-items: start;
		gap: var(--agsc-gap);
	}
}

/* Filters */

.agsc {
	color: var(--agsc-ink);
	font-size: 14px;
	line-height: 1.4;
}

.agsc *,
.agsc *::before,
.agsc *::after {
	box-sizing: border-box;
}

/* The theme's button and link styles are reset for our own controls. */
.agsc button {
	margin: 0;
	padding: 0;
	font: inherit;
	color: inherit;
	text-transform: none;
	letter-spacing: normal;
	background: none;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	cursor: pointer;
}

.agsc [hidden] {
	display: none !important;
}

.agsc a,
.agsc a:hover,
.agsc a:focus,
.agsc a:active,
.agsc a:visited {
	color: inherit;
	text-decoration: none;
}

.agsc :focus-visible {
	outline: 2px solid var(--agsc-ink);
	outline-offset: 2px;
}

.agsc-loading {
	opacity: 0.5;
	pointer-events: none;
	transition: opacity 0.15s;
}

/* Head: as high as the sorting row, so its hairline lines up with the cards' top. */

.agsc-filters__head {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: calc(var(--agsc-row) + var(--agsc-row-gap));
	padding-bottom: var(--agsc-row-gap);
	border-bottom: 1px solid var(--agsc-line);
}

.agsc-filters__title {
	font-family: "Neue Haas Unica", sans-serif;
	font-size: 16px;
	font-weight: 500;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.agsc .agsc-filters__reset {
	margin-left: auto;
	font-size: 13px;
	color: var(--agsc-muted);
	text-decoration: underline;
	text-decoration-color: var(--agsc-border);
	text-underline-offset: 4px;
}

.agsc .agsc-filters__reset:hover {
	color: var(--agsc-ink);
}

.agsc .agsc-filters__close,
.agsc .agsc-filters__foot,
.agsc .agsc-open,
.agsc .agsc-backdrop {
	display: none;
}

/* Chosen values: a chip each, a click removes it */

/* .agsc prefix: the theme's reset (css/header.css: ul[class] { margin: 0; padding: 0 }) outranks one class. */
.agsc .agsc-chosen {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 16px 0;
	list-style: none;
	border-bottom: 1px solid var(--agsc-line);
}

.agsc-chosen li {
	margin: 0;
	padding: 0;
}

.agsc .agsc-chip {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 10px 6px 12px;
	font-size: 13px;
	line-height: 1.2;
	background: var(--agsc-chosen);
	border: 1px solid var(--agsc-line);
	border-radius: 999px;
	transition: border-color 0.15s;
}

.agsc-chip::after {
	content: "";
	flex: none;
	width: 10px;
	height: 10px;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%23201600'%3E%3Cpath d='M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.agsc .agsc-chip:hover {
	border-color: var(--agsc-ink);
}

/* Groups */

.agsc-group {
	border-bottom: 1px solid var(--agsc-line);
}

.agsc-group__title {
	position: relative;
	display: block;
	padding: 16px 24px 16px 0;
	font-family: "Neue Haas Unica", sans-serif;
	font-size: 14px;
	font-weight: 500;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	list-style: none;
	cursor: pointer;
	user-select: none;
}

.agsc-group__title::-webkit-details-marker {
	display: none;
}

.agsc-group__title::after {
	content: "";
	position: absolute;
	top: 50%;
	right: 2px;
	width: 14px;
	height: 8px;
	margin-top: -4px;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%23201600'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E") center / contain no-repeat;
	transition: transform 0.2s;
}

.agsc-group[open] > .agsc-group__title::after {
	transform: rotate(180deg);
}

.agsc .agsc-list {
	margin: 0;
	padding: 0 0 14px;
	list-style: none;
}

.agsc-list li {
	margin: 0;
	padding: 0;
}

.agsc-list.is-collapsed li:nth-child(n + 9) {
	display: none;
}

.agsc .agsc-more {
	margin: -6px 0 16px;
	font-size: 13px;
	color: var(--agsc-muted);
	text-decoration: underline;
	text-decoration-color: var(--agsc-border);
	text-underline-offset: 4px;
}

.agsc .agsc-more:hover {
	color: var(--agsc-ink);
}

/* Options: the site's checkbox (css/forms.css) drawn before the label */

.agsc-option {
	position: relative;
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 7px 0 7px 32px;
	font-size: 14px;
	color: var(--agsc-ink);
}

.agsc-option::before {
	content: "";
	position: absolute;
	top: 7px;
	left: 0;
	width: 20px;
	height: 20px;
	border: 1px solid var(--agsc-border);
	border-radius: 6px;
	background: #fff center / 14px no-repeat;
	transition: border-color 0.2s, background-color 0.2s;
}

a.agsc-option:hover::before {
	border-color: var(--agsc-ink);
}

.agsc-option[aria-checked="true"]::before {
	border-color: var(--agsc-ink);
	background-color: var(--agsc-ink);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%23fff'%3E%3Cpath d='M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z'/%3E%3C/svg%3E");
}

.agsc-option[aria-disabled="true"] {
	color: var(--agsc-faint);
	cursor: default;
}

.agsc-option[aria-disabled="true"]::before {
	border-color: var(--agsc-line);
}

.agsc-option__label {
	flex: 1;
	min-width: 0;
	padding-top: 1px;
}

.agsc-option__count {
	flex: none;
	padding-top: 2px;
	font-size: 12px;
	color: var(--agsc-muted);
}

.agsc-option[aria-disabled="true"] .agsc-option__count {
	color: inherit;
}

/* Price range: two fields like the site's own (css/forms.css) and a two-handle slider */

.agsc .agsc-price {
	display: flex;
	flex-direction: column;
	gap: 18px;
	margin: 0;
	padding: 2px 0 22px;
}

.agsc-price__fields {
	display: flex;
	align-items: center;
	gap: 8px;
}

.agsc .agsc-price__field {
	position: relative;
	flex: 1;
	min-width: 0;
	margin: 0;
}

.agsc-price__hint {
	position: absolute;
	top: 50%;
	left: 12px;
	font-size: 13px;
	color: var(--agsc-muted);
	transform: translateY(-50%);
	pointer-events: none;
}

/* The site's field (css/forms.css) is drawn from these variables; only the size differs here. */
.agsc .agsc-price__field input {
	--ags-field-own-h: 44px;
	--ags-field-padding: 0 8px 0 34px;
	--ags-field-font: 14px;
	-moz-appearance: textfield;
	appearance: textfield;
}

.agsc-price__field input::-webkit-outer-spin-button,
.agsc-price__field input::-webkit-inner-spin-button {
	margin: 0;
	-webkit-appearance: none;
}

.agsc .agsc-price__field input:hover {
	--ags-field-line: var(--ags-field-border);
}

.agsc-price__slider {
	position: relative;
	height: 20px;
	margin: 0 10px;
}

.agsc-price__track {
	position: absolute;
	top: 50%;
	left: 0;
	right: 0;
	height: 2px;
	margin-top: -1px;
	border-radius: 2px;
	background: linear-gradient(to right, var(--agsc-line) var(--from, 0%), var(--agsc-ink) var(--from, 0%), var(--agsc-ink) var(--to, 100%), var(--agsc-line) var(--to, 100%));
}

/* The inputs overhang by half a thumb, so the thumbs' centres meet the track's ends. */
.agsc .agsc-price__slider input[type="range"] {
	position: absolute;
	top: 0;
	left: -10px;
	width: calc(100% + 20px);
	height: 20px;
	margin: 0;
	padding: 0;
	background: none;
	border: 0;
	pointer-events: none;
	-webkit-appearance: none;
	appearance: none;
}

.agsc-price__slider input[type="range"]::-webkit-slider-runnable-track {
	background: none;
}

.agsc-price__slider input[type="range"]::-webkit-slider-thumb {
	width: 20px;
	height: 20px;
	border: 1.5px solid var(--agsc-ink);
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 4px rgba(32, 22, 0, 0.15);
	cursor: grab;
	pointer-events: auto;
	-webkit-appearance: none;
	appearance: none;
}

.agsc-price__slider input[type="range"]::-moz-range-thumb {
	box-sizing: border-box;
	width: 20px;
	height: 20px;
	border: 1.5px solid var(--agsc-ink);
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 4px rgba(32, 22, 0, 0.15);
	cursor: grab;
	pointer-events: auto;
}

.agsc-price__slider input[type="range"]::-moz-range-track {
	background: none;
}

.agsc-price__slider input[type="range"]:active::-webkit-slider-thumb {
	cursor: grabbing;
}

/* Without JS the range is sent by the button; with JS it applies by itself. */
.agsc .agsc-price__apply {
	align-self: flex-start;
	padding: 8px 16px;
	font-size: 13px;
	border: 1px solid var(--agsc-border);
	border-radius: 12px;
}

.agsc .agsc-price.is-live .agsc-price__apply {
	display: none;
}

/* Below 1024px: "Фільтри" beside the sorting, the filters in a drawer */

@media (max-width: 1023px) {
	.agsc .agsc-open {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		gap: 8px;
		width: calc(50% - 6px);
		height: var(--agsc-row);
		margin-bottom: 12px;
		padding: 0 16px;
		font-size: 14px;
		color: var(--agsc-ink);
		background: #fff;
		border: 1px solid var(--agsc-border);
		border-radius: 12px;
		transition: border-color 0.2s;
	}

	.agsc .agsc-open:hover {
		border-color: var(--agsc-ink);
	}

	.agsc-open__icon {
		flex: none;
		width: 20px;
		height: 20px;
	}

	.agsc-open__count {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-width: 20px;
		height: 20px;
		padding: 0 6px;
		font-size: 12px;
		color: #fff;
		background: var(--agsc-ink);
		border-radius: 10px;
	}

	/* The sorting form (in #primary, after the filters) goes up into the button's row. */
	.agsc-layout #primary .woocommerce-ordering {
		width: calc(50% - 6px);
		margin: calc(-1 * (var(--agsc-row) + 12px)) 0 24px auto;
	}

	.agsc-layout #primary .woocommerce-ordering select.orderby {
		width: 100%;
		min-width: 0;
	}

	.agsc-filters {
		position: fixed;
		z-index: 2147483001; /* Above the floating cart and chat buttons. */
		top: 0;
		bottom: 0;
		left: 0;
		display: flex;
		flex-direction: column;
		width: min(88vw, 380px);
		background: #fff;
		box-shadow: 0 0 40px rgba(32, 22, 0, 0.2);
		transform: translateX(-105%);
		visibility: hidden;
		transition:
			transform var(--ags-close, 0.3s) var(--ags-ease-close, ease),
			visibility 0s linear var(--ags-close, 0.3s);
	}

	/* The theme's motion tokens (css/pages.css): the drawer and its backdrop as the cart's, both ways. */
	.agsc-filters.is-open {
		transform: none;
		visibility: visible;
		transition: transform var(--ags-open, 0.45s) var(--ags-ease, ease-out);
	}

	.agsc-filters__head {
		min-height: 0;
		padding: 16px 20px;
	}

	.agsc .agsc-filters__close {
		position: relative;
		display: block;
		flex: none;
		width: 32px;
		height: 32px;
		margin-left: auto;
	}

	.agsc .agsc-filters__reset + .agsc-filters__close {
		margin-left: 0;
	}

	/* The cross: Phosphor's x, as the theme's icons */
	.agsc-filters__close::before {
		content: "";
		position: absolute;
		top: 50%;
		left: 50%;
		width: 22px;
		height: 22px;
		background: var(--agsc-ink);
		-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%23000'%3E%3Cpath d='M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z'/%3E%3C/svg%3E") center / contain no-repeat;
		mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%23000'%3E%3Cpath d='M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z'/%3E%3C/svg%3E") center / contain no-repeat;
		transform: translate(-50%, -50%);
	}

	.agsc-filters__body {
		flex: 1;
		overflow-y: auto;
		overscroll-behavior: contain;
		padding: 0 20px;
	}

	.agsc .agsc-filters__foot {
		display: block;
		padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
		border-top: 1px solid var(--agsc-line);
	}

	.agsc .agsc-filters__show {
		width: 100%;
		height: 52px;
		font-family: "Neue Haas Unica", sans-serif;
		font-size: 14px;
		font-weight: 500;
		letter-spacing: 0.04em;
		text-transform: uppercase;
		color: #fff;
		background: var(--agsc-ink);
		border-radius: 12px;
	}

	.agsc .agsc-filters__show:hover,
	.agsc .agsc-filters__show:focus {
		color: #fff;
		background: var(--agsc-ink);
	}

	.agsc .agsc-backdrop {
		position: fixed;
		z-index: 2147483000;
		inset: 0;
		display: block;
		background: rgba(32, 22, 0, 0.4);
		opacity: 0;
		visibility: hidden;
		transition:
			opacity var(--ags-close, 0.3s) var(--ags-ease-close, ease),
			visibility 0s linear var(--ags-close, 0.3s);
	}

	.agsc .agsc-backdrop.is-open {
		opacity: 1;
		visibility: visible;
		transition: opacity var(--ags-open, 0.45s) var(--ags-ease, ease-out);
	}

	html.agsc-locked,
	html.agsc-locked body {
		overflow: hidden;
	}

	.agsc-option {
		padding-top: 10px;
		padding-bottom: 10px;
	}

	.agsc-option::before {
		top: 10px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.agsc-filters,
	.agsc .agsc-backdrop {
		transition: none !important;
	}
}
