/**
 * Rooster One: FiboFilters' filters in Rooster Zero's filters column (AIEO_FiboFilters_Shop). Loaded with the filters.
 *
 * FiboFilters draws in its own colours: the shop's base and link colours from its settings (variables on the body),
 * and whites and greys of its own. Here they are the palette's, in both schemes: the theme's filters' look (the
 * headings at the field's height in the small size, a line under each, the items in the text colour, the theme's
 * check: a box in the page's ground with a 1 px line, ticked in the text colour), the theme's field recipe for its
 * inputs, the theme's buttons, its panels (the phone's overlay and its off-canvas) on the page's ground above the sticky
 * header and the bottom bar. A bridge over a plugin's unlayered rules, as the theme's are: layered, every declaration
 * !important, so FiboFilters' sheet and its inline variables give way while the theme's layered !important rules keep
 * the last word.
 */

@layer rooster.plugins {

	/* FiboFilters' own variables, on the body as it prints them: the accent for a choice, the theme's lines. */
	body {
		--fibofilters--colors--base: var(--wp--preset--color--accent) !important;
		--fibofilters--colors--link: var(--wp--preset--color--accent-text) !important;
		--fibofilters--colors-input-border: color-mix(in srgb, var(--wp--preset--color--fg) 48%, transparent) !important;
	}

	/* The column's card, as WooCommerce's block draws it (its position support): in view as the page scrolls, under
	   the sticky header. The theme's places (the undocked card) have the last word. */
	.rooster-shop__filters > .aieo-fibofilters--vertical { position: sticky; top: calc(var(--rooster-sticky-top, 0px) + var(--wp--preset--spacing--4, 1rem) + var(--wp-admin--admin-bar--position-offset, 0px)); z-index: 10; }

	/* The filters, as the theme's: a heading at the field's height in the small size, a line under each filter. */
	:is(.aieo-fibofilters, .fibofilters-offcanvas, .fibofilters-mobile-overlay) .fibofilters-block { padding-block: var(--wp--preset--spacing--2, 0.5rem) var(--wp--preset--spacing--4, 1rem) !important; border-bottom: 1px solid var(--wp--preset--color--line) !important; font-size: var(--wp--preset--font-size--sm, 0.875rem) !important; color: var(--wp--preset--color--fg) !important; }
	:is(.aieo-fibofilters, .fibofilters-offcanvas, .fibofilters-mobile-overlay) .fibofilters-block__headline .fibofilters-block__headline-box-inner { min-height: var(--wp--custom--rooster--field--height, 2.75rem) !important; color: var(--wp--preset--color--fg) !important; font-family: inherit !important; font-size: var(--wp--preset--font-size--sm, 0.875rem) !important; font-weight: 600 !important; letter-spacing: normal !important; line-height: 1.25 !important; text-transform: none !important; }
	:is(.aieo-fibofilters, .fibofilters-offcanvas, .fibofilters-mobile-overlay) .fibofilters-block__headline :is(p, span) { color: var(--wp--preset--color--muted) !important; font-size: var(--wp--preset--font-size--xs, 0.75rem) !important; font-weight: 400 !important; }
	.fibofilters-item__label, .fibofilters-item__label span { color: var(--wp--preset--color--fg) !important; }
	.fibofilters-item__counter { color: var(--wp--preset--color--muted) !important; }
	.fibofilters-item--more-less, .fibofilters-block__breadcrumbs a { color: var(--wp--preset--color--accent-text) !important; }

	/* The theme's check: a box in the page's ground with a 1 px line, ticked in the text colour; a radio's dot the same. */
	.fibofilters-item__control { border: 0 !important; border-radius: min(var(--wp--custom--rooster--shape--control, 4px), 0.25rem) !important; background: var(--wp--preset--color--bg) !important; box-shadow: inset 0 0 0 1px var(--fibofilters--colors-input-border) !important; color: var(--wp--preset--color--fg) !important; }
	.fibofilters-item--radio .fibofilters-item__control { border-radius: 50% !important; }
	.fibofilters-item.fibofilters-selected > .fibofilters-item__interactive > .fibofilters-item__control,
	.fibofilters-item.fibofilters-selected > .fibofilters-collapser-container > .fibofilters-item__interactive > .fibofilters-item__control { background: var(--wp--preset--color--bg) !important; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--wp--preset--color--fg) 80%, transparent) !important; }
	.fibofilters-item--radio.fibofilters-selected > .fibofilters-item__interactive > .fibofilters-item__control { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--wp--preset--color--fg) 80%, transparent), inset 0 0 0 4px var(--wp--preset--color--bg), inset 0 0 0 10px var(--wp--preset--color--fg) !important; }
	.fibofilters-item__control svg [stroke] { stroke: currentColor !important; }
	.fibofilters-item__control svg [fill]:not([fill="none"]) { fill: currentColor !important; }
	.fibofilters-item__interactive:focus-visible { outline: none !important; box-shadow: var(--wp--custom--rooster--focus-ring, 0 0 0 3px currentColor) !important; border-radius: var(--wp--custom--rooster--shape--control, 4px) !important; }

	/* A choice drawn as a button, a select's list, a toggle. */
	.fibofilters-item--button { border-radius: var(--wp--custom--rooster--shape--control, 4px) !important; background: var(--wp--preset--color--bg) !important; }
	.fibofilters-item--button.fibofilters-selected { background: var(--wp--preset--color--accent) !important; }
	.fibofilters-item--button.fibofilters-selected :is(.fibofilters-item__counter, .fibofilters-item__label span) { color: var(--wp--preset--color--on-accent) !important; }
	.fibofilters__select-suggestions { border: 1px solid var(--wp--preset--color--line) !important; border-radius: var(--wp--custom--rooster--shape--panel, 8px) !important; background: var(--wp--preset--color--bg) !important; box-shadow: var(--wp--custom--rooster--shadow--md) !important; color: var(--wp--preset--color--fg) !important; }
	.fibofilters__select-suggestions-item--active { background: var(--wp--preset--color--subtle) !important; }
	.fibofilters__select-suggestions-item--selected, .fibofilters__select-suggestions-item--selected .fibofilters-item__counter { background: var(--wp--preset--color--accent) !important; color: var(--wp--preset--color--on-accent) !important; }
	.fibofilters-item--select:is(:hover, :focus-within), .fibofilters-items-search:is(:hover, :focus-within) { background: var(--wp--preset--color--bg) !important; }
	.fibofilters__select-controls--sep { background: var(--wp--preset--color--line) !important; }
	:is(.fibofilters__select-controls--close, .fibofilters-items-search__controls--close) { color: var(--wp--preset--color--muted) !important; }
	.fibofilters__select-controls--toggle path { stroke: var(--wp--preset--color--muted) !important; }
	.fibofilters-item--toggle .fibofilters-item__toggle .fibofilters-item__toggle-thumb { background: var(--wp--preset--color--bg) !important; }

	/* The fields (a range's inputs, the values' search): the theme's field recipe. */
	:is(.woocommerce, :root) .fibofilters-input__wrapper input:is([type="number"], [type="search"]).fibofilters-input__element,
	.fibofilters-items-search input[type="search"], .fibofilters-item--select input[role="combobox"] {
		min-height: var(--wp--custom--rooster--field--height, 2.75rem) !important; border-radius: var(--wp--custom--rooster--shape--control, 4px) !important;
		background: var(--wp--preset--color--bg) !important; box-shadow: inset 0 0 0 1px var(--wp--preset--color--line) !important; color: var(--wp--preset--color--fg) !important; font-size: 1rem !important;
	}
	:is(.woocommerce, :root) .fibofilters-input__wrapper input:is([type="number"], [type="search"]).fibofilters-input__element:focus { outline: none !important; box-shadow: inset 0 0 0 1px var(--wp--preset--color--muted), inset 0 0 0 1.5px var(--wp--preset--color--muted) !important; }
	:is(.woocommerce, :root) .fibofilters-input__wrapper .fibofilters-input__label { background: var(--wp--preset--color--bg) !important; color: var(--wp--preset--color--muted) !important; }
	@media (min-width: 783px) {
		:is(.woocommerce, :root) .fibofilters-input__wrapper input:is([type="number"], [type="search"]).fibofilters-input__element,
		.fibofilters-items-search input[type="search"], .fibofilters-item--select input[role="combobox"] { font-size: var(--wp--preset--font-size--sm, 0.875rem) !important; }
	}

	/* The price's slider: the theme's, in the text colour; its histogram in the accent's wash. */
	.fibofilters-range__track, .fibofilters-range__track::before { background: var(--wp--preset--color--line) !important; }
	.fibofilters-range__segment--active { background: var(--wp--preset--color--fg) !important; }
	.fibofilters-range__handle, .fibofilters-range__handle:is(:hover, :focus) { border-color: var(--wp--preset--color--fg) !important; background: var(--wp--preset--color--bg) !important; }
	.fibofilters-range__handle::before { box-shadow: 0 0 0 8px color-mix(in srgb, var(--wp--preset--color--fg) 12%, transparent) !important; }
	.fibofilters-slider-histogram__item { background: color-mix(in srgb, var(--wp--preset--color--accent) 35%, var(--wp--preset--color--bg)) !important; }

	/* The filter buttons (a phone's bar, its panel). */
	.fibofilters-filter-button { min-height: 44px !important; border-radius: var(--wp--custom--rooster--shape--chip) !important; background: var(--wp--preset--color--bg) !important; box-shadow: inset 0 0 0 1px var(--wp--preset--color--line) !important; color: var(--wp--preset--color--fg) !important; text-shadow: none !important; }
	:is(.fibofilters-filter-button:hover, .fibofilters-filter-button.fibofilters-filter-button-selected) { box-shadow: inset 0 0 0 1px var(--wp--preset--color--fg) !important; }

	/* The chosen filters, as the theme's own chosen-filters chips (WooCommerce's removable chips under the theme's Design
	   settings, Shop filters: the chip's corners, border and colours, the fields' corners and the theme's line by default),
	   one chip as tall as a row, and "clear all" as the theme's "Clear filters" link. */
	.fibofilters-applied-filters { display: flex !important; flex-wrap: wrap !important; align-items: center !important; gap: var(--wp--preset--spacing--2) !important; margin: 0 !important; padding: 0 !important; }
	.fibofilters-applied-filters .fibofilters-applied-filter {
		box-sizing: border-box !important; display: inline-flex !important; align-items: center !important; gap: 0.375rem !important; min-height: 2rem !important; margin: 0 !important; padding: 0 0.625rem !important;
		border: var(--wp--custom--rooster--filter-chip--border-width, 1px) solid var(--wp--custom--rooster--filter-chip--border-color, var(--wp--preset--color--line)) !important;
		border-radius: var(--wp--custom--rooster--filter-chip--radius, var(--wp--custom--rooster--shape--control)) !important;
		background: var(--wp--custom--rooster--filter-chip--background, transparent) !important; box-shadow: none !important; color: var(--wp--custom--rooster--filter-chip--text, currentColor) !important;
		font-size: var(--wp--preset--font-size--sm) !important; font-weight: 400 !important; line-height: 1.25 !important; text-shadow: none !important;
	}
	.fibofilters-applied-filters .fibofilters-applied-filter :is(span, strong, b) { font-weight: inherit !important; }
	.fibofilters-applied-filters .fibofilters-applied-filter:is(:hover, :focus-visible) { border-color: var(--wp--preset--color--fg) !important; }
	.fibofilters-applied-filters .fibofilters-applied-filter svg :is([stroke]) { stroke: currentColor !important; }
	.fibofilters-applied-filters .fibofilters-applied-filter svg [fill]:not([fill="none"]) { fill: currentColor !important; }
	.fibofilters-applied-filters .fibofilters-applied-filter--clear-all { padding: 0 !important; border: 0 !important; background: transparent !important; color: var(--wp--preset--color--fg) !important; font-size: var(--wp--preset--font-size--xs) !important; text-decoration: underline !important; }
	.fibofilters-applied-filters .fibofilters-applied-filter--clear-all svg { display: none !important; }

	/* In the filters column (the choice "Chosen filters": in the filters column, the default): under the last filter, as
	   the theme's own active filters, and "clear all" on a line of its own under the chips. */
	.aieo-fibofilters-applied--column { margin-block-start: var(--wp--preset--spacing--5) !important; }
	.aieo-fibofilters-applied--column .fibofilters-applied-filter--clear-all { flex-basis: 100% !important; flex-direction: row !important; justify-content: flex-start !important; text-align: start !important; }
	.aieo-fibofilters-applied--column .fibofilters-applied-filter--clear-all > * { margin-inline: 0 !important; }

	/* Above the products (the choice's other value): one spacing step from the results count and from the first product,
	   as the count is from the toolbar; its row's place kept from the first paint where the address holds chosen filters
	   (is-reserved, AIEO_FiboFilters_Shop::applied_row(); FiboFilters' own reserve of 46 px was taller than the row and
	   still moved the list). Without chosen filters the row takes no room. */
	.aieo-fibofilters-applied { min-height: 0 !important; }
	.aieo-fibofilters-applied--above { margin-block: var(--wp--preset--spacing--3) 0 !important; }
	.aieo-fibofilters-applied--above:not(.is-reserved):not(:has(.fibofilters-applied-filter)) { display: none !important; }
	.aieo-fibofilters-applied--above.is-reserved { display: block !important; min-height: 2rem !important; }
	.wp-block-woocommerce-product-collection:is(:has(> .aieo-fibofilters-applied--above.is-reserved), :has(> .aieo-fibofilters-applied--above .fibofilters-applied-filter)) > :is(.rooster-shop__count, .wc-block-product-results-count) { margin-block-end: var(--wp--preset--spacing--3) !important; }
	.aieo-fibofilters-applied--above:is(.is-reserved, :has(.fibofilters-applied-filter)) ~ :is(.wc-block-product-template, .wp-block-woocommerce-product-template, .fibofilters-show-previous-button-container) { margin-block-start: var(--wp--preset--spacing--3) !important; }
	.fibofilters-clear-filter-btn, .fibofilters-clear-filter-btn:hover { border-radius: var(--wp--custom--rooster--shape--control, 4px) !important; background: var(--wp--preset--color--bg) !important; color: var(--wp--preset--color--fg) !important; }

	/* The phone's row: WooCommerce's "Filter products" field beside the sorting (the theme's phone rules draw it; the same
	   recipe here for the widths they do not reach), FiboFilters' own bar and its placeholder out of sight: the field
	   opens its panel (aieo-fibofilters.js). */
	.aieo-fibofilters :is(.fibofilters-mobile-filters, .fibofilters-skeleton--mobile) { display: none !important; }
	.aieo-fibofilters__open {
		display: inline-flex; align-items: center; gap: var(--wp--preset--spacing--1, 0.25rem); box-sizing: border-box; min-height: var(--wp--custom--rooster--field--height, 2.75rem); padding: 0 0.625rem;
		border: 1px solid var(--wp--preset--color--line); border-radius: var(--wp--custom--rooster--shape--control, 4px); background: var(--wp--preset--color--bg); color: var(--wp--preset--color--fg);
		font: inherit; font-size: 1rem; font-weight: 400; line-height: 1.4; white-space: nowrap; cursor: pointer;
	}
	.aieo-fibofilters__open:focus-visible { outline: none; box-shadow: var(--wp--custom--rooster--focus-ring, 0 0 0 3px currentColor); }
	@media (min-width: 782px) {
		.aieo-fibofilters--both .aieo-fibofilters__open { display: none; }
	}

	/* The panels (the phone's overlay, the off-canvas), on the page's ground, above the sticky header and the bottom bar
	   (the theme's overlay layer, as its search popover), their close button in reach; the theme's buttons in them. */
	.fibofilters-mobile-overlay, .fibofilters-offcanvas { z-index: calc(var(--wp--custom--rooster--z--overlay, 300) + 100000) !important; background: var(--wp--preset--color--bg) !important; color: var(--wp--preset--color--fg) !important; }
	.fibofilters-offcanvas-bg { z-index: calc(var(--wp--custom--rooster--z--overlay, 300) + 99999) !important; }
	:is(.fibofilters-mobile-overlay__header, .fibofilters-mobile-overlay__footer, .fibofilters-offcanvas-header, .fibofilters-offcanvas-footer) { background: var(--wp--preset--color--bg) !important; border-color: var(--wp--preset--color--line) !important; }
	:is(.fibofilters-mobile-overlay__header-title, .fibofilters-offcanvas-header p) { color: var(--wp--preset--color--fg) !important; font-weight: 600 !important; }
	:is(.fibofilters-mobile-overlay__header-clear, .fibofilters-mobile-overlay__header-close, .fibofilters-offcanvas-clear, .fibofilters-offcanvas-close) { min-width: 44px !important; min-height: 44px !important; background: var(--wp--preset--color--bg) !important; color: var(--wp--preset--color--fg) !important; }
	:is(.fibofilters-mobile-overlay__header-close, .fibofilters-offcanvas-close) svg [stroke] { stroke: currentColor !important; }
	:is(.fibofilters-mobile-overlay__header-clear, .fibofilters-offcanvas-clear)::before { color: var(--wp--preset--color--line) !important; }
	:is(.fibofilters-mobile-overlay__footer .fibofilters-button, .fibofilters-offcanvas-btn) {
		min-height: var(--wp--custom--rooster--field--height, 2.75rem) !important; border: 0 !important; border-radius: var(--wp--custom--rooster--shape--button, 4px) !important;
		background: var(--wp--custom--rooster--button--background, var(--wp--preset--color--accent)) !important; color: var(--wp--custom--rooster--button--text, var(--wp--preset--color--on-accent)) !important; font-weight: 600 !important;
	}
	:is(.fibofilters-mobile-overlay__footer .fibofilters-button, .fibofilters-offcanvas-btn):hover { background: color-mix(in srgb, var(--wp--custom--rooster--button--background, var(--wp--preset--color--accent)) 85%, var(--wp--custom--rooster--button--away)) !important; }
	:is(.fibofilters-mobile-overlay, .fibofilters-offcanvas) :is(button, [role="button"], [tabindex="0"], a):focus-visible { outline: none !important; box-shadow: var(--wp--custom--rooster--focus-ring, 0 0 0 3px currentColor) !important; }
	.fibofilters-popover { border: 1px solid var(--wp--preset--color--line) !important; border-radius: var(--wp--custom--rooster--shape--panel, 8px) !important; background: var(--wp--preset--color--bg) !important; box-shadow: var(--wp--custom--rooster--shadow--lg) !important; }
	.fibofilters-tooltip { background: var(--wp--preset--color--fg) !important; }
	.fibofilters-tooltip__content, .fibofilters-tooltip__content :is(h3, a) { color: var(--wp--preset--color--bg) !important; }

	/* The products' placeholders while FiboFilters loads more. */
	.fibofilters-product-placeholder::before { --fiboFiltersPlaceholderL: no-repeat linear-gradient(var(--wp--preset--color--line) 0 0) !important; background: var(--fiboFiltersPlaceholderL), var(--fiboFiltersPlaceholderL), var(--wp--preset--color--subtle) !important; }
}
