/**
 * Object archive filter sidebar + mobile drawer.
 *
 * NOTE: colors, spacing, and the 992px breakpoint below are generic
 * placeholders — swap in your real design tokens / SCSS variables.
 */

.object-filter__drawer-trigger {
	display: none;
	align-items: center;
	gap: 8px;
	margin: 16px 0;
	padding: 10px 16px;
	border: 1px solid #ddd;
	border-radius: 8px;
	background: #fff;
	cursor: pointer;
}

/* Column split (filters/content) now comes from the site's Row/Col grid —
   see object-archive-layout's `Row` class and the sidebar/content `Col-lg-*`
   classes in archive-object.php. align-items: flex-start keeps the two
   columns from stretching to match each other's height, same as the
   previous `align-items: start` on the CSS grid this replaces. */
.object-archive-layout {
	align-items: flex-start;
}

.object-filter-sidebar {
	--object-filter-sticky-offset: calc(
		var(--header-padding-compact) *
		2 +
		42px +
		24px
	);
	position: sticky;
	top: var(--object-filter-sticky-offset);
	/* Leave the same breathing room at the bottom as the top offset gives
	   it, so the sidebar never grows taller than the visible viewport once
	   it's stuck — beyond that it scrolls internally instead of pushing
	   past the fold. */
	max-height: calc(100vh - var(--object-filter-sticky-offset) - 24px);
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 24px;
}

.object-filter__close {
	display: none;
}

.object-filter-group__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 8px;
}

.object-filter-group__title {
	font-size: var(--body2-font-size);
	font-weight: 600;
	margin: 0;
	color: var(--blue-dark);
}

.object-filter-reset {
	background: none;
	border: none;
	cursor: pointer;
	color: #888;
	padding: 4px;
	line-height: 0;
}

.object-filter-reset.is-spinning i {
	display: inline-block;
	animation: object-filter-spin 0.6s linear infinite;
}

@keyframes object-filter-spin {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(-360deg);
	}
}

.object-filter-options {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

/* Must come after the rule above and be more specific, otherwise the
   native [hidden] behavior gets silently overridden by display:flex —
   author CSS always wins over the browser's default hidden styling
   regardless of source order once specificity is higher. */
.object-filter-options[hidden] {
	display: none;
}

.object-filter-option {
	background: none;
	border: none;
	text-align: left;
	padding: 4px 0;
	font-size: var(--body3-font-size);
	color: var(--blue-dark);
	cursor: pointer;
}

.object-filter-option.is-selected {
	color: #4389ca;
	font-weight: 600;
}

.object-filter-show-more {
	margin-top: 6px;
	background: none;
	border: none;
	color: #4389ca;
	font-size: 13px;
	cursor: pointer;
	padding: 0;
}

.object-filter__loader {
	display: flex;
	justify-content: center;
	padding: 24px 0;
}

.object-filter__backdrop {
	display: none;
}

/* --- Mobile: sidebar becomes a drawer --------------------------------- */
@media (max-width: 992px) {
	.object-filter__drawer-trigger {
		display: inline-flex;
		position: fixed;
		left: 16px;
		bottom: 16px;
		margin: 0;
		z-index: 998;
		box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	}

	body.object-filter-drawer-open .object-filter__drawer-trigger {
		display: none;
	}

	.object-filter-sidebar {
		position: fixed;
		top: 0;
		left: 0;
		height: 100%;
		max-height: none;
		width: min(320px, 85vw);
		background: #fff;
		z-index: 1001;
		padding: 64px 24px 24px;
		overflow-y: auto;
		transform: translateX(-100%);
		transition: transform 0.25s ease;
	}

	.object-filter-sidebar.is-open {
		transform: translateX(0);
	}

	.object-filter__close {
		display: block;
		position: absolute;
		top: 16px;
		right: 16px;
		background: none;
		border: none;
		cursor: pointer;
	}

	.object-filter__backdrop {
		display: none;
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, 0.4);
		z-index: 1000;
	}

	body.object-filter-drawer-open .object-filter__backdrop {
		display: block;
	}

	body.object-filter-drawer-open {
		overflow: hidden;
	}
}
