/*
 * Header, footer, top bar, social icons and search overlay.
 *
 * Three header layouts and three footer layouts share these rules; only the
 * arrangement differs, under `.mtkb-header--{layout}` and
 * `.mtkb-footer--{layout}`. Everything reads theme.json tokens, which the
 * Customizer's colour controls override at :root — so changing the primary
 * colour recolours the header, the footer and the buttons together.
 */

/* =========================================================================
 * TOP BAR
 * ====================================================================== */

.mtkb-topbar {
	background: var(--wp--preset--color--summit);
	color: var(--wp--preset--color--ice);
	font-size: var(--wp--preset--font-size--xs);
}

.mtkb-topbar__inner {
	max-width: var(--wp--style--global--wide-size);
	margin-inline: auto;
	padding: 8px var(--wp--preset--spacing--30);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 6px var(--wp--preset--spacing--30);
}

.mtkb-topbar__text {
	margin: 0;
}

.mtkb-topbar__contact {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--20);
}

.mtkb-topbar a {
	color: inherit;
	text-decoration: none;
}

.mtkb-topbar a:hover {
	text-decoration: underline;
}

/* =========================================================================
 * HEADER — shared
 * ====================================================================== */

.mtkb-header {
	background: var(--wp--preset--color--surface);
	border-bottom: 1px solid var(--wp--preset--color--border);
	position: relative;
	z-index: 30;
}

.mtkb-header.is-sticky {
	position: sticky;
	top: 0;
}

.mtkb-header.is-scrolled {
	box-shadow: 0 2px 12px rgba(15, 23, 32, .10);
}

.mtkb-header__inner {
	max-width: var(--wp--style--global--wide-size);
	margin-inline: auto;
	padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--30);
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--30);
}

/* ---- Brand ---- */

.mtkb-header__brand {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 2px;
	min-width: 0;
}

.mtkb-header__brand .custom-logo-link {
	display: block;
	line-height: 0;
}

.mtkb-header__brand img {
	display: block;
	max-height: 52px;
	width: auto;
	height: auto;
}

.mtkb-brand__title {
	margin: 0;
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--lg);
	font-weight: 600;
	line-height: 1.15;
}

.mtkb-brand__title a {
	color: var(--wp--preset--color--summit);
	text-decoration: none;
}

.mtkb-brand__tagline {
	margin: 0;
	font-size: var(--wp--preset--font-size--xs);
	color: var(--wp--preset--color--mist);
}

/* ---- Menu ---- */

.mtkb-header__nav {
	flex: 1 1 auto;
	min-width: 0;
}

.mtkb-menu {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--wp--preset--spacing--10) var(--wp--preset--spacing--30);
	list-style: none;
	margin: 0;
	padding: 0;
}

.mtkb-menu > li > a {
	display: inline-block;
	padding: 6px 0;
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 600;
	color: var(--wp--preset--color--ink);
	text-decoration: none;
	border-bottom: 2px solid transparent;
}

.mtkb-menu > li > a:hover,
.mtkb-menu > li.current-menu-item > a,
.mtkb-menu > li.current_page_item > a {
	color: var(--wp--preset--color--glacier);
	border-bottom-color: var(--wp--preset--color--glacier);
}

/* Sub-menus. One level only — the header is not a sitemap. */
.mtkb-menu li {
	position: relative;
}

.mtkb-menu .sub-menu {
	position: absolute;
	top: 100%;
	left: 0;
	min-width: 200px;
	list-style: none;
	margin: 0;
	padding: 6px 0;
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--mtkb-radius);
	box-shadow: 0 6px 18px rgba(15, 23, 32, .12);
	opacity: 0;
	visibility: hidden;
	transform: translateY(4px);
	transition: opacity var(--mtkb-transition), transform var(--mtkb-transition), visibility var(--mtkb-transition);
	z-index: 5;
}

.mtkb-menu li:hover > .sub-menu,
.mtkb-menu li:focus-within > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.mtkb-menu .sub-menu a {
	display: block;
	padding: 8px 16px;
	font-size: var(--wp--preset--font-size--sm);
	color: var(--wp--preset--color--ink);
	text-decoration: none;
}

.mtkb-menu .sub-menu a:hover {
	background: var(--wp--preset--color--surface-alt);
	color: var(--wp--preset--color--glacier);
}

/* ---- Actions ---- */

.mtkb-header__actions {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
}

.mtkb-header__icon {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: none;
	color: var(--wp--preset--color--slate);
	cursor: pointer;
	text-decoration: none;
	transition: background var(--mtkb-transition), color var(--mtkb-transition);
}

.mtkb-header__icon:hover {
	background: var(--wp--preset--color--surface-alt);
	color: var(--wp--preset--color--summit);
}

.mtkb-header__icon svg {
	width: 21px;
	height: 21px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.9;
	stroke-linecap: round;
}

.mtkb-header__icon--shortlist svg {
	fill: none;
}

.mtkb-header__icon .mtkb-fav-count {
	position: absolute;
	top: 2px;
	right: 0;
	margin: 0;
}

.mtkb-header__cta {
	white-space: nowrap;
	font-size: var(--wp--preset--font-size--xs);
	padding: 10px 18px;
}

/* ---- Burger ---- */

.mtkb-header__burger {
	display: none;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 42px;
	height: 42px;
	padding: 0 9px;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--mtkb-radius);
	background: none;
	cursor: pointer;
}

.mtkb-header__burger span {
	display: block;
	height: 2px;
	background: var(--wp--preset--color--ink);
	border-radius: 2px;
}

/* =========================================================================
 * HEADER — layout variants
 * ====================================================================== */

/* ---- Classic: brand, menu, actions on one row ---- */

.mtkb-header--classic .mtkb-header__nav {
	display: flex;
	justify-content: flex-end;
}

/* ---- Centered: brand row above a centred menu ---- */

.mtkb-header--centered .mtkb-header__inner {
	flex-direction: column;
	align-items: stretch;
	gap: var(--wp--preset--spacing--20);
}

.mtkb-header--centered .mtkb-header__top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--wp--preset--spacing--20);
}

.mtkb-header--centered .mtkb-header__brand {
	align-items: flex-start;
}

.mtkb-header--centered .mtkb-header__nav--center .mtkb-menu {
	justify-content: center;
	border-top: 1px solid var(--wp--preset--color--border);
	padding-top: var(--wp--preset--spacing--10);
}

/* ---- Split: menu | brand | actions ---- */

.mtkb-header--split .mtkb-header__inner {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
}

.mtkb-header--split .mtkb-header__nav--left .mtkb-menu {
	justify-content: flex-start;
}

.mtkb-header--split .mtkb-header__brand {
	justify-self: center;
	text-align: center;
}

.mtkb-header--split .mtkb-header__brand .mtkb-brand__title,
.mtkb-header--centered .mtkb-header__brand .mtkb-brand__title {
	text-align: inherit;
}

.mtkb-header--split .mtkb-header__actions {
	justify-self: end;
}

/* =========================================================================
 * HEADER — mobile
 * ====================================================================== */

.mtkb-header__drawer {
	border-top: 1px solid var(--wp--preset--color--border);
	padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--30) var(--wp--preset--spacing--30);
	background: var(--wp--preset--color--surface);
}

.mtkb-header__drawer[hidden] {
	display: none;
}

.mtkb-header__drawer-menu {
	flex-direction: column;
	align-items: stretch;
	gap: 0;
}

.mtkb-header__drawer-menu > li > a {
	display: block;
	padding: 12px 0;
	border-bottom: 1px solid var(--wp--preset--color--border);
	border-bottom-width: 1px;
	font-size: var(--wp--preset--font-size--md);
}

.mtkb-header__drawer-menu .sub-menu {
	position: static;
	opacity: 1;
	visibility: visible;
	transform: none;
	border: none;
	box-shadow: none;
	padding: 0 0 0 var(--wp--preset--spacing--20);
}

.mtkb-header__drawer-cta {
	display: block;
	margin-top: var(--wp--preset--spacing--20);
	text-align: center;
}

@media (max-width: 900px) {
	.mtkb-header__burger {
		display: flex;
	}

	/*
	 * The in-header menu gives way to the drawer below the breakpoint.
	 *
	 * Qualified with `.mtkb-header` deliberately: the layout variants above
	 * set `display` via `.mtkb-header--classic .mtkb-header__nav`, which is
	 * specificity (0,2,0). A bare `.mtkb-header__nav` here is (0,1,0) and
	 * loses — media queries add no specificity — so the menu stayed visible
	 * next to the burger on mobile. Matching (0,2,0) lets source order decide,
	 * and this block is last.
	 */
	.mtkb-header .mtkb-header__nav {
		display: none;
	}

	.mtkb-header--classic .mtkb-header__inner,
	.mtkb-header--split .mtkb-header__inner,
	.mtkb-header--centered .mtkb-header__inner {
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		gap: var(--wp--preset--spacing--20);
	}

	.mtkb-header--centered .mtkb-header__top {
		display: contents;
	}

	.mtkb-header--split .mtkb-header__brand {
		justify-self: auto;
		text-align: left;
		order: -1;
	}

	.mtkb-header__cta {
		display: none; /* It is repeated at the bottom of the drawer. */
	}
}

@media (max-width: 480px) {
	.mtkb-header__brand img {
		max-height: 40px;
	}
	.mtkb-brand__tagline {
		display: none;
	}
}

/* =========================================================================
 * SEARCH OVERLAY
 * ====================================================================== */

.mtkb-search-overlay {
	position: sticky;
	top: 0;
	z-index: 29;
	background: var(--wp--preset--color--surface-alt);
	border-bottom: 1px solid var(--wp--preset--color--border);
}

.mtkb-search-overlay[hidden] {
	display: none;
}

.mtkb-search-overlay__form {
	max-width: var(--wp--style--global--wide-size);
	margin-inline: auto;
	padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--30);
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--10);
}

.mtkb-search-overlay input[type="search"] {
	flex: 1 1 auto;
	min-width: 0;
	padding: 12px 14px;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--mtkb-radius);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--sm);
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--ink);
}

.mtkb-search-overlay__close {
	appearance: none;
	border: none;
	background: none;
	font-size: 26px;
	line-height: 1;
	color: var(--wp--preset--color--mist);
	cursor: pointer;
	padding: 0 6px;
}

/* =========================================================================
 * FOOTER — shared
 * ====================================================================== */

.mtkb-footer {
	margin-top: var(--wp--preset--spacing--70);
	font-size: var(--wp--preset--font-size--sm);
}

.mtkb-footer__inner {
	max-width: var(--wp--style--global--wide-size);
	margin-inline: auto;
	padding: var(--wp--preset--spacing--60) var(--wp--preset--spacing--30) var(--wp--preset--spacing--40);
}

/* ---- Colour schemes ---- */

.mtkb-footer--dark {
	background: var(--wp--preset--color--summit);
	color: var(--wp--preset--color--ice);
}

.mtkb-footer--light {
	background: var(--wp--preset--color--surface-alt);
	color: var(--wp--preset--color--slate);
	border-top: 1px solid var(--wp--preset--color--border);
}

.mtkb-footer--accent {
	background: var(--wp--preset--color--ember);
	color: #fff;
}

.mtkb-footer--dark a,
.mtkb-footer--accent a {
	color: #fff;
	text-decoration: none;
}

.mtkb-footer--dark a:hover,
.mtkb-footer--accent a:hover {
	text-decoration: underline;
}

.mtkb-footer--light a {
	color: var(--wp--preset--color--glacier);
	text-decoration: none;
}

.mtkb-footer--light a:hover {
	text-decoration: underline;
}

.mtkb-footer--dark .mtkb-footer__heading,
.mtkb-footer--accent .mtkb-footer__heading {
	color: #fff;
}

.mtkb-footer--light .mtkb-footer__heading {
	color: var(--wp--preset--color--summit);
}

/* ---- Brand ---- */

.mtkb-footer__brand {
	margin-bottom: var(--wp--preset--spacing--20);
}

.mtkb-footer__brand img,
.mtkb-footer__logo img {
	display: block;
	max-height: 56px;
	width: auto;
	height: auto;
}

.mtkb-footer--dark .mtkb-brand__title a,
.mtkb-footer--accent .mtkb-brand__title a {
	color: #fff;
}

.mtkb-footer__about-text {
	margin: 0 0 var(--wp--preset--spacing--20);
	max-width: 42ch;
	line-height: 1.6;
	opacity: .9;
}

/* ---- Headings and menus ---- */

.mtkb-footer__heading {
	margin: 0 0 var(--wp--preset--spacing--20);
	font-size: var(--wp--preset--font-size--sm);
	font-family: var(--wp--preset--font-family--body);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .06em;
}

.mtkb-footer__menu,
.mtkb-footer__contact {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.mtkb-footer__menu a,
.mtkb-footer__contact a {
	opacity: .9;
}

.mtkb-footer__menu a:hover {
	opacity: 1;
}

/* ---- Layout: columns ---- */

.mtkb-footer__columns {
	display: grid;
	grid-template-columns: 1.6fr 1fr 1fr 1.2fr;
	gap: var(--wp--preset--spacing--50);
}

@media (max-width: 900px) {
	.mtkb-footer__columns {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: var(--wp--preset--spacing--40);
	}
	.mtkb-footer__column--about {
		grid-column: 1 / -1;
	}
}

@media (max-width: 520px) {
	.mtkb-footer__columns {
		grid-template-columns: 1fr;
	}
}

/* ---- Layout: centered ---- */

.mtkb-footer__centered {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: var(--wp--preset--spacing--20);
}

.mtkb-footer__centered .mtkb-footer__about-text {
	max-width: 56ch;
}

/* ---- Layout: minimal ---- */

.mtkb-footer--minimal .mtkb-footer__inner {
	padding-block: var(--wp--preset--spacing--40) var(--wp--preset--spacing--30);
}

.mtkb-footer__minimal {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--wp--preset--spacing--30);
}

.mtkb-footer__minimal .mtkb-footer__brand {
	margin-bottom: 0;
}

/* ---- Inline nav (centered + minimal) ---- */

.mtkb-footer__inline-menu {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--wp--preset--spacing--10) var(--wp--preset--spacing--30);
	list-style: none;
	margin: 0;
	padding: 0;
}

.mtkb-footer__inline-menu a {
	font-weight: 600;
}

/* ---- Bottom strip ---- */

.mtkb-footer__bottom {
	margin-top: var(--wp--preset--spacing--50);
	padding-top: var(--wp--preset--spacing--30);
	border-top: 1px solid currentColor;
	/* currentColor at full strength would be a hard rule against a dark
	   background; this keeps it a divider rather than a border. */
	border-top-color: color-mix(in srgb, currentColor 22%, transparent);
}

.mtkb-footer__legal {
	margin: var(--wp--preset--spacing--20) 0 0;
	font-size: var(--wp--preset--font-size--xs);
	opacity: .75;
	max-width: 80ch;
}

.mtkb-footer__baseline {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--wp--preset--spacing--20);
	margin-top: var(--wp--preset--spacing--20);
	font-size: var(--wp--preset--font-size--xs);
}

.mtkb-footer__copyright {
	margin: 0;
	opacity: .75;
}

.mtkb-footer__legal-menu {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--20);
	list-style: none;
	margin: 0;
	padding: 0;
}

/* The disclosure inside a dark footer needs its own treatment — the amber
   left border from style.css disappears against the navy. */
.mtkb-footer .mtkb-disclosure {
	background: transparent;
	border-left-color: var(--wp--preset--color--caution);
	padding-block: var(--wp--preset--spacing--10);
	font-size: var(--wp--preset--font-size--xs);
	line-height: 1.6;
}

.mtkb-footer .mtkb-disclosure p {
	margin: 0;
	opacity: .95;
}

.mtkb-footer--dark .mtkb-disclosure,
.mtkb-footer--accent .mtkb-disclosure {
	color: #fff;
}

/* =========================================================================
 * SOCIAL
 * ====================================================================== */

.mtkb-social {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	list-style: none;
	margin: var(--wp--preset--spacing--20) 0 0;
	padding: 0;
}

.mtkb-social a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: color-mix(in srgb, currentColor 12%, transparent);
	transition: background var(--mtkb-transition);
}

.mtkb-social a:hover {
	background: color-mix(in srgb, currentColor 24%, transparent);
}

.mtkb-social svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

/* =========================================================================
 * BLOG / SEARCH / 404 ODDS AND ENDS
 * ====================================================================== */

.mtkb-article__header {
	margin-bottom: var(--wp--preset--spacing--30);
}

.mtkb-article__meta {
	color: var(--wp--preset--color--mist);
	font-size: var(--wp--preset--font-size--sm);
	margin: 8px 0 0;
}

.mtkb-article__image img {
	width: 100%;
	height: auto;
	border-radius: var(--mtkb-radius);
}

.mtkb-article {
	max-width: 72ch;
}

.mtkb-guide-card__meta {
	color: var(--wp--preset--color--mist);
	font-size: var(--wp--preset--font-size--xs);
	margin: 0 0 6px;
}

.mtkb-search-result {
	padding: var(--wp--preset--spacing--20) 0;
	border-bottom: 1px solid var(--wp--preset--color--border);
}

.mtkb-search-result h2 {
	margin: 0 0 6px;
	font-size: var(--wp--preset--font-size--lg);
}

.mtkb-searchform {
	display: flex;
	gap: 8px;
}

.mtkb-searchform input[type="search"] {
	flex: 1 1 auto;
	min-width: 0;
	padding: 10px 12px;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--mtkb-radius);
	font-family: inherit;
}

/* Prevent scrolling behind the open mobile drawer. */
body.mtkb-menu-open {
	overflow: hidden;
}
