/* Blog Filter
   Every rule is scoped under .spark-bf (plus the one .spark-bf-is-hidden helper class that the
   script puts on filtered-out Loop Grid cards), so nothing here affects the rest of the site.
   See README.md in this folder for what each class/variable controls. */

/* ==========================================================================
   1. BASE: quick settings (colours, sizes, fonts)
   ========================================================================== */
.spark-bf {
	--bf-accent: var(--e-global-color-primary, #FFC300);
	--bf-accent-text: #1A1919;
	--bf-text: var(--e-global-color-text, #1A1919);
	--bf-muted: #6B6A68;
	--bf-border: #E4E3E1;
	--bf-field-bg: #FFFFFF;
	--bf-panel-bg: #FFFFFF;
	--bf-panel-border: #EFEEEC;
	--bf-divider: #ECEBE9;
	--bf-chip-bg: #FDF5D8;
	--bf-chip-border: #F5DF92;
	--bf-height: 44px;
	--bf-search-w: 316px;
	--bf-gap: 12px;
	--bf-below: 64px;
	--bf-body-font: var(--e-global-typography-text-font-family, "SF Pro Display"), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

	position: relative;
	z-index: 5;
	box-sizing: border-box;
	margin: 0 0 var(--bf-below);
	padding: 0;
	color: var(--bf-text);
	font-family: var(--bf-body-font);
	font-size: 15px;
	line-height: 1.4;
}

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

.spark-bf [hidden] {
	display: none !important;
}

/* No side padding on any device: the Elementor container around the widget provides the
   same side spacing as the site header, so the bar lines up with the header. */
.spark-bf__inner {
	max-width: 1280px;
	margin: 0 auto;
	padding: 0;
}

/* Cards filtered out of the Loop Grid (and the pagination while filtering). */
.spark-bf-is-hidden {
	display: none !important;
}

/* Visually hidden, read by screen readers (live result count). */
.spark-bf__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ==========================================================================
   2. BAR: search on the left, dropdowns on the right
   ========================================================================== */
.spark-bf__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
}

.spark-bf__search {
	display: flex;
	align-items: center;
	flex: 0 1 var(--bf-search-w);
	gap: 10px;
	min-width: 0;
	height: var(--bf-height);
	margin: 0;
	padding: 0 18px;
	border: 1px solid var(--bf-border);
	border-radius: 999px;
	background: var(--bf-field-bg);
	color: var(--bf-muted);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.spark-bf__search:focus-within {
	border-color: var(--bf-accent);
	box-shadow: 0 0 0 1px var(--bf-accent);
}

.spark-bf__search-icon {
	flex: none;
	color: var(--bf-text);
}

/* Beats the theme's default input styling (border, padding, radius, width). */
.spark-bf .spark-bf__input,
.spark-bf .spark-bf__input:focus {
	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	outline: 0;
	box-shadow: none;
	background: transparent;
	color: var(--bf-text);
	font-family: inherit;
	font-size: 14px;
	line-height: 1.4;
	-webkit-appearance: none;
	appearance: none;
}

.spark-bf .spark-bf__input::placeholder {
	color: var(--bf-text);
	opacity: 1;
}

.spark-bf .spark-bf__input::-webkit-search-cancel-button,
.spark-bf .spark-bf__input::-webkit-search-decoration {
	-webkit-appearance: none;
	appearance: none;
}

.spark-bf__filters {
	display: flex;
	align-items: center;
	gap: var(--bf-gap);
	margin-left: auto;
}

/* ==========================================================================
   3. DROPDOWN BUTTONS
   ========================================================================== */
.spark-bf__dd {
	position: relative;
}

.spark-bf .spark-bf__trigger {
	display: inline-flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	width: auto;
	min-width: var(--bf-dd-w, 0);
	height: var(--bf-height);
	margin: 0;
	padding: 0 18px;
	border: 1px solid var(--bf-border);
	border-radius: 999px;
	background: var(--bf-field-bg);
	color: var(--bf-text);
	font-family: inherit;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.2;
	text-align: left;
	text-transform: none;
	cursor: pointer;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.spark-bf .spark-bf__trigger:hover,
.spark-bf .spark-bf__trigger:focus {
	background: var(--bf-field-bg);
	border-color: var(--bf-accent);
	color: var(--bf-text);
}

.spark-bf .spark-bf__trigger:focus-visible {
	outline: 2px solid var(--bf-text);
	outline-offset: 2px;
}

.spark-bf__trigger-label {
	flex: 1 1 auto;
}

.spark-bf__chevron {
	flex: none;
	transition: transform 0.2s ease;
}

/* Open */
.spark-bf .spark-bf__dd.is-open .spark-bf__trigger {
	border-color: var(--bf-accent);
	box-shadow: 0 0 0 1px var(--bf-accent);
	font-weight: 500;
}

.spark-bf__dd.is-open .spark-bf__chevron {
	transform: rotate(180deg);
}

/* Has a filter applied */
.spark-bf .spark-bf__dd.has-value .spark-bf__trigger {
	background: var(--bf-chip-bg);
	border-color: var(--bf-accent);
	font-weight: 500;
}

.spark-bf__badge {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 24px;
	height: 24px;
	padding: 0 6px;
	border-radius: 999px;
	background: var(--bf-accent);
	color: var(--bf-accent-text);
	font-size: 13px;
	font-weight: 500;
	line-height: 1;
}

/* ==========================================================================
   4. DROPDOWN PANEL
   ========================================================================== */
.spark-bf__panel {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	z-index: 30;
	min-width: 300px;
	max-width: calc(100vw - 32px);
	padding: 12px 12px 14px;
	border: 1px solid var(--bf-panel-border);
	border-radius: 20px;
	background: var(--bf-panel-bg);
	box-shadow: 0 12px 32px rgba(26, 25, 25, 0.12);
}

.spark-bf__dd--cols-2 .spark-bf__panel {
	width: 600px;
}

.spark-bf__dd.is-right .spark-bf__panel {
	left: auto;
	right: 0;
}

/* A long list scrolls inside the panel; Clear and Apply below it stay in view. */
.spark-bf__options {
	max-height: min(60vh, 440px);
	margin: 0;
	padding: 8px 12px 4px;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	list-style: none;
}

/* Two columns that fill top to bottom (first column first), the rows set by the widget. */
.spark-bf__dd--cols-2 .spark-bf__options {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	grid-template-rows: repeat(var(--bf-rows, 6), auto);
	grid-auto-flow: column;
	column-gap: 40px;
}

.spark-bf__options li {
	margin: 0;
	padding: 0;
	break-inside: avoid;
}

.spark-bf__opt {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0;
	padding: 9px 0;
	cursor: pointer;
	-webkit-user-select: none;
	user-select: none;
}

/* The real checkbox stays in the page for keyboards and screen readers; the box is drawn. */
.spark-bf .spark-bf__check {
	position: absolute;
	width: 22px;
	height: 22px;
	margin: 0;
	padding: 0;
	opacity: 0;
	cursor: pointer;
}

.spark-bf__box {
	flex: none;
	position: relative;
	width: 22px;
	height: 22px;
	border: 2px solid var(--bf-text);
	border-radius: 6px;
	background: var(--bf-panel-bg);
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.spark-bf__box::after {
	content: "";
	position: absolute;
	left: 6px;
	top: 2px;
	width: 5px;
	height: 10px;
	border: solid var(--bf-accent-text);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg) scale(0);
	transition: transform 0.15s ease;
}

.spark-bf__check:checked + .spark-bf__box {
	background: var(--bf-accent);
	border-color: var(--bf-accent);
}

.spark-bf__check:checked + .spark-bf__box::after {
	transform: rotate(45deg) scale(1);
}

.spark-bf__check:focus-visible + .spark-bf__box {
	outline: 2px solid var(--bf-text);
	outline-offset: 2px;
}

.spark-bf__opt-text {
	font-size: 15px;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

.spark-bf__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-top: 8px;
	padding: 14px 12px 0;
	border-top: 1px solid var(--bf-divider);
}

.spark-bf .spark-bf__clear,
.spark-bf .spark-bf__clear-all {
	margin: 0;
	padding: 4px 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: var(--bf-text);
	font-family: inherit;
	font-size: 15px;
	font-weight: 400;
	line-height: 1.2;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.spark-bf .spark-bf__clear:hover,
.spark-bf .spark-bf__clear:focus,
.spark-bf .spark-bf__clear-all:hover,
.spark-bf .spark-bf__clear-all:focus {
	background: transparent;
	color: var(--bf-text);
	text-decoration-thickness: 2px;
}

.spark-bf .spark-bf__clear:focus-visible,
.spark-bf .spark-bf__clear-all:focus-visible,
.spark-bf .spark-bf__apply:focus-visible,
.spark-bf .spark-bf__chip-x:focus-visible {
	outline: 2px solid var(--bf-text);
	outline-offset: 2px;
}

.spark-bf .spark-bf__apply {
	margin: 0;
	padding: 12px 28px;
	border: 0;
	border-radius: 999px;
	background: var(--bf-accent);
	color: var(--bf-accent-text);
	font-family: inherit;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.2;
	cursor: pointer;
	transition: filter 0.2s ease;
}

.spark-bf .spark-bf__apply:hover,
.spark-bf .spark-bf__apply:focus {
	background: var(--bf-accent);
	color: var(--bf-accent-text);
	filter: brightness(0.95);
}

/* ==========================================================================
   5. APPLIED CHIPS, EMPTY MESSAGE
   ========================================================================== */
.spark-bf__chips {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 16px;
	margin-top: 20px;
}

.spark-bf__chiplist {
	display: contents;
	margin: 0;
	padding: 0;
	list-style: none;
}

.spark-bf__chip {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	margin: 0;
	padding: 0 14px 0 18px;
	height: 40px;
	border: 1px solid var(--bf-chip-border);
	border-radius: 999px;
	background: var(--bf-chip-bg);
	font-size: 14px;
	line-height: 1.2;
}

.spark-bf .spark-bf__chip-x {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--bf-text);
	cursor: pointer;
}

.spark-bf .spark-bf__chip-x:hover,
.spark-bf .spark-bf__chip-x:focus {
	background: rgba(26, 25, 25, 0.08);
	color: var(--bf-text);
}

.spark-bf__empty,
.spark-bf__loading {
	margin: 48px 0 0;
	text-align: center;
	color: var(--bf-muted);
	font-size: 16px;
	line-height: 1.5;
}

.spark-bf__notice {
	margin: 12px 0 0;
	padding: 10px 14px;
	border: 1px dashed #C9A100;
	background: #FFF9E0;
	font-size: 13px;
}

/* ==========================================================================
   6. TABLET (768-1024)
   ========================================================================== */
@media (min-width: 768px) and (max-width: 1024px) {
	.spark-bf__bar {
		gap: 16px;
	}

	.spark-bf__search {
		flex: 1 1 auto;
		max-width: var(--bf-search-w);
	}

	.spark-bf__dd--cols-2 .spark-bf__panel {
		width: 520px;
	}
}

/* ==========================================================================
   7. MOBILE (767 and below): search on top, two dropdowns side by side,
      the open list spans the full width under them
   ========================================================================== */
@media (max-width: 767px) {
	.spark-bf {
		--bf-below: 40px;
	}

	.spark-bf__bar {
		flex-direction: column;
		align-items: stretch;
		gap: 12px;
	}

	.spark-bf__search {
		flex: none;
		width: 100%;
	}

	.spark-bf__filters {
		position: relative;
		width: 100%;
		margin-left: 0;
		gap: 12px;
	}

	.spark-bf__dd {
		position: static;
		flex: 1 1 0;
		min-width: 0;
	}

	.spark-bf .spark-bf__trigger {
		width: 100%;
		min-width: 0;
		padding: 0 16px;
	}

	.spark-bf__search-icon {
		width: 16px;
		height: 16px;
	}

	.spark-bf__panel,
	.spark-bf__dd--cols-2 .spark-bf__panel,
	.spark-bf__dd.is-right .spark-bf__panel {
		left: 0;
		right: 0;
		width: auto;
		min-width: 0;
		max-width: none;
	}

	.spark-bf__options {
		max-height: min(55vh, 380px);
	}

	.spark-bf__dd--cols-2 .spark-bf__options {
		display: block;
	}

	.spark-bf__chips {
		margin-top: 16px;
		gap: 10px 12px;
	}

	.spark-bf__empty {
		margin-top: 32px;
	}
}

/* ==========================================================================
   8. SMALL PHONES (374 and below)
   ========================================================================== */
@media (max-width: 374px) {
	.spark-bf .spark-bf__trigger {
		padding: 0 12px;
		font-size: 14px;
	}

	.spark-bf__search {
		padding: 0 16px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.spark-bf * {
		transition: none !important;
	}
}
