/**
 * OMI header: bar, desktop menu, mobile header + off-canvas menu.
 * Figma: OMI Home Page → Navigation (3:66), Sub Menu Design (71:7).
 *
 * @author Sameer Ali
 */

/* ---------- Bar ---------- */

.omi-header {
	position: relative;
	z-index: 1000;
	box-sizing: border-box;
	padding-top: 20px;
	background: var(--omi-color-white);
	font-family: var(--omi-font);
	color: var(--omi-color-text);
	transition: box-shadow .3s var(--omi-ease);
}

.omi-header *,
.omi-header *::before,
.omi-header *::after {
	box-sizing: border-box;
}

.omi-header .omi-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	width: 100%;
	max-width: calc(var(--omi-container) + var(--omi-gutter) * 2);
	height: 97px;
	margin: 0 auto;
	padding: 0 var(--omi-gutter);
}

/* ---------- Logo ---------- */

.omi-header .omi-logo,
.omi-offcanvas .omi-logo {
	display: inline-flex;
	flex: 0 0 auto;
	line-height: 0;
}

.omi-header .omi-logo__img {
	display: block;
	width: 176px;
	height: auto;
	max-width: none;
}

/* ---------- Right column: menu above search ---------- */

.omi-header .omi-header__right {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 8px;
	min-width: 0;
}

/* ---------- Desktop menu ---------- */

.omi-header .omi-menu {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.omi-header .omi-menu__item {
	position: static; /* panels position against the header (full width) */
	margin: 0;
	padding: 0;
	list-style: none;
}

.omi-header .omi-menu__item::before,
.omi-header .omi-menu__item::after {
	content: none;
}

.omi-header .omi-menu__link {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: -8px 0;     /* bigger hit area without moving the layout */
	padding: 8px 0;
	font: 500 14px/17px var(--omi-font);
	color: var(--omi-color-text);
	text-decoration: none;
	white-space: nowrap;
	background: none;
	border: 0;
	transition: color .2s var(--omi-ease);
}

.omi-header .omi-menu__label {
	display: inline-block;
}

.omi-header .omi-icon--chevron {
	flex: 0 0 auto;
	display: block;
	width: 10px;
	height: 10px;
	transition: transform .25s var(--omi-ease);
}

/* Active underline (Figma: 2px, full item width, right under the text). */
.omi-header .omi-menu__link::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 6px;
	height: 2px;
	background: var(--omi-color-primary);
	transform: scaleX(0);
	transform-origin: left center;
	transition: transform .25s var(--omi-ease);
}

.omi-header .omi-menu__link:hover,
.omi-header .omi-menu__link:focus-visible {
	color: var(--omi-color-primary);
}

.omi-header .omi-menu__link:focus-visible {
	outline: 2px solid var(--omi-color-primary);
	outline-offset: 4px;
	border-radius: 2px;
}

/* Open panel + current section = Figma "About OMI" active state. */
.omi-header .omi-menu__item.is-open > .omi-menu__link,
.omi-header .omi-menu__item.is-current > .omi-menu__link {
	color: var(--omi-color-primary);
	/* Bold look without changing the width (keeps the menu from shifting). */
	-webkit-text-stroke: .45px currentColor;
}

.omi-header .omi-menu__item.is-open > .omi-menu__link::after,
.omi-header .omi-menu__item.is-current > .omi-menu__link::after {
	transform: scaleX(1);
}

.omi-header .omi-menu__item.is-open > .omi-menu__link .omi-icon--chevron {
	transform: rotate(180deg);
}

.omi-header .omi-menu-notice {
	margin: 0;
	font: 500 13px/1.4 var(--omi-font);
}

/* ---------- Burger (hidden on desktop) ---------- */

.omi-header .omi-header__burger {
	display: none;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 22px;
	background: var(--omi-color-surface);
	color: var(--omi-color-text);
	cursor: pointer;
	box-shadow: none;
	transition: background-color .2s var(--omi-ease), color .2s var(--omi-ease);
}

.omi-header .omi-header__burger:hover,
.omi-header .omi-header__burger:focus-visible {
	background: var(--omi-color-primary-soft);
	color: var(--omi-color-primary);
}

/* ---------- Sticky header (desktop only) ---------- */

@media (min-width: 1200px) {
	.omi-header {
		position: sticky;
		top: 0;
	}

	.admin-bar .omi-header {
		top: 32px;
	}

	/* Owner 2026-10-13: logo top on the same line as the menu row, and
	   more space under the search pill (was centred in a 97px row). */
	.omi-header .omi-header__inner {
		align-items: flex-start;
		height: auto;
		padding-top: 17px;
		padding-bottom: 28px;
	}

	.omi-header.is-scrolled {
		box-shadow: 0 8px 24px -16px rgba(23, 44, 69, .35);
	}

	/* While a mega panel is open the panel has its own divider + shadow,
	   so the scroll shadow is hidden (otherwise two lines show). */
	.omi-header.is-scrolled.is-mega-open {
		box-shadow: none;
	}

	html {
		scroll-padding-top: 140px;
	}
}

/* ---------- Tablet + mobile header ---------- */

@media (max-width: 1199px) {
	.omi-header {
		padding-top: 0;
	}

	.omi-header .omi-header__inner {
		height: 80px;
	}

	.omi-header .omi-logo__img {
		width: 160px;
	}

	.omi-header .omi-header__right {
		display: none;
	}

	.omi-header .omi-header__burger {
		display: inline-flex;
	}
}

@media (max-width: 767px) {
	.omi-header .omi-header__inner {
		height: 68px;
	}

	.omi-header .omi-logo__img {
		width: 136px;
	}
}

/* ---------- Off-canvas menu ---------- */

.omi-offcanvas {
	position: fixed;
	inset: 0;
	z-index: 100000;
	font-family: var(--omi-font);
	color: var(--omi-color-text);
}

.omi-offcanvas[hidden] {
	display: none;
}

.omi-offcanvas *,
.omi-offcanvas *::before,
.omi-offcanvas *::after {
	box-sizing: border-box;
}

.omi-offcanvas .omi-offcanvas__overlay {
	position: absolute;
	inset: 0;
	background: rgba(23, 44, 69, .45);
	opacity: 0;
	transition: opacity .3s var(--omi-ease);
}

.omi-offcanvas .omi-offcanvas__panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	gap: 20px;
	width: min(420px, 100%);
	padding: 16px var(--omi-gutter) 32px;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--omi-color-white);
	box-shadow: -24px 0 48px -24px rgba(23, 44, 69, .35);
	transform: translateX(100%);
	transition: transform .35s var(--omi-ease);
}

.omi-offcanvas .omi-offcanvas__panel > * {
	flex-shrink: 0;
}

.omi-offcanvas.is-open .omi-offcanvas__overlay {
	opacity: 1;
}

.omi-offcanvas.is-open .omi-offcanvas__panel {
	transform: translateX(0);
}

.admin-bar .omi-offcanvas .omi-offcanvas__panel {
	top: var(--wp-admin--admin-bar--height, 0px);
}

.omi-offcanvas .omi-offcanvas__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	min-height: 48px;
}

.omi-offcanvas .omi-logo__img {
	display: block;
	width: 136px;
	height: auto;
	max-width: none;
}

.omi-offcanvas .omi-offcanvas__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 20px;
	background: var(--omi-color-surface);
	color: var(--omi-color-text);
	cursor: pointer;
	box-shadow: none;
}

.omi-offcanvas .omi-offcanvas__close:hover,
.omi-offcanvas .omi-offcanvas__close:focus-visible {
	background: var(--omi-color-primary-soft);
	color: var(--omi-color-primary);
}

/* Mobile menu (accordion) */

.omi-offcanvas .omi-mnav,
.omi-offcanvas .omi-mnav__sub {
	margin: 0;
	padding: 0;
	list-style: none;
}

.omi-offcanvas .omi-mnav__item {
	margin: 0;
	padding: 0;
	list-style: none;
}

.omi-offcanvas .omi-mnav__item::before,
.omi-offcanvas .omi-mnav__item::after {
	content: none;
}

.omi-offcanvas .omi-mnav__item--l0 {
	border-bottom: 1px solid var(--omi-color-line);
}

.omi-offcanvas .omi-mnav__row {
	display: flex;
	align-items: center;
	gap: 8px;
}

.omi-offcanvas .omi-mnav__item--l0 > .omi-mnav__row > .omi-mnav__link {
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	min-height: 52px;
	margin: 0;
	padding: 14px 0;
	border: 0;
	background: none;
	font: 600 15px/1.35 var(--omi-font);
	color: var(--omi-color-text);
	text-align: left;
	text-decoration: none;
	cursor: pointer;
	box-shadow: none;
}

.omi-offcanvas .omi-mnav__toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 20px;
	background: var(--omi-color-surface);
	color: var(--omi-color-text);
	cursor: pointer;
	box-shadow: none;
}

.omi-offcanvas .omi-icon--chevron {
	display: block;
	width: 12px;
	height: 12px;
	transition: transform .25s var(--omi-ease);
}

.omi-offcanvas [aria-expanded="true"] .omi-icon--chevron {
	transform: rotate(180deg);
}

.omi-offcanvas [aria-expanded="true"].omi-mnav__toggle {
	background: var(--omi-color-primary-soft);
	color: var(--omi-color-primary);
}

.omi-offcanvas .omi-mnav__item--l0.is-open > .omi-mnav__row > .omi-mnav__link,
.omi-offcanvas .omi-mnav__item--l0.is-current > .omi-mnav__row > .omi-mnav__link {
	color: var(--omi-color-primary);
}

.omi-offcanvas .omi-mnav__sub--l1 {
	padding: 0 0 16px 12px;
	animation: omi-fade-down .3s var(--omi-ease);
}

.omi-offcanvas .omi-mnav__sub--l1[hidden] {
	display: none;
}

.omi-offcanvas .omi-mnav__item--l1.has-children {
	margin-top: 8px;
}

.omi-offcanvas .omi-mnav__heading {
	display: inline-block;
	padding: 8px 0 6px;
	border-bottom: 2px solid var(--omi-color-primary);
	font: 700 14px/1.3 var(--omi-font);
	color: var(--omi-color-primary);
	text-decoration: none;
}

.omi-offcanvas .omi-mnav__sub--l2 {
	padding: 6px 0 4px;
}

.omi-offcanvas .omi-mnav__item--l1 .omi-mnav__link,
.omi-offcanvas .omi-mnav__item--l2 .omi-mnav__link {
	display: block;
	padding: 9px 0;
	font: 500 14px/1.4 var(--omi-font);
	color: var(--omi-color-text);
	text-decoration: none;
}

.omi-offcanvas .omi-mnav__link:hover,
.omi-offcanvas .omi-mnav__link:focus-visible,
.omi-offcanvas .omi-mnav__item.is-current > .omi-mnav__row > .omi-mnav__link {
	color: var(--omi-color-primary);
}

/* Hide the off-canvas completely on desktop. */
@media (min-width: 1200px) {
	.omi-offcanvas {
		display: none !important;
	}
}

@keyframes omi-fade-down {
	from { opacity: 0; transform: translateY(-6px); }
	to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.omi-header,
	.omi-header *,
	.omi-offcanvas,
	.omi-offcanvas * {
		transition: none !important;
		animation: none !important;
	}
}
