/**
 * Impact Slider. Everything else in the calculator is styled with block
 * settings in the editor; this only covers the range input, which has no
 * block-editor controls of its own.
 *
 * The fill and handle use the block's text colour (currentColor), so they can
 * be changed in the editor. The default is the theme's brand colour.
 */

.wp-block-bsc-impact-slider {
	--bsc-brand: var(--wp--preset--color--primary, #ffca04);
	--bsc-text: var(--wp--preset--color--main, #1e1e1e);
	--bsc-track: #dbdbdb;

	color: var(--bsc-brand);
}

.wp-block-bsc-impact-slider__input {
	--bsc-track-fill: linear-gradient(to right, currentColor var(--bsc-fill, 50%), var(--bsc-track) var(--bsc-fill, 50%));

	-webkit-appearance: none;
	appearance: none;
	display: block;
	box-sizing: border-box;
	width: 100%;
	height: 24px;
	margin: 0;
	cursor: pointer;
}

/*
 * Resets theme form-field styles. Specificity (0,3,0) is needed to beat rules
 * like Ollie's input:not([type="submit"]):not([type="radio"]), which is (0,2,1).
 */
.wp-block-bsc-impact-slider .wp-block-bsc-impact-slider__input[type="range"] {
	padding: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	background: transparent;
	color: inherit;
}

.wp-block-bsc-impact-slider__input:disabled {
	cursor: default;
	opacity: 1;
}

.wp-block-bsc-impact-slider__input::-webkit-slider-runnable-track {
	height: 8px;
	border-radius: 999px;
	background: var(--bsc-track-fill);
}

.wp-block-bsc-impact-slider__input::-moz-range-track {
	height: 8px;
	border-radius: 999px;
	background: var(--bsc-track-fill);
}

.wp-block-bsc-impact-slider__input::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 22px;
	height: 22px;
	margin-top: -7px;
	border: 2px solid var(--bsc-text);
	border-radius: 50%;
	background: currentColor;
}

.wp-block-bsc-impact-slider__input::-moz-range-thumb {
	width: 18px;
	height: 18px;
	border: 2px solid var(--bsc-text);
	border-radius: 50%;
	background: currentColor;
}

.wp-block-bsc-impact-slider__input:focus {
	outline: none;
}

.wp-block-bsc-impact-slider__input:focus-visible::-webkit-slider-thumb {
	outline: 3px solid var(--bsc-text);
	outline-offset: 2px;
}

.wp-block-bsc-impact-slider__input:focus-visible::-moz-range-thumb {
	outline: 3px solid var(--bsc-text);
	outline-offset: 2px;
}
