:root {
	--mth-accent: #087a67;
	--mth-ink: #10231b;
	--mth-brand: #e9f8f3;
	--mth-base: #f1faf6;
	--mth-dark: #0d1511;
	--mth-dark-panel: #121d17;
	--mth-dark-card: #17231d;
	--mth-warning: #d97706;
	--mth-critical: #b42318;
	--mth-surface: rgba(255, 255, 255, 0.82);
	--mth-muted: #496158;
	--mth-line: rgba(8, 122, 103, 0.22);
	--mth-shadow: 0 16px 48px rgba(16, 35, 27, 0.08);
	--mth-header-height: 58px;
	--mth-page-gutter: clamp(1rem, 3vw, 2.25rem);
	--mth-wide: 1440px;
	--mth-footer-surface: #f1faf6;
	--mth-footer-ink: #10231b;
	color-scheme: light dark;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}
body.mth-theme .screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute !important;
	white-space: nowrap;
	width: 1px;
}
body.mth-theme .screen-reader-text:focus {
	clip: auto;
	clip-path: none;
	height: auto;
	margin: 0;
	overflow: visible;
	width: auto;
}

html {
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--mth-header-height) + 1rem);
	-webkit-text-size-adjust: 100%;
}

body.mth-theme {
	min-width: 320px;
	min-height: 100vh;
	margin: 0;
	color: var(--mth-ink);
	background: linear-gradient(135deg, var(--mth-base) 0%, var(--mth-brand) 100%) fixed;
	font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
}

body.mth-theme .wp-site-blocks {
	display: flex;
	min-height: 100vh;
	flex-direction: column;
	padding: 0;
}

body.mth-theme .mth-site-main {
	flex: 1 0 auto;
	width: 100%;
}

/* The configured landing page starts directly below the slim header. */
body.mth-theme .mth-landing-main,
body.mth-theme .mth-landing-main > .wp-block-post-content {
	width: 100%;
	max-width: none;
	margin: 0;
	padding: 0;
}

body.mth-theme .mth-landing-main > .wp-block-post-content > .wp-block-paragraph:empty {
	display: none;
}

/* Fallback when a Site Editor database template still renders page.html. */
body.mth-theme.home.page .mth-content-shell {
	padding-top: 0;
	padding-bottom: 0;
}

body.mth-theme.home.page .mth-content-shell > .wp-block-post-content > .wp-block-paragraph:empty {
	display: none;
	margin: 0;
}

body.mth-theme .mth-landing-main > .wp-block-post-content > .mth-scrollytelling,
body.mth-theme.home.page .mth-content-shell > .wp-block-post-content > .mth-scrollytelling {
	margin-block-start: 0;
	margin-block-end: 0;
}

body.mth-theme .mth-app-main {
	width: 100%;
	min-height: calc(100vh - var(--mth-header-height));
	min-height: calc(100dvh - var(--mth-header-height));
	padding: 0;
}

body.mth-theme .mth-app-main > .wp-block-post-content {
	width: 100%;
	min-height: inherit;
	max-width: none;
	margin: 0;
	padding: 0;
}

body.mth-theme :where(a, button, input, select, textarea, summary):focus-visible {
	outline: 3px solid var(--mth-accent);
	outline-offset: 3px;
}

body.mth-theme a {
	text-decoration-thickness: 0.08em;
	text-underline-offset: 0.16em;
}

body.mth-theme a:hover {
	text-decoration-thickness: 0.12em;
}

body.mth-theme :where(img, video, iframe) {
	max-width: 100%;
}

body.mth-theme ::selection {
	color: var(--mth-ink);
	background: var(--mth-brand);
}

/* Keep the complete template part sticky; the inner header alone is bounded by its wrapper. */
body.mth-theme .wp-block-template-part:has(> .mth-site-header) {
	position: sticky;
	z-index: 1000;
	top: 0;
}

body.admin-bar.mth-theme .wp-block-template-part:has(> .mth-site-header) {
	top: 32px;
}

/* Slim, editor-controlled site header. */
body.mth-theme .mth-site-header {
	position: relative;
	z-index: auto;
	top: auto;
	margin: 0;
	border-bottom: 1px solid var(--mth-line);
	background: rgba(241, 250, 246, 0.92);
	-webkit-backdrop-filter: blur(18px) saturate(140%);
	backdrop-filter: blur(18px) saturate(140%);
}

body.mth-theme .mth-header-inner {
	min-height: var(--mth-header-height);
	max-width: var(--mth-wide);
	margin-block: 0;
	margin-inline: auto;
	padding: 0.35rem var(--mth-page-gutter);
}

body.mth-theme .mth-brand-lockup {
	min-width: 0;
	flex: 0 1 auto;
	gap: 0.6rem;
}

body.mth-theme .mth-brand-lockup .wp-block-site-logo {
	flex: 0 0 auto;
}

body.mth-theme .mth-brand-lockup .wp-block-site-logo img {
	display: block;
	width: 36px;
	height: 36px;
	border-radius: 0.45rem;
	object-fit: contain;
}

body.mth-theme .mth-brand-lockup .wp-block-site-title {
	min-width: 0;
	margin: 0;
	font-size: clamp(0.92rem, 0.82rem + 0.35vw, 1.1rem);
	font-weight: 760;
	line-height: 1.15;
}

body.mth-theme .mth-brand-lockup .wp-block-site-title a {
	display: block;
	max-width: min(42vw, 34rem);
	color: var(--mth-ink);
	overflow: hidden;
	text-decoration: none;
	text-overflow: ellipsis;
	white-space: nowrap;
}

body.mth-theme .mth-primary-nav {
	font-size: 0.88rem;
	font-weight: 650;
}

body.mth-theme .mth-primary-nav .wp-block-navigation-item__content {
	padding-block: 0.45rem;
	color: var(--mth-ink);
	text-decoration: none;
}

body.mth-theme .mth-primary-nav .current-menu-item > .wp-block-navigation-item__content,
body.mth-theme .mth-primary-nav .wp-block-navigation-item__content:hover {
	color: var(--mth-accent);
}

body.mth-theme .wp-block-navigation__responsive-container-open,
body.mth-theme .wp-block-navigation__responsive-container-close {
	min-width: 40px;
	min-height: 40px;
	padding: 0.45rem;
	border: 1px solid var(--mth-line);
	border-radius: 0.5rem;
	color: var(--mth-ink);
}

body.mth-theme .wp-block-navigation__responsive-container.is-menu-open {
	padding: var(--mth-page-gutter);
	color: var(--mth-ink);
	background: var(--mth-base);
}

/* Content keeps comfortable reading width while wide/plugin surfaces get room. */
body.mth-theme .mth-content-shell {
	width: 100%;
	padding: clamp(2rem, 5vw, 4.5rem) var(--mth-page-gutter);
}

/* Static pages provide their own headings inside the page content. This also
 * covers database-saved copies of older page templates that still contain the
 * automatic Post Title block. */
body.mth-theme.page .mth-content-shell > .wp-block-post-title {
	display: none;
}

body.mth-theme .mth-content-shell > :where(:not(.alignleft):not(.alignright):not(.alignfull)) {
	width: 100%;
	max-width: var(--mth-wide);
}

body.mth-theme .mth-content-shell > .alignwide {
	max-width: var(--mth-wide);
}

body.mth-theme :where(.wp-block-post-content, .mth-content-shell) > .alignfull {
	width: 100vw;
	max-width: none;
	margin-inline: calc(50% - 50vw);
}

body.mth-theme :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
	max-width: 100%;
	border: 1px solid var(--mth-line);
	border-radius: 0.5rem;
	color: var(--mth-ink);
	background: rgba(255, 255, 255, 0.8);
	font: inherit;
}

body.mth-theme :where(.wp-element-button, .wp-block-button__link) {
	min-height: 42px;
	padding: 0.65rem 1rem;
	border: 1px solid var(--mth-accent);
	border-radius: 0.5rem;
	color: #fff;
	background: var(--mth-accent);
	box-shadow: none;
	transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

body.mth-theme :where(.wp-element-button, .wp-block-button__link):hover {
	background: #066554;
	box-shadow: 0 8px 24px rgba(8, 122, 103, 0.18);
	transform: translateY(-1px);
}

/* The native footer owns its layout, including saved Site Editor variants.
 * Query its actual width: a tablet reader can be narrower than the viewport. */
body.mth-theme .mth-site-footer {
	container: nexus-footer / inline-size;
	--mth-footer-logo-height: 64px;
	margin: 0;
	padding: 0;
	border-top: 1px solid var(--mth-line);
	color: var(--mth-footer-ink);
	background: var(--mth-footer-surface);
}

body.mth-theme .mth-footer-inner {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	align-items: center;
	gap: 0.75rem 1.5rem;
	max-width: var(--mth-wide);
	margin-block: 0;
	margin-inline: auto;
	padding: 1rem var(--mth-page-gutter);
}

body.mth-theme .mth-footer-inner > *,
body.mth-theme .mth-footer-brand > * {
	min-width: 0;
	margin: 0;
}

body.mth-theme .mth-footer-brand {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.65rem 0.75rem;
}

body.mth-theme .mth-footer-brand > .wp-block-site-logo {
	flex: 0 0 var(--mth-footer-logo-height);
	width: var(--mth-footer-logo-height);
}

body.mth-theme .mth-footer-brand .wp-block-site-logo > a {
	display: block;
	width: 100%;
	line-height: 0;
}

body.mth-theme .mth-footer-brand > .mth-footer-title {
	flex: 1 1 calc(100% - var(--mth-footer-logo-height) - 0.75rem);
}

body.mth-theme .mth-footer-brand .wp-block-site-logo img {
	display: block;
	width: var(--mth-footer-logo-height);
	height: var(--mth-footer-logo-height);
	border-radius: 0;
	background: transparent;
	object-fit: contain;
}

/* Both brands share one display height. The artwork supplies its own alpha;
 * no light plate, file replacement, recoloring or image crop. */
body.mth-theme .mth-footer-brand > .wp-block-image {
	flex: 0 0 auto;
	width: max-content !important; /* Replace saved fixed block widths at this logo-only boundary. */
	max-width: min(100%, calc(var(--mth-footer-logo-height) * 2.5));
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
}

body.mth-theme .mth-footer-brand > .wp-block-image :is(a, img) {
	display: block;
	background: transparent;
}

body.mth-theme .mth-footer-brand > .wp-block-image img {
	width: auto !important;
	height: var(--mth-footer-logo-height) !important;
	max-height: var(--mth-footer-logo-height);
	object-fit: contain !important; /* Saved image blocks can carry inline cover. */
}

body.mth-theme .mth-footer-brand > p:not(.mth-footer-title) {
	flex: 1 1 8rem;
	font-size: 0.8125rem;
	line-height: 1.5;
	overflow-wrap: anywhere;
}

body.mth-theme .mth-footer-title,
body.mth-theme .mth-footer-copy,
body.mth-theme .mth-footer-nav {
	font-size: 0.8125rem;
	line-height: 1.5;
}

body.mth-theme .mth-footer-title {
	margin: 0;
	font-weight: 700;
	overflow-wrap: anywhere;
}

body.mth-theme nav.mth-footer-nav {
	width: 100%;
	padding-top: 0.5rem;
	border-top: 1px solid var(--mth-line);
}

body.mth-theme .mth-footer-nav,
body.mth-theme .mth-footer-nav .wp-block-navigation__container {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-start;
	align-items: center;
	gap: 0.25rem 0.5rem;
	margin: 0;
	padding-inline: 0;
	list-style: none;
}

body.mth-theme .mth-footer-nav a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0.45rem 0.65rem;
	border-radius: 0.35rem;
	overflow-wrap: anywhere;
}

body.mth-theme .mth-footer-title a,
body.mth-theme .mth-footer-nav a {
	color: inherit;
	text-decoration: none;
}

body.mth-theme .mth-footer-nav a:hover {
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

body.mth-theme .mth-site-footer a:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

@container nexus-footer (min-width: 30rem) {
	body.mth-theme .mth-footer-brand {
		display: grid;
		grid-template-columns: var(--mth-footer-logo-height) minmax(0, 1fr) auto;
		gap: 0.25rem 0.75rem;
	}
	body.mth-theme .mth-footer-brand > .wp-block-site-logo { grid-column: 1; grid-row: 1 / span 2; }
	body.mth-theme .mth-footer-brand > .mth-footer-title { grid-column: 2; grid-row: 1; }
	body.mth-theme .mth-footer-brand > .wp-block-image { grid-column: 3; grid-row: 1 / span 2; }
	body.mth-theme .mth-footer-brand > p:not(.mth-footer-title) { grid-column: 2; }
}

@container nexus-footer (min-width: 48rem) {
	body.mth-theme .mth-footer-inner { grid-template-columns: minmax(0, 1fr) auto; }
	body.mth-theme nav.mth-footer-nav { width: auto; padding-top: 0; border-top: 0; }
}

@media (max-width: 782px) {
	body.admin-bar.mth-theme .wp-block-template-part:has(> .mth-site-header) {
		top: 46px;
	}
}

@media (max-width: 700px) {
	:root {
		--mth-header-height: 50px;
	}

	body.mth-theme .mth-site-header {
		-webkit-backdrop-filter: none;
		backdrop-filter: none;
		background: var(--mth-base);
	}

	body.mth-theme .mth-header-inner {
		margin-block: 0;
		padding-block: 0.2rem;
	}

	body.mth-theme .mth-brand-lockup .wp-block-site-logo img {
		width: 32px;
		height: 32px;
	}

	body.mth-theme .mth-primary-nav .wp-block-navigation__responsive-container {
		position: fixed;
		z-index: 100000;
		inset: 0;
		width: 100vw;
		max-width: none;
		height: 100vh;
		height: 100dvh;
		max-height: none;
		margin: 0;
		overflow-x: hidden;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		overscroll-behavior: contain;
	}

	body.mth-theme .mth-primary-nav .wp-block-navigation__responsive-container.is-menu-open {
		display: flex;
		padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
	}

	body.mth-theme .mth-primary-nav .wp-block-navigation__responsive-container-content,
	body.mth-theme .mth-primary-nav .wp-block-navigation__container {
		width: 100%;
		max-width: none;
		overflow: visible;
	}

	body.mth-theme .mth-primary-nav .wp-block-navigation__responsive-container-content {
		padding-top: 3.5rem;
	}

	html.has-modal-open,
	html.has-modal-open body {
		overflow: hidden;
	}
}

@media (max-width: 700px) {
	body.mth-theme .mth-primary-nav .wp-block-navigation__responsive-container.is-menu-open {
		color: var(--mth-ink);
		background: linear-gradient(145deg, #f1faf6 0%, #e9f8f3 100%);
	}

	body.mth-theme .mth-primary-nav .wp-block-navigation__responsive-container-close {
		position: absolute;
		top: max(0.85rem, env(safe-area-inset-top));
		right: max(1rem, env(safe-area-inset-right));
		z-index: 2;
		display: grid;
		width: 44px;
		height: 44px;
		padding: 0;
		border: 1px solid var(--mth-line);
		border-radius: 0.65rem;
		color: var(--mth-ink);
		background: rgba(255, 255, 255, 0.76);
		place-items: center;
		box-shadow: 0 8px 24px rgba(16, 35, 27, 0.08);
	}

	body.mth-theme .mth-primary-nav .wp-block-navigation__responsive-container-content {
		--navigation-layout-justification-setting: stretch;
		--navigation-layout-justify: flex-start;
		display: flex;
		width: min(100%, 34rem);
		flex-direction: column;
		margin-inline: auto;
		padding-top: max(4.75rem, calc(env(safe-area-inset-top) + 4rem));
		align-items: stretch !important;
		justify-content: flex-start;
		text-align: left;
	}

	body.mth-theme .mth-primary-nav .wp-block-navigation__responsive-container-content::before {
		display: block;
		margin: 0 0 1rem;
		padding: 0 0 0.8rem;
		border-bottom: 1px solid var(--mth-line);
		color: var(--mth-muted);
		font-size: 0.72rem;
		font-weight: 800;
		letter-spacing: 0.1em;
		text-transform: uppercase;
		content: "Navigation";
	}

	body.mth-theme .mth-primary-nav .wp-block-navigation__responsive-container-content > .wp-block-navigation__container {
		display: flex;
		width: 100%;
		gap: 0.35rem;
		align-items: stretch !important;
		flex-direction: column;
		justify-content: flex-start !important;
	}

	body.mth-theme .mth-primary-nav .wp-block-navigation__responsive-container-content .wp-block-navigation-item {
		width: 100%;
		gap: 0;
		align-items: stretch !important;
	}

	body.mth-theme .mth-primary-nav .wp-block-navigation__responsive-container-content .wp-block-navigation-item.has-child {
		flex-direction: column;
	}

	body.mth-theme .mth-primary-nav .wp-block-navigation__responsive-container-content .wp-block-navigation-item__content {
		display: flex;
		width: 100%;
		min-height: 48px;
		padding: 0.72rem 0.85rem;
		border: 1px solid transparent;
		border-radius: 0.6rem;
		color: var(--mth-ink);
		font-size: clamp(0.96rem, 3.8vw, 1.08rem);
		font-weight: 700;
		line-height: 1.3;
		text-align: left;
		text-decoration: none;
		align-items: center;
	}

	body.mth-theme .mth-primary-nav .wp-block-navigation__responsive-container-content .wp-block-navigation-item__content:hover,
	body.mth-theme .mth-primary-nav .wp-block-navigation__responsive-container-content .wp-block-navigation-item__content:focus-visible {
		border-color: var(--mth-line);
		background: rgba(255, 255, 255, 0.7);
	}

	body.mth-theme .mth-primary-nav .wp-block-navigation__responsive-container-content :where(.current-menu-item, .current-menu-ancestor) > .wp-block-navigation-item__content {
		border-color: var(--mth-accent);
		color: #fff;
		background: var(--mth-accent);
	}

	body.mth-theme .mth-primary-nav .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container {
		position: static;
		display: flex;
		width: calc(100% - 1rem);
		min-width: 0;
		height: auto;
		margin: 0.15rem 0 0.35rem 1rem;
		padding: 0.25rem 0 0.25rem 0.55rem;
		border: 0;
		border-left: 2px solid var(--mth-line);
		gap: 0.15rem;
		background: transparent;
		box-shadow: none;
		flex-direction: column;
		opacity: 1;
		visibility: visible;
		overflow: visible;
	}

	body.mth-theme .mth-primary-nav .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
		min-height: 42px;
		padding: 0.55rem 0.75rem;
		font-size: 0.9rem;
		font-weight: 620;
	}

	body.mth-theme .mth-primary-nav .wp-block-navigation__submenu-icon {
		margin-left: auto;
	}
}

@media (prefers-color-scheme: dark) {
	:root {
		--mth-surface: rgba(23, 35, 29, 0.88);
		--mth-footer-surface: #121d17;
		--mth-footer-ink: #e9f8f3;
		--mth-muted: #aec3b8;
		--mth-line: rgba(233, 248, 243, 0.16);
		--mth-shadow: 0 18px 52px rgba(0, 0, 0, 0.3);
	}

	body.mth-theme {
		--wp--preset--color--base: #0d1511;
		--wp--preset--color--contrast: #e9f8f3;
		--wp--preset--color--brand: #17231d;
		color: #e9f8f3;
		background: linear-gradient(135deg, var(--mth-dark) 0%, var(--mth-dark-panel) 100%) fixed;
	}

	body.mth-theme :where(h1, h2, h3, h4, h5, h6),
	body.mth-theme .mth-brand-lockup .wp-block-site-title a,
	body.mth-theme .mth-primary-nav .wp-block-navigation-item__content {
		color: #e9f8f3;
	}

	body.mth-theme .mth-site-header {
		background: rgba(13, 21, 17, 0.92);
	}

	body.mth-theme :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
		color: #e9f8f3;
		background: var(--mth-dark-card);
	}

	body.mth-theme .wp-block-navigation__responsive-container.is-menu-open {
		color: #e9f8f3;
		background: var(--mth-dark);
	}
}

@media (prefers-color-scheme: dark) {
	body.mth-theme .mth-primary-nav .wp-block-navigation__responsive-container-close {
		color: #e9f8f3;
		background: var(--mth-dark-card);
	}

	body.mth-theme .mth-primary-nav .wp-block-navigation__responsive-container-content .wp-block-navigation-item__content:hover,
	body.mth-theme .mth-primary-nav .wp-block-navigation__responsive-container-content .wp-block-navigation-item__content:focus-visible {
		background: rgba(233, 248, 243, 0.07);
	}
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
	}
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
	body.mth-theme .mth-site-header {
		background: var(--mth-base);
	}

	@media (prefers-color-scheme: dark) {
		body.mth-theme .mth-site-header {
			background: var(--mth-dark);
		}
	}
}
