/* ============================================================
   Homepage "Find your meter" picker
   Markup: template-homepage.php · Logic: includes/home-meter-picker.php,
   js/home-meter-picker.js. Everything is scoped to .home-filter-module.

   Colours, radii and shadow come from the --lig-* tokens at the top of
   css/custom.css, shared with the shop filter bar. Navy text on the orange
   button is 5.35:1; white would be 2.95:1, below the 4.5:1 minimum.
   ============================================================ */

.home-filter-module {
	position: relative;
	z-index: 5;
	/* Overlap the bottom edge of the hero slider. */
	margin: -64px 0 48px;
}

.home-filter-module .mp {
	background: #fff;
	border: 1px solid var(--lig-card-border);
	border-radius: var(--lig-radius-card);
	box-shadow: var(--lig-shadow-card);
	padding: 28px 32px;
	color: var(--lig-navy-dark);
}

/* Shared focus ring for every control. */
.home-filter-module .mp a:focus-visible,
.home-filter-module .mp select:focus-visible,
.home-filter-module .mp button:focus-visible,
.home-filter-module .mp__type-input:focus-visible + .mp__type-box {
	outline: 3px solid var(--lig-navy);
	outline-offset: 2px;
}

/* ----- Header row ----- */
.home-filter-module .mp__head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: 8px 24px;
	margin-bottom: 20px;
}
.home-filter-module .mp__title {
	margin: 0 0 6px;
	font-family: inherit;
	font-size: 30px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: normal;
	text-transform: none;
	text-align: left;
	color: var(--lig-navy-dark);
}
.home-filter-module .mp__intro {
	margin: 0;
	font-size: 17px;
	line-height: 1.45;
	color: var(--lig-text-2);
}
.home-filter-module .mp__call {
	margin: 0;
	font-size: 16px;
	color: var(--lig-text-2);
}
.home-filter-module .mp__call a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	font-weight: 700;
	color: var(--lig-navy);
	text-decoration: underline;
	text-underline-offset: 3px;
	white-space: nowrap;
}
.home-filter-module .mp__call a:hover {
	color: var(--lig-navy-dark);
}

/* ----- Fields row ----- */
.home-filter-module .mp__fields {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 16px 20px;
}
.home-filter-module .mp__field {
	flex: 1 1 240px;
	min-width: 0;
}
.home-filter-module .mp__label {
	display: block;
	margin: 0 0 8px;
	font-size: 16px;
	font-weight: 700;
	color: var(--lig-navy-dark);
}
.home-filter-module .mp__select {
	display: block;
	width: 100%;
	height: 54px;
	margin: 0;
	padding: 0 44px 0 16px;
	font-family: inherit;
	font-size: 17px;
	color: var(--lig-navy);
	background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231B3A75' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 16px center / 12px 8px;
	border: 1.5px solid var(--lig-control-border);
	border-radius: var(--lig-radius-control);
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	cursor: pointer;
}
.home-filter-module .mp__select:hover {
	border-color: var(--lig-navy);
}
.home-filter-module .mp__select.is-set {
	border-color: var(--lig-navy);
	box-shadow: inset 0 0 0 1px var(--lig-navy);
	font-weight: 600;
}
.home-filter-module .mp__actions {
	flex: 0 0 auto;
}
.home-filter-module .mp__submit {
	display: block;
	/* Fits "Show matching meters" so the label swap doesn't shift the selects. */
	min-width: 260px;
	height: 54px;
	margin: 0;
	padding: 0 28px;
	font-family: inherit;
	font-size: 17px;
	font-weight: 700;
	color: var(--lig-navy-dark);
	background: var(--lig-orange);
	border: 0;
	border-radius: var(--lig-radius-control);
	cursor: pointer;
	transition: background-color 150ms ease;
}
.home-filter-module .mp__submit:hover {
	background: #ff8331;
}

/* ----- Meter type ----- */
.home-filter-module .mp__types {
	min-width: 0;
	margin: 24px 0 0;
	padding: 24px 0 0;
	border: 0;
	border-top: 1px solid #E1E7F1;
}
/* Floated so the legend sits below the divider like a normal heading,
   instead of being drawn into the fieldset's top border. */
.home-filter-module .mp__types-title {
	float: left;
	width: 100%;
	margin: 0 0 4px;
	padding: 0;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--lig-navy-dark);
	border: 0;
}
.home-filter-module .mp__types-help {
	clear: both;
	margin: 0 0 14px;
	font-size: 15px;
	color: var(--lig-text-2);
}
.home-filter-module .mp__type-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 12px;
}
.home-filter-module .mp__type {
	position: relative;
	display: block;
	margin: 0;
	font-weight: 400;
	cursor: pointer;
}
/* Visually hidden but still focusable; the box after it shows the state. */
.home-filter-module .mp__type-input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
	pointer-events: none;
}
.home-filter-module .mp__type-box {
	display: flex;
	align-items: center;
	gap: 12px;
	height: 100%;
	min-height: 72px;
	padding: 12px 36px 12px 14px;
	color: var(--lig-navy);
	background: #fff;
	border: 1.5px solid var(--lig-control-border);
	border-radius: 10px;
	transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.home-filter-module .mp__type:hover .mp__type-box {
	border-color: var(--lig-navy);
	background: var(--lig-tint);
}
.home-filter-module .mp__type-icon {
	flex: 0 0 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 30px;
}
.home-filter-module .mp__type-icon svg {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
}
.home-filter-module .mp__type-text {
	min-width: 0;
}
.home-filter-module .mp__type-name {
	display: block;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.25;
}
.home-filter-module .mp__type-desc {
	display: block;
	margin-top: 2px;
	font-size: 14px;
	line-height: 1.35;
	color: var(--lig-text-2);
}
.home-filter-module .mp__type-check {
	position: absolute;
	top: 8px;
	right: 8px;
	display: none;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	color: var(--lig-navy);
	background: #fff;
	border-radius: 50%;
}
.home-filter-module .mp__type-check svg {
	width: 14px;
	height: 14px;
}

/* Selected: navy fill, white text and icon, check mark. */
.home-filter-module .mp__type-input:checked + .mp__type-box,
.home-filter-module .mp__type:hover .mp__type-input:checked + .mp__type-box {
	color: #fff;
	background: var(--lig-navy);
	border-color: var(--lig-navy);
}
.home-filter-module .mp__type-input:checked + .mp__type-box .mp__type-desc {
	color: #DCE3F0;
}
.home-filter-module .mp__type-input:checked + .mp__type-box .mp__type-check {
	display: flex;
}

/* No category for this combination. */
.home-filter-module .mp__type-input:disabled + .mp__type-box {
	opacity: 0.45;
	cursor: not-allowed;
}
.home-filter-module .mp__type:hover .mp__type-input:disabled + .mp__type-box {
	background: #fff;
	border-color: var(--lig-control-border);
}

/* ----- Summary row (filled by JS; hidden while empty) ----- */
.home-filter-module .mp__summary {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 4px 16px;
	margin-top: 20px;
	padding: 4px 8px 4px 16px;
	font-size: 16px;
	color: var(--lig-navy-dark);
	background: var(--lig-tint);
	border-radius: var(--lig-radius-control);
}
.home-filter-module .mp__summary:empty {
	display: none;
}
.home-filter-module .mp__summary-text {
	margin: 0;
	padding: 8px 0;
}
.home-filter-module .mp__clear {
	min-height: 44px;
	padding: 0 8px;
	font-family: inherit;
	font-size: 16px;
	font-weight: 700;
	color: var(--lig-navy);
	text-decoration: underline;
	text-underline-offset: 3px;
	background: none;
	border: 0;
	cursor: pointer;
}

/* ----- Tablet and phone ----- */
@media (max-width: 991px) {
	.home-filter-module .mp__actions {
		flex: 1 1 100%;
	}
	.home-filter-module .mp__submit {
		width: 100%;
	}
}
@media (max-width: 767px) {
	.home-filter-module {
		/* The hero is much shorter on phones; a full 64px would cover its
		   "Learn more" button. */
		margin-top: -24px;
	}
	.home-filter-module .mp {
		padding: 22px 16px;
	}
	.home-filter-module .mp__title {
		font-size: 26px;
	}
	.home-filter-module .mp__submit {
		min-width: 0;
	}
	.home-filter-module .mp__type-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 10px;
	}
	.home-filter-module .mp__type-box {
		flex-direction: column;
		align-items: flex-start;
		gap: 8px;
		padding: 12px 30px 12px 12px;
	}
	.home-filter-module .mp__type-icon {
		flex-basis: auto;
		justify-content: flex-start;
	}
}
