/**
 * Achol Core — Custom Header
 *
 * Loaded site-wide only when the Header is enabled in Achol
 * Settings (see modules/header/header-hooks.php). Reuses the same
 * --achol-* CSS variables already defined in achol-blocks.css —
 * no brand color/token is redefined here.
 */

:root {
	--achol-header-height: 72px;
	--achol-header-height-desktop: 92px;
	--achol-container-max-width: 1280px;
}

/* -----------------------------------------------------------------
 * Body-level positioning compensation
 *
 * Applied via the 'body_class' filter (header-hooks.php). Reserves
 * space at the top of the page when the header is taken out of
 * normal flow (position: fixed) for Sticky or Transparent-capable
 * behavior — except on the Transparent-capable homepage, where no
 * space is reserved on purpose, so the header visually overlaps the
 * Hero Slider underneath it.
 * ----------------------------------------------------------------- */

body.achol-header-space-reserved {
	padding-top: calc(var(--achol-header-height) + 1px); /* +1px accounts for .achol-header's border-bottom, which sits outside the inner element's own height. */
}

@media (min-width: 1024px) {

	body.achol-header-space-reserved {
		padding-top: calc(var(--achol-header-height-desktop) + 1px);
	}
}

/* -----------------------------------------------------------------
 * Header root
 * ----------------------------------------------------------------- */

.achol-header {
	position: relative;
	width: 100%;
	background-color: var(--achol-bg);
	border-bottom: 1px solid var(--achol-border);
	z-index: 20;
	box-sizing: border-box;
}

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

.achol-header--fixed {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 100; /* Above the Hero Slider's highest z-index (4). */
	transition: transform 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

.achol-header--sticky.achol-header--hidden {
	transform: translateY(-100%);
}

/* Transparent (only ever applied on the front page, at the top of
 * the page — see achol_render_header()). */
.achol-header--transparent {
	background-color: transparent;
	border-bottom-color: transparent;
}

.achol-header--transparent .achol-header__logo-text,
.achol-header--transparent .achol-header__hamburger-bar,
.achol-header--transparent .achol-header__icon-btn,
.achol-header--transparent .achol-header__nav-menu > li > a {
	color: #FFFFFF;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.achol-header--transparent .achol-header__hamburger-bar {
	background-color: #FFFFFF;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* -----------------------------------------------------------------
 * Inner layout
 * ----------------------------------------------------------------- */

.achol-header__inner {
	max-width: var(--achol-container-max-width);
	margin: 0 auto;
	height: var(--achol-header-height);
	padding: 0 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

@media (min-width: 1024px) {

	.achol-header__inner {
		height: var(--achol-header-height-desktop);
		padding: 0 32px;
		display: grid;
		grid-template-columns: auto 1fr auto;
		align-items: center;
		justify-content: normal;
		gap: 24px;
	}
}

/* -----------------------------------------------------------------
 * Hamburger (mobile/tablet, < 1024px)
 *
 * Lives as the LAST item inside .achol-header__utilities (see PHP
 * markup) so it sits after Search/Account/Wishlist/Cart in one row,
 * matching the reference mobile layout: Logo left, all utility
 * icons — including the menu trigger — right.
 * ----------------------------------------------------------------- */

.achol-header__hamburger {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	gap: 5px;
	width: 44px;
	height: 44px;
	padding: 0;
	background: transparent;
	border: none;
	cursor: pointer;
	flex-shrink: 0;
}

.achol-header__hamburger-bar {
	display: block;
	width: 22px;
	height: 2px;
	background-color: var(--achol-text-primary);
	border-radius: 1px;
}

.achol-header__hamburger:focus-visible {
	outline: 2px solid var(--achol-primary);
	outline-offset: 2px;
}

@media (min-width: 1024px) {

	.achol-header__hamburger {
		display: none;
	}
}

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

.achol-header__logo {
	flex: 0 1 auto;
	display: flex;
	justify-content: flex-start;
	min-width: 0;
}

.achol-header__logo-link {
	display: inline-flex;
	align-items: center;
	max-width: 130px;
}

.achol-header__logo-image {
	display: block;
	max-height: 44px;
	width: auto;
	max-width: 100%;
}

.achol-header__logo-text {
	font-size: 19px;
	font-weight: 700;
	color: var(--achol-secondary);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

@media (min-width: 1024px) {

	.achol-header__logo {
		flex: none;
		justify-content: flex-start;
	}

	.achol-header__logo-link {
		max-width: 230px;
	}

	.achol-header__logo-image {
		max-height: 60px;
	}

	.achol-header__logo-text {
		font-size: 26px;
	}
}

/* -----------------------------------------------------------------
 * Navigation (desktop inline; hidden below 1024px — the Mobile
 * Drawer carries its own copy of the same menu instead, see
 * .achol-mobile-drawer__nav below).
 * ----------------------------------------------------------------- */

.achol-header__nav {
	display: none;
}

@media (min-width: 1024px) {

	.achol-header__nav {
		display: block;
		min-width: 0;
	}

	.achol-header__nav-menu {
		display: flex;
		align-items: center;
		gap: 28px;
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.achol-header__nav-menu li {
		position: relative;
	}

	.achol-header__nav-menu > li > a {
		display: block;
		padding: 8px 0;
		color: var(--achol-text-primary);
		font-weight: 600;
		font-size: 15px;
		text-decoration: none;
		white-space: nowrap;
	}

	.achol-header__nav-menu > li > a:hover,
	.achol-header__nav-menu > li > a:focus-visible {
		color: var(--achol-primary);
	}

	.achol-header__nav-menu .sub-menu {
		position: absolute;
		top: 100%;
		left: 0;
		min-width: 200px;
		margin: 0;
		padding: 8px 0;
		list-style: none;
		background-color: var(--achol-bg);
		border: 1px solid var(--achol-border);
		border-radius: 4px;
		box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
		opacity: 0;
		visibility: hidden;
		transform: translateY(4px);
		transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
		z-index: 10;
	}

	.achol-header__nav-menu li:hover > .sub-menu,
	.achol-header__nav-menu li:focus-within > .sub-menu {
		opacity: 1;
		visibility: visible;
		transform: translateY(0);
	}

	.achol-header__nav-menu .sub-menu a {
		display: block;
		padding: 8px 16px;
		color: var(--achol-text-primary);
		font-size: 14px;
		text-decoration: none;
		white-space: nowrap;
	}

	.achol-header__nav-menu .sub-menu a:hover,
	.achol-header__nav-menu .sub-menu a:focus-visible {
		background-color: var(--achol-surface);
		color: var(--achol-primary);
	}
}

/* -----------------------------------------------------------------
 * Utility icons (Search, Account, Wishlist, Cart)
 * ----------------------------------------------------------------- */

.achol-header__utilities {
	display: flex;
	align-items: center;
	gap: 4px;
	flex-shrink: 0;
}

@media (min-width: 480px) {

	.achol-header__utilities {
		gap: 8px;
	}
}

.achol-header__icon-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	background: transparent;
	border: none;
	color: var(--achol-text-primary);
	cursor: pointer;
	text-decoration: none;
	flex-shrink: 0;
}

.achol-header__icon-btn:hover,
.achol-header__icon-btn:focus-visible {
	color: var(--achol-primary);
}

.achol-header__icon-btn:focus-visible {
	outline: 2px solid var(--achol-primary);
	outline-offset: 2px;
}

/* Account and Wishlist now sit in the header's utility row on every
 * screen size (Logo left; Search, Account, Wishlist, Cart, and the
 * menu trigger all right) — no longer breakpoint-hidden, and no
 * longer duplicated inside the Mobile Drawer. */

/* TI WooCommerce Wishlist renders its own internal markup inside
 * this wrapper. Bounded to the same compact footprint as the other
 * icon buttons — with overflow hidden — so it stays icon-only and
 * doesn't break the row's alignment, without touching the plugin's
 * own output/markup. */
.achol-header__wishlist {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	overflow: hidden;
	white-space: nowrap;
	flex-shrink: 0;
}

.achol-header__wishlist a,
.achol-header__wishlist .wishlist_products_counter {
	display: inline-flex;
	align-items: center;
	color: inherit;
}

@media (max-width: 359px) {

	.achol-header__icon-btn,
	.achol-header__wishlist,
	.achol-header__hamburger {
		width: 38px;
		height: 38px;
	}

	.achol-header__logo-link {
		max-width: 88px;
	}
}

.achol-header__cart-count {
	position: absolute;
	top: 2px;
	right: 2px;
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background-color: var(--achol-primary);
	color: var(--achol-secondary);
	font-size: 10px;
	font-weight: 700;
	line-height: 1;
	border-radius: 999px;
}

/* -----------------------------------------------------------------
 * Search panel
 * ----------------------------------------------------------------- */

.achol-header__search-panel {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	background-color: var(--achol-bg);
	border-bottom: 1px solid var(--achol-border);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

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

.achol-header__search-panel-inner {
	max-width: var(--achol-container-max-width);
	margin: 0 auto;
	padding: 16px;
	display: flex;
	align-items: center;
	gap: 12px;
}

.achol-header__search-panel-inner form {
	flex: 1;
	margin: 0;
}

.achol-header__search-panel-inner input[type="search"],
.achol-header__search-panel-inner input[type="text"] {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--achol-border);
	border-radius: 4px;
	font-size: 15px;
}

.achol-header__search-close {
	flex-shrink: 0;
	width: 36px;
	height: 36px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	color: var(--achol-text-secondary);
	cursor: pointer;
}

.achol-header__search-close:focus-visible {
	outline: 2px solid var(--achol-primary);
	outline-offset: 2px;
}

/* -----------------------------------------------------------------
 * Mobile Drawer
 * ----------------------------------------------------------------- */

.achol-mobile-drawer[hidden] {
	display: none;
}

.achol-mobile-drawer {
	position: fixed;
	inset: 0;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 200;
}

.achol-mobile-drawer__backdrop {
	position: absolute;
	inset: 0;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: rgba(0, 0, 0, 0.45);
}

.achol-mobile-drawer__panel {
	position: absolute;
	top: 0;
	left: 0;
	bottom: 0;
	width: 84%;
	max-width: 340px;
	background-color: var(--achol-bg);
	padding: 20px;
	overflow-y: auto;
	transform: translateX(-100%);
	transition: transform 0.3s ease;
}

.achol-mobile-drawer.is-open .achol-mobile-drawer__panel {
	transform: translateX(0);
}

.achol-mobile-drawer__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin-bottom: 12px;
	background: transparent;
	border: none;
	color: var(--achol-text-primary);
	cursor: pointer;
}

.achol-mobile-drawer__close:focus-visible {
	outline: 2px solid var(--achol-primary);
	outline-offset: 2px;
}

.achol-mobile-drawer__nav-menu {
	margin: 0 0 20px 0;
	padding: 0;
	list-style: none;
}

.achol-mobile-drawer__nav-menu li {
	border-bottom: 1px solid var(--achol-border);
}

.achol-mobile-drawer__nav-menu a {
	display: block;
	padding: 14px 4px;
	color: var(--achol-text-primary);
	font-weight: 600;
	font-size: 16px;
	text-decoration: none;
	min-height: 44px;
}

.achol-mobile-drawer__nav-menu .sub-menu {
	margin: 0 0 0 12px;
	padding: 0;
	list-style: none;
}

.achol-mobile-drawer__nav-menu .sub-menu a {
	font-weight: 400;
	font-size: 15px;
	color: var(--achol-text-secondary);
}

/* -----------------------------------------------------------------
 * Reduced motion
 * ----------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {

	.achol-header--fixed,
	.achol-mobile-drawer__panel {
		transition: none;
	}
}
