/* Header — a cool charcoal slab (--qg-color-nav, deliberately bluer/darker
   than the brand's warm ink) with light type/icons throughout, so the bar
   always reads as a distinct, premium fixture rather than blending into
   whatever's behind it. On the front page it floats over the hero as
   frosted dark glass — never literally transparent, since the hero itself
   is a light warm gradient and a fully see-through bar there had zero
   contrast — and settles to a fully solid, blurred version of the same
   gradient with a shadow the moment the page scrolls (component.js already
   toggles .is-stuck — see that file; nothing here needed any JS changes).
   A hairline accent gradient along the bottom edge (::after) is the one
   warm touch against all that cool dark, tying it back to the brand
   without competing with the hero. Every selector below matches what
   component.js already expects ([data-open], [hidden], .is-stuck), so the
   search overlay, mobile drawer and focus-trap all keep working untouched. */

.qg-header a:focus-visible,
.qg-header button:focus-visible {
	outline: 2px solid var(--qg-color-accent);
	outline-offset: 3px;
	border-radius: 2px;
}

.qg-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: var(--qg-gradient-nav);
	backdrop-filter: blur(14px) saturate(140%);
	-webkit-backdrop-filter: blur(14px) saturate(140%);
	border-bottom: 1px solid var(--qg-color-nav-line);
	transition: background-color 0.4s var(--qg-ease), border-color 0.4s var(--qg-ease), box-shadow 0.4s var(--qg-ease);
}

.qg-header::after {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	bottom: -1px;
	height: 2px;
	background: linear-gradient(90deg, var(--qg-color-yellow) 0%, var(--qg-color-accent) 50%, transparent 100%);
	opacity: 0.7;
	pointer-events: none;
}

.qg-header.is-stuck {
	box-shadow: var(--qg-shadow-lg);
}

/* Frosted-glass state — front page only, before scrolling. Same cool dark
   gradient as the solid bar, just thinner/more transparent so the hero
   shows through, with less blur since there's less to diffuse yet. */

.qg-header--transparent:not(.is-stuck) {
	position: fixed;
	left: 0;
	right: 0;
	background: linear-gradient(180deg, rgba(11, 14, 20, 0.55) 0%, rgba(5, 7, 9, 0.4) 100%);
	backdrop-filter: blur(6px) saturate(120%);
	-webkit-backdrop-filter: blur(6px) saturate(120%);
	border-bottom-color: transparent;
}

.qg-header--transparent:not(.is-stuck)::after {
	opacity: 0.4;
}

.qg-header--transparent.is-stuck {
	position: sticky;
}

.qg-header__bar {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	column-gap: var(--qg-space-4);
	height: var(--qg-header-height);
	transition: height 0.3s var(--qg-ease);
}

.qg-header.is-stuck .qg-header__bar {
	height: calc(var(--qg-header-height) - 14px);
}

.qg-header__brand {
	grid-column: 1;
	display: flex;
	align-items: center;
	gap: var(--qg-space-2);
	justify-self: start;
	min-width: 0;
}

.qg-header__logo img,
.qg-header__logo svg {
	max-height: calc(var(--qg-header-height) - 40px);
	width: auto;
	transition: max-height 0.3s var(--qg-ease);
}

.qg-header__wordmark {
	display: inline-flex;
	align-items: baseline;
	gap: 0.5rem;
	text-decoration: none;
}

.qg-header__mark {
	display: none;
}

.qg-header__wordmark-text {
	font-family: var(--qg-font-heading);
	font-size: 1.3rem;
	font-weight: 500;
	letter-spacing: 0.01em;
	color: var(--qg-color-surface);
	transition: color 0.4s var(--qg-ease);
	white-space: nowrap;
}

.qg-header__wordmark-secondary {
	font-style: normal;
	font-weight: 400;
	opacity: 0.75;
	margin-left: 0.3em;
}

.qg-header__toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	margin-left: -0.5rem;
	color: var(--qg-color-surface);
	cursor: pointer;
	transition: color 0.3s var(--qg-ease), opacity 0.2s var(--qg-ease);
}

.qg-header__toggle:hover {
	opacity: 0.6;
}

/* Primary nav — plain text links, generous letter tracking, an underline
   that draws in on hover instead of a filled pill background. */

.qg-header__nav {
	grid-column: 2;
	display: flex;
	justify-self: center;
}

.qg-header__menu {
	display: flex;
	align-items: center;
	gap: var(--qg-space-5);
	list-style: none;
	margin: 0;
	padding: 0;
}

.qg-header__menu > li {
	position: relative;
}

.qg-header__menu > li > a {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	padding: 0.4rem 0;
	text-decoration: none;
	font-family: var(--qg-font-body);
	font-weight: 450;
	font-size: 0.86rem;
	letter-spacing: 0.03em;
	color: var(--qg-color-surface);
	position: relative;
	transition: color 0.3s var(--qg-ease);
}

.qg-header__menu > li > a::after {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	bottom: -1px;
	height: 1px;
	background: currentColor;
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 0.3s var(--qg-ease);
}

.qg-header__menu > li > a:hover::after,
.qg-header__menu > li > a:focus-visible::after,
.qg-header__menu > li.current-menu-item > a::after {
	transform: scaleX(1);
}

/* Dropdown submenus */

.qg-header__menu .menu-item-has-children > a::before {
	content: '';
	width: 5px;
	height: 5px;
	border-right: 1px solid currentColor;
	border-bottom: 1px solid currentColor;
	transform: rotate(45deg);
	margin-top: -2px;
}

.qg-header__menu .sub-menu {
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translate(-50%, 6px);
	min-width: 200px;
	margin: 0;
	padding: var(--qg-space-2) 0;
	list-style: none;
	background: var(--qg-color-surface);
	border: 1px solid var(--qg-color-line);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s var(--qg-ease), transform 0.25s var(--qg-ease), visibility 0.25s;
	z-index: 10;
}

.qg-header__menu .menu-item-has-children:hover > .sub-menu,
.qg-header__menu .menu-item-has-children:focus-within > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translate(-50%, 12px);
}

.qg-header__menu .sub-menu a {
	display: block;
	padding: 0.6rem var(--qg-space-3);
	text-decoration: none;
	text-align: center;
	white-space: nowrap;
	font-size: 0.84rem;
	letter-spacing: 0.02em;
	color: var(--qg-color-ink-soft);
	transition: color 0.2s var(--qg-ease);
}

.qg-header__menu .sub-menu a:hover {
	color: var(--qg-color-ink);
}

/* Actions: search / account / wishlist / cart — bare line icons. */

.qg-header__actions {
	grid-column: 3;
	display: flex;
	align-items: center;
	gap: var(--qg-space-2);
	justify-self: end;
}

.qg-header__icon-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border: 0;
	background: none;
	color: var(--qg-color-surface);
	text-decoration: none;
	cursor: pointer;
	transition: color 0.3s var(--qg-ease), opacity 0.2s var(--qg-ease);
}

.qg-header__icon-btn:hover,
.qg-header__icon-btn:focus-visible {
	opacity: 0.6;
}

/* EN / አማ language toggle (see qg_language_toggle() in
   inc/template-tags.php) — a compact pill matching the dark header's icon
   row, distinct from the auth page's larger tab-switcher but the same
   underlying idea: an active option picked out in solid white, everything
   else translucent. */
.qg-lang-toggle {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	padding: 3px;
	background: rgba(255, 255, 255, 0.1);
	border-radius: 999px;
}

.qg-lang-toggle__option {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 30px;
	padding: 0.3rem 0.55rem;
	border-radius: 999px;
	font-family: var(--qg-font-body);
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	color: rgba(255, 253, 250, 0.6);
	text-decoration: none;
	transition: background-color 0.25s var(--qg-ease), color 0.25s var(--qg-ease);
}

.qg-lang-toggle__option:hover {
	color: var(--qg-color-surface);
}

.qg-lang-toggle__option.is-active {
	background: var(--qg-color-surface);
	color: var(--qg-color-ink);
}

/* Inside the mobile drawer (light background, not the dark header bar). */
.qg-mobile-nav__lang {
	margin: 0 var(--qg-space-4) var(--qg-space-3);
	background: var(--qg-color-paper);
}

.qg-mobile-nav__lang .qg-lang-toggle__option {
	color: var(--qg-color-ink-soft);
}

.qg-mobile-nav__lang .qg-lang-toggle__option:hover {
	color: var(--qg-color-ink);
}

.qg-mobile-nav__lang .qg-lang-toggle__option.is-active {
	background: var(--qg-color-ink);
	color: var(--qg-color-surface);
}

.qg-icon {
	width: 19px;
	height: 19px;
	stroke-width: 1.4;
}

.qg-header__badge {
	position: absolute;
	top: 4px;
	right: 4px;
	min-width: 15px;
	height: 15px;
	padding: 0 3px;
	border-radius: 999px;
	background: var(--qg-gradient-cta);
	color: #fff;
	font-family: var(--qg-font-body);
	font-size: 0.6rem;
	line-height: 15px;
	text-align: center;
	font-weight: 600;
}

.qg-header__badge.is-pulsing,
.qg-tabbar__badge.is-pulsing {
	animation: qg-badge-pulse 0.5s var(--qg-ease);
}

@keyframes qg-badge-pulse {
	0% {
		transform: scale(1);
	}
	40% {
		transform: scale(1.45);
	}
	100% {
		transform: scale(1);
	}
}

/* Search overlay */

.qg-header__search {
	position: fixed;
	inset: 0;
	z-index: 150;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding-top: min(20vh, 180px);
	background: rgba(22, 19, 15, 0.55);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	opacity: 0;
	transition: opacity 0.3s var(--qg-ease);
}

.qg-header__search[data-open] {
	opacity: 1;
}

.qg-header__search[hidden] {
	display: none;
}

.qg-header__search-panel {
	position: relative;
	width: min(90vw, 620px);
	transform: translateY(-14px);
	transition: transform 0.3s var(--qg-ease);
}

.qg-header__search[data-open] .qg-header__search-panel {
	transform: translateY(0);
}

.qg-header__search-form {
	position: relative;
	display: flex;
	align-items: center;
	gap: var(--qg-space-2);
	background: var(--qg-color-surface);
	border-bottom: 1px solid var(--qg-color-ink);
	padding: 0.5rem 0.25rem;
}

.qg-header__search-icon {
	color: var(--qg-color-muted);
	flex-shrink: 0;
}

.qg-header__search-form input[type='search'] {
	flex: 1 1 auto;
	min-width: 0;
	border: 0;
	background: none;
	padding: 0.65rem 0;
	font-family: var(--qg-font-heading);
	font-size: 1.3rem;
	color: var(--qg-color-ink);
}

.qg-header__search-form input[type='search']:focus-visible {
	outline: none;
}

.qg-header__search-form button {
	flex-shrink: 0;
	border: 0;
	background: none;
	color: var(--qg-color-ink);
	padding: 0.5rem 0.75rem;
	font-family: var(--qg-font-body);
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: var(--qg-tracking-label);
	cursor: pointer;
	transition: opacity 0.2s var(--qg-ease);
}

.qg-header__search-form button:hover {
	opacity: 0.6;
}

.qg-header__search-close {
	position: absolute;
	top: -48px;
	right: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-radius: 50%;
	background: none;
	color: #fff;
	cursor: pointer;
}

.qg-header__search-close:hover {
	background: rgba(255, 255, 255, 0.12);
}

/* Mobile drawer */

.qg-mobile-nav {
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	width: min(85vw, 360px);
	background: var(--qg-color-surface);
	z-index: 201;
	display: flex;
	flex-direction: column;
	transform: translateX(-100%);
	transition: transform 0.35s var(--qg-ease);
	box-shadow: var(--qg-shadow-lg);
}

.qg-mobile-nav[data-open] {
	transform: translateX(0);
}

.qg-mobile-nav__backdrop {
	position: fixed;
	inset: 0;
	background: rgba(22, 19, 15, 0.45);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
	z-index: 200;
	opacity: 0;
	transition: opacity 0.35s var(--qg-ease);
}

.qg-mobile-nav__backdrop[data-open] {
	opacity: 1;
}

/* Head — the same red→orange gradient every button/badge on the site
   uses (see --qg-gradient-cta in assets/css/tokens.css), instead of a
   bare white bar with a hairline rule, so the drawer reads as a
   deliberate brand surface from the first frame. */
.qg-mobile-nav__head {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
	padding: var(--qg-space-4);
	background: var(--qg-gradient-cta);
	overflow: hidden;
}

.qg-mobile-nav__head::after {
	content: '';
	position: absolute;
	inset: 0;
	background: radial-gradient(70% 90% at 110% 0%, rgba(255, 255, 255, 0.28) 0%, transparent 100%);
	pointer-events: none;
}

.qg-mobile-nav__title {
	position: relative;
	font-family: var(--qg-font-heading);
	font-size: 1.2rem;
	font-weight: 700;
	color: #fff8ee;
}

.qg-mobile-nav__close {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	flex-shrink: 0;
	border: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.22);
	color: #fff8ee;
	cursor: pointer;
	transition: background-color 0.2s var(--qg-ease), transform 0.2s var(--qg-ease);
}

.qg-mobile-nav__close:hover {
	background: rgba(255, 255, 255, 0.34);
	transform: rotate(90deg);
}

.qg-mobile-nav__close .qg-icon {
	width: 17px;
	height: 17px;
}

/* Body — the scrollable middle section (menu + language switch), so the
   footer quick-links row below stays pinned regardless of menu length. */
.qg-mobile-nav__body {
	flex: 1;
	overflow-y: auto;
	padding: var(--qg-space-2) 0;
}

.qg-mobile-nav__menu {
	list-style: none;
	margin: 0;
	padding: 0.4rem var(--qg-space-3);
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}

.qg-mobile-nav__menu a {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.85rem 0.9rem;
	border-radius: var(--qg-radius);
	text-decoration: none;
	font-family: var(--qg-font-body);
	font-size: 1rem;
	font-weight: 600;
	color: var(--qg-color-ink);
	transition: background-color 0.2s var(--qg-ease), color 0.2s var(--qg-ease);
}

.qg-mobile-nav__menu a::after {
	content: '';
	flex-shrink: 0;
	width: 7px;
	height: 7px;
	border-top: 1.5px solid var(--qg-color-muted);
	border-right: 1.5px solid var(--qg-color-muted);
	transform: rotate(45deg);
	opacity: 0.6;
	transition: border-color 0.2s var(--qg-ease), opacity 0.2s var(--qg-ease);
}

.qg-mobile-nav__menu a:hover,
.qg-mobile-nav__menu a:focus-visible {
	background: var(--qg-color-accent-soft);
	color: var(--qg-color-accent-dark);
}

.qg-mobile-nav__menu a:hover::after,
.qg-mobile-nav__menu a:focus-visible::after {
	border-color: var(--qg-color-accent-dark);
	opacity: 1;
}

.qg-mobile-nav__menu .sub-menu {
	list-style: none;
	margin: 0.15rem 0 0.3rem;
	padding: 0 0 0 var(--qg-space-3);
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}

.qg-mobile-nav__menu .sub-menu a {
	font-size: 0.9rem;
	font-weight: 500;
	color: var(--qg-color-ink-soft);
	padding: 0.65rem 0.9rem;
}

/* Footer — pinned quick-links row (Account / Wishlist / Cart), so the
   three most-reached-for destinations never need a scroll to find, no
   matter how long the menu above grows. */
.qg-mobile-nav__footer {
	display: flex;
	flex-shrink: 0;
	border-top: 1px solid var(--qg-color-line);
	padding: var(--qg-space-2) var(--qg-space-2) calc(var(--qg-space-2) + env(safe-area-inset-bottom, 0px));
}

.qg-mobile-nav__quick-link {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.3rem;
	padding: 0.6rem 0.4rem;
	border-radius: var(--qg-radius);
	text-decoration: none;
	color: var(--qg-color-ink-soft);
	font-family: var(--qg-font-body);
	font-size: 0.72rem;
	font-weight: 600;
	transition: background-color 0.2s var(--qg-ease), color 0.2s var(--qg-ease);
}

.qg-mobile-nav__quick-link:hover,
.qg-mobile-nav__quick-link:focus-visible {
	background: var(--qg-color-paper);
	color: var(--qg-color-accent-dark);
}

.qg-mobile-nav__quick-link .qg-icon {
	width: 20px;
	height: 20px;
}

/* Bottom tab bar — phone-only. */

.qg-tabbar {
	display: none;
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 120;
	align-items: stretch;
	justify-content: space-around;
	background: rgba(246, 242, 236, 0.94);
	backdrop-filter: blur(16px) saturate(140%);
	-webkit-backdrop-filter: blur(16px) saturate(140%);
	border-top: 1px solid var(--qg-color-line);
	padding-bottom: env(safe-area-inset-bottom, 0);
	transition: transform 0.35s var(--qg-ease), opacity 0.3s var(--qg-ease);
}

/* Ceded to the "Install the app" card while it's open (see
   components/pwa-install/component.js, which is the only thing that ever
   adds this class) — on phones the tab bar's z-index otherwise sits above
   the install card and covers it entirely. Slides back in the instant the
   card is dismissed or Install is tapped. */
body.qg-pwa-install-open .qg-tabbar {
	transform: translateY(100%);
	opacity: 0;
	pointer-events: none;
}

.qg-tabbar__item {
	position: relative;
	display: flex;
	flex: 1;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.2rem;
	padding: 0.5rem 0.25rem 0.6rem;
	text-decoration: none;
	color: var(--qg-color-muted);
	transition: color 0.2s var(--qg-ease);
}

.qg-tabbar__item .qg-icon {
	width: 20px;
	height: 20px;
	stroke-width: 1.4;
}

.qg-tabbar__item span:last-child {
	font-family: var(--qg-font-body);
	font-size: 0.63rem;
	font-weight: 500;
	letter-spacing: 0.02em;
}

.qg-tabbar__item.is-active {
	color: var(--qg-color-ink);
}

.qg-tabbar__item.is-active::before {
	content: '';
	position: absolute;
	top: 0;
	left: 50%;
	transform: translateX(-50%);
	width: 3px;
	height: 3px;
	border-radius: 50%;
	background: var(--qg-color-accent);
}

.qg-tabbar__icon-wrap {
	position: relative;
	display: inline-flex;
}

.qg-tabbar__badge {
	position: absolute;
	top: -4px;
	right: -8px;
	min-width: 15px;
	height: 15px;
	padding: 0 3px;
	border-radius: 999px;
	background: var(--qg-gradient-cta);
	color: #fff;
	font-size: 0.58rem;
	font-weight: 600;
	line-height: 15px;
	text-align: center;
}

@media (max-width: 767px) {
	.qg-tabbar {
		display: flex;
	}

	/* The checkout page (and its endpoints) intentionally renders the
	   minimal checkout header instead — no .qg-tabbar in the DOM there — so
	   this reserved space only applies where the tab bar actually exists. */
	body:not(.woocommerce-checkout) {
		padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
	}

	.qg-header__actions a.qg-header__icon-btn {
		display: none;
	}
}

@media (max-width: 1023px) {
	.qg-header__toggle {
		display: inline-flex;
	}

	.qg-header__nav {
		display: none;
	}
}

@media (max-width: 480px) {
	.qg-header__search {
		padding-top: max(76px, min(14vh, 140px));
	}

	.qg-header__search-panel {
		width: min(92vw, 620px);
	}

	.qg-header__search-form {
		gap: var(--qg-space-1);
	}

	.qg-header__search-form input[type='search'] {
		font-size: 1.05rem;
	}

	.qg-header__search-form button {
		padding: 0.5rem 0.5rem;
		font-size: 0.68rem;
		letter-spacing: 0.08em;
	}

	.qg-header__wordmark-text {
		font-size: 1.1rem;
	}

	.qg-header__icon-btn,
	.qg-header__toggle {
		width: 34px;
		height: 34px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.qg-header,
	.qg-header__bar,
	.qg-header__wordmark-text,
	.qg-header__icon-btn,
	.qg-mobile-nav,
	.qg-mobile-nav__backdrop,
	.qg-header__menu > li > a::after,
	.qg-header__menu .sub-menu,
	.qg-header__search,
	.qg-header__search-panel,
	.qg-header__badge,
	.qg-tabbar__badge,
	.qg-tabbar {
		transition: none;
		animation: none;
	}
}
