/*
 * Filter section v2 — luxury PLP (faceted sidebar + mobile sheet)
 * Research: vertical sidebar for many facets; mobile drawer/modal; minimal editorial UI.
 * Page layout: .plp-shell--fv2 wraps aside (this block) + .plp-shell__main (products grid).
 */

/* Above navbar (~1001), bottom nav (1000), cart (999), chat / festival overlays (9999) */
:root {
	--fv2-z-backdrop: 50000;
	--fv2-z-sheet: 50001;
	/* Match app.css .products { padding: 60px 0 } — single source for PLP vertical rhythm */
	--fv2-plp-section-pad: 60px;
}

.fv2-sr-only {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

/* ---- Page shell: sidebar | products (desktop) ---- */
/* Match .products vertical rhythm so filter column lines up with product cards */
.plp-shell--fv2 {
	width: 100%;
	max-width: 1480px;
	margin-inline: auto;
	padding-inline: clamp(16px, 3vw, 32px);
}

@media (min-width: 992px) {
	.plp-shell--fv2 {
		display: grid;
		grid-template-columns: minmax(0, 288px) minmax(0, 1fr);
		gap: clamp(20px, 3vw, 44px);
		align-items: start;
		/* Keep filter + grid in normal flow so sticky does not paint over footer */
		position: relative;
		z-index: 0;
	}

	.plp-shell__aside {
		position: sticky;
		top: calc(88px + env(safe-area-inset-top, 0px));
		align-self: start;
		/* Cap height so long filter UI scrolls inside, not over footer */
		max-height: calc(100vh - 88px - env(safe-area-inset-top, 0px) - 32px);
		display: flex;
		flex-direction: column;
		min-height: 0;
	}

	.plp-shell__main {
		min-width: 0;
		/* Prevent margin collapse with section.products so top alignment stays predictable */
		display: flow-root;
	}
}

/*
 * Avoid double top padding: .products has padding: 60px 0 in app.css — strip top only here
 * so the sticky sidebar and product cards share the same vertical start.
 */
.plp-shell--fv2 .plp-shell__main > section.products {
	padding-bottom: var(--fv2-plp-section-pad) !important;
}

/* Sticky sidebar must not paint over the footer when scrolling */
body:has(.plp-shell--fv2) footer {
	position: relative;
	z-index: 5;
}

/* ---- Root ---- */
.fv2-root {
	position: relative;
	/* No z-index here — avoids stacking over page footer when sticky */
}

/* Dim overlay (mobile) */
.fv2-backdrop {
	display: none;
	position: fixed;
	inset: 0;
	z-index: var(--fv2-z-backdrop);
	background: rgba(15, 12, 10, 0.48);
	backdrop-filter: blur(4px);
	opacity: 0;
	transition: opacity 0.35s ease;
}

.fv2-backdrop.is-visible {
	display: block;
	opacity: 1;
}

body.fv2-plp-open {
	overflow: hidden;
	touch-action: none;
}

/* ---- Mobile trigger bar ---- */
.fv2-mob-bar {
	margin-bottom: 12px;
}

@media (min-width: 992px) {
	/* Desktop: completely remove mobile bar from flow */
	.fv2-mob-bar {
		display: none !important;
		margin: 0;
		height: 0;
		overflow: hidden;
	}
}

.fv2-root .mobile-filter-toggle.fv2-mob {
	display: none;
	width: 100%;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 16px 24px;
	border: none;
	border-radius: 2px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.28em;
	text-transform: uppercase;
	cursor: pointer;
	color: var(--primary-title-color, #1a1a1a);
	background: var(--primary-background-color, #fff);
	border: 1px solid color-mix(in srgb, var(--primary-title-color, #000) 12%, transparent);
	box-shadow: 0 18px 40px color-mix(in srgb, var(--primary-title-color, #000) 8%, transparent);
}

.fv2-mob__icon {
	font-size: 14px;
	opacity: 0.7;
}

/* Mobile sheet top bar — hidden on desktop */
.fv2-mob-sheet-header {
	display: none;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-shrink: 0;
	padding: 12px 18px;
	padding-top: max(12px, env(safe-area-inset-top, 0px));
	border-bottom: 1px solid color-mix(in srgb, var(--primary-title-color, #000) 10%, transparent);
	background: color-mix(in srgb, var(--secondary-background-color, #f5f2ed) 35%, var(--primary-background-color, #fff));
}

.fv2-mob-sheet-title {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: var(--primary-title-color, #111);
}

.fv2-close-sheet {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: none;
	border-radius: 2px;
	background: color-mix(in srgb, var(--primary-title-color, #000) 6%, transparent);
	color: var(--primary-title-color, #111);
	cursor: pointer;
	transition:
		background 0.2s ease,
		transform 0.15s ease;
}

.fv2-close-sheet:hover {
	background: color-mix(in srgb, var(--primary-title-color, #000) 12%, transparent);
}

.fv2-close-sheet:active {
	transform: scale(0.96);
}

.fv2-close-sheet i {
	font-size: 18px;
	line-height: 1;
}

[dir='rtl'] .fv2-mob-sheet-header {
	flex-direction: row-reverse;
}

/* ---- Panel (sidebar / sheet) ---- */
.fv2-root .filter-section.fv2-panel {
	position: relative;
	display: flex;
	flex-direction: column;
	max-height: none;
	margin: 0;
	padding: 0;
	background: var(--primary-background-color, #fafaf9);
	border: 1px solid color-mix(in srgb, var(--primary-title-color, #000) 8%, transparent);
	border-radius: 2px;
	box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
	overflow: hidden;
}

@media (min-width: 992px) {
	/* Fill sticky aside; scroll stays inside .fv2-panel__scroll */
	.fv2-root.plp-shell__aside .filter-section.fv2-panel {
		flex: 1 1 auto;
		min-height: 0;
		max-height: 100%;
	}
}

.fv2-panel__scroll {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 22px 20px 12px;
	-webkit-overflow-scrolling: touch;
}

@media (min-width: 992px) {
	/* Desktop: minimal top padding so filter content aligns with product cards */
	.fv2-panel__scroll {
		padding-top: 0;
	}
}

.fv2-panel__foot {
	flex-shrink: 0;
	padding: 16px 20px 20px;
	border-top: 1px solid color-mix(in srgb, var(--primary-title-color, #000) 8%, transparent);
	background: color-mix(in srgb, var(--secondary-background-color, #f5f2ed) 40%, var(--primary-background-color, #fff));
}

/* ---- Header (editorial minimal) ---- */
.fv2-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 22px;
	padding-bottom: 18px;
	border-bottom: 1px solid color-mix(in srgb, var(--primary-title-color, #000) 10%, transparent);
}

@media (min-width: 992px) {
	/* Desktop: reduce header spacing for tighter alignment */
	.fv2-head {
		margin-bottom: 16px;
		padding-bottom: 12px;
		padding-top: 8px;
	}
}

.fv2-eyebrow {
	margin: 0 0 6px;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.35em;
	text-transform: uppercase;
	color: color-mix(in srgb, var(--primary-text-color, #555) 75%, transparent);
}

.fv2-heading {
	margin: 0;
	font-size: 22px;
	font-weight: 300;
	letter-spacing: 0.02em;
	line-height: 1.15;
	color: var(--primary-title-color, #111);
	font-family: Georgia, 'Times New Roman', serif;
}

.fv2-root .reset-filters.fv2-clear {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	text-decoration: none;
	color: color-mix(in srgb, var(--primary-text-color, #444) 90%, transparent);
	border-bottom: 1px solid color-mix(in srgb, var(--primary-title-color, #000) 20%, transparent);
	padding-bottom: 2px;
	transition: color 0.2s ease, border-color 0.2s ease;
}

.fv2-root .reset-filters.fv2-clear:hover {
	color: var(--primary-title-color, #000);
	border-bottom-color: var(--primary-title-color, #000);
}

/* ---- Accordions (<details>) ---- */
.fv2-acc {
	border-bottom: 1px solid color-mix(in srgb, var(--primary-title-color, #000) 7%, transparent);
}

.fv2-acc__summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 0;
	cursor: pointer;
	list-style: none;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--primary-title-color, #222);
}

.fv2-acc__summary::-webkit-details-marker {
	display: none;
}

.fv2-acc__icon {
	width: 18px;
	height: 18px;
	position: relative;
	flex-shrink: 0;
	opacity: 0.45;
}

.fv2-acc__icon::before,
.fv2-acc__icon::after {
	content: '';
	position: absolute;
	background: currentColor;
	border-radius: 1px;
}

.fv2-acc__icon::before {
	width: 10px;
	height: 1.5px;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
}

.fv2-acc__icon::after {
	width: 1.5px;
	height: 10px;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	transition: opacity 0.2s ease;
}

.fv2-acc[open] .fv2-acc__icon::after {
	opacity: 0;
}

.fv2-acc__body {
	padding-bottom: 16px;
}

.fv2-muted {
	margin: 0;
	font-size: 13px;
	color: color-mix(in srgb, var(--primary-text-color, #666) 85%, transparent);
}

/* ---- Chips ---- */
.fv2-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.fv2-chip {
	position: relative;
	cursor: pointer;
}

.fv2-chip__input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	margin: 0;
}

.fv2-chip__text {
	display: inline-block;
	padding: 8px 14px;
	border-radius: 2px;
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 0.04em;
	color: var(--primary-title-color, #333);
	background: var(--primary-background-color, #fff);
	border: 1px solid color-mix(in srgb, var(--primary-title-color, #000) 12%, transparent);
	transition:
		border-color 0.2s ease,
		background 0.2s ease,
		color 0.2s ease;
}

.fv2-chip:hover .fv2-chip__text {
	border-color: color-mix(in srgb, var(--primary-title-color, #000) 22%, transparent);
}

.fv2-chip__input:focus-visible + .fv2-chip__text {
	outline: 2px solid var(--primary-brand-color, #c9a227);
	outline-offset: 2px;
}

.fv2-chip__input:checked + .fv2-chip__text {
	color: var(--primary-title-color, #111);
	background: color-mix(in srgb, var(--primary-brand-color, #c9a227) 12%, transparent);
	border-color: color-mix(in srgb, var(--primary-brand-color, #c9a227) 55%, transparent);
}

.fv2-chip--line .fv2-chip__text {
	border-radius: 999px;
}

/* ---- Price ---- */
.fv2-price__hero {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin-bottom: 14px;
}

.fv2-price__cap {
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: color-mix(in srgb, var(--primary-text-color, #555) 80%, transparent);
}

.fv2-price__val {
	font-size: 28px;
	font-weight: 300;
	font-variant-numeric: tabular-nums;
	letter-spacing: -0.02em;
	color: var(--primary-title-color, #111);
}

.fv2-price__range {
	width: 100%;
	height: 2px;
	-webkit-appearance: none;
	appearance: none;
	background: color-mix(in srgb, var(--primary-title-color, #000) 14%, transparent);
	border-radius: 0;
	margin: 0 0 10px;
	outline: none;
}

.fv2-price__range::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--primary-title-color, #111);
	border: 2px solid var(--primary-background-color, #fff);
	box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary-title-color, #000) 25%, transparent);
	cursor: pointer;
}

.fv2-price__range::-moz-range-thumb {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--primary-title-color, #111);
	border: 2px solid var(--primary-background-color, #fff);
	cursor: pointer;
}

.fv2-price__ends {
	display: flex;
	justify-content: space-between;
	font-size: 11px;
	font-weight: 500;
	color: color-mix(in srgb, var(--primary-text-color, #666) 90%, transparent);
}

/* ---- Sort: underline tabs ---- */
.fv2-sortblock {
	margin-top: 8px;
	padding-top: 18px;
	border-top: 1px solid color-mix(in srgb, var(--primary-title-color, #000) 7%, transparent);
}

.fv2-sortblock__label {
	margin: 0 0 12px;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: color-mix(in srgb, var(--primary-text-color, #555) 85%, transparent);
}

.fv2-sort {
	display: flex;
	flex-direction: column;
	gap: 0;
}

.fv2-sort__btn {
	position: relative;
	display: block;
	width: 100%;
	padding: 12px 0;
	border: none;
	background: none;
	font-size: 13px;
	font-weight: 400;
	text-align: start;
	color: color-mix(in srgb, var(--primary-text-color, #444) 95%, transparent);
	cursor: pointer;
	transition: color 0.2s ease;
}

.fv2-sort__btn::after {
	content: '';
	position: absolute;
	left: 0;
	bottom: 6px;
	width: 0;
	height: 1px;
	background: var(--primary-title-color, #111);
	transition: width 0.25s ease;
}

.fv2-sort__btn:hover {
	color: var(--primary-title-color, #111);
}

.fv2-sort__btn.is-on {
	color: var(--primary-title-color, #111);
	font-weight: 600;
}

.fv2-sort__btn.is-on::after {
	width: 100%;
}

/* ---- Switches ---- */
.fv2-extras {
	margin-top: 20px;
	display: flex;
	flex-direction: column;
	gap: 18px;
}

/* Contain the visually hidden input — without this, absolute input can anchor to a distant
   ancestor and expand .fv2-panel__scroll / add blank scroll area when toggling. */
.fv2-switch {
	position: relative;
}

.fv2-switch__input {
	position: absolute;
	top: 0;
	inset-inline-start: 0;
	width: 1px;
	height: 1px;
	margin: 0;
	padding: 0;
	border: 0;
	opacity: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	white-space: nowrap;
	appearance: none;
	-webkit-appearance: none;
}

/* Keep focus ring on the label (not the 1×1px box) so it doesn’t inflate scroll height */
.fv2-switch__input:focus {
	outline: none;
}

.fv2-switch__input:focus-visible + .fv2-switch__label {
	outline: 2px solid var(--primary-brand-color, #c9a227);
	outline-offset: 3px;
	border-radius: 4px;
}

.fv2-switch__label {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	cursor: pointer;
}

.fv2-switch__ui {
	flex-shrink: 0;
	position: relative;
	width: 44px;
	height: 26px;
	margin-top: 2px;
	border-radius: 999px;
	overflow: hidden;
	background: color-mix(in srgb, var(--primary-title-color, #000) 12%, transparent);
	transition: background 0.25s ease;
}

.fv2-switch__knob {
	position: absolute;
	top: 3px;
	inset-inline-start: 3px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--primary-background-color, #fff);
	box-shadow: 0 1px 4px color-mix(in srgb, var(--primary-title-color, #000) 15%, transparent);
	transition: inset-inline-start 0.25s ease;
}

.fv2-switch__input:checked + .fv2-switch__label .fv2-switch__ui {
	background: var(--primary-title-color, #1a1a1a);
}

.fv2-switch__input:checked + .fv2-switch__label .fv2-switch__knob {
	inset-inline-start: 21px;
}

.fv2-switch__copy {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.fv2-switch__t {
	font-size: 13px;
	font-weight: 600;
	color: var(--primary-title-color, #222);
}

.fv2-switch__d {
	font-size: 12px;
	line-height: 1.35;
	color: color-mix(in srgb, var(--primary-text-color, #555) 92%, transparent);
}

/* ---- Apply ---- */
.fv2-apply {
	width: 100%;
	padding: 16px 20px;
	border: none;
	border-radius: 2px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	cursor: pointer;
	color: var(--primary-button-text-color, #fff);
	background: var(--primary-button-background-color, #141414);
	transition:
		background 0.2s ease,
		transform 0.15s ease;
}

.fv2-apply:hover {
	background: color-mix(in srgb, var(--primary-button-hover-background-color, #000) 88%, #333);
	color: var(--primary-button-hover-text-color, #fff);
}

.fv2-apply:active {
	transform: scale(0.99);
}

/* ---- Mobile / tablet portrait: full-screen sheet ---- */
@media (max-width: 991px) {
	.fv2-root .mobile-filter-toggle.fv2-mob {
		display: flex;
	}

	.fv2-root .filter-section.fv2-panel .fv2-mob-sheet-header {
		display: flex;
	}

	.fv2-root .filter-section.fv2-panel {
		position: fixed;
		inset: 0;
		z-index: var(--fv2-z-sheet);
		max-height: 100vh;
		max-height: 100dvh;
		border-radius: 0;
		transform: translate3d(0, 105%, 0);
		transition: transform 0.42s cubic-bezier(0.32, 0.72, 0, 1);
		visibility: hidden;
		pointer-events: none;
	}

	.fv2-root .filter-section.fv2-panel.active {
		transform: translate3d(0, 0, 0);
		visibility: visible;
		pointer-events: auto;
	}

	/* Safe area handled by .fv2-mob-sheet-header */
	.fv2-panel__scroll {
		padding-top: 18px;
	}

	.fv2-panel__foot {
		padding-bottom: max(20px, env(safe-area-inset-bottom));
	}
}

@media (min-width: 992px) {
	.fv2-backdrop {
		display: none !important;
	}

	.fv2-mob-sheet-header {
		display: none !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	.fv2-root .filter-section.fv2-panel {
		transition: none;
	}
	.fv2-sort__btn::after {
		transition: none;
	}
}
