/*
 * Header component. Source: wordpress/aronex mvp/Header.dc.html.
 * Mobile first. Desktop layout starts at 1024px.
 * Colors and sizes come only from assets/css/tokens.css.
 */

.aronex-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: var(--color-header-bg);
	border-bottom: 1px solid var(--color-border);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
}

/* Skip link: hidden until it gets keyboard focus, then shown at the top of the page. */
.aronex-skip-link {
	position: absolute;
	top: var(--space-2);
	right: var(--space-4);
	z-index: 1000;
	padding: var(--space-2) var(--space-4);
	border-radius: var(--radius-md);
	background: var(--color-bg);
	color: var(--color-text);
	text-decoration: none;
	transform: translateY(-200%);
}

.aronex-skip-link:focus {
	transform: translateY(0);
	outline: 2px solid var(--color-focus);
	outline-offset: 2px;
}

/* No blue tap flash on mobile; keyboard focus is still shown by :focus-visible */
.aronex-header a,
.aronex-header button {
	-webkit-tap-highlight-color: transparent;
}

.aronex-header__bar {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	height: var(--header-height-mobile);
	padding: 0 var(--gutter-mobile);
}

.aronex-header__logo {
	font-size: var(--text-lg);
	font-weight: var(--font-weight-bold);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--color-text);
	text-decoration: none;
}

/* Burger (mobile only) */
.aronex-header__burger {
	display: inline-flex;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 24px;
	height: 24px;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
}

.aronex-header__burger-line {
	display: block;
	height: 2px;
	background: var(--color-text);
	transition: transform 0.25s ease, opacity 0.25s ease;
}

.aronex-header[data-open="true"] .aronex-header__burger-line:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

.aronex-header[data-open="true"] .aronex-header__burger-line:nth-child(2) {
	opacity: 0;
}

.aronex-header[data-open="true"] .aronex-header__burger-line:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

/* Navigation: a dropdown panel on mobile, a row on desktop */
.aronex-header__nav {
	position: absolute;
	top: 100%;
	inset-inline: 0;
	display: flex;
	flex-direction: column;
	padding: var(--space-2) var(--gutter-mobile) var(--space-4);
	background: var(--color-bg);
	border-bottom: 1px solid var(--color-border);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-12px);
	transition: transform 0.25s ease, opacity 0.25s ease, visibility 0.25s ease;
}

.aronex-header[data-open="true"] .aronex-header__nav {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.aronex-header__nav-link {
	padding: var(--space-4) 0;
	border-bottom: 1px solid var(--color-border);
	font-size: var(--text-md);
	color: var(--color-text);
	text-decoration: none;
}

.aronex-header__nav-link:last-child {
	border-bottom: 0;
}

/* Actions: WhatsApp button and cart */
.aronex-header__actions {
	display: flex;
	align-items: center;
	gap: var(--space-4);
}

.aronex-header__wa {
	display: inline-flex;
	align-items: center;
	padding: var(--space-2) var(--space-3);
	border-radius: var(--radius-md);
	background: var(--color-action);
	color: var(--color-accent-contrast);
	font-size: var(--text-sm);
	font-weight: var(--font-weight-medium);
	text-decoration: none;
	white-space: nowrap;
	transition: background 0.2s ease, transform 0.2s ease;
}

.aronex-header__wa:hover,
.aronex-header__wa:focus-visible {
	background: var(--color-action-hover);
	color: var(--color-accent-contrast);
	transform: translateY(-1px);
}

.aronex-header__cart-link {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	color: var(--color-text);
}

/* Cart icon inside the mobile menu panel */
.aronex-header__nav-cart {
	position: relative;
	display: inline-flex;
	align-items: center;
	align-self: flex-start;
	margin-top: var(--space-4);
	color: var(--color-text);
}

.aronex-header__cart-count {
	position: absolute;
	top: -6px;
	inset-inline-start: -8px;
	min-width: 18px;
	height: 18px;
	padding: 0 var(--space-1);
	border-radius: var(--radius-pill);
	background: var(--color-action);
	color: var(--color-accent-contrast);
	font-size: var(--text-xs);
	line-height: 18px;
	text-align: center;
}

/* Mobile: the cart lives in the menu panel, not in the bar */
.aronex-header__cart-link--desktop {
	display: none;
}

/* Overlay behind the open mobile menu */
.aronex-header__overlay {
	position: fixed;
	inset: var(--header-height-mobile) 0 0 0;
	background: var(--color-overlay);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.aronex-header[data-open="true"] + .aronex-header__overlay {
	opacity: 1;
	visibility: visible;
}

/* Desktop */
@media (min-width: 1024px) {
	.aronex-header__nav-cart {
		display: none;
	}

	.aronex-header__cart-link--desktop {
		display: inline-flex;
	}

	.aronex-header__bar {
		height: var(--header-height);
		padding: 0 var(--gutter-desktop);
	}

	.aronex-header__burger,
	.aronex-header__overlay {
		display: none;
	}

	.aronex-header__nav {
		position: static;
		flex-direction: row;
		gap: var(--space-6);
		padding: 0;
		border: 0;
		background: none;
		opacity: 1;
		visibility: visible;
		transform: none;
	}

	.aronex-header__nav-link {
		padding: var(--space-1) 0;
		border: 0;
		font-size: var(--text-base);
		background: linear-gradient(var(--color-accent-soft), var(--color-accent-soft)) no-repeat 0 100% / 0 1px;
		transition: background-size 0.25s ease;
	}

	.aronex-header__nav-link:hover,
	.aronex-header__nav-link:focus-visible {
		background-size: 100% 1px;
	}

}
