/**
 * Almaz Filter — Frontend styles.
 */

/* ================================================================== */
/*  Widget container                                                   */
/* ================================================================== */
.almaz-filter-widget {
	/* Accent color. Overridden per filter set via an inline style on this element. */
	--almaz-accent: #2271b1;

	/* Colors the checked/active state of checkboxes, radios and selects.
	   Inherited by all form controls inside the widget. */
	accent-color: var(--almaz-accent);

	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: #1d2327;
	margin-bottom: 20px;
}

.almaz-filter-widget__title {
	margin: 0 0 12px;
	font-size: 18px;
	font-weight: 700;
	color: #1d2327;
}

/* ================================================================== */
/*  Filter form                                                        */
/* ================================================================== */
.almaz-filter-form {
	display: flex;
	flex-direction: column;
	gap: 0;
}

/* ================================================================== */
/*  Accordion sections                                                 */
/* ================================================================== */
.almaz-filter-section {
	border: 1px solid #e0e0e0;
	border-radius: 4px;
	margin-bottom: 8px;
	background: #fff;
}

.almaz-accordion__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 10px 14px;
	background: none;
	border: none;
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	color: #1d2327;
	text-align: left;
}

.almaz-accordion__header:hover {
	background: #f9f9f9;
}

/* Remove the focus ring that appears after a mouse click, but keep it for
   keyboard users (accessibility). */
.almaz-accordion__header:focus {
	outline: none;
}

.almaz-accordion__header:focus-visible {
	outline: 2px solid var(--almaz-accent);
	outline-offset: -2px;
}

.almaz-accordion__arrow {
	font-size: 10px;
	transition: transform 0.2s ease;
}

.almaz-accordion__header[aria-expanded="false"] .almaz-accordion__arrow {
	transform: rotate(-90deg);
}

.almaz-accordion__body {
	padding: 8px 14px 14px;
	border-top: 1px solid #e0e0e0;
}

/* ================================================================== */
/*  Toggle switch (ui_type = toggle)                                   */
/*  One row: title on the left, switch on the right. The section keeps  */
/*  its .almaz-accordion__body wrapper (refreshPanel swaps that node's  */
/*  innerHTML on every AJAX update — without it the count would go      */
/*  stale), it is just laid out inline instead of stacked.              */
/* ================================================================== */
.almaz-filter-section[data-filter-type="toggle"],
.almaz-filter-section[data-filter-type="rating"] {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 6px 14px;
}

.almaz-toggle-title {
	font-size: 14px;
	font-weight: 600;
	color: #1d2327;
}

.almaz-filter-section[data-filter-type="toggle"] .almaz-accordion__body,
.almaz-filter-section[data-filter-type="rating"] .almaz-accordion__body {
	padding: 0;
	border-top: none;
	flex-shrink: 0;
}

.almaz-toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	/* Comfortable touch target on phones without inflating the desktop row. */
	min-height: 44px;
	cursor: pointer;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
}

/* The real checkbox stays in the DOM and in the tab order — hidden with
   opacity, never display:none, so keyboard focus and form serialisation keep
   working. */
.almaz-toggle__input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	padding: 0;
	opacity: 0;
	pointer-events: none;
}

.almaz-toggle__track {
	display: block;
	position: relative;
	width: 40px;
	height: 22px;
	flex-shrink: 0;
	border-radius: 11px;
	background: #d5d8dc;
	transition: background-color 0.2s ease;
}

.almaz-toggle__thumb {
	display: block;
	position: absolute;
	top: 2px;
	left: 2px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
	transition: transform 0.2s ease;
}

.almaz-toggle__input:checked + .almaz-toggle__track {
	background: var(--almaz-accent);
}

.almaz-toggle__input:checked + .almaz-toggle__track .almaz-toggle__thumb {
	transform: translateX(18px);
}

.almaz-toggle__input:focus-visible + .almaz-toggle__track {
	outline: 2px solid var(--almaz-accent);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.almaz-toggle__track,
	.almaz-toggle__thumb {
		transition: none;
	}
}

/* ================================================================== */
/*  Filter options (checkbox, radio)                                   */
/* ================================================================== */
.almaz-filter-option {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 4px 0;
	cursor: pointer;
	font-size: 13px;
}

/* ------------------------------------------------------------------ */
/*  Hover affordance                                                    */
/*  Amazon-style and deliberately minimal: the label takes the accent   */
/*  colour and the box gets an accent ring. No background fill, no      */
/*  padding or radius on the row — nothing shifts.                      */
/*  @media (hover: hover) so a tap on touch does not leave the          */
/*  last-touched row stuck in the hover state.                          */
/* ------------------------------------------------------------------ */
.almaz-filter-option,
.almaz-filter-option input[type="checkbox"],
.almaz-filter-option input[type="radio"] {
	transition: color .15s ease, outline-color .15s ease;
}

/* .almaz-swatch-option is excluded throughout: colour chips carry their own
   tooltip on hover and any tint would misrepresent the colour being shown. */
@media (hover: hover) {
	.almaz-filter-option:not(.almaz-swatch-option):not(.almaz-filter-option--disabled):hover {
		color: var(--almaz-accent, #2271b1);
	}
}

.almaz-filter-option input[type="checkbox"],
.almaz-filter-option input[type="radio"] {
	margin: 0;
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}

.almaz-term-count {
	color: #909090;
	font-size: 12px;
}

/* "Count position: aligned to the right edge" (per filter set). The count is a
   direct flex child of the option row, so auto margin pushes it to the far
   edge; the label takes the slack and wraps if it must. */
.almaz-counts--right .almaz-filter-option > .almaz-term-count {
	margin-left: auto;
	padding-left: 8px;
	flex-shrink: 0;
}
.almaz-counts--right .almaz-filter-option > .almaz-filter-option__label {
	flex: 1 1 auto;
	min-width: 0;
}

/* ------------------------------------------------------------------ */
/*  Colour / image term inside a checkbox or radio list                 */
/*  The swatch IS the control: the native box is hidden and the tick is  */
/*  drawn on the colour itself. Unchecked shows a plain circle.          */
/* ------------------------------------------------------------------ */
.almaz-swatch {
	position: relative;
	display: inline-block;
	width: 24px;
	height: 24px;
	flex-shrink: 0;
	border-radius: 50%;
	background-color: var(--almaz-swatch-bg, transparent);
	background-image: var(--almaz-swatch-img, none);
	background-size: cover;
	background-position: 50% 50%;
	background-repeat: no-repeat;
	/* Inset ring instead of a border: a border would eat into the 24px and make
	   pale swatches look smaller than dark ones. */
	box-shadow: inset 0 0 0 1px rgba(23, 23, 23, .18);
}

/* The real control stays in the DOM and in the tab order — hidden with
   opacity, never display:none, so keyboard focus and serialisation keep
   working (same approach as the toggle switch). */
.almaz-filter-option--swatch > input[type="checkbox"],
.almaz-filter-option--swatch > input[type="radio"] {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
	pointer-events: none;
}

/* Tick on a white disc, not a bare white tick: a white glyph vanishes on a
   white or cream swatch, while the disc reads on any colour at all. */
.almaz-filter-option--swatch .almaz-swatch::after {
	content: "";
	position: absolute;
	inset: 0;
	margin: auto;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background-color: #fff;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.4l2.4 2.4 4.6-5.2' fill='none' stroke='%231d2327' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-size: 11px 11px;
	background-position: 50% 50%;
	background-repeat: no-repeat;
	box-shadow: 0 0 0 1px rgba(23, 23, 23, .12);
	opacity: 0;
	transform: scale(.6);
	transition: opacity .12s ease, transform .12s ease;
}

.almaz-filter-option--swatch > input:checked ~ .almaz-swatch::after {
	opacity: 1;
	transform: scale(1);
}

/* Keyboard users still get a visible focus ring, since the input itself is
   invisible. */
.almaz-filter-option--swatch > input:focus-visible ~ .almaz-swatch {
	box-shadow: inset 0 0 0 1px rgba(23, 23, 23, .18), 0 0 0 2px var(--almaz-accent, #2271b1);
}

@media (prefers-reduced-motion: reduce) {
	.almaz-filter-option--swatch .almaz-swatch::after {
		transition: none;
	}
}

/* ================================================================== */
/*  Select / Dropdown                                                  */
/* ================================================================== */
.almaz-filter-select {
	width: 100%;
	padding: 6px 10px;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	font-size: 13px;
	background: #fff;
}

/* ================================================================== */
/*  Range Slider                                                       */
/* ================================================================== */
.almaz-range-slider {
	padding: 10px 0;
}

.almaz-range-slider__track {
	margin: 10px 8px;
}

/* Filled portion of the noUiSlider takes the accent color. */
.almaz-filter-widget .noUi-connect {
	background: var(--almaz-accent);
}

.almaz-range-values {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin-top: 8px;
	font-size: 13px;
	color: #50575e;
}

.almaz-range-value {
	flex: 1;
	min-width: 0;
	padding: 6px 8px;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	font-size: 13px;
	text-align: center;
	background: #fff;
	color: inherit;
	/* No spinner arrows: the slider is the coarse control, these fields are for
	   typing an exact bound. Firefox honours `appearance`, Blink/WebKit need
	   the pseudo-elements below. */
	-moz-appearance: textfield;
	appearance: textfield;
}

.almaz-range-value::-webkit-outer-spin-button,
.almaz-range-value::-webkit-inner-spin-button {
	-webkit-appearance: none;
	appearance: none;
	margin: 0;
}

.almaz-range-value:focus {
	outline: none;
	border-color: var(--almaz-accent);
}

/* ================================================================== */
/*  Date Range                                                         */
/* ================================================================== */
.almaz-date-range {
	display: flex;
	align-items: center;
	gap: 8px;
}

.almaz-date-range input {
	flex: 1;
	padding: 6px 10px;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	font-size: 13px;
	background: #fff;
}

.almaz-date-sep {
	color: #787c82;
}

/* ================================================================== */
/*  Meta text input                                                    */
/* ================================================================== */
.almaz-meta-input {
	width: 100%;
	padding: 6px 10px;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	font-size: 13px;
}

/* ================================================================== */
/*  Search input with button                                           */
/* ================================================================== */
.almaz-search-section {
	padding: 10px 14px;
}

.almaz-search-section .almaz-filter-section__title {
	display: block;
	font-weight: 600;
	margin-bottom: 6px;
	font-size: 14px;
}

.almaz-search-wrap {
	display: flex;
	gap: 0;
}

.almaz-search-input {
	flex: 1;
	padding: 8px 12px;
	border: 1px solid #c3c4c7;
	border-radius: 4px 0 0 4px;
	border-right: none;
	font-size: 14px;
}

.almaz-search-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 8px 14px;
	background: var(--almaz-accent);
	color: #fff;
	border: 1px solid var(--almaz-accent);
	border-radius: 0 4px 4px 0;
	cursor: pointer;
	transition: filter 0.15s;
}

.almaz-search-btn:hover {
	filter: brightness(0.9);
}

.almaz-search-btn svg {
	width: 16px;
	height: 16px;
}

/* ================================================================== */
/*  Not found message                                                  */
/* ================================================================== */
.almaz-not-found {
	padding: 40px 20px;
	text-align: center;
	color: #787c82;
	font-size: 15px;
	background: #f9f9f9;
	border: 1px solid #e0e0e0;
	border-radius: 4px;
}

.almaz-not-found p {
	margin: 0;
}

/* Dependent (dynamic) filter with no options left for the current selection. */
.almaz-no-options,
.almaz-parent-hint {
	margin: 0;
	padding: 4px 0;
	color: #787c82;
	font-size: 13px;
	font-style: italic;
}

/* Hierarchical taxonomy tree (expand/collapse). */
.almaz-tree-toggle {
	display: inline-block;
	width: 14px;
	margin-right: 2px;
	font-size: 11px;
	line-height: 1;
	color: #787c82;
	cursor: pointer;
	user-select: none;
	text-align: center;
}

.almaz-filter-option--child {
	position: relative;
}

/* Sort widget (select). */
.almaz-sort-section {
	margin-bottom: 16px;
}

.almaz-sort-section .almaz-filter-section__title {
	display: block;
	margin-bottom: 6px;
	font-weight: 600;
}

.almaz-sort-select {
	width: 100%;
}

/* "Show more" / load-more button. */
.almaz-load-more {
	display: block;
	margin: 20px auto;
	padding: 10px 28px;
	font-size: 15px;
	line-height: 1.2;
	cursor: pointer;
	color: #fff;
	background: var(--almaz-accent, #2271b1);
	border: none;
	border-radius: 4px;
	transition: opacity 0.15s ease;
}

.almaz-load-more:hover {
	opacity: 0.9;
}

.almaz-load-more--loading {
	opacity: 0.6;
	cursor: default;
}

/* "Ghost" option: exists in the catalogue but returns no results for the current
   selection. Shown greyed-out and non-interactive. */
/* Unavailable value. `default`, not `not-allowed`: the "stop" cursor reads as an
   error the shopper caused, when all that happened is the current selection
   left nothing behind this option. The greying already says it is inert, and
   the disabled input blocks the click. */
.almaz-filter-option--disabled {
	opacity: 0.45;
	cursor: default;
}

.almaz-filter-option--disabled input {
	cursor: default;
}

/* ================================================================== */
/*  Buttons                                                            */
/* ================================================================== */
.almaz-filter-actions {
	margin-top: 4px;
}

.almaz-apply-btn {
	display: block;
	width: 100%;
	padding: 10px;
	background: var(--almaz-accent);
	color: #fff;
	border: none;
	border-radius: 4px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: filter 0.15s;
}

.almaz-apply-btn:hover {
	filter: brightness(0.9);
}

/* Locked while the panel is being re-rendered from the pending selection, so it
   cannot be pressed against options that are about to change. */
.almaz-apply-btn:disabled {
	cursor: progress;
	opacity: 0.6;
}

.almaz-reset-btn {
	display: block;
	width: 100%;
	padding: 8px;
	background: none;
	color: var(--almaz-accent);
	border: 1px solid var(--almaz-accent);
	border-radius: 4px;
	font-size: 13px;
	cursor: pointer;
	transition: background-color 0.15s, color 0.15s;
}

.almaz-reset-btn:hover {
	background: var(--almaz-accent);
	color: #fff;
}

/* ================================================================== */
/*  Loading state                                                      */
/* ================================================================== */
.almaz-loading {
	opacity: 0.5;
	pointer-events: none;
	position: relative;
	transition: opacity 0.2s;
}

/* ================================================================== */
/*  Mobile toggle                                                      */
/* ================================================================== */
.almaz-filter-toggle {
	display: none;
}

/* ================================================================== */
/*  Mobile layout (< 768px)                                            */
/* ================================================================== */
@media (max-width: 767px) {
	.almaz-filter-toggle {
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 8px;
		width: 100%;
		padding: 12px;
		background: var(--almaz-accent);
		color: #fff;
		border: none;
		border-radius: 4px;
		font-size: 15px;
		font-weight: 600;
		cursor: pointer;
		margin-bottom: 12px;
	}

	.almaz-filter-toggle__icon {
		font-size: 18px;
	}

	.almaz-filter-form {
		display: none;
	}

	.almaz-filter-form.almaz-open {
		display: flex;
		flex-direction: column;
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 99999;
		background: #fff;
		padding: 16px;
		overflow-y: auto;
		animation: almazSlideUp 0.25s ease;
	}

	/* Prevent body scroll when overlay is open */
	body.almaz-filter-overlay-open {
		overflow: hidden;
	}

	/* Hide the posts/cards container while the filter overlay is open so cards
	   don't show through (robust even if a transformed ancestor breaks the
	   panel's fixed positioning). Applied to the configured container via JS. */
	.almaz-hidden-overlay {
		display: none !important;
	}

	@keyframes almazSlideUp {
		from {
			transform: translateY(100%);
			opacity: 0;
		}
		to {
			transform: translateY(0);
			opacity: 1;
		}
	}
}

/* ============================================================
   Active-filter chips (removable tags of selected values)
   ============================================================ */
.almaz-active-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	margin: 0 0 16px;
}

.almaz-active-chips--empty {
	display: none;
	margin: 0;
}

.almaz-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	padding: 5px 10px;
	background: #f0f0f1;
	border: 1px solid #dcdcde;
	border-radius: 16px;
	font-size: 13px;
	line-height: 1.3;
	color: #1d2327;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.almaz-chip:hover,
.almaz-chip:focus-visible {
	background: #e5f0f8;
	border-color: var(--almaz-accent, #2271b1);
	outline: none;
}

.almaz-chip__label {
	font-weight: 600;
}

.almaz-chip__value {
	font-weight: 400;
}

.almaz-chip__remove {
	font-size: 16px;
	line-height: 1;
	color: #787c82;
}

.almaz-chip:hover .almaz-chip__remove,
.almaz-chip:focus-visible .almaz-chip__remove {
	color: var(--almaz-accent, #2271b1);
}

.almaz-chip--reset {
	background: transparent;
	border: 1px dashed var(--almaz-accent, #2271b1);
	color: var(--almaz-accent, #2271b1);
	font-weight: 600;
}

.almaz-chip--reset:hover,
.almaz-chip--reset:focus-visible {
	background: var(--almaz-accent, #2271b1);
	border-color: var(--almaz-accent, #2271b1);
	color: #fff;
}

/* SEO filter pages — text block under the product grid */
.almaz-seo-text {
	margin: 2em 0;
	clear: both;
}
.almaz-seo-text__title {
	margin: 0 0 .5em;
}
.almaz-seo-text__body {
	color: inherit;
	line-height: 1.6;
}

/* ------------------------------------------------------------------ */
/*  Collapse long option lists ("Show all" toggle)                     */
/* ------------------------------------------------------------------ */
.almaz-filter-option.almaz-facet-hidden {
	display: none !important;
}

/* Only the option list scrolls, never the whole section body: applyCollapse()
   wraps the options in .almaz-facet-list and leaves the "Show all"/"Collapse"
   link as a sibling below it, so the link is always visible without any sticky
   positioning (which Chrome failed to repaint while the list was scrolling).
   --almaz-facet-height is written on .almaz-filter-widget from the "Collapse
   long option lists" settings (px, or `none` when the admin set 0); the 320px
   fallback only applies if the variable is absent. */
.almaz-facet-expanded .almaz-facet-list {
	max-height: var(--almaz-facet-height, 320px);
	overflow-y: auto;
	overscroll-behavior: contain;
}

/* Slim, arrow-less scrollbar for Blink/WebKit. `appearance: none` on the
   scrollbar itself is what drops the stepper arrows; ::-webkit-scrollbar-button
   is belt-and-braces for older builds that keep them. */
.almaz-facet-expanded .almaz-facet-list::-webkit-scrollbar {
	-webkit-appearance: none;
	appearance: none;
	width: 6px;
}
.almaz-facet-expanded .almaz-facet-list::-webkit-scrollbar-button {
	display: none;
	width: 0;
	height: 0;
}
.almaz-facet-expanded .almaz-facet-list::-webkit-scrollbar-track {
	background: transparent;
}
.almaz-facet-expanded .almaz-facet-list::-webkit-scrollbar-thumb {
	background-color: #c2c6cd;
	border-radius: 4px;
}
.almaz-facet-expanded .almaz-facet-list::-webkit-scrollbar-thumb:hover {
	background-color: #a6a9b2;
}

/* Firefox has no ::-webkit-scrollbar and needs the standard properties — but
   they must stay out of Blink's reach. Measured: declaring scrollbar-width or
   scrollbar-color makes Chrome render its own standard scrollbar (10px) and
   ignore every ::-webkit-scrollbar rule above, so the 6px would be lost.
   Firefox's thin scrollbar has no stepper arrows to begin with. */
@supports not selector(::-webkit-scrollbar) {
	.almaz-facet-expanded .almaz-facet-list {
		scrollbar-width: thin;
		scrollbar-color: #c2c6cd transparent;
	}
}

.almaz-facet-showall {
	display: inline-flex;
	align-items: center;
	gap: .35em;
	margin-top: .5em;
	padding: 0;
	background: none;
	border: none;
	cursor: pointer;
	color: var(--almaz-accent, #2271b1);
	font-size: .9em;
	font-weight: 600;
}

/* The background/colour resets are repeated on :hover and :focus on purpose:
   themes style `button:hover` (specificity 0,1,1), which outranks the plain
   `.almaz-facet-showall` class above and was painting this link's background
   black on hover. */
.almaz-facet-showall:hover,
.almaz-facet-showall:focus,
.almaz-facet-showall:focus-visible,
.almaz-facet-showall:active {
	background: none;
	border: none;
	box-shadow: none;
	color: var(--almaz-accent, #2271b1);
	text-decoration: underline;
}

/* ------------------------------------------------------------------ */
/*  Labels (pill buttons)                                              */
/* ------------------------------------------------------------------ */
.almaz-filter-section[data-filter-type="labels"] .almaz-accordion__body,
.almaz-filter-section[data-filter-type="labels"] .almaz-facet-list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
/* When collapsing wraps the pills in .almaz-facet-list, that wrapper becomes
   the body's flex item — it has to span the row and carry the pill layout
   itself (rule above), or the pills would stack in a single column. */
.almaz-filter-section[data-filter-type="labels"] .almaz-facet-list,
.almaz-filter-section[data-filter-type="labels"] .almaz-facet-showall {
	flex-basis: 100%;
}
.almaz-filter-section[data-filter-type="labels"] .almaz-filter-option {
	margin: 0;
	padding: 6px 14px;
	border: 1px solid #d5d8dc;
	border-radius: 999px;
	cursor: pointer;
	line-height: 1.2;
	transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.almaz-filter-section[data-filter-type="labels"] .almaz-filter-option input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}
.almaz-filter-section[data-filter-type="labels"] .almaz-filter-option:has(input:checked) {
	border-color: var(--almaz-accent, #2271b1);
	background: var(--almaz-accent, #2271b1);
	color: #fff;
}
/* Fallback for browsers without :has() — colour just the label text. */
.almaz-filter-section[data-filter-type="labels"] .almaz-filter-option input:checked ~ span {
	font-weight: 600;
}
.almaz-filter-section[data-filter-type="labels"] .almaz-filter-option--disabled {
	opacity: .5;
	cursor: default;
}

/* ------------------------------------------------------------------ */
/*  Image + name (ui_type = image_list): tile + name, multi-select      */
/*  Modelled on Ozon's brand facet — 44px bordered tile holding a 36px   */
/*  logo, name beside it, accent border while hovered or picked. Plain   */
/*  checkboxes underneath, so several values combine and a second click  */
/*  clears one; the native box is hidden because the tile IS the state.  */
/* ------------------------------------------------------------------ */
.almaz-brand-option {
	gap: 10px;
	padding: 4px 0;
}

/* Hidden with opacity, never display:none, so keyboard focus and form
   serialisation keep working. [type] qualifier is load-bearing: the base rule
   that sizes checkboxes is `.almaz-filter-option input[type="checkbox"]`. */
.almaz-brand-option > input[type="checkbox"] {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
	pointer-events: none;
}

.almaz-brand-tile {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	box-sizing: border-box;
	width: 44px;
	height: 44px;
	padding: 3px;
	border: 1px solid #e0e2e6;
	border-radius: 12px;
	background: #fff;
	transition: border-color .15s ease;
}

/* The art keeps its own rounding and clips the logo. `contain`, not `cover`:
   a brand logo is usually wide and cropping it to a square destroys it. */
.almaz-brand-tile__art {
	display: block;
	width: 36px;
	height: 36px;
	border-radius: 8px;
	background-color: var(--almaz-swatch-bg, transparent);
	background-image: var(--almaz-swatch-img, none);
	background-size: contain;
	background-position: 50% 50%;
	background-repeat: no-repeat;
}

/* Selected: a 2px accent border, with the padding trimmed by the same 1px so
   the tile keeps its 44px and the row never shifts. */
.almaz-brand-option > input:checked ~ .almaz-brand-tile {
	border-color: var(--almaz-accent, #2271b1);
	border-width: 2px;
	padding: 2px;
}
.almaz-brand-option > input:focus-visible ~ .almaz-brand-tile {
	outline: 2px solid var(--almaz-accent, #2271b1);
	outline-offset: 2px;
}

/* Hover: the same accent at half strength, so hover and "selected" stay
   distinguishable — at full strength they were the identical border. Only for
   tiles that are not already chosen; a selected one keeps its solid accent.
   The plain colour is declared first as the fallback for engines without
   color-mix(). */
@media (hover: hover) {
	.almaz-brand-option:not(.almaz-filter-option--disabled):hover > input:not(:checked) ~ .almaz-brand-tile {
		border-color: var(--almaz-accent, #2271b1);
		border-color: color-mix(in srgb, var(--almaz-accent, #2271b1) 50%, transparent);
		border-width: 2px;
		padding: 2px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.almaz-brand-tile {
		transition: none;
	}
}

/* ------------------------------------------------------------------ */
/*  Images, grid (ui_type = image_grid)                                */
/*  Woodmart's "Filter by brand" arrangement — bare tiles, N per row,  */
/*  name and count in the hover tooltip — with Zolden's framed tile.   */
/*  Interaction is the same as image_list: plain checkboxes, so values */
/*  combine and a second click clears one.                             */
/* ------------------------------------------------------------------ */
/* Declared on BOTH the body and .almaz-facet-list: once "Show all" kicks in,
   applyCollapse() moves the options inside .almaz-facet-list, and a rule living
   only on the body would stop applying to them. */
.almaz-filter-section[data-filter-type="image_grid"] .almaz-accordion__body,
.almaz-filter-section[data-filter-type="image_grid"] .almaz-facet-list {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 8px;
}
.almaz-filter-section[data-almaz-grid-cols="1"] .almaz-accordion__body,
.almaz-filter-section[data-almaz-grid-cols="1"] .almaz-facet-list { grid-template-columns: repeat(1, 1fr); }
.almaz-filter-section[data-almaz-grid-cols="2"] .almaz-accordion__body,
.almaz-filter-section[data-almaz-grid-cols="2"] .almaz-facet-list { grid-template-columns: repeat(2, 1fr); }
.almaz-filter-section[data-almaz-grid-cols="3"] .almaz-accordion__body,
.almaz-filter-section[data-almaz-grid-cols="3"] .almaz-facet-list { grid-template-columns: repeat(3, 1fr); }
.almaz-filter-section[data-almaz-grid-cols="4"] .almaz-accordion__body,
.almaz-filter-section[data-almaz-grid-cols="4"] .almaz-facet-list { grid-template-columns: repeat(4, 1fr); }
.almaz-filter-section[data-almaz-grid-cols="5"] .almaz-accordion__body,
.almaz-filter-section[data-almaz-grid-cols="5"] .almaz-facet-list { grid-template-columns: repeat(5, 1fr); }
.almaz-filter-section[data-almaz-grid-cols="6"] .almaz-accordion__body,
.almaz-filter-section[data-almaz-grid-cols="6"] .almaz-facet-list { grid-template-columns: repeat(6, 1fr); }

/* The scroll wrapper and the "Show all" link are rows of their own, not cells. */
.almaz-filter-section[data-filter-type="image_grid"] .almaz-facet-list,
.almaz-filter-section[data-filter-type="image_grid"] .almaz-facet-showall {
	grid-column: 1 / -1;
}
/* Same reason as the colour palette: the tooltip sits above the tile, and a
   scroll container would clip it. The swatch count keeps a long grid short. */
.almaz-filter-section[data-filter-type="image_grid"] .almaz-facet-list {
	max-height: none;
	overflow: visible;
}

.almaz-imggrid-option {
	position: relative;
	display: block;
	margin: 0;
	padding: 0;
	cursor: pointer;
}
/* Hidden with opacity, never display:none, so keyboard focus and form
   serialisation keep working. [type] qualifier is load-bearing: the base rule
   that sizes checkboxes is `.almaz-filter-option input[type="checkbox"]`. */
.almaz-imggrid-option > input[type="checkbox"] {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
	pointer-events: none;
}

.almaz-imggrid-tile {
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 100%;
	/* Only a picture-free grid ever sets the variable — see the template. */
	height: var(--almaz-grid-h, 56px);
	padding: 3px;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	background: #fff;
	transition: border-color .15s ease;
}
.almaz-imggrid-tile__art {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	overflow: hidden;
	border-radius: 2px;
	background-color: var(--almaz-swatch-bg, transparent);
	background-image: var(--almaz-swatch-img, none);
	/* contain, not cover: a logo cropped to the tile is destroyed. */
	background-size: contain;
	background-position: 50% 50%;
	background-repeat: no-repeat;
	/* Text fallback for a term with neither picture nor colour. */
	padding: 0 6px;
	font-size: .82em;
	line-height: 1.2;
	text-align: center;
	overflow-wrap: anywhere;
}

/* Selected: a 2px accent border with the padding trimmed by the same 1px, so
   the tile keeps its size and the grid never reflows. */
.almaz-imggrid-option > input:checked ~ .almaz-imggrid-tile {
	border-color: var(--almaz-accent, #2271b1);
	border-width: 2px;
	padding: 2px;
}
.almaz-imggrid-option > input:focus-visible ~ .almaz-imggrid-tile {
	outline: 2px solid var(--almaz-accent, #2271b1);
	outline-offset: 2px;
}

/* Hover: the same accent at half strength, so hover stays distinguishable from
   "selected". Plain colour first as the fallback for engines without color-mix(). */
@media (hover: hover) {
	.almaz-imggrid-option:not(.almaz-filter-option--disabled):hover > input:not(:checked) ~ .almaz-imggrid-tile {
		border-color: var(--almaz-accent, #2271b1);
		border-color: color-mix(in srgb, var(--almaz-accent, #2271b1) 50%, transparent);
		border-width: 2px;
		padding: 2px;
	}
}

.almaz-imggrid-option.almaz-filter-option--disabled {
	cursor: default;
	opacity: .45;
}

@media (prefers-reduced-motion: reduce) {
	.almaz-imggrid-tile {
		transition: none;
	}
}

/* ------------------------------------------------------------------ */
/*  Colour swatches (ui_type = swatch_color)                           */
/*  Round chips carrying a colour and/or an image, with the term name  */
/*  and count in a hover tooltip instead of a caption.                 */
/* ------------------------------------------------------------------ */
.almaz-filter-section[data-filter-type="swatch_color"] .almaz-accordion__body,
.almaz-filter-section[data-filter-type="swatch_color"] .almaz-facet-list {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
}
.almaz-filter-section[data-filter-type="swatch_color"] .almaz-facet-list,
.almaz-filter-section[data-filter-type="swatch_color"] .almaz-facet-showall {
	flex-basis: 100%;
}
/* Swatch grids opt out of the expanded-height cap: the tooltip sits above the
   chip, and a scroll container would clip it. The swatch count setting is what
   keeps a long palette short here. */
.almaz-filter-section[data-filter-type="swatch_color"] .almaz-facet-list {
	max-height: none;
	overflow: visible;
}

.almaz-swatch-option {
	--almaz-swatch-size: 30px;
	--almaz-swatch-edge: rgba(23, 23, 23, .115);
	position: relative;
	display: block;
	width: var(--almaz-swatch-size);
	height: var(--almaz-swatch-size);
	margin: 0;
	padding: 0;
	border-radius: 999px;
	cursor: pointer;
	background-color: var(--almaz-swatch-bg, transparent);
	background-image: var(--almaz-swatch-img, none);
	background-size: cover;
	background-position: 50% 50%;
	background-repeat: no-repeat;
}
/* [type] qualifier is load-bearing: the base rule that sizes checkboxes is
   `.almaz-filter-option input[type="checkbox"]`, and a plain `.almaz-swatch-option
   input` would lose to it and leave a 16px box sitting on the chip. */
.almaz-swatch-option input[type="checkbox"] {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
	margin: 0;
}

/* Depth: a hairline ring plus a soft shadow falling from the top-left, so pale
   chips (white, cream) still read as objects rather than holes in the page. */
.almaz-swatch-dot {
	position: absolute;
	inset: 0;
	border-radius: inherit;
	box-shadow:
		inset 0 0 0 1px var(--almaz-swatch-edge),
		inset 1px 3px 0 var(--almaz-swatch-edge);
}

/* Selected: a ring floating just outside the chip, so it never covers the
   colour itself. */
.almaz-swatch-dot::after {
	content: "";
	position: absolute;
	inset: -3px;
	border-radius: inherit;
	box-shadow: 0 0 0 2px var(--almaz-accent, #2271b1);
	opacity: 0;
	transition: opacity .15s ease;
}
.almaz-swatch-option input:checked ~ .almaz-swatch-dot::after {
	opacity: 1;
}
.almaz-swatch-option input:focus-visible ~ .almaz-swatch-dot::after {
	opacity: .45;
}

/* Unavailable values (the "show greyed out" ghosts mode): struck through with a
   diagonal line, which stays legible on any chip colour. */
.almaz-swatch-option.almaz-filter-option--disabled {
	cursor: default;
	opacity: .55;
}
.almaz-swatch-option.almaz-filter-option--disabled .almaz-swatch-dot {
	background: linear-gradient(
		to bottom right,
		transparent calc(50% - .5px),
		rgba(23, 23, 23, .45) calc(50% - .5px) calc(50% + .5px),
		transparent calc(50% + .5px)
	);
}

/* Tooltip carrying "Name (count)". Never display:none — only its opacity is
   animated — because this span is also the label's accessible name. */
.almaz-swatch-tip {
	position: absolute;
	bottom: calc(100% + 10px);
	left: 50%;
	z-index: 3;
	width: max-content;
	max-width: 180px;
	padding: 5px 12px;
	border-radius: 999px;
	background: #171717;
	color: #fff;
	font-size: 12px;
	line-height: 1.35;
	text-align: center;
	opacity: 0;
	pointer-events: none;
	transform: translateX(-50%) scale(.75);
	transition: opacity .15s ease, transform .15s ease;
}
.almaz-swatch-tip::after {
	content: "";
	position: absolute;
	bottom: -5px;
	left: 50%;
	margin-left: -5px;
	border: 5px solid transparent;
	border-bottom: 0;
	border-top-color: #171717;
}
/* Only where a real pointer exists: after a tap on touch the tooltip would
   stay stuck open over the neighbouring chips. */
@media (pointer: fine) {
	.almaz-swatch-option:hover .almaz-swatch-tip,
	.almaz-imggrid-option:hover .almaz-swatch-tip {
		opacity: 1;
		transform: translateX(-50%) scale(1);
	}
}
@media (prefers-reduced-motion: reduce) {
	.almaz-swatch-tip {
		transition: none;
	}
}
/* Caption under an image swatch. swatch_color is deliberately NOT in this
   selector any more: its chips have no caption, and this rule would otherwise
   outrank .almaz-swatch-tip and shrink the tooltip text. */

/* ------------------------------------------------------------------ */
/*  Rating (stars) filter                                              */
/* ------------------------------------------------------------------ */
/* The rating filter is a single switch ("Rated 4 and up") laid out exactly like
   ui_type=toggle — see the toggle block near the top of this file. All that is
   left here is the gold star that follows the wording in the section header. */
.almaz-rating-star {
	color: #f5a623;
	font-size: 1.05em;
	line-height: 1;
	margin-left: .25em;
}
/* Star chips render the star glyphs in gold too. */
.almaz-chip__value {
	white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/*  Searchable facets: fSelect (dropdown) + autocomplete               */
/* ------------------------------------------------------------------ */
.almaz-facet-search {
	width: 100%;
	box-sizing: border-box;
	padding: 6px 10px;
	margin-bottom: 8px;
	border: 1px solid #d5d8dc;
	border-radius: 6px;
	font-size: .95em;
}
.almaz-fselect-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	width: 100%;
	padding: 8px 12px;
	background: #fff;
	border: 1px solid #d5d8dc;
	border-radius: 6px;
	cursor: pointer;
	text-align: left;
	color: inherit;
}
.almaz-fselect-toggle__arrow {
	font-size: .8em;
	line-height: 1;
	color: var(--almaz-accent, #2271b1);
}
.almaz-fselect-panel {
	margin-top: 6px;
	border: 1px solid #e2e4e7;
	border-radius: 6px;
	padding: 8px;
	background: #fff;
}
.almaz-fselect-list {
	max-height: 240px;
	overflow-y: auto;
}

/* ------------------------------------------------------------------ */
/*  Navigation widgets (categories / brands)                           */
/* ------------------------------------------------------------------ */
.almaz-nav-category {
	list-style: none;
	margin: 0;
	padding: 0;
}
.almaz-nav-item {
	margin: 0;
}
.almaz-nav-link {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 5px 0;
	text-decoration: none;
	color: inherit;
}
/* :not(--current) — the current row shares the .almaz-nav-link class for its
   layout, but it is a span with nowhere to go, so it must not answer hover. */
.almaz-nav-link:not(.almaz-nav-link--current):hover .almaz-nav-name {
	color: var(--almaz-accent, #2271b1);
	text-decoration: underline;
}
.almaz-nav-link.is-active .almaz-nav-name {
	color: var(--almaz-accent, #2271b1);
	font-weight: 600;
}

/* ================================================================== */
/*  Hover affordance for the remaining control types                   */
/*  Same intent as the checkbox/radio rows near the top of this file:  */
/*  make it obvious the whole control is clickable, without shouting.  */
/*  Colour swatches are deliberately absent — they answer hover with   */
/*  their tooltip instead.                                             */
/* ================================================================== */
@media (hover: hover) {

	/* Every control answers hover with the accent TEXT colour and nothing else —
	   no rings, no borders, no fills. Label pills carry their own text, so the
	   rule at the top of this file already covers them.

	   Selects and the fSelect trigger have no text of their own to recolour and
	   deliberately get no hover treatment: a border change there was the
	   "accent frame" the client asked to drop. */

	/* Toggle switch — darken the track only while off, so the "on" accent
	   colour is never muddied. */
	.almaz-toggle__input:not(:checked) + .almaz-toggle__track:hover {
		background: #b6bac0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.almaz-filter-option,
	.almaz-filter-option input[type="checkbox"],
	.almaz-filter-option input[type="radio"] {
		transition: none;
	}
}

/* ================================================================== */
/*  Two-level category display (Ozon-style)                            */
/*  Parent one step up, then the current category and its children at   */
/*  the same indent. Applies to nav links and to checkbox/radio lists;  */
/*  a flat taxonomy never produces these classes.                       */
/* ================================================================== */

/* The step-up row: a chevron and muted text, so it reads as "back" and
   not as another category to pick. */
.almaz-nav-item--up > .almaz-nav-link,
.almaz-filter-option--up {
	color: #646970;
}
.almaz-nav-up {
	display: inline-block;
	margin-right: 4px;
	font-size: 1.1em;
	line-height: 1;
}

/* The category you are already on: a grey pill, plain text, no link. Ozon uses
   the same shape (8px radius, 6px/8px padding) and cancels its own link with
   `cursor: default` — here there is simply no <a> to click. */
.almaz-nav-link--current {
	background: #f2f3f5;
	border-radius: 8px;
	padding: 6px 8px;
	cursor: default;
	color: #1d2327;
}
/* Match the horizontal inset on the ordinary rows so the names line up whether
   or not the pill is there. */
.almaz-nav-link {
	padding-left: 8px;
	padding-right: 8px;
}
.almaz-nav-item--up > .almaz-nav-link {
	/* The chevron hangs into that inset instead of pushing the name across. */
	padding-left: 0;
}

/* In a checkbox/radio list the current row has no pill — the checked control
   already marks it — so weight alone carries it. */
.almaz-filter-option--current > .almaz-filter-option__label {
	font-weight: 600;
	color: #1d2327;
}

/* "All" as the last row of a radio list: a reset, not a value. */
.almaz-filter-option--any > .almaz-filter-option__label {
	color: var(--almaz-accent, #2271b1);
}
.almaz-filter-option--any {
	margin-top: 2px;
}
