/* ==========================================================================
   Shop, category, brand & search listings.
   Desktop ≥1024px: filter sidebar + grid. Phones/tablets: filters in a bottom sheet.
   ========================================================================== */

/* WooCommerce clearfix pseudo-elements would become empty grid cells. */
ul.products::before,
ul.products::after {
	display: none !important;
}

/* ---- Hero strip -------------------------------------------------------- */
.shop-hero {
	padding-block: var(--sp-4) var(--sp-5);
	border-bottom: 1px solid var(--line);
	background:
		radial-gradient(ellipse 50% 160% at 100% 0%, rgba(var(--gold-rgb), 0.1), transparent 60%),
		var(--black-800);
}

html:not([dir="rtl"]) .shop-hero {
	background:
		radial-gradient(ellipse 50% 160% at 0% 0%, rgba(var(--gold-rgb), 0.1), transparent 60%),
		var(--black-800);
}

.shop-hero__title {
	display: flex;
	align-items: center;
	gap: var(--sp-3);
	margin: var(--sp-3) 0 0;
	font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.25rem);
	line-height: 1.25;
}

.shop-hero__icon {
	display: grid;
	flex-shrink: 0;
	place-items: center;
	width: 44px;
	height: 44px;
	border-radius: var(--r-md);
	background: rgba(var(--gold-rgb), 0.12);
	color: var(--gold-500);
}

.shop-hero__icon .mst-icon {
	width: 24px;
	height: 24px;
}

.shop-hero__desc {
	max-width: 72ch;
	margin-top: var(--sp-2);
	font-size: var(--fs-sm);
	color: var(--text-secondary);
}

.shop-hero__desc p {
	margin: 0;
}

@media (max-width: 767px) {
	.shop-hero__desc {
		display: -webkit-box;
		overflow: hidden;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}
}

.shop__body {
	padding-block: var(--sp-4) var(--sp-9);
}

/* ---- Chips row (categories / sub-categories / brands) ------------------- */
.shop-chips {
	display: flex;
	gap: var(--sp-2);
	margin: 0 calc(var(--gutter) * -1) var(--sp-4);
	padding: 2px var(--gutter);
	overflow-x: auto;
	scroll-snap-type: x proximity;
	scrollbar-width: none;
}

.shop-chips::-webkit-scrollbar {
	display: none;
}

.shop-chips .chip {
	flex-shrink: 0;
	scroll-snap-align: start;
}

.shop-chips .chip.is-active {
	border-color: transparent;
	background: var(--gold-gradient);
	color: var(--text-on-gold);
}

.shop-chips .chip.is-active .mst-icon {
	color: var(--text-on-gold);
}

/* ---- Layout ------------------------------------------------------------ */
.shop-layout {
	display: grid;
	gap: var(--sp-6);
	align-items: start;
}

.shop-main {
	min-width: 0;
}

@media (min-width: 1024px) {
	.shop-layout {
		grid-template-columns: 260px minmax(0, 1fr);
	}
	.shop-main ul.products {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (min-width: 1280px) {
	.shop-main ul.products {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

/* ---- Toolbar ----------------------------------------------------------- */
.shop-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--sp-2) var(--sp-3);
	margin-bottom: var(--sp-4);
}

.woocommerce-result-count {
	margin: 0;
	margin-inline-end: auto;
	font-size: var(--fs-sm);
	color: var(--text-secondary);
}

.shop-toolbar__filter {
	--btn-h: var(--tap);
}

.shop-toolbar__filter .mst-icon {
	width: 18px;
	height: 18px;
}

.count-badge--inline {
	position: static;
	display: inline-grid;
	place-items: center;
}

@media (min-width: 1024px) {
	.shop-toolbar__filter {
		display: none;
	}
}

@media (max-width: 599px) {
	.woocommerce-result-count {
		order: 3;
		flex-basis: 100%;
		font-size: var(--fs-xs);
	}
}

.shop-toolbar__end {
	display: flex;
	align-items: center;
	gap: var(--sp-2);
}

.woocommerce-ordering {
	margin: 0;
}

.woocommerce-ordering select {
	min-height: var(--tap);
	max-width: 210px;
	font-size: var(--fs-sm);
}

.view-toggle {
	display: none;
	gap: 6px;
}

@media (min-width: 768px) {
	.view-toggle {
		display: flex;
	}
}

/* ---- Active filter chips ----------------------------------------------- */
.active-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--sp-2);
	margin-bottom: var(--sp-4);
}

.active-filters__chip {
	gap: 6px;
	border-color: rgba(var(--gold-rgb), 0.5);
	color: var(--text-primary);
}

.active-filters__chip .mst-icon {
	width: 14px;
	height: 14px;
	color: var(--text-muted);
}

.active-filters__chip:hover .mst-icon {
	color: var(--danger-text);
}

.active-filters__clear {
	padding: 0 var(--sp-2);
	font-size: var(--fs-sm);
	color: var(--gold-400);
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* ---- Filters: sidebar (desktop) ---------------------------------------- */
.shop-filters__panel {
	display: flex;
	flex-direction: column;
	margin: 0;
}

.shop-filters__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding-bottom: var(--sp-3);
	border-bottom: 1px solid var(--line);
}

.shop-filters__title {
	display: flex;
	align-items: center;
	gap: var(--sp-2);
	margin: 0;
	font-size: var(--fs-lg);
}

.shop-filters__title .mst-icon {
	width: 20px;
	height: 20px;
	color: var(--gold-500);
}

.filter-group {
	border-bottom: 1px solid var(--line);
}

.filter-group summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 52px;
	font-weight: var(--fw-bold);
	cursor: pointer;
	list-style: none;
}

.filter-group summary::-webkit-details-marker {
	display: none;
}

.filter-group summary .mst-icon {
	width: 18px;
	height: 18px;
	color: var(--text-muted);
	transition: transform var(--t-fast);
}

.filter-group[open] summary .mst-icon {
	transform: rotate(180deg);
}

.filter-group__body {
	display: grid;
	gap: 2px;
	padding-bottom: var(--sp-4);
}

.filter-group__body--pills {
	display: flex;
	flex-wrap: wrap;
	gap: var(--sp-2);
}

.filter-check {
	display: flex;
	align-items: center;
	gap: var(--sp-3);
	min-height: 40px;
	font-size: var(--fs-sm);
	cursor: pointer;
}

.filter-check input {
	width: 18px;
	height: 18px;
	margin: 0;
	accent-color: var(--gold-500);
}

.filter-check small {
	margin-inline-start: auto;
	color: var(--text-muted);
}

.filter-pill {
	position: relative;
	cursor: pointer;
}

.filter-pill input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.filter-pill span {
	display: inline-flex;
	align-items: center;
	min-height: 38px;
	padding: 0 var(--sp-3);
	border: 1px solid var(--black-500);
	border-radius: var(--r-pill);
	font-size: var(--fs-sm);
	font-weight: var(--fw-semibold);
	transition: border-color var(--t-fast), background var(--t-fast);
}

.filter-pill:hover span {
	border-color: rgba(var(--gold-rgb), 0.5);
}

.filter-pill input:checked + span {
	border-color: var(--gold-500);
	background: rgba(var(--gold-rgb), 0.12);
	color: var(--gold-300);
}

.filter-pill input:focus-visible + span {
	outline: 2px solid var(--gold-400);
	outline-offset: 2px;
}

/* Dual price slider */
.price-range {
	position: relative;
	height: 32px;
}

.price-range__track {
	position: absolute;
	inset-inline: 0;
	top: 50%;
	height: 4px;
	margin-top: -2px;
	border-radius: var(--r-pill);
	background: var(--black-600);
}

.price-range__fill {
	position: absolute;
	top: 0;
	bottom: 0;
	left: var(--lo, 0%);
	right: calc(100% - var(--hi, 100%));
	border-radius: inherit;
	background: var(--gold-gradient);
}

.price-range input[type="range"] {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 32px;
	margin: 0;
	background: none;
	pointer-events: none;
	-webkit-appearance: none;
	appearance: none;
	direction: ltr;
}

.price-range input[type="range"]::-webkit-slider-runnable-track {
	background: none;
}

.price-range input[type="range"]::-webkit-slider-thumb {
	width: 22px;
	height: 22px;
	border: 3px solid var(--gold-500);
	border-radius: 50%;
	background: var(--black-900);
	pointer-events: auto;
	cursor: grab;
	-webkit-appearance: none;
}

.price-range input[type="range"]::-moz-range-thumb {
	width: 18px;
	height: 18px;
	border: 3px solid var(--gold-500);
	border-radius: 50%;
	background: var(--black-900);
	pointer-events: auto;
	cursor: grab;
}

.price-range__values {
	margin: var(--sp-2) 0 0;
	font-family: var(--font-en-head);
	font-size: var(--fs-sm);
	font-weight: var(--fw-bold);
	text-align: center;
	color: var(--gold-400);
}

.shop-filters__foot {
	display: grid;
	grid-template-columns: 1fr 2fr;
	gap: var(--sp-2);
	padding-top: var(--sp-4);
}

.shop-filters__foot a[aria-disabled="true"] {
	opacity: 0.45;
	pointer-events: none;
}

.shop-filters__close,
.shop-filters__overlay {
	display: none;
}

@media (min-width: 1024px) {
	.shop-filters {
		position: sticky;
		top: calc(var(--header-h) + var(--sp-4));
		max-height: calc(100vh - var(--header-h) - var(--sp-6));
		overflow-y: auto;
		scrollbar-width: thin;
	}
	/* Filters apply instantly on desktop once JS runs. */
	.js-ready .shop-filters__foot button[type="submit"] {
		display: none;
	}
	.js-ready .shop-filters__foot {
		grid-template-columns: 1fr;
	}
}

/* ---- Filters: bottom sheet (phones & tablets) -------------------------- */
@media (max-width: 1023px) {
	.shop-filters {
		position: fixed;
		inset: 0;
		z-index: var(--z-drawer);
		visibility: hidden;
		pointer-events: none;
	}
	.shop-filters.is-open {
		visibility: visible;
		pointer-events: auto;
	}
	.shop-filters__overlay {
		display: block;
		position: absolute;
		inset: 0;
		background: var(--overlay);
		opacity: 0;
		transition: opacity var(--t-base) var(--ease);
	}
	.shop-filters.is-open .shop-filters__overlay {
		opacity: 1;
	}
	.shop-filters__panel {
		position: absolute;
		inset-inline: 0;
		bottom: 0;
		max-height: 88vh;
		max-height: 88dvh;
		border-top: 1px solid var(--line);
		border-radius: var(--r-lg) var(--r-lg) 0 0;
		background: var(--black-700);
		box-shadow: var(--shadow-lg);
		transform: translateY(100%);
		transition: transform var(--t-base) var(--ease-out);
	}
	.shop-filters.is-open .shop-filters__panel {
		transform: none;
	}
	.shop-filters__head {
		padding: var(--sp-3) var(--sp-4);
	}
	.shop-filters__head::before {
		content: "";
		position: absolute;
		top: 8px;
		left: 50%;
		width: 40px;
		height: 4px;
		margin-left: -20px;
		border-radius: var(--r-pill);
		background: var(--black-500);
	}
	.shop-filters__close {
		display: inline-grid;
	}
	.shop-filters__body {
		flex: 1;
		min-height: 0;
		padding: 0 var(--sp-4);
		overflow-y: auto;
		overscroll-behavior: contain;
	}
	.shop-filters__foot {
		padding: var(--sp-3) var(--sp-4) calc(var(--sp-3) + env(safe-area-inset-bottom));
		border-top: 1px solid var(--line);
		background: var(--black-800);
	}
	body.filters-open {
		overflow: hidden;
	}
}

/* ---- Load more / pagination -------------------------------------------- */
.shop-more {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--sp-3);
	margin-top: var(--sp-6);
}

.shop-more__btn {
	min-width: 220px;
}

.shop-more__status {
	margin: 0;
	font-size: var(--fs-xs);
	color: var(--text-muted);
}

/* With JS the numbered links stay in the HTML (for search engines) but the button replaces them. */
.js-ready .shop-more.has-button .woocommerce-pagination {
	display: none;
}

.shop-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--sp-3);
	padding: var(--sp-9) var(--sp-5);
	border: 1px solid var(--line);
	border-radius: var(--r-card);
	background: var(--surface-1);
	text-align: center;
}

.shop-empty h2 {
	margin: 0;
	font-size: var(--fs-h4);
}

.shop-empty p {
	margin: 0;
}
