/* =============================================================================
   Inventory filter UI
   ========================================================================== */

:root {
	--em-navy: #2F336D;
	--em-navy-dark: #232862;
	--em-ink: #2F2F2F;
	--em-ink-muted: #6B6B6B;
	--em-border: #D9D9D9;
	--em-border-dark: #151515;
	--em-row-border: #E5E5E5;
	--em-row-bg: #FFFFFF;
	--em-pill-bg: #EEF1F4;
}

.em-inventory-head {
	padding-top: 100px;
	padding-bottom: 60px;
}

/* ---------- top bar (search + color dd + toggle) -------------------------- */

.em-filter {
	margin-top: 32px;
	background: #fff;
	border: 1px solid var(--em-border);
}

.em-filter__topbar {
	display: grid;
	grid-template-columns: 1fr minmax(220px, 320px) auto;
	align-items: stretch;
	border-bottom: 1px solid var(--em-row-border);
}

.em-filter__search {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 0 24px;
	min-height: 64px;
	border-right: 1px solid var(--em-row-border);
}

.em-filter__search input[type="text"] {
	flex: 1;
	border: 0;
	background: transparent;
	font-size: 18px;
	color: var(--em-ink);
	font-family: inherit;
	outline: none;
	padding: 8px 0;
}

.em-filter__search input::placeholder {
	color: var(--em-ink-muted);
}

.em-filter__search button {
	background: none;
	border: 0;
	padding: 0;
	color: var(--em-ink);
	cursor: pointer;
	display: inline-flex;
}

.em-filter__color-dd {
	position: relative;
	border-right: 1px solid var(--em-row-border);
}

.em-filter__color-dd summary {
	list-style: none;
	cursor: pointer;
	min-height: 64px;
	padding: 0 24px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	font-size: 16px;
	font-weight: 500;
	color: var(--em-ink);
	user-select: none;
}

.em-filter__color-dd summary::-webkit-details-marker { display: none; }
.em-filter__color-dd[open] summary svg { transform: rotate(180deg); }
.em-filter__color-dd summary svg { transition: transform 0.15s ease; }

.em-filter__color-list {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 5;
	background: #fff;
	border: 1px solid var(--em-border);
	border-top: 0;
	padding: 16px 24px;
	max-height: 360px;
	overflow-y: auto;
	display: grid;
	gap: 10px;
}

.em-filter__toggle {
	background: none;
	border: 0;
	padding: 0 24px;
	cursor: pointer;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	font-size: 16px;
	font-weight: 500;
	color: var(--em-ink);
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 64px;
	font-family: inherit;
}

.em-filter__toggle-icon {
	transition: transform 0.2s ease;
}

.em-filter__toggle[aria-expanded="false"] .em-filter__toggle-icon {
	transform: rotate(-90deg);
}

/* ---------- filter panels grid ------------------------------------------- */

.em-filter__panels {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 0;
	padding: 24px 0;
}

/* Collapsed state hides the panels and the Reset/Apply actions.
   The active-pills/sort row stays visible so users can still see what's
   applied and remove individual filters with the pill × buttons.
   The display:none rule applies pre-JS so collapsed is the default
   first-paint state — no flash of expanded filters on load. */
.em-filter--collapsed .em-filter__panels,
.em-filter--collapsed .em-filter__actions {
	display: none;
}
.em-filter--collapsed .em-filter__active-row { border-top: 0; }

.em-filter__panel {
	border: 0;
	border-right: 1px solid var(--em-row-border);
	margin: 0;
	padding: 0 24px;
	min-width: 0;
}

.em-filter__panel:last-child { border-right: 0; }

.em-filter__panel legend {
	font-size: 14px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--em-ink-muted);
	padding: 0;
	margin: 0 0 14px 0;
}

.em-filter__options {
	display: grid;
	gap: 10px;
}

.em-filter__option {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	cursor: pointer;
	font-size: 17px;
	color: var(--em-ink);
	line-height: 1.3;
	user-select: none;
}

.em-filter__option input[type="checkbox"],
.em-filter__option input[type="radio"] {
	appearance: none;
	-webkit-appearance: none;
	width: 18px;
	height: 18px;
	border: 1.5px solid var(--em-ink);
	border-radius: 2px;
	margin: 0;
	background: #fff;
	display: inline-grid;
	place-content: center;
	cursor: pointer;
	flex-shrink: 0;
}

.em-filter__option input[type="checkbox"]::before,
.em-filter__option input[type="radio"]::before {
	content: "";
	width: 10px;
	height: 10px;
	background: var(--em-ink);
	opacity: 0;
	transition: opacity 0.1s ease;
}

.em-filter__option input[type="checkbox"]:checked::before,
.em-filter__option input[type="radio"]:checked::before {
	opacity: 1;
}

/* ---------- length panel: numeric inputs, slider, presets ---------------- */

.em-filter__panel--length .em-filter__length-inputs {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: end;
	gap: 8px;
	margin-bottom: 12px;
}

.em-filter__small-label {
	font-size: 13px;
	color: var(--em-ink-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	display: block;
	margin-bottom: 4px;
}

.em-filter__panel--length input[type="number"] {
	width: 100%;
	border: 1px solid var(--em-border);
	background: #fff;
	padding: 8px 10px;
	font-size: 16px;
	font-family: inherit;
	color: var(--em-ink);
	box-sizing: border-box;
}

.em-filter__panel--length input[type="number"]::-webkit-inner-spin-button,
.em-filter__panel--length input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.em-filter__panel--length input[type="number"] { -moz-appearance: textfield; }

.em-filter__length-sep {
	color: var(--em-ink-muted);
	font-size: 18px;
	padding-bottom: 8px;
}

.em-filter__length-slider {
	margin: 12px 0;
	padding: 14px 8px 6px;
}

.em-filter__slider-track {
	position: relative;
	height: 4px;
	background: var(--em-border);
	border-radius: 2px;
}

.em-filter__slider-range {
	position: absolute;
	top: 0;
	bottom: 0;
	background: var(--em-navy);
	border-radius: 2px;
}

.em-filter__slider-thumb {
	position: absolute;
	top: 50%;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--em-navy);
	border: 2px solid #fff;
	box-shadow: 0 1px 3px rgba(0,0,0,0.18);
	transform: translate(-50%, -50%);
	padding: 0;
	cursor: grab;
}

.em-filter__slider-thumb:active { cursor: grabbing; }

.em-filter__length-presets {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 6px;
	margin-top: 8px;
}

.em-filter__length-presets button {
	background: #fff;
	border: 1px solid var(--em-border);
	padding: 8px 6px;
	font-size: 15px;
	font-family: inherit;
	color: var(--em-ink);
	cursor: pointer;
	transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.em-filter__length-presets button:hover { border-color: var(--em-ink); }
.em-filter__length-presets button.is-active {
	background: var(--em-navy);
	color: #fff;
	border-color: var(--em-navy);
}

/* ---------- thickness range selects ------------------------------------ */

.em-filter__range-selects {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: end;
	gap: 8px;
	margin-bottom: 14px;
}

.em-filter__range-select {
	display: block;
	min-width: 0;
}

.em-filter__range-select select {
	width: 100%;
	border: 1px solid var(--em-border);
	background: #fff;
	padding: 8px 28px 8px 10px;
	font-size: 15px;
	font-family: inherit;
	color: var(--em-ink);
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3e%3cpath d='M1 1l5 5 5-5' stroke='%232F2F2F' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
	background-repeat: no-repeat;
	background-position: right 10px center;
	background-size: 10px 6px;
}

.em-filter__panel--thickness .em-filter__option--other {
	font-size: 15px;
	color: var(--em-ink-muted);
	margin-top: 4px;
}

/* ---------- active filters row + sort ------------------------------------ */

.em-filter__active-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 12px 24px;
	border-top: 1px solid var(--em-row-border);
	flex-wrap: wrap;
}

.em-filter__active-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	min-height: 28px;
}

.em-filter__active-pills::before {
	content: "Active filters:";
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--em-ink-muted);
	margin-right: 4px;
}

.em-filter__pill {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--em-pill-bg);
	color: var(--em-ink);
	font-size: 14px;
	padding: 6px 10px 6px 14px;
	border-radius: 999px;
	line-height: 1;
}

.em-filter__pill button {
	background: none;
	border: 0;
	padding: 0;
	margin: 0;
	cursor: pointer;
	display: inline-flex;
	color: var(--em-ink-muted);
	font-size: 16px;
	line-height: 1;
}

.em-filter__pill button:hover { color: var(--em-ink); }

.em-filter__active-meta {
	display: flex;
	gap: 18px;
	align-items: center;
	font-size: 15px;
	color: var(--em-ink);
}

.em-filter__results-count { font-weight: 500; }
.em-filter__results-count:empty { display: none; }

.em-filter__sort {
	display: inline-flex;
	gap: 8px;
	align-items: center;
}

.em-filter__sort label {
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--em-ink-muted);
}

.em-filter__sort select {
	border: 0;
	background: none;
	font-size: 15px;
	font-family: inherit;
	color: var(--em-ink);
	cursor: pointer;
	padding: 4px 0;
}

/* ---------- Reset / Apply --------------------------------------------- */

.em-filter__actions {
	display: flex;
	justify-content: flex-end;
	gap: 16px;
	padding: 14px 24px;
	border-top: 1px solid var(--em-row-border);
	align-items: center;
}

.em-filter__reset {
	background: none;
	border: 0;
	padding: 8px 4px;
	cursor: pointer;
	font-size: 14px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--em-ink);
	font-family: inherit;
}

.em-filter__apply {
	background: var(--em-navy);
	color: #fff;
	border: 0;
	padding: 12px 24px;
	cursor: pointer;
	font-size: 14px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	font-weight: 500;
	font-family: inherit;
	transition: background 0.12s ease;
}

.em-filter__apply:hover { background: var(--em-navy-dark); }

/* ---------- tile count (parent term grid) ------------------------- */

.em-tile__count-inline {
	color: var(--em-ink-muted);
	font-weight: 400;
	font-size: 0.85em;
	margin-left: 4px;
}

/* ---------- loading state ---------------------------------------------- */

.em-filter-loading {
	display: none;
	margin: 20px 0;
	color: var(--em-ink-muted);
}

.em-filter.is-loading + .em-filter-loading,
.em-inventory.is-loading .em-filter-loading {
	display: block;
}

.em-no-result {
	padding: 24px;
	color: var(--em-ink-muted);
	font-style: italic;
	grid-column: 1 / -1;
}

/* ---------- lot card (per-slab result) ---------------------------------- */

.em-lot-card .em-lot-card__link {
	display: block;
	color: inherit;
	text-decoration: none;
}

.em-lot-card .em-lot-card__img {
	margin-bottom: 16px;
	overflow: hidden;
}

.em-lot-card .em-lot-card__img img {
	display: block;
	width: 100%;
	height: 456px;
	object-fit: cover;
	transition: transform 0.45s ease;
}

.em-lot-card .em-lot-card__link:hover .em-lot-card__img img {
	transform: scale(1.02);
}

.em-lot-card .em-lot-card__title {
	font-size: 20px;
	font-weight: 600;
	color: var(--em-ink);
	margin: 0 0 6px 0;
}

.em-lot-card__lot-row {
	margin-bottom: 10px;
}

.em-lot-card__lot-num {
	display: inline-block;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #FFFFFF;
	background: var(--em-navy);
	padding: 5px 10px;
	border-radius: 3px;
}

/* Stone card — collapsed one-per-stone tile for the default browse/filter grid. */
.em-stone-card .em-stone-card__meta {
	padding: 12px 0 0;
}

.em-stone-card .em-stone-card__title {
	font-size: 20px;
	font-weight: 600;
	color: var(--em-ink);
	margin: 0 0 4px 0;
}

.em-stone-card__count {
	display: inline-block;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--em-navy);
	opacity: 0.7;
}

.em-lot-card__specs {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px 14px;
	margin: 10px 0 0;
	padding: 12px 0 0;
	border-top: 1px solid var(--em-row-border);
	font-size: 14px;
}

.em-lot-card__specs > div { min-width: 0; }

.em-lot-card__specs dt {
	color: var(--em-ink);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	margin-bottom: 3px;
}

.em-lot-card__specs dd {
	margin: 0;
	color: var(--em-ink);
	font-size: 15px;
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

@media (max-width: 1024px) {
	.em-lot-card .em-lot-card__img img { height: 400px; }
}

@media (max-width: 767px) {
	.em-lot-card__specs { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- single-collection: single-lot view banner ------------------- */

.em-single-lot-banner {
	margin: 0 0 28px 0;
	padding: 14px 20px;
	background: rgba(47, 51, 109, 0.06);
	border-left: 3px solid var(--em-navy);
	font-size: 16px;
	color: var(--em-ink);
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	flex-wrap: wrap;
}

.em-single-lot-banner .em-single-lot-show-all {
	color: var(--em-navy);
	font-weight: 600;
	text-decoration: underline;
}

.em-single-lot-banner .em-single-lot-show-all:hover { color: var(--em-navy-dark); }

/* ---------- Inventory dropdown menu hierarchy ---------------------------
   Bold category headers (Natural Stone, Engineered Stones, Porcelain, Glass
   Slabs, Semi-Precious) sit at the top of each group; their child items
   render in regular weight. "Engineered Stones" is a non-navigating header.

   The theme's base CSS positions every .sub-menu as an absolute fly-out,
   which works for one level but stacks level-2 menus on top of their
   level-1 siblings. Override: keep level 1 as the fly-out from the top nav,
   but render level 2 inline inside the level-1 dropdown so all items
   appear in a single column. */

.rst-main-menu .em-menu-bold > a {
	font-weight: 700 !important;
}

/* The Engineered Stones header is a stub anchor (#) — keep it visually a
   group label, not a clickable thing. */
.rst-main-menu .em-menu-header > a {
	cursor: default;
	pointer-events: none;
}

/* Level-2 sub-menus: render inline within the level-1 dropdown column.
   No absolute positioning, no shadow, always visible, indented. */
.rst-main-menu .sub-menu .sub-menu {
	position: static;
	display: block;
	width: auto;
	padding: 0;
	margin: 0;
	box-shadow: none;
	background: transparent;
}

/* Level-2 items: regular weight, indented to show parent/child hierarchy. */
.rst-main-menu .sub-menu .sub-menu li {
	margin: 12px 0 12px 0;
}

.rst-main-menu .sub-menu .sub-menu li:last-child {
	margin-bottom: 4px;
}

.rst-main-menu .sub-menu .sub-menu li a {
	font-weight: 400;
	padding-left: 18px;
	font-size: 16px;
}

/* Ensure the level-1 dropdown is wide enough to fit the long brand names. */
.rst-main-menu > ul > li > .sub-menu {
	width: 280px;
}

/* ---------- responsive --------------------------------------------------- */

@media (max-width: 1200px) {
	.em-filter__panels { grid-template-columns: repeat(2, 1fr); }
	.em-filter__panel { border-right: 0; border-bottom: 1px solid var(--em-row-border); padding-top: 16px; padding-bottom: 16px; }
	.em-filter__panel:nth-child(2n) { border-right: 0; }
	.em-filter__panel:nth-last-child(-n+2) { border-bottom: 0; }
}

@media (max-width: 767px) {
	.em-filter__topbar {
		grid-template-columns: 1fr;
	}
	.em-filter__search,
	.em-filter__color-dd,
	.em-filter__toggle {
		border-right: 0;
		border-bottom: 1px solid var(--em-row-border);
		justify-content: flex-start;
	}
	.em-filter__toggle { border-bottom: 0; }

	.em-filter__panels { grid-template-columns: 1fr; }
	.em-filter__panel { border-right: 0; border-bottom: 1px solid var(--em-row-border); }
	.em-filter__panel:last-child { border-bottom: 0; }

	.em-filter__active-row { flex-direction: column; align-items: flex-start; gap: 10px; }
}
