/**
 * Kubota Europe division spec filter (WPBakery element `vc_kbeu_spec_filter`).
 *
 * The bar itself — the black "All products" pill, the white facet pills with
 * their hanging panels, the radio lists and the "Search by name" box — is the
 * shared filter-bar component (`assets/css/kbeu-filter-bar.css`, classes
 * `kbeu-fb__*`; the form carries `kbeu-fb kbeu-sf`). This file only adds the
 * facet control the spec filter alone has: the min/max range panel of Figma
 * nodes 4926-716 / 5103-1517 (grey track, teal fill, white round handles, bold
 * values).
 *
 * Progressive enhancement: the number inputs (`.kbeu-sf__number`) are the no-JS
 * controls; once the script adds `.is-enhanced` they hide behind the slider and
 * the bold values.
 */

/* The range rules read the bar's tokens through the element's own names. */
.kbeu-sf {
	--kbeu-sf-teal: var( --kbeu-fb-teal );
	--kbeu-sf-ink: var( --kbeu-fb-ink );
	--kbeu-sf-line: var( --kbeu-fb-line );
	--kbeu-sf-track: var( --kbeu-color-surface-alt );
}

/* --- Range ---------------------------------------------------------------------- */

.kbeu-sf__range-fields {
	display: flex;
	justify-content: space-between;
	gap: 12px;
}

.kbeu-sf__range-field {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
	font-weight: 300;
}

.kbeu-sf__range-field:last-child {
	text-align: right;
}

/* "Min" / "Max": 12px light. */
.kbeu-sf__range-caption {
	font-size: clamp( 11px, 0.47vw, 12px );
	font-weight: 300;
	line-height: 1.2;
	color: var( --kbeu-sf-ink );
}

/* The bold values ("26 HP"): 14px bold, shown once enhanced. */
.kbeu-sf__range-value {
	display: none;
	font-size: clamp( 13px, 0.55vw, 14px );
	font-weight: 700;
	line-height: 1.2;
	color: var( --kbeu-sf-ink );
}

.kbeu-sf.is-enhanced .kbeu-sf__range-value {
	display: block;
}

/* The number inputs: the no-JS controls; hidden once the slider takes over. */
.kbeu-sf .kbeu-sf__number {
	box-sizing: border-box;
	width: 100%;
	max-width: 110px;
	margin: 0;
	padding: 6px 8px;
	border: 1px solid var( --kbeu-sf-line );
	border-radius: 8px;
	background: #fff;
	font-family: inherit;
	font-size: clamp( 13px, 0.55vw, 14px );
	font-weight: 700;
	line-height: 1.2;
	color: var( --kbeu-sf-ink );
}

.kbeu-sf.is-enhanced .kbeu-sf__number {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect( 0 0 0 0 );
	border: 0;
}

/* Dual-range slider: two native range inputs stacked over one track, their
   tracks made invisible so only the thumbs are drawn; the inputs ignore the
   pointer and the thumbs catch it, so either handle can be grabbed anywhere. */
.kbeu-sf__slider {
	display: none;
	position: relative;
	height: 20px;
	margin: clamp( 12px, 0.78vw, 20px ) 10px 4px;
}

.kbeu-sf.is-enhanced .kbeu-sf__slider {
	display: block;
}

.kbeu-sf__track,
.kbeu-sf__fill {
	position: absolute;
	top: 50%;
	height: clamp( 8px, 0.49vw, 12.5px );
	border-radius: 999px;
	transform: translateY( -50% );
	pointer-events: none;
}

.kbeu-sf__track {
	left: -10px;
	right: -10px;
	background: var( --kbeu-sf-track );
}

.kbeu-sf__fill {
	left: calc( var( --lo, 0 ) * 100% );
	right: calc( ( 1 - var( --hi, 1 ) ) * 100% );
	background: var( --kbeu-sf-teal );
}

/* The `!important`s: Impreza paints every focused input
   (`input:not([type=submit]):focus { background: var(--inputs-focus-background) }`),
   so while a handle is being dragged — its input has focus — the input's box
   would cover the track and the teal fill with a grey slab until focus moves
   elsewhere. The inputs, focused or not, stay fully transparent. */
.kbeu-sf .kbeu-sf__thumb,
.kbeu-sf .kbeu-sf__thumb:focus,
.kbeu-sf .kbeu-sf__thumb:focus-visible,
.kbeu-sf .kbeu-sf__thumb:active {
	position: absolute;
	top: 0;
	left: -10px;
	right: -10px;
	width: calc( 100% + 20px );
	height: 20px;
	margin: 0;
	padding: 0;
	border: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	outline: none !important;
	pointer-events: none;
	-webkit-appearance: none;
	appearance: none;
}

.kbeu-sf .kbeu-sf__thumb::-webkit-slider-runnable-track,
.kbeu-sf .kbeu-sf__thumb:focus::-webkit-slider-runnable-track {
	height: 20px;
	background: transparent !important;
	border: 0;
	box-shadow: none;
}

.kbeu-sf .kbeu-sf__thumb::-moz-range-track,
.kbeu-sf .kbeu-sf__thumb:focus::-moz-range-track {
	height: 20px;
	background: transparent !important;
	border: 0;
}

.kbeu-sf .kbeu-sf__thumb::-webkit-slider-thumb,
.kbeu-sf .kbeu-sf__thumb:focus::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 20px;
	height: 20px;
	border: 0;
	border-radius: 50%;
	background: #fff !important;
	box-shadow: 0 1px 4px rgba( 0, 0, 0, 0.3 );
	cursor: grab;
	pointer-events: auto;
}

.kbeu-sf .kbeu-sf__thumb::-moz-range-thumb,
.kbeu-sf .kbeu-sf__thumb:focus::-moz-range-thumb {
	width: 20px;
	height: 20px;
	border: 0;
	border-radius: 50%;
	background: #fff !important;
	box-shadow: 0 1px 4px rgba( 0, 0, 0, 0.3 );
	cursor: grab;
	pointer-events: auto;
}

/* Keyboard focus on a handle: a teal ring on the handle itself. */
.kbeu-sf .kbeu-sf__thumb:focus-visible::-webkit-slider-thumb {
	box-shadow: 0 0 0 3px rgba( 0, 168, 169, 0.35 ), 0 1px 4px rgba( 0, 0, 0, 0.3 );
}

.kbeu-sf .kbeu-sf__thumb:focus-visible::-moz-range-thumb {
	box-shadow: 0 0 0 3px rgba( 0, 168, 169, 0.35 ), 0 1px 4px rgba( 0, 0, 0, 0.3 );
}

.kbeu-sf .kbeu-sf__thumb:active::-webkit-slider-thumb {
	cursor: grabbing;
}

/* The "max" input is drawn on top; when both handles meet at the right end the
   script raises the "min" one instead so the pair can be pulled apart. */
.kbeu-sf .kbeu-sf__thumb[data-bound='max'] {
	z-index: 2;
}

.kbeu-sf .kbeu-sf__thumb.is-top {
	z-index: 3;
}
