/* Site header: top bar with logo, search, actions; menu row. Sizes follow the 1440px Figma frame. */

/* Sticky under the WP admin bar (the variable is set by WordPress only when the bar is shown). */
.site-header {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 100;
	background: var(--color-surface);
	transition: box-shadow 0.25s ease;
}

.site-header.is-scrolled {
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}
.header-note {
	margin: 0;
	padding: 6px max(var(--container-gutter), calc((100% - var(--container-width)) / 2));
	border-top: 1px solid var(--color-border);
	background: var(--color-bg);
	color: var(--color-text-muted);
	font-size: 13px;
	line-height: 18px;
	text-align: center;
}
/* On narrow screens the admin bar scrolls away, so the header sticks to the very top. */
@media (max-width: 600px) {
	.admin-bar .site-header {
		top: 0;
	}
}

.header-top,
.header-menu {
	display: flex;
	align-items: center;
	justify-content: space-between;
	/* Full-width rows with content aligned to the container. */
	padding: 0 max(var(--container-gutter), calc((100% - var(--container-width)) / 2));
}

.header-top {
	height: 54px;
}

.header-menu {
	height: 36px;
	border-top: 1px solid var(--color-border);
}

.site-header a,
.site-header a:visited {
	color: var(--color-text);
	text-decoration: none;
}

.site-header a:hover,
.site-header a:focus {
	color: var(--color-primary);
}

/* Logo + search */

.header-top .left-part {
	display: flex;
	align-items: center;
	gap: 24px;
	flex: 1;
	min-width: 0;
}

.custom-logo-link {
	display: flex;
	flex-shrink: 0;
}

.custom-logo {
	width: 133px;
	height: auto;
}

.search-bar {
	margin: 0;
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	max-width: 430px;
	height: 32px;
	padding: 0 10px;
	background: var(--color-input);
	border-radius: var(--radius);
	box-sizing: border-box;
}

.search-bar img {
	flex-shrink: 0;
	width: 16px;
	height: 16px;
}

.site-header .header-search {
	flex: 1;
	min-width: 0;
	height: 100%;
	padding: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	background: transparent;
	-webkit-appearance: none;
	appearance: none;
	font: inherit;
	font-size: 14px;
	color: var(--color-text);
	outline: none;
}

.site-header .header-search::placeholder {
	color: var(--color-text-muted);
}

/* Actions */

.header-top .right-part {
	display: flex;
	align-items: center;
	gap: 0;
}

.header-action {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
}

.header-action img {
	display: block;
	width: 40px;
	height: 40px;
}

/* Wishlist / compare counters (filled by assets/js/product-lists.js). */
.header-action {
	position: relative;
}

.header-action__count {
	position: absolute;
	top: 3px;
	right: 2px;
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	border-radius: 8px;
	background: var(--color-primary);
	font-size: 10px;
	font-weight: 600;
	line-height: 16px;
	text-align: center;
	color: #fff;
	box-sizing: border-box;
}

.header-action__count[hidden] {
	display: none;
}

.header-cart {
	width: auto;
	gap: 6px;
	margin-left: 8px;
	font-size: 15px;
	white-space: nowrap;
}

.header-cart img {
	width: 20px;
	height: 20px;
}

/* Menus */

.header-menu .main-navigation {
	width: auto;
}

.header-menu .main-navigation ul {
	display: flex;
	align-items: center;
	gap: 24px;
}

.header-menu .main-navigation a {
	font-size: 14px;
	line-height: 36px;
	white-space: nowrap;
}

/* Language switcher: "Eng" with chevron and dropdown. */

.header-menu .menu-item-has-children > a {
	display: flex;
	align-items: center;
	gap: 4px;
}

.header-menu .menu-item-has-children > a::after {
	content: "";
	width: 6px;
	height: 6px;
	margin-top: -3px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg);
	transition: transform var(--transition);
}

.header-menu .menu-item-has-children:hover > a::after,
.header-menu .menu-item-has-children.focus > a::after {
	margin-top: 3px;
	transform: rotate(-135deg);
}

/* Hidden with visibility instead of the _s left: -999em trick, so the dropdown can align right. */
.header-menu .main-navigation ul ul {
	display: block;
	left: auto;
	right: 0;
	visibility: hidden;
	opacity: 0;
	transition: opacity var(--transition), visibility var(--transition);
	min-width: 80px;
	padding: 6px 0;
	background: var(--color-surface);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.header-menu .main-navigation ul li:hover > ul,
.header-menu .main-navigation ul li.focus > ul {
	left: auto;
	right: 0;
	visibility: visible;
	opacity: 1;
}

.header-menu .main-navigation ul ul a {
	width: auto;
	padding: 0 16px;
	line-height: 32px;
}

/* Burger button and menu panel: tablet / mobile only. */

.menu-burger,
.header-menu__head,
.header-overlay {
	display: none;
}

@media (max-width: 1024px) {
	.menu-burger {
		display: flex;
		flex-shrink: 0;
		align-items: center;
		justify-content: center;
		width: 40px;
		height: 40px;
		padding: 0;
		border: 0;
		border-radius: var(--radius);
		background: var(--color-input);
		color: var(--color-text);
		cursor: pointer;
	}

	/* Three lines: the span is the middle one, ::before / ::after the outer ones. */
	.menu-burger__lines,
	.menu-burger__lines::before,
	.menu-burger__lines::after {
		display: block;
		width: 18px;
		height: 1.5px;
		background: currentColor;
	}

	.menu-burger__lines {
		position: relative;
	}

	.menu-burger__lines::before,
	.menu-burger__lines::after {
		content: "";
		position: absolute;
		left: 0;
	}

	.menu-burger__lines::before {
		top: -6px;
	}

	.menu-burger__lines::after {
		top: 6px;
	}

	.menu-burger:hover,
	.menu-burger[aria-expanded="true"] {
		color: var(--color-primary);
	}

	/* Tablet: the burger sits right next to the search (the row gap is 24px). */
	.header-top .left-part .menu-burger {
		margin-left: -14px;
	}

	/* The menu row becomes a panel sliding in from the right. */
	.header-menu {
		position: fixed;
		top: var(--wp-admin--admin-bar--height, 0px);
		right: 0;
		bottom: 0;
		z-index: 1001;
		flex-direction: column;
		align-items: stretch;
		justify-content: flex-start;
		width: min(360px, 88vw);
		height: auto;
		padding: 0 20px 24px;
		overflow-y: auto;
		border-top: 0;
		background: var(--color-surface);
		box-shadow: -8px 0 32px rgba(0, 0, 0, 0.15);
		visibility: hidden;
		transform: translateX(100%);
		transition: transform 0.3s ease, visibility 0.3s;
	}

	.is-menu-open .header-menu {
		visibility: visible;
		transform: none;
	}

	.header-menu__head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		min-height: 60px;
		border-bottom: 1px solid var(--color-border);
	}

	.header-menu__title {
		font-size: 20px;
		font-weight: 500;
	}

	.header-menu__close {
		position: relative;
		width: 36px;
		height: 36px;
		margin-right: -8px;
		padding: 0;
		border: 0;
		background: none;
		cursor: pointer;
	}

	.header-menu__close::before,
	.header-menu__close::after {
		content: "";
		position: absolute;
		top: 50%;
		left: 8px;
		width: 20px;
		height: 1.5px;
		background: var(--color-text);
		transform: rotate(45deg);
	}

	.header-menu__close::after {
		transform: rotate(-45deg);
	}

	.header-overlay {
		position: fixed;
		inset: 0;
		z-index: 1000;
		display: block;
		background: rgba(0, 0, 0, 0.45);
		opacity: 0;
		visibility: hidden;
		transition: opacity 0.3s ease, visibility 0.3s;
	}

	.is-menu-open .header-overlay {
		opacity: 1;
		visibility: visible;
	}

	.is-menu-open {
		overflow: hidden;
	}

	/* Vertical lists in the panel. */
	.header-menu .main-navigation {
		width: 100%;
	}

	.header-menu .main-navigation ul {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
	}

	.header-menu .main-navigation a {
		font-size: 16px;
		line-height: 1.3;
		padding: 14px 0;
		border-bottom: 1px solid var(--color-border);
	}

	#header-menu-right {
		margin-top: 16px;
	}

	#header-menu-right a {
		font-size: 15px;
		color: #5c5c5c;
	}

	/* Language switcher: the languages as a row of buttons under "Eng". */
	.header-menu .menu-item-has-children > a {
		pointer-events: none;
		border-bottom: 0;
		padding-bottom: 8px;
	}

	.header-menu .menu-item-has-children > a::after {
		display: none;
	}

	.header-menu .main-navigation ul ul,
	.header-menu .main-navigation ul li:hover > ul,
	.header-menu .main-navigation ul li.focus > ul {
		position: static;
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		gap: 8px;
		float: none;
		min-width: 0;
		padding: 0;
		background: none;
		box-shadow: none;
		visibility: visible;
		opacity: 1;
	}

	.header-menu .main-navigation ul ul a {
		padding: 8px 14px;
		border: 1px solid var(--color-border);
		line-height: 1;
	}
}

@media (max-width: 768px) {
	/* Row 1: logo + actions. Row 2: search + burger. */
	.header-top {
		height: auto;
		flex-wrap: wrap;
		gap: 8px;
		padding-top: 8px;
		padding-bottom: 10px;
	}

	.header-top .left-part {
		display: contents;
	}

	.custom-logo-link {
		order: 1;
	}

	.header-top .right-part {
		order: 2;
		margin-left: auto;
	}

	.custom-logo {
		width: 110px;
	}

	.header-action,
	.header-action img {
		width: 32px;
		height: 32px;
	}

	.header-cart {
		width: auto;
		margin-left: 4px;
		font-size: 14px;
	}

	.header-cart img {
		width: 20px;
		height: 20px;
	}

	.search-bar {
		order: 3;
		flex: 0 0 calc(100% - 48px);
		max-width: none;
		height: 40px;
	}

	.header-top .left-part .menu-burger {
		order: 4;
		margin-left: 0;
	}
}
