/**
 * Video Explorer facet UI (08-UI-SPEC, VID-07) — /videos/ archive only.
 *
 * Scoped under .llb-archive--videos. Styles the faceted GET form
 * (template-parts/library-filter-videos.php), the cascading Subject locked-state,
 * the active-filter pills (rendered by 08-03's JS into [data-llb-pills]), and an
 * aria-busy loading affordance on #llb-results.
 *
 * Brand: crimson/gold/off-white ONLY — consumes the :root tokens from style.css
 * via var() (never redeclared). Focus rings are gold/crimson, never a cool tone
 * (FND-02). Mobile-first: single column, then a 270px facet sidebar at >=761px.
 *
 * Expected pill markup (produced by 08-03 video-explorer.js):
 *   <span class="llb-pill">{name}<button class="llb-pill__remove" aria-label="Remove {name}">×</button></span>
 *   <button class="llb-clear-all" type="button">Clear all</button>
 */

/* ---- Layout ---------------------------------------------------------------- */
.llb-archive--videos .llb-explorer {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

@media (min-width: 761px) {
	/* The <form> wraps search + facets; #llb-results is its sibling. display:contents
	   lets the search bar span full width while facets sit beside the results. */
	.llb-archive--videos .llb-explorer {
		display: grid;
		grid-template-columns: 270px minmax(0, 1fr);
		gap: 1.4rem 1.75rem;
		align-items: start;
	}
	.llb-archive--videos .llb-filter-form { display: contents; }
	.llb-archive--videos .llb-search { grid-column: 1 / -1; }
	.llb-archive--videos .llb-facets { grid-column: 1; grid-row: 2; }
	.llb-archive--videos .llb-explorer__results { grid-column: 2; grid-row: 2; }
}

/* ---- Prominent keyword search bar ------------------------------------------ */
.llb-archive--videos .llb-search {
	display: flex;
	gap: .5rem;
}
.llb-archive--videos .llb-search__input {
	flex: 1 1 auto;
	min-width: 0;
	padding: .8rem 1rem;
	font: inherit;
	color: var(--foreground);
	background: var(--card);
	border: 2px solid var(--border);
	border-radius: var(--radius);
}
.llb-archive--videos .llb-search__input:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(181, 38, 30, .22); /* crimson ring — not a cool tone */
}
.llb-archive--videos .llb-search__btn {
	flex: 0 0 auto;
	padding: 0 1.3rem;
	font: inherit;
	font-weight: 700;
	color: var(--secondary-foreground);
	background: var(--secondary);
	border: 0;
	border-radius: var(--radius);
	cursor: pointer;
}
.llb-archive--videos .llb-search__btn:hover { background: var(--secondary-hover); }
.llb-archive--videos .llb-search__btn:focus-visible {
	outline: 3px solid var(--primary);
	outline-offset: 2px;
}

/* ---- Facet sidebar --------------------------------------------------------- */
.llb-archive--videos .llb-facets {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	padding: 1rem;
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: 12px;
}
.llb-archive--videos .llb-facet {
	margin: 0;
	padding: 0 0 1rem;
	border: 0;
	border-bottom: 1px solid var(--border);
}
.llb-archive--videos .llb-facets > .llb-facet:last-of-type,
.llb-archive--videos .llb-facet__group:last-child .llb-facet {
	border-bottom: 0;
	padding-bottom: 0;
}
.llb-archive--videos .llb-facet__legend {
	display: flex;
	align-items: center;
	gap: .5rem;
	padding: 0 0 .6rem;
	font-family: "Merriweather", Georgia, serif;
	font-weight: 700;
	color: var(--foreground);
}
.llb-archive--videos .llb-facet__badge {
	flex: 0 0 auto;
	width: 1.35rem;
	height: 1.35rem;
	display: grid;
	place-items: center;
	font-family: "DM Sans", system-ui, sans-serif;
	font-size: .78rem;
	font-weight: 700;
	color: var(--primary-foreground);
	background: var(--primary);
	border-radius: 50%;
}
.llb-archive--videos .llb-facet__opts {
	display: flex;
	flex-direction: column;
	gap: .15rem;
}

/* Custom checkbox: hide native input, draw a brand box, keep it keyboard-usable */
.llb-archive--videos .llb-facet__opt {
	display: flex;
	align-items: center;
	gap: .6rem;
	min-height: 44px; /* touch target */
	padding: .1rem .25rem;
	cursor: pointer;
	border-radius: 6px;
}
.llb-archive--videos .llb-facet__opt:hover { background: color-mix(in srgb, var(--primary) 7%, transparent); }
.llb-archive--videos .llb-facet__input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	margin: 0;
}
.llb-archive--videos .llb-facet__box {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	background: var(--card);
	border: 2px solid var(--border);
	border-radius: 5px;
	position: relative;
}
.llb-archive--videos .llb-facet__input:checked + .llb-facet__box {
	background: var(--primary);
	border-color: var(--primary);
}
.llb-archive--videos .llb-facet__input:checked + .llb-facet__box::after {
	content: "";
	position: absolute;
	left: 6px;
	top: 2px;
	width: 5px;
	height: 10px;
	border: solid var(--primary-foreground);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}
.llb-archive--videos .llb-facet__input:focus-visible + .llb-facet__box {
	outline: 3px solid var(--secondary); /* gold keyboard ring */
	outline-offset: 2px;
}
.llb-archive--videos .llb-facet__name { line-height: 1.3; }

/* ---- Subject cascade: locked state ---------------------------------------- */
.llb-archive--videos .llb-facet__lock {
	padding: .85rem;
	color: color-mix(in srgb, var(--foreground) 65%, transparent);
	background: color-mix(in srgb, var(--border) 30%, transparent);
	border: 1px dashed var(--border);
	border-radius: 8px;
}
.llb-archive--videos .llb-facet__lock-copy { margin: 0 0 .7rem; font-size: .9rem; line-height: 1.4; }
.llb-archive--videos .llb-facet__dots {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: .45rem;
}
.llb-archive--videos .llb-facet__dot {
	display: flex;
	align-items: center;
	gap: .5rem;
	font-weight: 600;
	color: var(--foreground);
}
.llb-archive--videos .llb-facet__dot-mark {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	display: grid;
	place-items: center;
	border: 2px solid var(--border);
	border-radius: 50%;
	background: var(--card);
}
.llb-archive--videos .llb-facet__dot.is-met .llb-facet__dot-mark {
	background: var(--primary);
	border-color: var(--primary);
}
.llb-archive--videos .llb-facet__dot.is-met .llb-facet__dot-mark::after {
	content: "";
	width: 4px;
	height: 8px;
	border: solid var(--primary-foreground);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg) translate(-1px, -1px);
}
.llb-archive--videos .llb-facet__empty {
	margin: 0;
	font-size: .9rem;
	color: color-mix(in srgb, var(--foreground) 65%, transparent);
}

/* ---- Facet actions --------------------------------------------------------- */
.llb-archive--videos .llb-facets__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .75rem;
}
.llb-archive--videos .llb-facets__apply {
	padding: .6rem 1.1rem;
	font: inherit;
	font-weight: 700;
	color: var(--primary-foreground);
	background: var(--primary);
	border: 0;
	border-radius: var(--radius);
	cursor: pointer;
}
.llb-archive--videos .llb-facets__apply:hover { background: var(--primary-hover); }
.llb-archive--videos .llb-facets__apply:focus-visible {
	outline: 3px solid var(--secondary);
	outline-offset: 2px;
}

/* ---- Active-filter pills (JS-rendered) ------------------------------------- */
.llb-archive--videos .llb-pills {
	display: flex;
	flex-wrap: wrap;
	gap: .5rem;
	align-items: center;
}
.llb-archive--videos .llb-pills:empty { display: none; }
.llb-archive--videos .llb-pill {
	display: inline-flex;
	align-items: center;
	gap: .4rem;
	padding: .35rem .4rem .35rem .75rem;
	font-size: .85rem;
	font-weight: 600;
	color: var(--primary);
	background: color-mix(in srgb, var(--primary) 10%, var(--card));
	border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
	border-radius: 999px;
}
.llb-archive--videos .llb-pill__remove {
	display: grid;
	place-items: center;
	width: 20px;
	height: 20px;
	font-size: .95rem;
	line-height: 1;
	color: var(--primary);
	background: color-mix(in srgb, var(--primary) 16%, transparent);
	border: 0;
	border-radius: 50%;
	cursor: pointer;
}
.llb-archive--videos .llb-pill__remove:focus-visible {
	outline: 2px solid var(--primary);
	outline-offset: 1px;
}
.llb-archive--videos .llb-clear-all {
	font-size: .85rem;
	font-weight: 600;
	color: color-mix(in srgb, var(--foreground) 65%, transparent);
	text-decoration: underline;
	background: none;
	border: 0;
	padding: .35rem .25rem;
	cursor: pointer;
}
.llb-archive--videos .llb-clear-all:hover { color: var(--primary); }

/* ---- Results loading affordance -------------------------------------------- */
.llb-archive--videos #llb-results[aria-busy="true"] { position: relative; }
@media (prefers-reduced-motion: no-preference) {
	.llb-archive--videos #llb-results[aria-busy="true"] {
		opacity: .55;
		transition: opacity .15s ease;
	}
}
