/**
 * MaxFurn Custom — catalogue: page-title banner, chips, breadcrumbs, sidebar
 * filters, toolbar, product grid and cards, pagination, filter dialog,
 * search results. Loaded on product archives, search and product pages.
 */

/* ---------- Breadcrumbs ---------- */

.mf-breadcrumbs ol {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: var(--wp--preset--font-size--small);
}

.mf-breadcrumbs li + li::before {
	content: "/";
	margin-right: 4px;
	opacity: 0.7;
}

.mf-breadcrumbs a {
	text-decoration: none;
}

.mf-breadcrumbs a:hover {
	text-decoration: underline;
}

.mf-breadcrumbs--dark {
	color: var(--mf-muted);
}

.mf-breadcrumbs--dark a {
	color: var(--mf-ink);
}

.mf-breadcrumbs--light,
.mf-breadcrumbs--light a {
	color: var(--mf-surface);
}

/* ---------- Page-title banner ---------- */

.mf-banner {
	background: var(--mf-banner);
	color: var(--mf-surface);
}

.mf-banner__inner {
	display: grid;
	gap: 12px;
	justify-items: center;
	padding-block: 40px;
	text-align: center;
}

.mf-banner__title {
	margin: 0;
	color: var(--mf-surface);
}

/* Red focus rings disappear on the green banner: use white there. */
.mf-banner :focus-visible {
	outline-color: var(--mf-surface);
}

.mf-chips ul,
.mf-chips__list {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin: 8px 0 0;
	padding: 0;
	list-style: none;
}

.mf-chip {
	display: inline-flex;
	align-items: center;
	min-height: 40px;
	padding: 0 18px;
	border: 1px solid rgba(255, 255, 255, 0.6);
	border-radius: var(--mf-radius-pill);
	color: var(--mf-surface);
	font-weight: 500;
	text-decoration: none;
}

.mf-chip:hover,
.mf-chip.is-current {
	background: var(--mf-surface);
	color: var(--mf-ink);
}

.mf-chips--dark {
	justify-content: flex-start;
}

.mf-chips--dark .mf-chip {
	border-color: var(--mf-border);
	background: var(--mf-surface);
	color: var(--mf-ink);
}

.mf-chips--dark .mf-chip:hover {
	border-color: var(--mf-ink);
}

/* ---------- Layout ---------- */

.mf-catalog {
	padding-block: 32px 56px;
}

.site-main:has(.mf-banner) {
	padding-top: 0;
}

.mf-catalog__intro,
.mf-catalog__seo {
	max-width: 900px;
	color: var(--mf-text);
}

.mf-catalog__intro {
	margin-bottom: 24px;
}

.mf-catalog__seo {
	margin-top: 48px;
	padding-top: 32px;
	border-top: 1px solid var(--mf-border);
}

.mf-catalog__layout {
	display: grid;
	gap: 32px;
}

@media (min-width: 1024px) {
	.mf-catalog__layout {
		grid-template-columns: 280px minmax(0, 1fr);
	}
}

.mf-section-title {
	margin: 0 0 20px;
}

/* ---------- Sidebar filters ---------- */

.mf-filters {
	display: grid;
	gap: 20px;
}

.mf-filters__form {
	display: grid;
	gap: 20px;
	margin: 0;
}

.mf-filters__section {
	margin: 0;
	padding: 20px;
	border: 0;
	border-radius: var(--mf-radius-card);
	background: var(--mf-surface);
}

.mf-filters__form > .mf-filters__section + .mf-filters__section {
	margin-top: 0;
}

.mf-filters__title {
	margin: 0 0 12px;
	padding: 0;
	font-family: var(--mf-font-heading);
	font-size: var(--wp--preset--font-size--large);
	font-weight: 500;
	color: var(--mf-ink);
}

.mf-filters__cats {
	margin: 0;
	padding: 0;
	list-style: none;
}

.mf-filters__cats a {
	display: block;
	padding: 6px 0;
	color: var(--mf-text);
	text-decoration: none;
}

.mf-filters__cats a:hover,
.mf-filters__cats a.is-current {
	color: var(--mf-red);
}

.mf-filters__count {
	color: var(--mf-muted);
	font-size: var(--wp--preset--font-size--small);
}

.mf-check {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 36px;
	cursor: pointer;
}

.mf-check input {
	width: 18px;
	height: 18px;
	margin: 0;
	accent-color: var(--mf-red);
}

.mf-filters__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
}

.js .mf-filters__apply {
	display: none;
}

.mf-filters__clear {
	/* Price red: 5.07:1 on the page background (brand red is 4.42:1). */
	color: var(--mf-price);
	font-weight: 500;
}

/* Price range: two native range inputs on one track. */
.mf-price-range__track {
	position: relative;
	height: 32px;
}

.mf-price-range__track input[type="range"] {
	position: absolute;
	inset: 0;
	width: 100%;
	min-height: 0;
	height: 32px;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	pointer-events: none;
	appearance: none;
	-webkit-appearance: none;
}

.mf-price-range__track::before {
	content: "";
	position: absolute;
	top: 14px;
	left: 0;
	right: 0;
	height: 4px;
	border-radius: 2px;
	background: var(--mf-border);
}

.mf-price-range__track input[type="range"]::-webkit-slider-thumb {
	width: 22px;
	height: 22px;
	border: 3px solid var(--mf-surface);
	border-radius: 50%;
	background: var(--mf-red);
	box-shadow: 0 0 0 1px var(--mf-red);
	cursor: pointer;
	pointer-events: auto;
	-webkit-appearance: none;
}

.mf-price-range__track input[type="range"]::-moz-range-thumb {
	width: 18px;
	height: 18px;
	border: 3px solid var(--mf-surface);
	border-radius: 50%;
	background: var(--mf-red);
	cursor: pointer;
	pointer-events: auto;
}

.mf-price-range__track input[type="range"]:focus-visible::-webkit-slider-thumb {
	outline: 2px solid var(--mf-ink);
	outline-offset: 2px;
}

.mf-price-range__values {
	display: flex;
	justify-content: space-between;
	margin: 8px 0 0;
	font-weight: 500;
}

/* Showroom promo */
.mf-promo {
	padding: 24px 20px;
	border-radius: var(--mf-radius-card);
	background: var(--mf-ink);
	color: var(--mf-surface);
}

.mf-promo__title {
	margin: 0 0 8px;
	color: var(--mf-surface);
	font-size: 20px;
}

.mf-promo p {
	color: #d9d9d9;
}

.mf-promo :focus-visible {
	outline-color: var(--mf-surface);
}

/* Sidebar on small screens: hidden behind the Filters button (JS); shown inline without JS. */
@media (max-width: 1023.98px) {
	.js .mf-catalog__sidebar {
		display: none;
	}
}

.mf-filter-dialog {
	width: min(420px, 92vw);
	max-width: none;
	height: 100%;
	max-height: none;
	margin: 0 0 0 auto;
	padding: 0;
	border: 0;
	background: var(--mf-bg);
}

.mf-filter-dialog::backdrop {
	background: rgba(20, 20, 20, 0.5);
}

.mf-filter-dialog[open] {
	display: flex;
	flex-direction: column;
}

.mf-filter-dialog__head,
.mf-filter-dialog__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 16px;
	background: var(--mf-surface);
}

.mf-filter-dialog__head {
	border-bottom: 1px solid var(--mf-border);
}

.mf-filter-dialog__title {
	margin: 0;
	font-size: var(--wp--preset--font-size--large);
}

.mf-filter-dialog__body {
	flex: 1;
	padding: 16px;
	overflow-y: auto;
}

.mf-filter-dialog__foot {
	border-top: 1px solid var(--mf-border);
}

.mf-filter-dialog__apply {
	flex: 1;
}

/* ---------- Toolbar ---------- */

.mf-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 20px;
	margin-bottom: 20px;
}

.mf-toolbar__count {
	margin: 0 auto 0 0;
	color: var(--mf-muted);
}

.mf-toolbar__form {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin: 0;
}

.mf-toolbar__field {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: var(--wp--preset--font-size--small);
}

.mf-toolbar__field select {
	width: auto;
	padding-right: 32px;
}

.js .mf-toolbar__go {
	display: none;
}

.mf-toolbar__filters-btn {
	background: var(--mf-ink);
}

@media (min-width: 1024px) {
	.mf-toolbar__filters-btn {
		display: none;
	}
}

.no-js .mf-toolbar__filters-btn,
.no-js .mf-view-toggle {
	display: none;
}

.mf-view-toggle {
	display: inline-flex;
	gap: 4px;
}

.mf-view-toggle__btn {
	width: var(--mf-tap);
	padding: 0;
	border-radius: 50%;
	background: var(--mf-surface);
	color: var(--mf-muted);
}

.mf-view-toggle__btn[aria-pressed="true"],
.mf-view-toggle__btn:hover {
	background: var(--mf-ink);
	color: var(--mf-surface);
}

/* Active filters */
.mf-active-filters ul {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 0 0 20px;
	padding: 0;
	list-style: none;
}

.mf-active-filters__chip {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 36px;
	padding: 0 14px;
	border-radius: var(--mf-radius-pill);
	background: var(--mf-surface);
	color: var(--mf-ink);
	font-size: var(--wp--preset--font-size--small);
	text-decoration: none;
	border: 1px solid var(--mf-border);
}

.mf-active-filters__chip:hover {
	border-color: var(--mf-red);
	color: var(--mf-red);
}

.mf-active-filters__clear {
	color: var(--mf-price);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
}

/* ---------- Grid and cards ---------- */

.mf-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px;
}

@media (min-width: 640px) {
	.mf-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 24px;
	}
}

@media (min-width: 1200px) {
	.mf-grid--wide {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.mf-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: var(--mf-radius-card);
	background: var(--mf-surface);
}

.mf-card__media {
	position: relative;
	aspect-ratio: 1 / 1;
	background: var(--mf-surface);
}

.mf-card__image-link {
	display: block;
	width: 100%;
	height: 100%;
}

.mf-card__image,
.mf-card__placeholder {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}

.mf-card__placeholder {
	background: var(--mf-bg);
}

/* "Fit whole image": the whole product on white. */
.mf-card--fit .mf-card__image {
	object-fit: contain;
	padding: 8px;
}

.mf-card__badges {
	position: absolute;
	top: 10px;
	left: 10px;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.mf-pill {
	display: inline-flex;
	align-items: center;
	padding: 3px 10px;
	border-radius: var(--mf-radius-pill);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.4;
}

.mf-pill--sale {
	background: var(--mf-red);
	color: var(--mf-surface);
}

.mf-pill--sold-out {
	background: var(--mf-surface);
	color: var(--mf-ink);
	box-shadow: 0 0 0 1px var(--mf-border);
}

.mf-pill--new {
	background: var(--mf-ink);
	color: var(--mf-surface);
}

.mf-pill--hot {
	background: #8a4b00;
	color: var(--mf-surface);
}

.mf-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 4px;
	padding: 14px 14px 16px;
}

.mf-card__title {
	margin: 0;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.35;
}

.mf-card__title a {
	color: var(--mf-ink);
	text-decoration: none;
}

.mf-card__title a:hover {
	color: var(--mf-red);
}

.mf-card__cat {
	margin: 0;
	color: var(--mf-muted);
	font-size: 12px;
}

.mf-card__price {
	margin: 4px 0 12px;
}

.mf-card__button {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: var(--mf-tap);
	margin-top: auto;
	padding: 0 12px;
	border: 1px solid var(--mf-ink);
	border-radius: var(--mf-radius-pill);
	color: var(--mf-ink);
	font-size: 14px;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
}

.mf-card__button:hover {
	background: var(--mf-ink);
	color: var(--mf-surface);
}

/* Prices */
.mf-price {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 8px;
}

.mf-price del,
.mf-price__regular {
	color: var(--mf-strike);
	font-size: 0.9em;
}

.mf-price ins,
.mf-price__current {
	color: var(--mf-price);
	font-weight: 600;
	text-decoration: none;
}

.mf-price--request {
	color: var(--mf-ink);
	font-weight: 600;
}

.mf-price__tax {
	color: var(--mf-muted);
	font-size: 12px;
	font-weight: 500;
}

/* List view (grid/list toggle). */
.mf-grid.is-list {
	grid-template-columns: 1fr;
}

.mf-grid.is-list .mf-card {
	flex-direction: row;
}

.mf-grid.is-list .mf-card__media {
	flex: 0 0 38%;
	max-width: 260px;
}

.mf-grid.is-list .mf-card__button {
	align-self: flex-start;
	min-width: 180px;
}

/* ---------- Pagination ---------- */

.mf-pagination ul {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin: 40px 0 0;
	padding: 0;
	list-style: none;
}

/* ---------- Empty state and search ---------- */

.mf-no-results {
	padding: 32px;
	border-radius: var(--mf-radius-card);
	background: var(--mf-surface);
}

.mf-no-results__message {
	font-size: var(--wp--preset--font-size--large);
	font-weight: 500;
}

.mf-no-results__search {
	max-width: 520px;
	margin-block: 16px;
}

.mf-search-page__form {
	max-width: 560px;
	margin: 0 auto 32px;
}

.mf-catalog--search .mf-catalog__main {
	min-width: 0;
}

.mf-search-articles {
	margin-top: 56px;
}

.mf-search-articles__list {
	display: grid;
	gap: 16px;
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 768px) {
	.mf-search-articles__list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.mf-search-articles__item {
	padding: 20px;
	border-radius: var(--mf-radius-card);
	background: var(--mf-surface);
}

.mf-search-articles__title {
	margin: 0 0 4px;
	font-size: var(--wp--preset--font-size--large);
}

.mf-search-articles__title a {
	text-decoration: none;
}

/* Phones: count on its own line, then Filters + Sort side by side. Page size and
   grid/list are hidden below 640px (two columns already fit the screen). */
@media (max-width: 639.98px) {
	.mf-toolbar {
		gap: 10px;
	}

	.mf-toolbar__count {
		flex-basis: 100%;
	}

	.mf-toolbar__form {
		flex: 1;
		flex-wrap: nowrap;
	}

	.mf-toolbar__field--per-page,
	.mf-view-toggle {
		display: none;
	}

	.mf-toolbar__field {
		flex: 1;
		/* Lets the sort select shrink at 320px instead of pushing the page sideways. */
		min-width: 0;
	}

	.mf-toolbar__field select {
		flex: 1;
		min-width: 0;
	}
}

@media (max-width: 639.98px) {
	.mf-toolbar__form {
		flex: 1 1 0;
		min-width: 0;
	}

	/* "Sort by" stays for screen readers; the select's value says enough on a phone. */
	.mf-toolbar__field span {
		position: absolute;
		width: 1px;
		height: 1px;
		margin: -1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}
}

/* Fieldset legends normally sit on the border line; float them inside the white card instead. */
fieldset.mf-filters__section > legend {
	float: left;
	width: 100%;
}

fieldset.mf-filters__section > legend + * {
	clear: both;
}
