/**
 * Header, primary navigation, membership badge and mobile drawer (mobile-first).
 * Desktop rules live in responsive.css.
 */

/* ---------------------------------------------------------------------------
 * Header shell
 * The header is fixed; .emt-site--has-header reserves its unscrolled height,
 * so the scrolled (shorter) state never moves page content.
 * ------------------------------------------------------------------------ */

.emt-site-header {
	position: fixed;
	top: var(--wp-admin--admin-bar--height, 0px);
	right: 0;
	left: 0;
	z-index: var(--emt-z-header);
	background-color: var(--emt-header-bg);
	border-bottom: 1px solid var(--emt-divider);
	transition:
		background-color var(--emt-duration) var(--emt-ease),
		border-color var(--emt-duration) var(--emt-ease),
		box-shadow var(--emt-duration) var(--emt-ease);
}

.emt-site-header.is-scrolled {
	background-color: var(--emt-header-bg-scrolled);
	border-bottom-color: transparent;
	box-shadow: var(--emt-shadow-header);
}

/* Front page: overlays the hero, becomes solid once scrolled */
.emt-site-header--transparent:not(.is-scrolled) {
	background-color: transparent;
	border-bottom-color: transparent;
	box-shadow: none;
}

.emt-site-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.25rem;
	height: var(--emt-header-height);
	transition: height var(--emt-duration) var(--emt-ease);
}

.emt-site-header.is-scrolled .emt-site-header__inner {
	height: var(--emt-header-height-scrolled);
}

/* Brand */
.emt-site-header__brand {
	display: flex;
	flex: 0 1 auto;
	align-items: center;
	min-width: 0;
}

.emt-site-header__brand .custom-logo-link,
.emt-mobile-nav__brand .custom-logo-link,
.emt-site-footer__brand .custom-logo-link {
	display: block;
	line-height: 0;
}

.emt-site-header__brand .custom-logo {
	display: block;
	width: var(--emt-logo-width-mobile);
	max-width: 100%;
	height: auto;
	max-height: var(--emt-logo-max-height);
	object-fit: contain;
	object-position: left center;
	transition: width var(--emt-duration) var(--emt-ease);
}

.emt-site-title {
	font-family: var(--emt-font-heading);
	font-size: var(--emt-fs-lg);
	font-weight: var(--emt-fw-bold);
	line-height: 1.2;
	letter-spacing: -0.01em;
	color: var(--emt-primary);
	text-decoration: none;
	white-space: nowrap;
}

.emt-site-title:hover {
	color: var(--emt-primary-hover);
}

/* Actions */
.emt-site-header__actions {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	gap: 0.5rem;
}

/* ---------------------------------------------------------------------------
 * Primary navigation (hidden on mobile, shown ≥ 922px)
 * ------------------------------------------------------------------------ */

.emt-primary-nav {
	display: none;
}

.emt-menu {
	padding: 0;
	margin: 0;
	list-style: none;
}

.emt-menu--primary {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: clamp(1rem, 2.2vw, 2.25rem);
}

.emt-menu--primary > .menu-item {
	position: relative;
}

.emt-menu--primary a {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding-block: 0.6rem;
	font-family: var(--emt-font-ui);
	font-size: var(--emt-fs-ui);
	font-weight: var(--emt-fw-semibold);
	line-height: 1.4;
	color: var(--emt-menu-text);
	text-decoration: none;
	white-space: nowrap;
}

/* Small active/hover indicator */
.emt-menu--primary > .menu-item > a::after {
	position: absolute;
	bottom: 0.15rem;
	left: 0;
	width: 18px;
	height: 2px;
	content: "";
	background-color: var(--emt-primary);
	border-radius: 2px;
	opacity: 0;
	transform: scaleX(0.4);
	transform-origin: left center;
	transition: opacity var(--emt-duration) var(--emt-ease), transform var(--emt-duration) var(--emt-ease);
}

.emt-menu--primary a:hover {
	color: var(--emt-primary-hover);
}

.emt-menu--primary > .menu-item > a:hover::after {
	opacity: 0.35;
	transform: scaleX(1);
}

.emt-menu--primary .current-menu-item > a,
.emt-menu--primary .current-menu-ancestor > a,
.emt-menu--primary .current_page_item > a {
	color: var(--emt-primary);
}

.emt-menu--primary > .current-menu-item > a::after,
.emt-menu--primary > .current-menu-ancestor > a::after,
.emt-menu--primary > .current_page_item > a::after {
	opacity: 1;
	transform: scaleX(1);
}

/* Dropdowns (depth 2) */
.emt-menu--primary .sub-menu {
	position: absolute;
	top: 100%;
	left: -1rem;
	z-index: 1;
	min-width: 230px;
	padding: 0.5rem;
	margin: 0;
	list-style: none;
	visibility: hidden;
	background: var(--emt-white);
	border: 1px solid var(--emt-border);
	border-radius: var(--emt-radius-md);
	box-shadow: var(--emt-shadow-md);
	opacity: 0;
	transform: translateY(4px);
	transition: opacity var(--emt-duration) var(--emt-ease), transform var(--emt-duration) var(--emt-ease), visibility var(--emt-duration);
}

.emt-menu--primary .menu-item:hover > .sub-menu,
.emt-menu--primary .menu-item:focus-within > .sub-menu {
	visibility: visible;
	opacity: 1;
	transform: translateY(0);
}

.emt-menu--primary .sub-menu a {
	display: flex;
	padding: 0.55rem 0.75rem;
	border-radius: var(--emt-radius-sm);
}

.emt-menu--primary .sub-menu a:hover {
	background-color: var(--emt-cream);
}

/* ---------------------------------------------------------------------------
 * Membership "₹0 to start" badge
 * The plugin injects .em-membership-badge into every wp_nav_menu and styles
 * it with !important rules; these more specific selectors restyle it as a
 * subtle inline pill. The theme fallback menu outputs the same markup.
 * ------------------------------------------------------------------------ */

.emt-theme .emt-menu .em-has-membership-badge > a {
	display: inline-flex !important;
	align-items: center;
	gap: 0.5rem;
	padding-top: 0.6rem !important;
	margin-top: 0 !important;
}

.emt-theme .emt-menu .em-has-membership-badge .em-membership-badge {
	position: static;
	display: inline-flex;
	align-items: center;
	height: auto;
	padding: 0.2rem 0.55rem;
	margin: 0;
	font-family: var(--emt-font-ui);
	font-size: var(--emt-fs-2xs);
	font-weight: var(--emt-fw-semibold);
	line-height: 1.3;
	letter-spacing: 0.01em;
	color: var(--emt-primary);
	white-space: nowrap;
	cursor: inherit;
	background: var(--emt-gold-tint);
	border: 1px solid var(--emt-gold-soft);
	border-radius: var(--emt-radius-pill);
	box-shadow: none;
	transition: background-color var(--emt-duration) var(--emt-ease), border-color var(--emt-duration) var(--emt-ease), color var(--emt-duration) var(--emt-ease);
}

.emt-theme .emt-menu .em-has-membership-badge .em-membership-badge__flash {
	display: none;
}

.emt-theme .emt-menu .em-has-membership-badge > a:hover .em-membership-badge,
.emt-theme .emt-menu .em-has-membership-badge > a:focus-visible .em-membership-badge,
.emt-theme .emt-menu .em-has-membership-badge.current-menu-item .em-membership-badge,
.emt-theme .emt-menu .em-has-membership-badge.current_page_item .em-membership-badge,
.emt-theme .emt-menu .em-has-membership-badge.em-membership-badge-active .em-membership-badge {
	color: var(--emt-primary-hover);
	background: rgba(212, 158, 23, 0.18);
	border-color: var(--emt-gold-border);
	box-shadow: none;
}

/* ---------------------------------------------------------------------------
 * Mobile toggle
 * ------------------------------------------------------------------------ */

.emt-nav-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	margin-right: -8px;
	color: var(--emt-heading);
	cursor: pointer;
	background: transparent;
	border: 0;
	border-radius: var(--emt-radius-sm);
	transition: color var(--emt-duration) var(--emt-ease), background-color var(--emt-duration) var(--emt-ease);
}

.emt-nav-toggle:hover {
	color: var(--emt-primary);
	background-color: var(--emt-primary-tint);
}

/* Without JS the drawer cannot open: show the plain navigation instead */
.no-js .emt-nav-toggle {
	display: none;
}

.no-js .emt-primary-nav {
	display: block;
	overflow-x: auto;
}

/* ---------------------------------------------------------------------------
 * Mobile drawer
 * ------------------------------------------------------------------------ */

.emt-mobile-nav {
	position: fixed;
	inset: 0;
	z-index: var(--emt-z-drawer);
}

.emt-mobile-nav[hidden] {
	display: none;
}

.emt-mobile-nav__overlay {
	position: absolute;
	inset: 0;
	background: var(--emt-overlay);
	opacity: 0;
	transition: opacity var(--emt-duration-slow) var(--emt-ease);
}

.emt-mobile-nav__panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	width: min(88vw, 380px);
	padding-top: var(--wp-admin--admin-bar--height, 0px);
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--emt-white);
	box-shadow: var(--emt-shadow-drawer);
	transform: translateX(100%);
	transition: transform var(--emt-duration-slow) var(--emt-ease);
}

.emt-mobile-nav.is-open .emt-mobile-nav__overlay {
	opacity: 1;
}

.emt-mobile-nav.is-open .emt-mobile-nav__panel {
	transform: translateX(0);
}

.emt-mobile-nav__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	min-height: 64px;
	padding: 0.5rem 0.75rem 0.5rem 1.25rem;
	border-bottom: 1px solid var(--emt-divider);
}

.emt-mobile-nav__brand .custom-logo {
	display: block;
	width: 170px;
	max-width: 100%;
	height: auto;
	max-height: 48px;
	object-fit: contain;
	object-position: left center;
}

.emt-mobile-nav__brand .emt-site-title {
	font-size: var(--emt-fs-md);
}

.emt-mobile-nav__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	color: var(--emt-heading);
	cursor: pointer;
	background: transparent;
	border: 0;
	border-radius: var(--emt-radius-sm);
}

.emt-mobile-nav__close:hover {
	color: var(--emt-primary);
	background-color: var(--emt-primary-tint);
}

.emt-mobile-nav__menu {
	padding: 0.75rem 1.25rem;
}

.emt-menu--mobile > .menu-item + .menu-item {
	border-top: 1px solid var(--emt-divider);
}

.emt-menu--mobile a {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 52px;
	padding: 0.75rem 0.5rem;
	font-family: var(--emt-font-ui);
	font-size: var(--emt-fs-base);
	font-weight: var(--emt-fw-medium);
	line-height: 1.35;
	color: var(--emt-heading);
	text-decoration: none;
	border-radius: var(--emt-radius-sm);
}

.emt-menu--mobile a:hover {
	color: var(--emt-primary);
	background-color: var(--emt-cream);
}

.emt-menu--mobile .current-menu-item > a,
.emt-menu--mobile .current_page_item > a {
	font-weight: var(--emt-fw-semibold);
	color: var(--emt-primary);
	background-color: var(--emt-primary-tint);
}

.emt-menu--mobile .current-menu-item > a::before,
.emt-menu--mobile .current_page_item > a::before {
	position: absolute;
	top: 14px;
	bottom: 14px;
	left: 0;
	width: 3px;
	content: "";
	background: var(--emt-primary);
	border-radius: 3px;
}

.emt-menu--mobile .sub-menu {
	padding: 0 0 0.5rem 1rem;
	margin: 0;
	list-style: none;
}

.emt-menu--mobile .sub-menu a {
	min-height: 44px;
	font-size: var(--emt-fs-sm);
}

.emt-theme .emt-menu--mobile .em-has-membership-badge > a {
	display: flex !important;
	padding-top: 0.75rem !important;
}

.emt-mobile-nav__footer {
	display: grid;
	gap: 1.25rem;
	padding: 1.25rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
	margin-top: auto;
	border-top: 1px solid var(--emt-divider);
}

.emt-auth-actions--mobile {
	display: grid;
	gap: 0.75rem;
}

.emt-auth-actions--mobile .emt-btn {
	width: 100%;
}

.emt-mobile-nav__trust {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.6rem;
	margin: 0;
	font-family: var(--emt-font-heading);
	font-size: var(--emt-fs-xs);
	font-weight: var(--emt-fw-semibold);
	color: var(--emt-text-strong);
	text-align: center;
}

.emt-mobile-nav__trust::before,
.emt-mobile-nav__trust::after {
	width: 18px;
	height: 1px;
	content: "";
	background: var(--emt-gold-border);
}

html.emt-nav-open {
	overflow: hidden;
}
