/*
 * Site Header Layout
 */

.qehs-site-header {
	width: 100%;
	height: var(--qehs-header-height);
	border-bottom: 1px solid var(--qehs-border);
	background-color: var(--qehs-background);
}

.qehs-site-header__inner {
	max-width: var(--qehs-header-container-max);
	height: 100%;
	margin: 0 auto;
	padding: 0 100px;
	display: flex;
	align-items: center;
	gap: var(--qehs-space-lg);
}

.qehs-site-header__logo {
	display: flex;
	align-items: center;
	min-width: 0;
	/* Pushes nav + cart + Login into one tight right-aligned cluster by
	   consuming all remaining space in this single gap — this is the fix
	   for nav previously landing near center: justify-content:space-between
	   across 3 children split the free space into two equal gaps instead. */
	margin-right: auto;
}

/* max-height + width:auto + max-width:100% (rather than a fixed height)
   lets the logo shrink proportionally on very narrow screens instead of
   forcing horizontal overflow — whichever constraint binds first still
   always preserves the uploaded logo's native aspect ratio. */
.qehs-site-header__logo img {
	display: block;
	height: auto;
	max-height: var(--qehs-header-logo-height);
	width: auto;
	max-width: 100%;
}

.qehs-site-title {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--qehs-primary);
}

.qehs-nav-primary__list {
	display: flex;
	align-items: center;
	gap: 31px;
}

/* Shared style for every nav item — <a>, <button>, or a disabled <span> */
.qehs-nav-link {
	display: inline-flex;
	align-items: center;
	gap: var(--qehs-space-xs);
	font-weight: 400;
	font-size: 12px;
	color: var(--qehs-nav-text-color);
	cursor: pointer;
}

.qehs-nav-link:hover,
.qehs-nav-link:focus-visible {
	color: var(--qehs-primary);
}

/* Non-functional placeholder nav items (e.g. Standards, Audit Companion).
   Visually identical to other nav items per the reference design (no
   badge/indicator) — non-interactivity is conveyed via cursor, tabindex,
   aria-disabled, and a title tooltip rather than a visible marker. */
.qehs-nav-link--disabled {
	cursor: default;
}

.qehs-nav-link--disabled:hover,
.qehs-nav-link--disabled:focus-visible {
	color: var(--qehs-nav-text-color);
}

.qehs-site-header__right {
	display: flex;
	align-items: center;
	gap: var(--qehs-space-md);
}

.qehs-site-header__actions {
	display: flex;
	align-items: center;
	gap: var(--qehs-space-md);
}

/* Pill-shaped Login/My Account button, scoped to the header only — the
   shared .qehs-btn--secondary class is also used by the Document Card's
   Add to Cart button, which must keep its own shape unchanged. */
.qehs-site-header__actions .qehs-btn--secondary {
	border-radius: 999px;
	padding: 16px 26px;
	font-size: 1rem;
	line-height: 1.15;
}

.qehs-nav-toggle {
	display: none;
	flex-direction: column;
	gap: 4px;
	padding: var(--qehs-space-xs);
}

.qehs-nav-toggle__bar {
	width: 22px;
	height: 2px;
	background-color: var(--qehs-text);
	border-radius: 2px;
}

/* --- Logged-in profile control (public header) ---
   Reuses the exact same class names/visual treatment as the account
   header's user menu (assets/css/layout/account.css) — that file is
   only enqueued on My Account pages, so this is a separate but
   matching definition here for the public header, not a duplicate of
   its logic (the JS toggle behavior IS shared, via assets/js/account.js,
   since both use the same class names/structure). */
.qehs-account-header__user {
	position: relative;
}

.qehs-account-header__user-toggle {
	display: flex;
	align-items: center;
	gap: var(--qehs-space-sm);
	background: none;
	border: none;
	cursor: pointer;
	color: var(--qehs-text);
	font-family: inherit;
}

.qehs-account-header__user-toggle:focus-visible {
	outline: 2px solid var(--qehs-secondary);
	outline-offset: 2px;
	border-radius: var(--qehs-radius-sm);
}

.qehs-account-header__avatar {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 999px;
	background-color: var(--qehs-success-tint);
	color: var(--qehs-primary);
	font-weight: 700;
	font-size: 0.9rem;
}

.qehs-account-header__name {
	font-weight: 600;
	font-size: 0.95rem;
	color: var(--qehs-text);
}

.qehs-account-header__user-menu {
	position: absolute;
	top: calc(100% + var(--qehs-space-sm));
	right: 0;
	margin: 0;
	padding: var(--qehs-space-xs);
	list-style: none;
	background-color: var(--qehs-background);
	border: 1px solid var(--qehs-border);
	border-radius: var(--qehs-radius-md);
	box-shadow: var(--qehs-shadow-md);
	min-width: 160px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-4px);
	transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

.qehs-account-header__user-toggle[aria-expanded='true'] + .qehs-account-header__user-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.qehs-account-header__user-menu a {
	display: block;
	padding: var(--qehs-space-sm) var(--qehs-space-md);
	border-radius: var(--qehs-radius-sm);
	color: var(--qehs-text);
	font-size: 0.9rem;
}

.qehs-account-header__user-menu a:hover,
.qehs-account-header__user-menu a:focus-visible {
	background-color: var(--qehs-background-alt);
}

@media (max-width: 1024px) {
	.qehs-site-header__inner {
		padding: 0 var(--qehs-space-lg);
	}

	.qehs-nav-primary {
		display: none;
	}

	.qehs-nav-toggle {
		display: flex;
	}

	/* Shown via JS when nav is toggled open on mobile. */
	.qehs-nav-primary.is-open {
		display: block;
		position: absolute;
		top: var(--qehs-header-height);
		left: 0;
		right: 0;
		background-color: var(--qehs-background);
		border-bottom: 1px solid var(--qehs-border);
	}

	.qehs-nav-primary.is-open .qehs-nav-primary__list {
		flex-direction: column;
		align-items: flex-start;
		padding: var(--qehs-space-md) var(--qehs-space-lg);
		gap: var(--qehs-space-md);
	}
}

/* Compact header on very small phones — shorter logo/header so the
   collapsed header stays visually clean rather than dominating the
   viewport, and tighter padding to keep everything on one row without
   crowding the toggle button. */
@media (max-width: 480px) {
	:root {
		--qehs-header-height: 72px;
		--qehs-header-logo-height: 34px;
	}

	.qehs-site-header__inner {
		padding: 0 var(--qehs-space-md);
		gap: var(--qehs-space-sm);
	}

	.qehs-site-header__right {
		gap: var(--qehs-space-sm);
	}

	.qehs-site-header__actions .qehs-btn--secondary {
		padding: var(--qehs-space-xs) var(--qehs-space-md);
		font-size: 0.85rem;
	}

	.qehs-account-header__name {
		display: none;
	}
}
