/* The facet rail — a drawer on a phone, a column on a desktop.
 *
 * Every value here is a theme token or a plain measurement. No colour literal,
 * no font name, no store: the rail inherits whatever palette the store's
 * global styles set, which is what makes one stylesheet right on fifty stores
 * (PATTERN-RULE.md).
 *
 * The desktop layout is the UA's own `details` rule being overridden, not a
 * script: `.st-facet-drawer:not([open]) > :not(summary)` is an author rule and
 * author rules win. `content-visibility` is set too, because recent Chrome
 * hides a closed `details` with that rather than `display`.
 */

.st-facet-drawer {
	display: block;
	border: 1px solid var(--wp--preset--color--ti-line);
	border-radius: var(--wp--custom--st-radius, 2px);
	background: var(--wp--preset--color--ti-bg-alt);
	margin-bottom: 1.5rem;
}

.st-facet-drawer__summary {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	cursor: pointer;
	list-style: none;
	padding: 0.85rem 1rem;
	font-family: var(--wp--preset--font-family--space-mono);
	font-size: 0.72rem;
	letter-spacing: var(--wp--custom--st-track, 0.12em);
	text-transform: var(--wp--custom--st-case, uppercase);
}

.st-facet-drawer__summary::after {
	content: "+";
	margin-left: auto;
}

.st-facet-drawer[open] > .st-facet-drawer__summary::after {
	content: "\2212";
}

.st-facet-drawer__clear {
	margin: 0;
	padding: 0 1rem 0.5rem;
	font-size: 0.78rem;
}

.st-facet {
	display: block;
	border-top: 1px solid var(--wp--preset--color--ti-line);
}

.st-facet__summary {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	cursor: pointer;
	list-style: none;
	padding: 0.7rem 1rem;
	font-weight: 600;
	font-size: 0.85rem;
}

.st-facet__summary::after {
	content: "+";
	margin-left: auto;
	opacity: 0.6;
}

.st-facet[open] > .st-facet__summary::after {
	content: "\2212";
}

.st-facet__terms {
	list-style: none;
	margin: 0;
	padding: 0 1rem 0.85rem;
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
}

.st-facet__term a {
	display: flex;
	gap: 0.5rem;
	align-items: baseline;
	text-decoration: none;
	font-size: 0.85rem;
	line-height: 1.35;
}

.st-facet__term.is-on a {
	font-weight: 700;
	text-decoration: underline;
}

.st-facet__count {
	margin-left: auto;
	font-family: var(--wp--preset--font-family--space-mono);
	font-size: 0.68rem;
	opacity: 0.65;
}

.st-facet__more {
	padding: 0 1rem 0.85rem;
}

.st-facet__more > summary {
	cursor: pointer;
	font-size: 0.78rem;
	opacity: 0.75;
}

.st-facet__more > .st-facet__terms {
	padding: 0.5rem 0 0;
}

/* Desktop: the drawer is not a drawer. Its own summary goes away and its
   contents are always shown, open or not, so the same markup is a column here
   and a tap target on a phone. */
@media (min-width: 1024px) {
	.st-facet-drawer > .st-facet-drawer__summary {
		display: none;
	}

	.st-facet-drawer:not([open]) > *:not(summary) {
		display: block;
		content-visibility: visible;
	}
}

/* The plugin's own filter column, when the theme rail has replaced it. Belt to
   inc/woocommerce/archive.php's braces: if a store re-enables the widget by
   hand, two rails still do not stack. */
.dtla-shop-archive__filters:has(.st-facet-drawer) .wpc-filters-main-wrap {
	display: none;
}
