/*
 * Archive filters (afb/archive-filters, post-list part): look of the former `category__form` form.
 * Mobile: full-width sort and "Filters" button, full-screen panel. Desktop (990px): 265px column to the
 * right of the cards, sort above the cards, collapsible groups on a grey background.
 */
.category__filters.wp-block-afb-archive-filters {
	width: 100vw;
	margin: 0 calc(-1 * var(--wp--preset--spacing--l)) var(--wp--preset--spacing--m);
	padding: 0 1rem;
	font-size: var(--wp--preset--font-size--xs);
}

.category__filters .afb-archive-filters__form {
	display: flex;
	flex-direction: column;
	flex-wrap: nowrap;
	gap: 0;
}

/* Sort. */
.category__filters .afb-archive-filters__sort select {
	appearance: none;
	width: 100%;
	height: 50px;
	margin: 0;
	padding: var(--wp--preset--spacing--m) var(--wp--preset--spacing--xxl) var(--wp--preset--spacing--m) var(--wp--preset--spacing--l);
	border: 0;
	border-radius: 0;
	background: var(--wp--preset--color--afb-white) url("../../svg/dropdown.svg") no-repeat calc(100% - 12px) 50% / 12px 12px;
	color: var(--wp--preset--color--grey-900);
	font: inherit;
	font-size: var(--wp--preset--font-size--m);
	font-weight: 100;
	line-height: 1.5;
	cursor: pointer;
}

/* "Filters" button (mobile, with JavaScript). */
.category__filters .afb-archive-filters__toggle {
	position: relative;
	width: 100%;
	height: 50px;
	padding: var(--wp--preset--spacing--m);
	border: 0;
	background: var(--wp--preset--color--grey-200) url("../../svg/dropdown.svg") no-repeat right 13px top 18px / 12px 12px;
	color: var(--wp--preset--color--afb-black);
	font: inherit;
	font-size: var(--wp--preset--font-size--m);
	font-weight: 700;
	line-height: 1.5;
	text-align: left;
	cursor: pointer;
}

@media (max-width: 989px) {
	.category__filters.is-enhanced .afb-archive-filters__toggle {
		display: block;
	}
}

.category__filters.is-enhanced .afb-archive-filters__panel.is-open {
	background: var(--wp--preset--color--grey-200);
}

.category__filters .afb-archive-filters__panel-header {
	flex-direction: column;
	align-items: center;
	padding: var(--wp--preset--spacing--m);
	font-weight: 700;
}

.category__filters .afb-archive-filters__panel-title {
	margin: 0;
	font-size: var(--wp--preset--font-size--s);
}

.category__filters .afb-archive-filters__close {
	align-self: flex-end;
	order: -1;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font-size: 3rem;
	line-height: 1;
	cursor: pointer;
}

/* "Years" and "Topics" groups: <details>, + / - sign like the former button. */
.category__filters .afb-archive-filters__group {
	margin-bottom: var(--wp--preset--spacing--xl);
	padding: var(--wp--preset--spacing--xs) var(--wp--preset--spacing--xl);
}

.category__filters .afb-archive-filters__legend {
	display: flex;
	align-items: center;
	margin-bottom: var(--wp--preset--spacing--s);
	font-size: 2.8rem;
	font-weight: 700;
	line-height: 1.5;
	list-style: none;
	cursor: pointer;
}

.category__filters .afb-archive-filters__legend::-webkit-details-marker {
	display: none;
}

.category__filters .afb-archive-filters__legend::after {
	content: "+";
	min-width: 30px;
	padding: var(--wp--preset--spacing--m);
	font-size: 2.5rem;
	font-weight: 400;
	line-height: 1.5;
	text-align: center;
}

.category__filters .afb-archive-filters__group[open] > .afb-archive-filters__legend::after {
	content: "-";
}

.category__filters .afb-archive-filters__items {
	display: block;
	columns: 2;
}

.category__filters .afb-archive-filters__item {
	position: relative;
	display: flex;
	align-items: flex-start;
	margin-bottom: var(--wp--preset--spacing--xs);
	break-inside: avoid;
}

.category__filters .afb-archive-filters__item label {
	margin-bottom: var(--wp--preset--spacing--m);
	text-transform: uppercase;
}

.category__filters .afb-archive-filters__submit {
	display: block;
	margin: 0 auto;
	padding: var(--wp--preset--spacing--m) var(--wp--preset--spacing--xl);
	border: 1px solid var(--wp--preset--color--afb-dark-red);
	border-radius: 999em;
	background-color: var(--wp--preset--color--afb-dark-red);
	color: var(--wp--preset--color--afb-white);
	font: inherit;
	font-size: var(--wp--preset--font-size--s);
	font-weight: 500;
	text-transform: uppercase;
	cursor: pointer;
}

@media (min-width: 990px) {
	/* The sort is positioned against `.category__wrapper` (position: relative). */
	.category__filters.wp-block-afb-archive-filters {
		position: static;
		flex: 0 0 265px;
		width: 265px;
		margin: 0 0 0 var(--wp--preset--spacing--m);
		padding: 0;
	}

	.category__filters .afb-archive-filters__form {
		display: block;
	}

	.category__filters .afb-archive-filters__sort {
		position: absolute;
		top: 0;
		right: calc(265px + 2 * var(--wp--preset--spacing--m));
		min-width: 150px;
		transform: translateY(-100%);
	}

	.category__filters .afb-archive-filters__sort select {
		width: auto;
	}

	.category__filters .afb-archive-filters__group {
		box-sizing: border-box;
		max-width: 270px;
		margin-bottom: var(--wp--preset--spacing--xxl);
		padding: var(--wp--preset--spacing--xxl) calc(var(--wp--preset--spacing--l) + var(--wp--preset--spacing--xl));
		background-color: var(--wp--preset--color--grey-200);
	}

	.category__filters .afb-archive-filters__items {
		columns: 1;
	}
}
