/* =========================================================
   List filter panel – Intertronics
   ---------------------------------------------------------
   Groups Impreza's List Search, List Result Counter and List
   Filter into one panel above a Post List, e.g. the Resource
   Category Lander content template:

   ┌ .itx-list-panel (Vertical Wrapper) ─────────────────────┐
   │ ┌ .itx-list-panel__top (Horizontal Wrapper, wrap) ────┐ │
   │ │ [ Search ......... ] [ Filter ▾ ] [ Sort ▾ ]  58 results │ │
   │ └─────────────────────────────────────────────────────┘ │
   └─────────────────────────────────────────────────────────┘

   Set these in the elements' "Extra class" settings:
   - .itx-list-panel         Vertical Wrapper, Gap 0
   - .itx-list-panel__top    Horizontal Wrapper, Gap 0, wrap on
   - .itx-list-search        List Search
   - .itx-list-order         List Order (optional)
   - .itx-list-count         List Result Counter
   - .itx-dropdown-filter    List Filter: Horizontal, Titles as
                             dropdowns, Show values on click,
                             Mobile view width blank. Each item
                             becomes a dropdown: Checkboxes for
                             multiselect (with an optional search
                             field), Radio buttons for one value.

   The panel uses the .itx-tile surface, border and radius
   (style.css). The search field and the dropdown button sit on
   it in white, at the same height and with the same focus ring
   (search-fields.css); the dropdown opens as a white menu card.
   Change the look in one place: the --itx-panel-*, --itx-control-*
   and --itx-menu-* tokens.
   ========================================================= */

.itx-list-panel {
	--itx-panel-bg: var(--color-content-bg-alt, #f7f7f7);
	--itx-panel-border: rgba(17, 17, 17, 0.07);
	--itx-panel-radius: calc(var(--site-border-radius, 1rem) * 0.75);
	--itx-panel-padding: 1.25rem 1.5rem;
	--itx-panel-gap: 1.25rem;
	--itx-control-height: 2.75rem;

	--itx-control-radius: var(--site-border-radius, 1rem);
	--itx-control-bg: #fff;
	--itx-control-text: var(--color-content-heading, #303030);
	--itx-control-muted: var(--color-intertronics-grey, #58595b);
	--itx-control-border: rgba(17, 17, 17, 0.1);
	--itx-control-accent: var(--color-content-primary, #f27a21);
	--itx-control-accent-hover: color-mix(in srgb, var(--color-content-primary, #f27a21) 88%, black);

	--itx-menu-radius: calc(var(--site-border-radius, 1rem) * 0.75);
	--itx-menu-shadow: 0 18px 36px -18px rgba(17, 17, 17, 0.35), 0 2px 6px rgba(17, 17, 17, 0.06);
	--itx-menu-hover-bg: color-mix(in srgb, var(--color-content-primary, #f27a21) 8%, white);

	/* The search field matches the dropdown button. */
	--itx-search-height: var(--itx-control-height);
	--itx-search-border: var(--itx-control-border);

	margin-bottom: 1.5rem;
	padding: var(--itx-panel-padding);
	background: var(--itx-panel-bg);
	border: 1px solid var(--itx-panel-border);
	border-radius: var(--itx-panel-radius);
}

/* ---------------------------------------------------------
   1. Top row: search and result count
   --------------------------------------------------------- */

.itx-list-panel__top.w-hwrapper {
	gap: 0.75rem 1.5rem;
}

.itx-list-panel .itx-list-search {
	flex: 1 1 18rem;
	max-width: 36rem;
	margin: 0;
}

.itx-list-panel .itx-list-count.w-list-result-counter {
	margin: 0;
	font-size: 0.875rem;
	color: var(--color-intertronics-grey, #58595b);
	white-space: nowrap;
}

.itx-list-panel .itx-list-count .total,
.itx-list-panel .itx-list-count .total-unfiltered {
	font-weight: 600;
	color: var(--color-content-heading, #303030);
}

/* ---------------------------------------------------------
   2. Technology dropdown
   Impreza draws the dropdown button from the --inputs-*
   properties (grid-filter.css), so re-pointing them gives it the
   search field's look. Selectors start
   .w-filter.for_list.itx-dropdown-filter to outrank Impreza's
   mod_dropdown rules.
   --------------------------------------------------------- */

.w-filter.for_list.itx-dropdown-filter {
	--inputs-height: var(--itx-control-height);
	--inputs-padding: 1.1rem;
	--inputs-font-size: 0.9375rem;
	--inputs-font-weight: 500;
	--inputs-border-width: 1px;
	--inputs-border-radius: var(--itx-control-radius);
	--inputs-background: var(--itx-control-bg);
	--inputs-border-color: var(--itx-control-border);
	--inputs-text-color: var(--itx-control-text);
	--inputs-box-shadow: none;
	--inputs-focus-background: var(--itx-control-bg);
	--inputs-focus-border-color: var(--itx-control-accent);
	--inputs-focus-text-color: var(--itx-control-text);
	--inputs-focus-box-shadow: 0 0 0 1px var(--itx-control-accent);

	flex: 0 1 auto;
	margin: 0;
}

/* One dropdown per filter item, side by side. */
.w-filter.for_list.itx-dropdown-filter .w-filter-list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
}

.w-filter.for_list.itx-dropdown-filter .w-filter-item {
	flex: 0 1 auto;
	min-width: 10rem;
	max-width: 20rem;
}

/* The button */
.w-filter.for_list.itx-dropdown-filter .w-filter-item-title {
	position: relative;
	margin: 0;
	padding-inline-end: 2.75rem;
	text-align: start;
	cursor: pointer;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.w-filter.for_list.itx-dropdown-filter .w-filter-item-title:hover {
	border-color: var(--itx-control-accent);
}

.w-filter.for_list.itx-dropdown-filter .w-filter-item-title:focus-visible {
	outline: 2px solid var(--itx-control-accent);
	outline-offset: 2px;
}

/* Selected values follow the label ("Technology: Adhesives, Robotics") in the brand colour. */
.w-filter.for_list.itx-dropdown-filter .w-filter-item-title > span {
	color: var(--itx-control-accent);
}

/* Chevron in place of Impreza's triangle; it turns while the menu is open. */
.w-filter.for_list.itx-dropdown-filter .w-filter-item-title::after {
	top: 50%;
	inset-inline-end: 1.1rem;
	width: 0.75rem;
	height: 0.75rem;
	margin: -0.375rem 0 0;
	border: 0;
	border-radius: 0;
	background: var(--itx-control-muted);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1.6 5.1 2.7 4 8 9.3 13.3 4l1.1 1.1L8 11.5z'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1.6 5.1 2.7 4 8 9.3 13.3 4l1.1 1.1L8 11.5z'/%3E%3C/svg%3E") center / contain no-repeat;
	transition: transform 0.2s ease;
}

.w-filter.for_list.itx-dropdown-filter .w-filter-item.expand .w-filter-item-title::after {
	transform: rotate(180deg);
}

/* With values chosen, Impreza hides the chevron and shows its clear (×) button. */
.w-filter.for_list.itx-dropdown-filter .w-filter-item-reset {
	z-index: 1;
	display: none;
	align-items: center;
	justify-content: center;
	top: 0;
	inset-inline-end: 0;
	width: 2.75rem;
	height: var(--itx-control-height);
	padding: 0;
	line-height: 1;
	color: var(--itx-control-muted);
	border-radius: 0 var(--itx-control-radius) var(--itx-control-radius) 0;
	transition: color 0.2s ease;
}

.w-filter.for_list.itx-dropdown-filter .w-filter-item.has_value .w-filter-item-reset {
	display: flex;
	color: var(--itx-control-muted);
}

.w-filter.for_list.itx-dropdown-filter .w-filter-item-reset:hover,
.w-filter.for_list.itx-dropdown-filter .w-filter-item-reset:focus-visible {
	color: var(--itx-control-accent);
}

/* The menu */
.w-filter.for_list.itx-dropdown-filter .w-filter-item-content {
	top: calc(100% + 0.375rem);
	inset-inline-start: 0;
	min-width: max(16rem, 100%);
	max-height: min(22rem, 60vh);
	padding: 0.375rem;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: #fff;
	border: 1px solid var(--itx-panel-border);
	border-radius: var(--itx-menu-radius);
	box-shadow: var(--itx-menu-shadow);
}

.w-filter.for_list.itx-dropdown-filter .w-filter-item-values {
	display: flex;
	flex-direction: column;
	gap: 0.125rem;
}

.w-filter.for_list.itx-dropdown-filter .w-filter-item-value {
	margin: 0;
}

.w-filter.for_list.itx-dropdown-filter .w-filter-item-value label {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.6rem 0.75rem;
	font-size: 0.9375rem;
	line-height: 1.3;
	color: var(--itx-control-text);
	border-radius: calc(var(--itx-menu-radius) * 0.6);
	cursor: pointer;
	transition: background-color 0.15s ease;
}

@media (hover: hover) {
	.w-filter.for_list.itx-dropdown-filter .w-filter-item-value label:hover {
		background: var(--itx-menu-hover-bg);
	}
}

.w-filter.for_list.itx-dropdown-filter .w-filter-item-value:has(input:checked) label {
	font-weight: 600;
}

/* Checkboxes: a rounded box that fills orange with a white tick. */
.w-filter.for_list.itx-dropdown-filter .w-filter-item-value input[type="checkbox"] {
	position: relative;
	width: 1.125rem;
	height: 1.125rem;
	margin: 0;
	background: #fff;
	border: 1.5px solid rgba(17, 17, 17, 0.28);
	border-radius: 0.3rem;
	box-shadow: none;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.w-filter.for_list.itx-dropdown-filter .w-filter-item-value input[type="checkbox"]::before {
	content: "";
	position: absolute;
	inset: 0;
	visibility: hidden;
	background: #fff;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6.2 11.6 2.6 8l-1.1 1.1 4.7 4.7 9.3-9.3-1.1-1.1z'/%3E%3C/svg%3E") center / 0.75rem no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6.2 11.6 2.6 8l-1.1 1.1 4.7 4.7 9.3-9.3-1.1-1.1z'/%3E%3C/svg%3E") center / 0.75rem no-repeat;
}

.w-filter.for_list.itx-dropdown-filter .w-filter-item-value input[type="checkbox"]:checked {
	background: var(--itx-control-accent);
	border-color: var(--itx-control-accent);
}

.w-filter.for_list.itx-dropdown-filter .w-filter-item-value input[type="checkbox"]:checked::before {
	visibility: visible;
}

.w-filter.for_list.itx-dropdown-filter .w-filter-item-value input[type="checkbox"]:focus-visible {
	outline: 2px solid var(--itx-control-accent);
	outline-offset: 2px;
}

/* Search field at the top of a long menu ("Show search field to narrow
   choices"); it stays in view while the options scroll. */
.w-filter.for_list.itx-dropdown-filter .w-filter-item-search {
	position: sticky;
	top: -0.375rem;
	z-index: 1;
	margin: -0.375rem -0.375rem 0.25rem;
	padding: 0.375rem;
	background: #fff;
}

.w-filter.for_list.itx-dropdown-filter .w-filter-item-search > input {
	box-sizing: border-box;
	width: 100%;
	height: 2.5rem;
	min-height: 0;
	padding: 0 2.5rem 0 0.75rem;
	font-size: 0.9375rem;
	line-height: normal;
	color: var(--itx-control-text);
	background: var(--itx-panel-bg);
	border: 1px solid var(--itx-control-border);
	border-radius: calc(var(--itx-menu-radius) * 0.6);
	box-shadow: none;
}

.w-filter.for_list.itx-dropdown-filter .w-filter-item-search > input:focus {
	background: #fff;
	border-color: var(--itx-control-accent);
	outline: none;
	box-shadow: 0 0 0 1px var(--itx-control-accent);
}

.w-filter.for_list.itx-dropdown-filter .w-filter-item-search > i,
.w-filter.for_list.itx-dropdown-filter .w-filter-item-search > svg {
	width: 2.5rem;
	inset-inline-end: 0.375rem;
	font-size: 0.875rem;
	color: var(--itx-control-muted);
}

.w-filter.for_list.itx-dropdown-filter .w-filter-item-message {
	padding: 0.5rem 0.75rem;
	color: var(--itx-control-muted);
}

/* Radio buttons (single choice, e.g. Year): a ring with an orange dot. */
.w-filter.for_list.itx-dropdown-filter .w-filter-item-value input[type="radio"] {
	position: relative;
	width: 1.125rem;
	height: 1.125rem;
	margin: 0;
	background: #fff;
	border: 1.5px solid rgba(17, 17, 17, 0.28);
	box-shadow: none;
	transition: border-color 0.15s ease;
}

.w-filter.for_list.itx-dropdown-filter .w-filter-item-value input[type="radio"]::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 0.5rem;
	height: 0.5rem;
	margin: 0;
	visibility: hidden;
	background: var(--itx-control-accent);
	border-radius: 50%;
	transform: translate(-50%, -50%);
}

.w-filter.for_list.itx-dropdown-filter .w-filter-item-value input[type="radio"]:checked {
	border-color: var(--itx-control-accent);
}

.w-filter.for_list.itx-dropdown-filter .w-filter-item-value input[type="radio"]:checked::before {
	visibility: visible;
}

.w-filter.for_list.itx-dropdown-filter .w-filter-item-value input[type="radio"]:focus-visible {
	outline: 2px solid var(--itx-control-accent);
	outline-offset: 2px;
}

/* ---------------------------------------------------------
   3. Sort (List Order): a select styled as the dropdown button
   --------------------------------------------------------- */

.itx-list-panel .itx-list-order.w-order {
	--inputs-height: var(--itx-control-height);
	--inputs-padding: 1.1rem;
	--inputs-font-size: 0.9375rem;
	--inputs-border-width: 1px;
	--inputs-border-radius: var(--itx-control-radius);
	--inputs-background: var(--itx-control-bg);
	--inputs-border-color: var(--itx-control-border);
	--inputs-text-color: var(--itx-control-text);
	--inputs-box-shadow: none;
	--inputs-focus-background: var(--itx-control-bg);
	--inputs-focus-border-color: var(--itx-control-accent);
	--inputs-focus-text-color: var(--itx-control-text);
	--inputs-focus-box-shadow: 0 0 0 1px var(--itx-control-accent);

	flex: 0 0 auto;
	margin: 0;
}

.itx-list-panel .itx-list-order .w-order-select > select {
	height: var(--itx-control-height);
	min-height: 0;
	padding: 0 2.75rem 0 1.1rem;
	font-size: 0.9375rem;
	font-weight: 500;
	line-height: normal;
	color: var(--itx-control-text);
	background: var(--itx-control-bg);
	border: 1px solid var(--itx-control-border);
	border-radius: var(--itx-control-radius);
	box-shadow: none;
	cursor: pointer;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.itx-list-panel .itx-list-order .w-order-select > select:hover {
	border-color: var(--itx-control-accent);
}

.itx-list-panel .itx-list-order .w-order-select > select:focus {
	border-color: var(--itx-control-accent);
	box-shadow: 0 0 0 1px var(--itx-control-accent);
}

.itx-list-panel .itx-list-order .w-order-select > select:focus-visible {
	outline: 2px solid var(--itx-control-accent);
	outline-offset: 2px;
}

/* The dropdown button's chevron in place of Impreza's triangle. */
.itx-list-panel .itx-list-order .w-order-select::after {
	top: 50%;
	inset-inline-end: 1.1rem;
	width: 0.75rem;
	height: 0.75rem;
	margin: -0.375rem 0 0;
	border: 0;
	border-radius: 0;
	background: var(--itx-control-muted);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1.6 5.1 2.7 4 8 9.3 13.3 4l1.1 1.1L8 11.5z'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1.6 5.1 2.7 4 8 9.3 13.3 4l1.1 1.1L8 11.5z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------------------------------------------------------
   4. Result count sits at the end of the row
   --------------------------------------------------------- */

.itx-list-panel__top .itx-list-count {
	margin-inline-start: auto !important;
}

/* ---------------------------------------------------------
   5. Phones: search on its own line, then the dropdowns, sort and count
   --------------------------------------------------------- */

@media (max-width: 1024px) {
	.itx-list-panel {
		--itx-panel-padding: 1rem;
	}
}

@media (max-width: 600px) {
	.itx-list-panel .itx-list-search {
		flex-basis: 100%;
		max-width: none;
	}

	.w-filter.for_list.itx-dropdown-filter,
	.itx-list-panel .itx-list-order.w-order {
		flex: 1 1 100%;
	}

	.w-filter.for_list.itx-dropdown-filter .w-filter-item {
		max-width: none;
	}

	.itx-list-panel .itx-list-order .w-order-select {
		width: 100%;
	}

	.itx-list-panel .itx-list-order .w-order-select > select {
		width: 100%;
	}
}

/* ---------------------------------------------------------
   6. Motion
   --------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.w-filter.for_list.itx-dropdown-filter .w-filter-item-title,
	.w-filter.for_list.itx-dropdown-filter .w-filter-item-title::after,
	.w-filter.for_list.itx-dropdown-filter .w-filter-item-reset,
	.w-filter.for_list.itx-dropdown-filter .w-filter-item-value label,
	.w-filter.for_list.itx-dropdown-filter .w-filter-item-value input[type="checkbox"],
	.w-filter.for_list.itx-dropdown-filter .w-filter-item-value input[type="radio"],
	.itx-list-panel .itx-list-order .w-order-select > select {
		transition: none;
	}
}
