/*
 * Metric Horizon Catalog - price range control.
 * The block is a self-contained field: the theme's generic input styles are
 * neutralised inside it, so the range inputs never inherit borders or padding.
 */

.mh-price {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 12px 16px 14px;
	background: var(--mh-white, #fff);
	border: 1px solid var(--mh-border, #e1e5ee);
	border-radius: var(--mh-radius-s, 12px);
	transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.mh-price:focus-within {
	border-color: var(--mh-primary, #0a1b4d);
	box-shadow: 0 0 0 3px rgba(10, 27, 77, 0.1);
}

/* ---------------- value row ---------------- */
.mh-price__row {
	display: flex;
	align-items: baseline;
	gap: 6px;
}

.mh-price__prefix {
	flex: 0 0 auto;
	font-size: 13px;
	color: var(--mh-text-muted, #5a6473);
}

/* Beat the theme's generic field styling without touching it. */
.mh-search-form .mh-price .mh-price__input,
.mh-price .mh-price__input {
	flex: 1 1 0;
	min-width: 0;
	width: auto;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	font-family: "Manrope", sans-serif;
	font-weight: 700;
	font-size: 15px;
	line-height: 1.3;
	color: var(--mh-text, #1c1f26);
	font-variant-numeric: tabular-nums;
	height: auto;
}

.mh-search-form .mh-price .mh-price__input:focus,
.mh-price .mh-price__input:focus {
	outline: none;
	border: 0;
	box-shadow: none;
}

.mh-price__input--max {
	text-align: right;
}

.mh-price__input::placeholder {
	color: #9aa3b2;
	font-weight: 600;
}

/* ---------------- slider ---------------- */
.mh-price__slider {
	position: relative;
	height: 18px;
	display: flex;
	align-items: center;
}

.mh-price__track {
	position: absolute;
	left: 0;
	right: 0;
	height: 3px;
	border-radius: 999px;
	background: var(--mh-border, #e1e5ee);
}

.mh-price__range {
	position: absolute;
	top: 0;
	bottom: 0;
	border-radius: 999px;
	background: var(--mh-primary, #0a1b4d);
}

/*
 * Both range inputs stack on the same line. Only the thumbs take pointer
 * events, so each handle stays grabbable across the whole track.
 */
.mh-search-form .mh-price input[type="range"],
.mh-price input[type="range"] {
	position: absolute;
	left: 0;
	top: 50%;
	transform: translateY(-50%);
	width: 100%;
	height: 18px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	pointer-events: none;
	-webkit-appearance: none;
	appearance: none;
}

.mh-price input[type="range"]:focus {
	outline: none;
}

.mh-price input[type="range"]::-webkit-slider-runnable-track {
	height: 18px;
	background: none;
	border: 0;
}

.mh-price input[type="range"]::-moz-range-track {
	height: 18px;
	background: none;
	border: 0;
}

.mh-price input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	pointer-events: auto;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--mh-white, #fff);
	border: 2px solid var(--mh-primary, #0a1b4d);
	box-shadow: 0 2px 6px rgba(10, 27, 77, 0.22);
	cursor: grab;
	transition: transform 0.15s ease, border-color 0.15s ease;
}

.mh-price input[type="range"]::-moz-range-thumb {
	pointer-events: auto;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--mh-white, #fff);
	border: 2px solid var(--mh-primary, #0a1b4d);
	box-shadow: 0 2px 6px rgba(10, 27, 77, 0.22);
	cursor: grab;
	transition: transform 0.15s ease, border-color 0.15s ease;
}

.mh-price input[type="range"]:hover::-webkit-slider-thumb,
.mh-price input[type="range"]:focus-visible::-webkit-slider-thumb {
	transform: scale(1.14);
	border-color: var(--mh-accent, #c9a14a);
}

.mh-price input[type="range"]:hover::-moz-range-thumb,
.mh-price input[type="range"]:focus-visible::-moz-range-thumb {
	transform: scale(1.14);
	border-color: var(--mh-accent, #c9a14a);
}

.mh-price input[type="range"]:active::-webkit-slider-thumb {
	cursor: grabbing;
}

.mh-price input[type="range"]:active::-moz-range-thumb {
	cursor: grabbing;
}

/* =========================================================
 * Project cards grid
 * Every card is the same height: the title reserves two lines,
 * the spec row a fixed one, and the price is pinned to the bottom.
 * ========================================================= */
.mh-projects {
	display: grid;
	gap: clamp(16px, 1.8vw, 26px);
	margin: 0;
	padding: 0;
	list-style: none;
	align-items: stretch;
}

.mh-projects--cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mh-projects--cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mh-projects--cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.mh-projects__item {
	display: flex;
}

.mh-project-card {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	background: var(--mh-white, #fff);
	border: 1px solid var(--mh-border, #e1e5ee);
	border-radius: var(--mh-radius-l, 24px);
	overflow: hidden;
	transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.mh-project-card:hover {
	transform: translateY(-4px);
	border-color: transparent;
	box-shadow: 0 20px 44px rgba(10, 27, 77, 0.16);
}

/* ---------------- media ---------------- */
.mh-project-card__media {
	position: relative;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: var(--mh-surface, #f4f6fa);
	flex: 0 0 auto;
}

.mh-project-card__media .mh-gallery-card,
.mh-project-card__media .mh-gallery-card__viewport,
.mh-project-card__media .mh-gallery-card__track {
	height: 100%;
}

.mh-project-card__media .mh-gallery-card {
	border-radius: 0;
}

.mh-project-card__media .mh-gallery-card__slide {
	aspect-ratio: auto;
	height: 100%;
}

.mh-project-card__cover {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Full-card link sits under the controls, so arrows and dots keep working. */
.mh-project-card__overlay {
	position: absolute;
	inset: 0;
	z-index: 1;
}

.mh-project-card__media .mh-gallery-card__nav,
.mh-project-card__media .mh-gallery-card__dots,
.mh-project-card__media .mh-gallery-card__counter {
	z-index: 3;
}

/* ---------------- badges and favourite ---------------- */
.mh-project-card__badges {
	position: absolute;
	top: 12px;
	left: 12px;
	z-index: 3;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
	max-width: calc(100% - 70px);
}

.mh-project-card__badge {
	padding: 5px 11px;
	border-radius: 999px;
	font-size: 11.5px;
	font-weight: 600;
	line-height: 1.2;
	color: #fff;
	background: rgba(10, 27, 77, 0.78);
	backdrop-filter: blur(4px);
}

.mh-project-card__badge--installment {
	background: var(--mh-accent, #c9a14a);
	color: #1c1f26;
}

.mh-project-card__fav {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 3;
}

.mh-project-card__fav .mh-fav-toggle {
	width: 36px;
	height: 36px;
	background: rgba(255, 255, 255, 0.94);
	border-color: transparent;
	box-shadow: 0 4px 12px rgba(10, 27, 77, 0.16);
}

/* ---------------- body ---------------- */
.mh-project-card__body {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	gap: 8px;
	padding: 18px 20px 20px;
}

/* Two lines reserved: one-line and two-line titles align the same way. */
.mh-project-card__title {
	margin: 0;
	font-family: "Manrope", sans-serif;
	font-weight: 700;
	font-size: clamp(16px, 1.5vw, 18px);
	line-height: 1.3;
	min-height: calc(2 * 1.3em);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.mh-project-card__title a {
	color: var(--mh-primary, #0a1b4d);
	text-decoration: none;
	background-image: none;
}

.mh-project-card:hover .mh-project-card__title a {
	color: var(--mh-primary-hover, #0d3b8e);
}

.mh-project-card__location {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	min-height: 1.4em;
	font-size: 13.5px;
	color: var(--mh-text-muted, #5a6473);
}

.mh-project-card__location .mh-icon {
	flex: 0 0 auto;
	width: 15px;
	height: 15px;
	color: var(--mh-accent, #c9a14a);
}

/* ---------------- specs ---------------- */
.mh-project-card__specs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 16px;
	margin: 6px 0 0;
	padding: 12px 0 0;
	border-top: 1px solid var(--mh-border, #e1e5ee);
	list-style: none;
	min-height: 44px;
	align-content: flex-start;
}

.mh-project-card__spec {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	color: var(--mh-text, #1c1f26);
	white-space: nowrap;
}

.mh-project-card__spec .mh-icon {
	width: 17px;
	height: 17px;
	color: var(--mh-text-muted, #5a6473);
}

/* ---------------- footer ---------------- */
.mh-project-card__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-top: auto;
	padding-top: 14px;
}

.mh-project-card__price {
	font-family: "Manrope", sans-serif;
	font-weight: 800;
	font-size: clamp(16px, 1.6vw, 19px);
	color: var(--mh-primary, #0a1b4d);
	font-variant-numeric: tabular-nums;
}

.mh-project-card__more {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 13px;
	font-weight: 600;
	color: var(--mh-secondary, #1e5ed6);
	opacity: 0;
	transform: translateX(-4px);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.mh-project-card__more .mh-icon {
	width: 15px;
	height: 15px;
}

.mh-project-card:hover .mh-project-card__more,
.mh-project-card:focus-within .mh-project-card__more {
	opacity: 1;
	transform: translateX(0);
}

/* ---------------- more link ---------------- */
.mh-projects__more {
	display: flex;
	justify-content: center;
	margin-top: clamp(20px, 2.5vw, 32px);
}

.mh-projects__more-link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 14px 28px;
	border: 1px solid var(--mh-border, #e1e5ee);
	border-radius: var(--mh-radius-s, 12px);
	font-family: "Manrope", sans-serif;
	font-weight: 700;
	font-size: 14px;
	color: var(--mh-primary, #0a1b4d);
	text-decoration: none;
	background-image: none;
	transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.mh-projects__more-link:hover {
	border-color: var(--mh-primary, #0a1b4d);
	color: var(--mh-primary-hover, #0d3b8e);
	transform: translateY(-1px);
}

@media (max-width: 991px) {
	.mh-projects--cols-3,
	.mh-projects--cols-4 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 575px) {
	.mh-projects {
		grid-template-columns: 1fr !important;
	}

	.mh-project-card__more {
		opacity: 1;
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mh-project-card,
	.mh-project-card__more,
	.mh-projects__more-link {
		transition: none;
	}
}
