/**
 * Inventify native header — glass pill, sticky, responsive.
 *
 * Phase 1: structure + styling only. Scroll-driven width animation and mobile open/close behaviour
 * are added by assets/js/header.js in Phase 3 (this file only defines the resting and .is-menu-open
 * states so the markup renders correctly without JS).
 */

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

.iv-header-spacer {
	height: 112px;
}

.iv-header {
	--iv-brand: #14b89a;
	--iv-brand-dark: #109f85;
	--iv-text: #111827;
	--iv-muted: #0a0a0a;
	--iv-glass-bg: rgba(255, 255, 255, 0.68);
	--iv-glass-border: rgba(255, 255, 255, 0.52);
	--iv-shadow: 0 18px 50px rgba(17, 24, 39, 0.12);
	--iv-bar-width: calc(100vw - 160px);
	--iv-admin-offset: 0px;

	position: fixed;
	z-index: 9999;
	top: calc(20px + var(--iv-admin-offset));
	left: 0;
	right: 0;
	display: flex;
	justify-content: center;
	width: 100%;
	pointer-events: none;
	font-family: inherit;
}

.admin-bar .iv-header {
	--iv-admin-offset: 32px;
}

.iv-header__bar {
	position: relative;
	z-index: 2;
	display: flex;
	flex-direction: column;
	width: var(--iv-bar-width);
	max-width: calc(100vw - 24px);
	background: var(--iv-glass-bg);
	border: 1px solid var(--iv-glass-border);
	/* Fixed radius (not 999px): the bar itself grows when the mega opens, and 999px would over-round
	   into a stadium as it gets taller. 30px == half the resting height, so closed it still reads as
	   the pill; open it's a clean rounded rectangle (Evermind-style). */
	border-radius: 30px;
	box-shadow: var(--iv-shadow);
	-webkit-backdrop-filter: blur(18px) saturate(160%);
	backdrop-filter: blur(18px) saturate(160%);
	pointer-events: auto;
	transition: box-shadow 160ms linear;
}

/* Top row: logo | nav | actions. Fixed height, pinned to the top; the mega row grows beneath it. */
.iv-header__top {
	display: grid;
	grid-template-columns: minmax(150px, 1fr) auto minmax(150px, 1fr);
	align-items: center;
	gap: 50px;
	min-height: 60px;
	padding: 0 8px 0 12px;
}

/* Solid fallback where backdrop-filter is unsupported (older/low-power browsers). */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
	.iv-header__bar {
		background: rgba(255, 255, 255, 0.96);
	}
}

/* Scrolled state (toggled by header.js). */
.iv-header.is-scrolled .iv-header__bar {
	box-shadow: 0 16px 44px rgba(17, 24, 39, 0.14);
}

/* Body scroll lock while the mobile menu is open (toggled by header.js). */
body.iv-scroll-locked {
	overflow: hidden;
}

/* Branding */
.iv-header__brand {
	grid-column: 1;
	display: inline-flex;
	justify-self: start;
	align-items: center;
	min-width: 0;
}

.iv-header__brand a,
.iv-header .custom-logo-link {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
}

.iv-header .custom-logo,
.iv-header__logo {
	display: block;
	width: 158px;
	max-width: 100%;
	height: auto;
}

.iv-header__logo-fallback {
	font-size: 20px;
	font-weight: 800;
	color: var(--iv-text);
}

/* Desktop navigation */
.iv-header__nav {
	grid-column: 2;
	display: inline-flex;
	justify-self: center;
	align-items: center;
}

.iv-header__nav .iv-menu {
	display: inline-flex;
	align-items: center;
	gap: 30px;
	margin: 0;
	padding: 0;
	list-style: none;
	white-space: nowrap;
}

.iv-header__nav a {
	color: var(--iv-muted);
	font-size: 15px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	transition: color 180ms ease;
}

.iv-header__nav a:hover,
.iv-header__nav a:focus-visible {
	color: var(--iv-brand);
}

/* Actions */
.iv-header__actions {
	grid-column: 3;
	display: inline-flex;
	justify-self: end;
	align-items: center;
}

.iv-header__lang,
.iv-header__auth {
	display: inline-flex;
	align-items: center;
}

.iv-header__button,
.iv-header__mobile-button {
	display: inline-flex;
	justify-content: center;
	align-items: center;
	min-height: 46px;
	padding: 0 24px;
	border-radius: 999px;
	background: var(--iv-brand);
	color: #fff !important;
	font-size: 15px;
	font-weight: 700;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	box-shadow: 0 12px 28px rgba(20, 184, 154, 0.28);
	transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.iv-header__button:hover,
.iv-header__button:focus-visible,
.iv-header__mobile-button:hover,
.iv-header__mobile-button:focus-visible {
	transform: translateY(-1px);
	background: var(--iv-brand-dark);
	color: #fff;
	box-shadow: 0 16px 34px rgba(20, 184, 154, 0.34);
}

/* Hamburger toggle (mobile only) */
.iv-header__toggle {
	display: none;
	width: 46px;
	height: 46px;
	margin: 0;
	padding: 11px 0 !important;
	border: 0;
	border-radius: 999px;
	background: var(--iv-brand-dark);
	cursor: pointer;
}

.iv-header__toggle-bar {
	display: block;
	width: 20px;
	height: 2px;
	margin: 5px auto;
	border-radius: 999px;
	background: #fff;
	transition: transform 220ms ease, opacity 220ms ease;
}

.iv-header.is-menu-open .iv-header__toggle-bar:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

.iv-header.is-menu-open .iv-header__toggle-bar:nth-child(2) {
	opacity: 0;
}

.iv-header.is-menu-open .iv-header__toggle-bar:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

/* Mobile panel (hidden off-canvas until .is-menu-open; shown only within the mobile breakpoint) */
.iv-header__mobile-panel {
	position: fixed;
	z-index: 1;
	top: 0;
	left: 0;
	right: 0;
	display: none;
	padding: 144px 22px 30px;
	background: #fff;
	border-bottom: 1px solid rgba(17, 24, 39, 0.08);
	box-shadow: 0 22px 50px rgba(17, 24, 39, 0.12);
	opacity: 0;
	transform: translateY(-100%);
	/*
	 * visibility:hidden removes the off-canvas links from the focus order and the accessibility
	 * tree while the panel is closed (a CSS-only fix; JS focus management is added in Phase 3). The
	 * visibility change is delayed until the slide-out finishes so the animation is still visible.
	 */
	visibility: hidden;
	pointer-events: auto;
	transition: transform 480ms cubic-bezier(0.16, 1, 0.3, 1), opacity 320ms ease, visibility 0s linear 480ms;
}

.iv-header__mobile-nav .iv-menu {
	display: grid;
	gap: 24px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.iv-header__mobile-nav a {
	font-size: 19px;
	font-weight: 600;
	color: var(--iv-text);
	text-decoration: none;
}

.iv-header__mobile-button {
	width: 100%;
	min-height: 52px;
	margin-top: 28px;
}

/* Responsive */
@media (max-width: 1024px) {
	.iv-header-spacer {
		height: 96px;
	}

	.iv-header {
		top: calc(14px + var(--iv-admin-offset));
		padding: 0 16px;
	}

	.iv-header__bar {
		width: 100%;
	}

	.iv-header__top {
		display: flex;
		justify-content: space-between;
		min-height: 60px;
		padding: 0 8px 0 10px;
		gap: 18px;
	}

	.iv-header .custom-logo,
	.iv-header__logo {
		width: 142px;
	}

	.iv-header__nav,
	.iv-header__actions .iv-header__button {
		display: none;
	}

	.iv-header__toggle {
		display: block;
		flex: 0 0 auto;
	}

	.iv-header__mobile-panel {
		display: block;
	}

	.iv-header.is-menu-open .iv-header__mobile-panel {
		opacity: 1;
		transform: translateY(0);
		visibility: visible;
		transition-delay: 0s;
	}
}

@media (max-width: 420px) {
	.iv-header .custom-logo,
	.iv-header__logo {
		width: 132px;
	}
}

@media (max-width: 782px) {
	.admin-bar .iv-header {
		--iv-admin-offset: 46px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.iv-header__bar,
	.iv-header__button,
	.iv-header__mobile-button,
	.iv-header__toggle-bar,
	.iv-header__mobile-panel {
		transition: none;
	}
}
