/* Mobile Home Mama - custom styles. */

/*
 * Lora (400-700) is loaded from Google Fonts in functions.php.
 * Segoe UI is a Microsoft system font (not on Google Fonts), so it is not
 * downloaded; other devices fall back to their system UI font.
 */

:root {
	--mhm-primary: #079cf2;
	--mhm-primary-dark: #0680cc;
	--mhm-secondary: #122838;
	--mhm-bg: #fff;
	--mhm-bg-alt: #e9f7fc;
	--mhm-accent: #ffb400;
	--mhm-font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
	--mhm-font-heading: "Lora", Georgia, "Times New Roman", serif;
	--mhm-max: 1200px;
	--mhm-gutter: 20px;
}

body {
	font-family: var(--mhm-font);
}

/* "body" raises specificity above GeneratePress's later "h1..h6 { font-family: inherit }" reset. */
body h1,
body h2,
body h3,
body h4,
body h5,
body h6,
body .mhm-button,
body .mhm-header__site-name,
body .mhm-footer__site-name,
body button,
body input[type="submit"],
body .wp-block-button__link {
	font-family: var(--mhm-font-heading);
}

/* Heading weights: h1 (hero) 600, all other headings 500. */
body h1 {
	font-weight: 600;
}

body h2,
body h3,
body h4,
body h5,
body h6 {
	font-weight: 500;
}

/* ---------- Header ---------- */
.mhm-header {
	position: relative;
	background: var(--mhm-bg);
	box-shadow: 0 1px 0 rgba(18, 40, 56, 0.1);
	font-family: var(--mhm-font);
}

.mhm-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	max-width: var(--mhm-max);
	margin: 0 auto;
	padding: 14px var(--mhm-gutter);
	box-sizing: border-box;
}

.mhm-header__brand img {
	display: block;
	max-height: 56px;
	width: auto;
}

.mhm-header__site-name,
.mhm-footer__site-name {
	font-size: 1.25rem;
	font-weight: 700;
	text-decoration: none;
}

.mhm-header__site-name {
	color: var(--mhm-secondary);
}

.mhm-nav__list,
.mhm-footer__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.mhm-nav__list a {
	display: block;
	position: relative;
	padding: 10px 12px;
	color: var(--mhm-secondary);
	font-weight: 500;
	text-decoration: none;
	transition: color 0.25s ease, background-color 0.25s ease, padding 0.25s ease;
}

.mhm-nav__list a:hover,
.mhm-nav__list a:focus-visible,
.mhm-nav__list .current-menu-item > a,
.mhm-nav__list a[aria-current="page"] {
	color: var(--mhm-primary);
}

.mhm-button {
	display: inline-block;
	padding: 12px 24px;
	border-radius: 6px;
	background: var(--mhm-primary);
	color: #fff;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	transition: background-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.mhm-button:hover,
.mhm-button:active {
	background: var(--mhm-primary-dark);
	box-shadow: 0 6px 16px rgba(7, 156, 242, 0.35);
	color: #fff;
	transform: translateY(-2px);
}

.mhm-button:active {
	box-shadow: none;
	transform: translateY(0);
}

.mhm-header a:focus-visible,
.mhm-header button:focus-visible,
.mhm-footer a:focus-visible {
	outline: 3px solid var(--mhm-accent);
	outline-offset: 2px;
}

.mhm-nav-toggle {
	display: none;
	position: relative;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid rgba(18, 40, 56, 0.25);
	border-radius: 6px;
	background: var(--mhm-bg);
	color: var(--mhm-secondary);
	cursor: pointer;
}

.mhm-nav-toggle__bar,
.mhm-nav-toggle__bar::before,
.mhm-nav-toggle__bar::after {
	position: absolute;
	width: 20px;
	height: 2px;
	background: currentcolor;
	content: "";
	transition: transform 0.2s, background-color 0.2s;
}

.mhm-nav-toggle__bar {
	top: 20px;
	left: 11px;
}

.mhm-nav-toggle__bar::before {
	top: -6px;
	left: 0;
}

.mhm-nav-toggle__bar::after {
	top: 6px;
	left: 0;
}

.mhm-nav-toggle[aria-expanded="true"] .mhm-nav-toggle__bar {
	background: transparent;
}

.mhm-nav-toggle[aria-expanded="true"] .mhm-nav-toggle__bar::before {
	transform: translateY(6px) rotate(45deg);
}

.mhm-nav-toggle[aria-expanded="true"] .mhm-nav-toggle__bar::after {
	transform: translateY(-6px) rotate(-45deg);
}

/* Desktop layout. */
@media (min-width: 901px) {
	.mhm-header__panel {
		display: flex;
		align-items: center;
		gap: 16px;
	}

	.mhm-nav__list {
		display: flex;
		gap: 4px;
	}
}

/* Mobile layout. */
@media (max-width: 900px) {
	.mhm-nav-toggle {
		display: block;
	}

	.mhm-header__panel {
		flex: 0 0 100%;
		max-height: 0;
		overflow: hidden;
		visibility: hidden;
		opacity: 0;
		transition: max-height 0.35s ease, opacity 0.25s ease, visibility 0s linear 0.35s;
	}

	.mhm-header__panel.is-open {
		max-height: 1500px;
		visibility: visible;
		opacity: 1;
		transition-delay: 0s;
	}

	.mhm-nav {
		padding-top: 12px;
	}

	.mhm-nav__list a {
		padding: 12px 0;
		border-bottom: 1px solid rgba(18, 40, 56, 0.1);
	}

	.mhm-header__panel .mhm-button {
		display: block;
		margin-top: 16px;
	}
}

/* ---------- Home search box and live suggestions (search.js) ---------- */
.mhm-search-box {
	display: flex;
	gap: 8px;
	margin: 0;
}

.mhm-search-box .mhm-suggest {
	flex: 1 1 auto;
	min-width: 0;
}

.mhm-search-box__submit.mhm-button {
	flex: 0 0 auto;
	padding: 0 18px;
	border: 0;
	cursor: pointer;
}

.mhm-suggest {
	position: relative;
}

.mhm-suggest__field {
	position: relative;
}

.mhm-suggest__icon {
	position: absolute;
	top: 50%;
	left: 12px;
	width: 18px;
	height: 18px;
	color: #3d5568;
	pointer-events: none;
	transform: translateY(-50%);
}

.mhm-suggest input[type="search"] {
	width: 100%;
	min-height: 48px;
	padding: 0 12px 0 40px;
	border: 1px solid rgba(18, 40, 56, 0.25);
	border-radius: 6px;
	background: #fff;
	color: var(--mhm-secondary);
	font-family: var(--mhm-font);
	font-size: 1rem;
	box-sizing: border-box;
}

.mhm-suggest input[type="search"]::placeholder {
	color: #6b7f8e;
}

.mhm-suggest input[type="search"]:focus {
	border-color: var(--mhm-primary);
	outline: 3px solid rgba(7, 156, 242, 0.25);
	outline-offset: 0;
}

/* Floating list under the field. */
.mhm-suggest__popup {
	position: absolute;
	top: calc(100% + 6px);
	right: 0;
	left: 0;
	z-index: 210;
	max-height: min(70vh, 520px);
	overflow-y: auto;
	padding: 6px;
	border: 1px solid rgba(18, 40, 56, 0.1);
	border-radius: 10px;
	background: #fff;
	box-shadow: 0 16px 40px rgba(18, 40, 56, 0.18);
	text-align: left;
	box-sizing: border-box;
	animation: mhm-suggest-in 0.15s ease-out;
}

.mhm-suggest__popup[hidden] {
	display: none;
}

@keyframes mhm-suggest-in {
	from {
		opacity: 0;
		transform: translateY(-4px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

.mhm-suggest__note {
	margin: 0;
	padding: 10px 12px 4px;
	color: #3d5568;
	font-size: 0.9375rem;
}

.mhm-suggest__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.mhm-suggest__option {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0;
	padding: 8px 10px;
	border-radius: 8px;
	color: var(--mhm-secondary);
	cursor: pointer;
}

.mhm-suggest__option:hover,
.mhm-suggest__option.is-active {
	background: var(--mhm-bg-alt);
}

/* Keyboard highlight also shows as an outline (not colour alone). */
.mhm-suggest__option.is-active {
	box-shadow: inset 0 0 0 2px var(--mhm-primary);
}

/* Contain, not cover: thumbnails are floor plans. */
.mhm-suggest__media {
	flex: 0 0 64px;
	height: 48px;
	border: 1px solid rgba(18, 40, 56, 0.1);
	border-radius: 6px;
	background: #fff;
	overflow: hidden;
}

.mhm-suggest__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.mhm-suggest__text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.mhm-suggest__name {
	overflow: hidden;
	font-weight: 600;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.mhm-suggest__name strong {
	color: var(--mhm-primary-text, #0570b0);
	font-weight: 700;
}

.mhm-suggest__meta {
	color: #3d5568;
	font-size: 0.8125rem;
}

.mhm-suggest__option--type,
.mhm-suggest__option--all {
	justify-content: space-between;
	color: var(--mhm-primary-text, #0570b0);
	font-weight: 600;
}

.mhm-suggest__option--all {
	margin-top: 4px;
	border-top: 1px solid rgba(18, 40, 56, 0.08);
	border-radius: 0 0 8px 8px;
}

.mhm-suggest__option--type .mhm-suggest__label::after,
.mhm-suggest__option--all .mhm-suggest__label::after {
	content: " →";
}

.mhm-suggest__count {
	flex: 0 0 auto;
	min-width: 24px;
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--mhm-bg-alt);
	color: var(--mhm-secondary);
	font-size: 0.75rem;
	text-align: center;
}

/* Header search. */
.mhm-header-search__toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid rgba(18, 40, 56, 0.2);
	border-radius: 50%;
	background: var(--mhm-bg);
	color: var(--mhm-secondary);
	cursor: pointer;
	transition: color 0.2s ease, border-color 0.2s ease;
}

.mhm-header-search__toggle[hidden] {
	display: none;
}

.mhm-header-search__toggle:hover,
.mhm-header-search__toggle[aria-expanded="true"] {
	border-color: var(--mhm-primary);
	color: var(--mhm-primary);
}

.mhm-header-search__toggle .mhm-icon {
	width: 20px;
	height: 20px;
}

@media (min-width: 901px) {
	/* Order in the bar: menu, search, call-to-action (the search comes first in the HTML for the mobile menu). */
	.mhm-header-search {
		position: relative;
		order: 1;
	}

	.mhm-header__panel > .mhm-button {
		order: 2;
	}

	/* Without JS the box simply sits in the bar. */
	.mhm-header-search:not(.is-ready) .mhm-search-box__submit {
		display: none;
	}

	.mhm-header-search.is-ready .mhm-header-search__panel {
		position: absolute;
		top: calc(100% + 18px);
		right: 0;
		z-index: 200;
		width: 460px;
		padding: 14px;
		border-radius: 12px;
		background: var(--mhm-bg);
		box-shadow: 0 16px 40px rgba(18, 40, 56, 0.18);
		visibility: hidden;
		opacity: 0;
		transform: translateY(-6px);
		transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
	}

	.mhm-header-search.is-open .mhm-header-search__panel {
		visibility: visible;
		opacity: 1;
		transform: none;
		transition-delay: 0s;
	}

	/* Suggestions span the whole panel (field and button), not just the field. */
	.mhm-header-search.is-ready .mhm-suggest {
		position: static;
	}

	.mhm-header-search.is-ready .mhm-suggest__popup {
		top: calc(100% + 6px);
	}
}

@media (max-width: 900px) {
	.mhm-header-search {
		padding-top: 16px;
	}

	.mhm-header-search__toggle,
	.mhm-header-search__toggle:not([hidden]) {
		display: none;
	}

	/* Phones submit with the keyboard's search key (or "See all results"), so the field gets the full width. */
	.mhm-header .mhm-search-box__submit {
		display: none;
	}

	/* The menu panel clips overflow while it animates, so suggestions sit in the flow here. */
	.mhm-header .mhm-suggest__popup {
		position: static;
		margin-top: 8px;
		box-shadow: 0 6px 18px rgba(18, 40, 56, 0.1);
	}
}

@media (prefers-reduced-motion: reduce) {
	.mhm-suggest__popup {
		animation: none;
	}

	.mhm-header-search.is-ready .mhm-header-search__panel {
		transform: none;
		transition: none;
	}
}

/* ---------- Dropdown submenus ---------- */
.mhm-nav__list .menu-item-has-children {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	position: relative;
}

.mhm-nav__list .sub-menu {
	margin: 0;
	padding: 0;
	list-style: none;
	visibility: hidden;
	opacity: 0;
	transition: opacity 0.25s ease, transform 0.25s ease, max-height 0.3s ease, visibility 0s linear 0.3s;
}

.mhm-nav__list .menu-item-has-children.is-open > .sub-menu {
	visibility: visible;
	opacity: 1;
	transition-delay: 0s;
}

.mhm-submenu-toggle {
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--mhm-secondary);
	cursor: pointer;
}

.mhm-submenu-toggle::before {
	display: block;
	width: 8px;
	height: 8px;
	margin: 0 auto;
	border: solid currentcolor;
	border-width: 0 2px 2px 0;
	content: "";
	transform: translateY(-2px) rotate(45deg);
	transition: transform 0.2s;
}

.mhm-submenu-toggle[aria-expanded="true"]::before {
	transform: translateY(2px) rotate(-135deg);
}

.mhm-submenu-toggle:hover {
	color: var(--mhm-primary);
}

.mhm-header .mhm-submenu-toggle:focus-visible {
	outline: 3px solid var(--mhm-accent);
	outline-offset: 2px;
}

@media (min-width: 901px) {
	.mhm-nav__list .sub-menu {
		position: absolute;
		top: 100%;
		left: 0;
		z-index: 100;
		min-width: 220px;
		padding: 8px 0;
		border-radius: 6px;
		background: var(--mhm-bg);
		box-shadow: 0 8px 24px rgba(18, 40, 56, 0.15);
		transform: translateY(8px);
	}

	.mhm-nav__list .menu-item-has-children:hover > .sub-menu,
	.mhm-nav__list .menu-item-has-children:focus-within > .sub-menu,
	.mhm-nav__list .menu-item-has-children.is-open > .sub-menu {
		visibility: visible;
		opacity: 1;
		transform: translateY(0);
		transition-delay: 0s;
	}

	.mhm-nav__list .sub-menu a {
		padding: 10px 16px;
		white-space: nowrap;
	}

	.mhm-nav__list .sub-menu a:hover,
	.mhm-nav__list .sub-menu a:focus-visible {
		padding-left: 22px;
		background: var(--mhm-bg-alt);
	}

	/* Animated underline on top-level links. */
	.mhm-nav__list > li > a::after {
		position: absolute;
		right: 12px;
		bottom: 4px;
		left: 12px;
		height: 2px;
		background: var(--mhm-primary);
		content: "";
		transform: scaleX(0);
		transform-origin: left center;
		transition: transform 0.25s ease;
	}

	.mhm-nav__list > li > a:hover::after,
	.mhm-nav__list > li > a:focus-visible::after,
	.mhm-nav__list > .current-menu-item > a::after,
	.mhm-nav__list > .menu-item-has-children:hover > a::after {
		transform: scaleX(1);
	}
}

@media (max-width: 900px) {
	.mhm-nav__list .menu-item-has-children > a {
		flex: 1 1 0;
	}

	.mhm-nav__list .sub-menu {
		flex: 0 0 100%;
		max-height: 0;
		overflow: hidden;
		padding-left: 16px;
	}

	.mhm-nav__list .menu-item-has-children.is-open > .sub-menu {
		max-height: 600px;
	}

	.mhm-nav__list a:hover,
	.mhm-nav__list a:focus-visible {
		padding-left: 8px;
	}

	.mhm-nav__list a:focus-visible {
		outline-offset: -3px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mhm-nav__list a,
	.mhm-nav__list a::after,
	.mhm-nav__list .sub-menu,
	.mhm-submenu-toggle::before,
	.mhm-header__panel,
	.mhm-footer a,
	.mhm-button {
		transition: none;
	}

	.mhm-button:hover,
	.mhm-footer a:hover,
	.mhm-footer a:focus-visible {
		transform: none;
	}
}

/* ---------- Footer ---------- */
.mhm-footer {
	background: var(--mhm-secondary);
	color: #d6e3ec;
	font-family: var(--mhm-font);
	line-height: 1.7;
	overflow-x: hidden;
}

.mhm-footer__inner {
	max-width: var(--mhm-max);
	margin: 0 auto;
	padding: 56px var(--mhm-gutter) 24px;
	box-sizing: border-box;
}

.mhm-footer__grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 32px;
}

.mhm-footer__heading {
	margin: 0 0 16px;
	color: #fff;
	font-size: 1.125rem;
	font-weight: 500;
}

.mhm-footer__site-name {
	color: #fff;
}

.mhm-footer__col img {
	max-width: 180px;
	height: auto;
}

.mhm-footer p {
	margin: 12px 0 0;
}

.mhm-footer a {
	display: inline-block;
	color: #d6e3ec;
	text-decoration: none;
	overflow-wrap: anywhere;
	background: linear-gradient(currentcolor, currentcolor) left bottom / 0 1px no-repeat;
	transition: color 0.25s ease, transform 0.25s ease, background-size 0.3s ease;
}

.mhm-footer a:hover,
.mhm-footer a:focus-visible {
	color: #fff;
	background-size: 100% 1px;
	transform: translateX(4px);
}

/* Footer widget areas (columns 2-4). */
.mhm-footer .widget + .widget {
	margin-top: 24px;
}

.mhm-footer .wp-block-heading,
.mhm-footer .widget-title,
.mhm-footer .widgettitle {
	margin: 0 0 16px;
	color: #fff;
	font-family: var(--mhm-font-heading);
	font-size: 1.125rem;
	font-weight: 500;
	line-height: 1.3;
}

.mhm-footer .widget ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.mhm-footer .widget li + li {
	margin-top: 8px;
}

.mhm-footer .widget p {
	margin: 0 0 12px;
}

.mhm-footer__list li + li {
	margin-top: 8px;
}

/* Social icon links (footer and Contact page). */
.mhm-social {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 16px 0 0;
	padding: 0;
	list-style: none;
}

.mhm-social a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.1);
	transition: background-color 0.25s ease, color 0.25s ease;
}

.mhm-social .mhm-icon {
	width: 20px;
	height: 20px;
}

.mhm-footer .mhm-social a,
.mhm-footer .mhm-social a:hover,
.mhm-footer .mhm-social a:focus-visible {
	background-size: 0 0;
	transform: none;
}

.mhm-footer .mhm-social a:hover,
.mhm-footer .mhm-social a:focus-visible {
	background-color: var(--mhm-primary);
}

.mhm-footer__bottom {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 40px;
	padding-top: 20px;
	border-top: 1px solid rgba(255, 255, 255, 0.15);
	font-size: 0.875rem;
}

.mhm-footer__bottom p {
	margin: 0;
}

@media (min-width: 600px) {
	.mhm-footer__grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 901px) {
	.mhm-footer__grid {
		grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
	}

	.mhm-footer__bottom {
		flex-direction: row;
		justify-content: space-between;
	}
}

/* ---------- Smooth scrolling ---------- */
@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

/* ---------- Animations ---------- */
@keyframes mhm-fade-up {
	from {
		opacity: 0;
		translate: 0 28px;
	}

	to {
		opacity: 1;
		translate: 0 0;
	}
}

/*
 * Scroll reveal. Add data-reveal to any element; optional values:
 * "up" (default), "down", "left", "right", "zoom", "fade".
 * Siblings reveal in a short stagger (set in main.js). The individual
 * "translate"/"scale" properties are used so hover "transform" effects
 * on the same element keep working. Only active once JS adds the ready class.
 */
.mhm-reveal-ready [data-reveal] {
	opacity: 0;
	translate: 0 28px;
	transition: opacity 0.7s ease var(--mhm-delay, 0s), translate 0.7s cubic-bezier(0.22, 1, 0.36, 1) var(--mhm-delay, 0s), scale 0.7s cubic-bezier(0.22, 1, 0.36, 1) var(--mhm-delay, 0s);
	will-change: opacity, translate;
}

.mhm-reveal-ready [data-reveal="down"] {
	translate: 0 -28px;
}

.mhm-reveal-ready [data-reveal="left"] {
	translate: -40px 0;
}

.mhm-reveal-ready [data-reveal="right"] {
	translate: 40px 0;
}

.mhm-reveal-ready [data-reveal="zoom"] {
	translate: none;
	scale: 0.94;
}

.mhm-reveal-ready [data-reveal="fade"] {
	translate: none;
}

.mhm-reveal-ready [data-reveal].is-visible {
	opacity: 1;
	translate: 0 0;
	scale: 1;
}

@media (prefers-reduced-motion: reduce) {
	.mhm-reveal-ready [data-reveal] {
		opacity: 1;
		translate: none;
		scale: none;
		transition: none;
	}
}
