/**
 * Beauvit — header.css
 * Minimal header, desktop navigation and the accessible mobile menu.
 */

.bv-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: var(--bv-bg);
	border-bottom: 1px solid var(--bv-line);
}

/* Keep the sticky header clear of the WordPress admin bar for logged-in users. */
body.admin-bar .bv-header {
	top: 32px;
}

@media (max-width: 782px) {
	body.admin-bar .bv-header {
		top: 46px;
	}
}

.bv-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.5rem;
	padding-block: clamp(1.1rem, 2vw, 1.6rem);
}

/* Wordmark */
.bv-brand {
	font-size: 1.25rem;
	font-weight: 700;
	letter-spacing: 0.18em;
	text-decoration: none;
	color: var(--bv-ink);
	white-space: nowrap;
}

.bv-brand:hover {
	color: var(--bv-ink);
	opacity: 0.7;
}

/* Category links sit after the brand; user links stay beside the cart. */
.bv-nav {
	display: flex;
	flex: 1;
	min-width: 0;
	align-items: center;
	justify-content: space-between;
	gap: clamp(1.25rem, 2.5vw, 2.25rem);
}

/* Right-hand cluster: cart + mobile toggle */
.bv-header__actions {
	display: flex;
	align-items: center;
	gap: clamp(1rem, 2.5vw, 2.25rem);
}

/* Navigation list */
.bv-menu {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: clamp(1.25rem, 2.5vw, 2.25rem);
}

.bv-menu li {
	margin: 0;
}

.bv-menu a {
	display: inline-block;
	padding: 0.25rem 0;
	font-size: 0.95rem;
	font-weight: 500;
	letter-spacing: 0.01em;
	color: var(--bv-ink);
	text-decoration: none;
	border-bottom: 1px solid transparent;
}

.bv-menu a:hover {
	color: var(--bv-ink-soft);
}

.bv-menu .current-menu-item > a,
.bv-menu .current_page_item > a,
.bv-menu .current-menu-parent > a,
.bv-menu .is-active > a {
	border-bottom-color: var(--bv-ink);
}

/* Cart cluster */
.bv-header__cart {
	display: flex;
	align-items: center;
}

/* Hamburger toggle (hidden on desktop) */
.bv-nav-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	margin: 0;
	background: none;
	border: none;
	color: var(--bv-ink);
	cursor: pointer;
}

.bv-nav-toggle__box {
	position: relative;
	display: block;
	width: 22px;
	height: 14px;
}

.bv-nav-toggle__bar,
.bv-nav-toggle__bar::before,
.bv-nav-toggle__bar::after {
	content: "";
	position: absolute;
	left: 0;
	width: 100%;
	height: 1.5px;
	background: currentColor;
	transition: transform var(--bv-transition), opacity var(--bv-transition);
}

.bv-nav-toggle__bar {
	top: 50%;
	transform: translateY(-50%);
}

.bv-nav-toggle__bar::before { top: -6px; }
.bv-nav-toggle__bar::after { top: 6px; }

.bv-nav-toggle[aria-expanded="true"] .bv-nav-toggle__bar {
	background: transparent;
}

.bv-nav-toggle[aria-expanded="true"] .bv-nav-toggle__bar::before {
	top: 0;
	transform: rotate(45deg);
}

.bv-nav-toggle[aria-expanded="true"] .bv-nav-toggle__bar::after {
	top: 0;
	transform: rotate(-45deg);
}

/* -------------------------------------------------------------------------
 * Mobile navigation
 * ---------------------------------------------------------------------- */
@media (max-width: 860px) {
	.bv-nav-toggle {
		display: inline-flex;
	}

	.bv-nav {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		z-index: 90;
		display: none;
		max-height: calc(100vh - 6rem);
		overflow-y: auto;
		background: var(--bv-bg);
		border-bottom: 1px solid var(--bv-line);
		padding: 0.25rem var(--bv-gutter) 1rem;
	}

	.bv-nav.is-open {
		display: block;
	}

	.bv-menu {
		flex-direction: column;
		flex-wrap: nowrap;
		align-items: stretch;
		gap: 0;
	}

	.bv-menu--categories {
		padding-bottom: 0.5rem;
		margin-bottom: 0.5rem;
		border-bottom: 1px solid var(--bv-line);
	}

	.bv-menu li {
		border-top: 1px solid var(--bv-line);
	}

	.bv-menu li:first-child {
		border-top: none;
	}

	.bv-menu a {
		display: block;
		padding: 0.95rem 0;
		font-size: 1.05rem;
	}

	.bv-menu .current-menu-item > a,
	.bv-menu .current_page_item > a,
	.bv-menu .current-menu-parent > a,
	.bv-menu .is-active > a {
		border-bottom-color: transparent;
		color: var(--bv-ink-soft);
	}
}

@media (max-width: 480px) {
	.bv-brand {
		font-size: 1.1rem;
		letter-spacing: 0.13em;
	}
}

/* Balanced three-area layout. The middle column keeps its own intrinsic width,
   with equal flexible columns on either side. */
.bv-header { background: #fff; }
.bv-header__inner {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	min-height: 80px;
	padding-block: 0.5rem;
	gap: 0;
}
.bv-brand { grid-column: 1; grid-row: 1; min-width: 0; justify-self: start; letter-spacing: 0; }
.bv-brand a { display: inline-flex; align-items: center; max-width: 100%; color: var(--bv-ink); text-decoration: none; }
.bv-brand__text {
	font-size: 1.25rem;
	font-weight: 700;
	letter-spacing: 0.045em;
	line-height: 1.2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.bv-brand .custom-logo { display: block; width: auto; max-width: min(220px, 100%); max-height: 48px; height: auto; object-fit: contain; }
.bv-nav {
	grid-column: 2;
	grid-row: 1;
	flex: none;
	justify-content: center;
	gap: clamp(1rem, 1.8vw, 1.75rem);
}
.bv-menu { flex-wrap: nowrap; gap: clamp(1rem, 1.8vw, 1.75rem); white-space: nowrap; }
.bv-menu > li { position: relative; }
.bv-menu a { padding: 0.55rem 0; font-size: 0.93rem; line-height: 1.4; }
.bv-menu .current-menu-ancestor > a { border-bottom-color: var(--bv-ink); }
.bv-menu .sub-menu {
	position: absolute;
	top: 100%;
	left: -1rem;
	z-index: 2;
	display: none;
	min-width: 12rem;
	list-style: none;
	margin: 0;
	padding: 0.5rem 1rem;
	background: #fff;
	border: 1px solid var(--bv-line);
	box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
}
.bv-menu .menu-item-has-children:hover > .sub-menu,
.bv-menu .menu-item-has-children:focus-within > .sub-menu { display: block; }
.bv-menu .sub-menu a { display: block; }
.bv-header__actions { grid-column: 3; grid-row: 1; justify-self: end; }
.bv-header__cart { min-width: 44px; min-height: 44px; justify-content: center; }
.bv-header__cart .wc-block-mini-cart__button,
.bv-header__cart .bv-cart-fallback { min-width: 44px; min-height: 44px; justify-content: center; }

.bv-mobile-search { display: none; }

/* Desktop search sits beside the cart, or inside compact navigation on tablets.
   Native details works without JS. */
.bv-search { width: 0; height: 0; }
.bv-search__toggle {
	position: absolute;
	top: 50%;
	right: calc(var(--bv-gutter) + 4.5rem);
	transform: translateY(-50%);
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	list-style: none;
	color: var(--bv-ink);
	cursor: pointer;
}
.bv-search__toggle::-webkit-details-marker { display: none; }
.bv-search__toggle::marker { content: ''; }
.bv-search__toggle:hover { color: var(--bv-ink-soft); }
.bv-search__toggle-label {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}
.bv-search__panel {
	position: absolute;
	top: 100%;
	right: var(--bv-gutter);
	z-index: 3;
	width: min(430px, calc(100% - 2 * var(--bv-gutter)));
	padding: 1.25rem;
	background: #fff;
	border: 1px solid var(--bv-line);
	box-shadow: 0 16px 32px rgba(0, 0, 0, 0.08);
}
.bv-search:not([open]) > .bv-search__panel { display: none; }
.bv-search__form label { display: block; margin-bottom: 0.55rem; font-size: 0.88rem; font-weight: 600; }
.bv-search__controls { display: flex; align-items: stretch; gap: 0.5rem; }
.bv-search__controls input[type="search"] {
	flex: 1;
	min-width: 0;
	min-height: 44px;
	padding: 0.55rem 0.75rem;
	border: 1px solid #c9c9c9;
	border-radius: var(--bv-radius);
	background: #fff;
	color: var(--bv-ink);
	font: inherit;
	font-size: 0.95rem;
}
.bv-search__submit {
	min-height: 44px;
	padding: 0.5rem 0.9rem;
	border: 1px solid var(--bv-ink);
	border-radius: var(--bv-radius);
	background: var(--bv-ink);
	color: #fff;
	font: inherit;
	font-size: 0.9rem;
	cursor: pointer;
}
.bv-search__close {
	display: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	min-width: 44px;
	border: 1px solid var(--bv-line);
	border-radius: var(--bv-radius);
	background: #fff;
	color: var(--bv-ink);
	cursor: pointer;
}
.bv-search.is-enhanced .bv-search__close { display: flex; }
.bv-nav-toggle:focus-visible,
.bv-search__toggle:focus-visible,
.bv-search__controls input:focus-visible,
.bv-search__controls button:focus-visible,
.bv-menu a:focus-visible,
.bv-brand a:focus-visible { outline: 2px solid var(--bv-ink); outline-offset: 3px; }

@media (max-width: 600px) {
	body.admin-bar .bv-header { top: 0; }
}

@media (max-width: 78rem) {
	.bv-header__inner {
		grid-template-columns: minmax(44px, 1fr) minmax(0, auto) minmax(44px, 1fr);
		min-height: 64px;
		gap: 0.5rem;
		padding-block: 0.35rem;
	}
	.bv-brand { grid-column: 2; justify-self: center; text-align: center; }
	.bv-brand .custom-logo { max-width: min(180px, 100%); max-height: 42px; }
	.bv-brand__text { font-size: 1.12rem; letter-spacing: 0.035em; }
	.bv-header__actions { display: contents; }
	.bv-header__cart { grid-column: 3; grid-row: 1; justify-self: end; }
	.bv-nav-toggle { grid-column: 1; grid-row: 1; justify-self: start; display: inline-flex; }
	.bv-nav {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		z-index: 3;
		display: none;
		max-height: calc(100dvh - 64px);
		overflow-y: auto;
		padding: 0.5rem var(--bv-gutter) 1.25rem;
		background: #fff;
		border-bottom: 1px solid var(--bv-line);
		box-shadow: 0 16px 24px rgba(0, 0, 0, 0.06);
	}
	.bv-nav.is-open { display: block; }
	.bv-search { width: auto; height: auto; border-bottom: 1px solid var(--bv-line); }
	.bv-search__toggle { position: static; transform: none; justify-content: flex-start; gap: 0.8rem; width: 100%; min-height: 52px; height: auto; }
	.bv-search__toggle-label { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip-path: none; font-size: 1rem; font-weight: 500; }
	.bv-search__panel { position: static; width: 100%; padding: 0 0 1rem; border: 0; box-shadow: none; }
	.bv-menu { display: block; white-space: normal; }
	.bv-menu--categories { border-bottom: 1px solid var(--bv-line); }
	.bv-menu > li + li { border-top: 1px solid var(--bv-line); }
	.bv-menu a { display: block; padding: 0.85rem 0; font-size: 1rem; }
	.bv-menu .sub-menu { position: static; display: block; min-width: 0; padding: 0 0 0.5rem 1rem; border: 0; box-shadow: none; }
	.bv-menu .sub-menu a { padding: 0.55rem 0; }
	.bv-menu .current-menu-item > a,
	.bv-menu .current_page_item > a,
	.bv-menu .current-menu-parent > a,
	.bv-menu .current-menu-ancestor > a,
	.bv-menu .is-active > a { border-bottom-color: transparent; color: var(--bv-ink-soft); }
}

/* Long administrator menus can need the compact layout on wider screens. */
@media (min-width: 78.001rem) {
	.bv-header.is-compact .bv-header__inner {
		grid-template-columns: minmax(44px, 1fr) minmax(0, auto) minmax(44px, 1fr);
		min-height: 64px;
		gap: 0.5rem;
		padding-block: 0.35rem;
	}
	.bv-header.is-compact .bv-brand { grid-column: 2; justify-self: center; text-align: center; }
	.bv-header.is-compact .bv-brand .custom-logo { max-width: min(180px, 100%); max-height: 42px; }
	.bv-header.is-compact .bv-brand__text { font-size: 1.12rem; letter-spacing: 0.035em; }
	.bv-header.is-compact .bv-header__actions { display: contents; }
	.bv-header.is-compact .bv-header__cart { grid-column: 3; grid-row: 1; justify-self: end; }
	.bv-header.is-compact .bv-nav-toggle { grid-column: 1; grid-row: 1; justify-self: start; display: inline-flex; }
	.bv-header.is-compact .bv-nav {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		z-index: 3;
		display: none;
		max-height: calc(100dvh - 64px);
		overflow-y: auto;
		padding: 0.5rem var(--bv-gutter) 1.25rem;
		background: #fff;
		border-bottom: 1px solid var(--bv-line);
		box-shadow: 0 16px 24px rgba(0, 0, 0, 0.06);
	}
	.bv-header.is-compact .bv-nav.is-open { display: block; }
	.bv-header.is-compact .bv-search { width: auto; height: auto; border-bottom: 1px solid var(--bv-line); }
	.bv-header.is-compact .bv-search__toggle { position: static; transform: none; justify-content: flex-start; gap: 0.8rem; width: 100%; min-height: 52px; height: auto; }
	.bv-header.is-compact .bv-search__toggle-label { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip-path: none; font-size: 1rem; font-weight: 500; }
	.bv-header.is-compact .bv-search__panel { position: static; width: 100%; padding: 0 0 1rem; border: 0; box-shadow: none; }
	.bv-header.is-compact .bv-menu { display: block; white-space: normal; }
	.bv-header.is-compact .bv-menu--categories { border-bottom: 1px solid var(--bv-line); }
	.bv-header.is-compact .bv-menu > li + li { border-top: 1px solid var(--bv-line); }
	.bv-header.is-compact .bv-menu a { display: block; padding: 0.85rem 0; font-size: 1rem; }
	.bv-header.is-compact .bv-menu .sub-menu { position: static; display: block; min-width: 0; padding: 0 0 0.5rem 1rem; border: 0; box-shadow: none; }
	.bv-header.is-compact .bv-menu .sub-menu a { padding: 0.55rem 0; }
	.bv-header.is-compact .bv-menu .current-menu-item > a,
	.bv-header.is-compact .bv-menu .current_page_item > a,
	.bv-header.is-compact .bv-menu .current-menu-parent > a,
	.bv-header.is-compact .bv-menu .current-menu-ancestor > a,
	.bv-header.is-compact .bv-menu .is-active > a { border-bottom-color: transparent; color: var(--bv-ink-soft); }
}

/* On phones, the left control opens a full-width product search only. */
@media (max-width: 860px) {
	.bv-header .bv-nav,
	.bv-header .bv-nav.is-open,
	.bv-nav-toggle { display: none; }

	.bv-mobile-search {
		display: block;
		grid-column: 1;
		grid-row: 1;
		justify-self: start;
		align-self: center;
	}
	.bv-mobile-search__toggle {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 44px;
		height: 44px;
		list-style: none;
		color: var(--bv-ink);
		cursor: pointer;
	}
	.bv-mobile-search__toggle::-webkit-details-marker { display: none; }
	.bv-mobile-search__toggle::marker { content: ''; }
	.bv-mobile-search__icon-close { display: none; }
	.bv-mobile-search[open] .bv-mobile-search__icon-search { display: none; }
	.bv-mobile-search[open] .bv-mobile-search__icon-close { display: block; }
	.bv-mobile-search__panel {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		z-index: 3;
		box-sizing: border-box;
		max-height: calc(100dvh - 64px);
		overflow-y: auto;
		padding: 20px;
		background: #fff;
		border-bottom: 1px solid var(--bv-line);
		box-shadow: 0 16px 24px rgba(0, 0, 0, 0.06);
	}
	.bv-mobile-search:not([open]) .bv-mobile-search__panel { display: none; }
	.bv-mobile-search__form {
		display: grid;
		grid-template-columns: minmax(0, 1fr);
		gap: 12px;
		width: 100%;
		min-width: 0;
		margin: 0;
	}
	.bv-mobile-search__form input[type="search"] {
		display: block;
		width: 100%;
		min-width: 0;
		box-sizing: border-box;
		height: 50px;
		margin: 0;
		padding: 0 15px;
		border: 1px solid #d4d4d4;
		border-radius: 12px;
		background: #fff;
		color: var(--bv-ink);
		font: inherit;
		font-size: 16px;
	}
	.bv-mobile-search__submit {
		display: block;
		width: 100%;
		box-sizing: border-box;
		min-height: 48px;
		margin: 0;
		padding: 0.5rem 0.9rem;
		border: 1px solid var(--bv-ink);
		border-radius: 12px;
		background: var(--bv-ink);
		color: #fff;
		font: inherit;
		font-size: 16px;
		cursor: pointer;
	}
	.bv-mobile-search__toggle:focus-visible {
		outline: 2px solid var(--bv-ink);
		outline-offset: 2px;
	}
	.bv-mobile-search__form input[type="search"]:focus-visible {
		border-color: transparent;
		outline: 2px solid var(--bv-ink);
		outline-offset: -2px;
		box-shadow: none;
	}
	.bv-mobile-search__submit:focus-visible {
		outline: 2px solid #fff;
		outline-offset: -4px;
		box-shadow: none;
	}
}
