/*
 * Header — Blocksy header builder skinned to the design (style.css 257-390).
 * Structure, sticky, transparent and sizes come from scripts/config/blocksy-header.php;
 * colours, blur, shadow, borders, icon buttons and the nav underline follow the tokens here.
 * States (design c1f698f): translucent white with blur from the start, at the top without hairline and
 * shadow; once stuck it adds hairline, shadow and the smaller logo. Only the home hero overlay
 * ([data-transparent-row], not stuck) is transparent with white content.
 */

/* Content edge: the design header uses the wide container. */
html [data-header] .ct-header .ct-container {
	--theme-normal-container-max-width: var(--ll-content-wide);
}

/* Layer: Blocksy's #header z-index 50 is a stacking context that traps the open menus (switcher, nav dropdowns);
   the product page's sticky bar (--ll-z-sticky-top) then covered them. The header layer sits above every bar,
   below the hints (region hint, cookie banner) and Blocksy's panels (drawer, off-canvas). */
#header {
	z-index: var(--ll-z-header);
}

/* Top of the page = design .header (white 90 %, blur, invisible 1px border);
   stuck row = design .header.is-scrolled (+ hairline, shadow). */
html [data-header] .ct-header [data-row*="middle"] {
	background-color: var(--ll-header-bg);
	--theme-border-bottom: 1px solid transparent;
	--theme-box-shadow: none;
	color: var(--ll-text-1);
	transition: background-color var(--ll-t-base) var(--ll-ease), box-shadow var(--ll-t-base) var(--ll-ease), border-color var(--ll-t-base) var(--ll-ease);
}
html [data-header] .ct-header [data-sticky*="yes"] [data-row*="middle"] {
	/* the row's inner div repeats Blocksy's border: keep it on the row only */
	background-color: var(--ll-header-bg); /* beats Blocksy's sticky row colour */
	--theme-border-bottom: 1px solid var(--ll-hairline);
	--theme-box-shadow: var(--ll-shadow-bar);
	color: var(--ll-text-1);
	--theme-link-initial-color: var(--ll-text-1);
	--theme-link-hover-color: var(--ll-text-1);
	--ll-icon-hover-bg: var(--ll-hover-tint);
	--ll-nav-underline-color: var(--ll-sand);
}
@media (min-width: 690px) {
	html [data-header] .ct-header [data-sticky*="yes"] [data-id="logo"] .site-logo-container {
		--logo-max-height: var(--ll-logo-h-scrolled);
	}
}

/* Transparent row over the home hero = design .header--overlay */
html [data-header] .ct-header [data-transparent-row="yes"]:not([data-sticky*="yes"] *) {
	background-color: transparent;
	color: var(--ll-on-emphasis);
	--theme-link-initial-color: var(--ll-on-emphasis);
	--theme-link-hover-color: var(--ll-on-emphasis);
	--ll-icon-hover-bg: var(--ll-hover-tint-on-dark);
	--ll-nav-underline-color: var(--ll-on-emphasis);
}
html [data-header] .ct-header [data-transparent-row="yes"]:not([data-sticky*="yes"] *) .ll-lsw {
	color: var(--ll-on-emphasis); /* the Blocksy text element sets its own colour; DE | CHF white like design .header--overlay */
}

/* Logo: one SVG with fill="currentColor" */
.ct-header .site-logo-container {
	color: inherit;
	transition: none;
}
.ct-header .site-logo-container svg {
	height: var(--logo-max-height);
	width: auto;
	transition: height var(--ll-t-base) var(--ll-ease);
}

/* Desktop row like design .header__inner (flex, space-between): the menu sits centred between logo and
   actions, not in the middle of the page (Blocksy's three-column grid). */
#header [data-device="desktop"] [data-row*="middle"] > .ct-container { /* Blocksy: #header [data-column-set="3"] > div, 1fr auto 1fr */
	grid-template-columns: repeat(3, auto);
	justify-content: space-between;
	column-gap: var(--ll-space-24);
}

/* Main menu: bold small links with a sand underline growing from the left */
html [data-header] .ct-header [data-id="menu"] {
	--menu-items-gap: var(--ll-nav-gap);
	--menu-item-height: auto; /* underline sits under the text, not at the row bottom */
}
html [data-header] .ct-header [data-id="menu"] > ul > li > a {
	--theme-font-family: var(--ll-font);
	--theme-font-weight: var(--ll-weight-bold);
	--theme-font-size: var(--ll-small);
	--theme-line-height: var(--ll-lh-relaxed);
	--theme-text-transform: none;
	--theme-letter-spacing: normal;
	--theme-link-initial-color: currentColor;
	--theme-link-hover-color: currentColor;
	--theme-link-active-color: currentColor;
	position: relative;
	padding-block: var(--ll-space-8);
	padding-inline: 0;
}
.ct-header [data-id="menu"] .ct-menu-link::after {
	content: "";
	position: absolute;
	inset: auto 100% 0 0;
	height: var(--ll-nav-underline);
	border-radius: var(--ll-r-hairline);
	background: var(--ll-nav-underline-color, var(--ll-sand));
	transition: right var(--ll-t-base) var(--ll-ease);
}
.ct-header [data-id="menu"] .ct-menu-link:hover::after,
.ct-header [data-id="menu"] .current-menu-item > .ct-menu-link::after,
.ct-header [data-id="menu"] .ct-menu-link[aria-current="page"]::after {
	right: 0;
}

/* Account + cart: round icon buttons (--ll-tap) */
.ct-header :is(.ct-account-item, .ct-cart-item) {
	inline-size: var(--ll-tap);
	block-size: var(--ll-tap);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--ll-r-full);
	color: inherit;
	/* Blocksy sets this to the dark text colour on the item and colours the logged-in account item (a span, no href)
	   with it: inherit the header colour instead, also white on the transparent header. */
	--theme-link-initial-color: currentColor;
	--theme-icon-color: currentColor;
	--theme-icon-hover-color: currentColor;
	--theme-icon-size: var(--ll-icon-m);
	transition: background-color var(--ll-t-fast) var(--ll-ease), transform var(--ll-t-fast) var(--ll-ease-pop);
}
.ct-header :is(.ct-account-item, .ct-cart-item):hover {
	background-color: var(--ll-icon-hover-bg, var(--ll-hover-tint));
	transform: translateY(var(--ll-lift-sm));
}
.ct-header :is(.ct-account-item, .ct-cart-item) svg {
	inline-size: var(--ll-icon-m);
	block-size: var(--ll-icon-m);
	fill: none; /* line icons; Blocksy fills icons with --theme-icon-color */
	stroke: currentColor;
	stroke-width: var(--ll-icon-stroke);
}
/* Account dropdown: the user icon instead of the avatar (template-parts/header-account.php), drawn like the header icon */
.ct-header-account-user-info .ct-media-container svg {
	inline-size: var(--ll-icon-m);
	block-size: var(--ll-icon-m);
	fill: none;
	stroke: currentColor;
	stroke-width: var(--ll-icon-stroke);
}
html [data-header] .ct-header [data-id="account"],
html [data-header] .ct-header [data-id="cart"] {
	--theme-icon-size: var(--ll-icon-m);
}
.ct-header [data-items] {
	gap: var(--ll-space-16);
}
.ct-header [data-column] [data-items] > * {
	--margin: 0; /* Blocksy adds side margins (also before the last item of the end column); spacing comes from the gap like in the design */
}

/* Cart count badge: cyan / petrol-deep, on the top right of the round button like the design (Blocksy anchors it to the icon). */
.ct-header .ct-cart-item {
	position: relative;
}
.ct-header .ct-cart-item .ct-icon-container {
	position: static;
}
.ct-header .ct-cart-item .ct-dynamic-count-cart {
	inset: var(--ll-badge-offset) calc(-1 * var(--ll-badge-offset)) auto auto;
	min-inline-size: var(--ll-badge);
	block-size: var(--ll-badge);
	padding-inline: var(--ll-space-4);
	border-radius: var(--ll-r-full);
	background: var(--ll-accent);
	color: var(--ll-petrol-deep);
	font-size: var(--ll-overline);
	font-weight: var(--ll-weight-bold);
	line-height: var(--ll-lh-tight);
}

/* Burger */
html [data-header] .ct-header [data-id="trigger"] {
	--theme-icon-size: var(--ll-burger-w);
	--theme-icon-color: currentColor;
	--theme-icon-hover-color: currentColor;
	color: inherit;
}

/*
 * Mobile drawer = Blocksy off-canvas (design ef39f30): full height above the header,
 * full width on phones, fixed width from tablet; head of header height with the logo centred and a round close X on the
 * right; h4 links with soft dividers; sub links body size in ink-soft.
 */
html [data-header] #offcanvas {
	--theme-box-shadow: var(--ll-shadow-float);
	background-color: var(--ll-scrim);
}
html [data-header] #offcanvas .ct-panel-inner {
	background-color: var(--ll-bg);
}
#offcanvas .ct-panel-actions {
	position: absolute;
	inset: 0 var(--ll-space-12) auto auto;
	z-index: 2;
	block-size: var(--ll-header-h);
	display: flex;
	align-items: center;
	padding: 0;
}
/* Blocksy styles the close button through --toggle-button-* (background with !important) */
html [data-header] #offcanvas .ct-toggle-close {
	inline-size: var(--ll-tap);
	block-size: var(--ll-tap);
	color: var(--ll-text-1);
	--toggle-button-radius: var(--ll-r-full);
	--toggle-button-background: transparent;
	--toggle-button-padding: 0;
	--toggle-button-margin-end: 0;
	--toggle-button-margin-block: 0;
	--theme-icon-size: var(--ll-icon-m);
	--theme-icon-color: var(--ll-text-1);
	--theme-icon-hover-color: var(--ll-text-1);
}
html [data-header] #offcanvas .ct-toggle-close:hover {
	--toggle-button-background: var(--ll-panel);
}
#offcanvas .ct-panel-content-inner {
	--margin: 0;
	padding: 0 var(--ll-space-24) var(--ll-space-24);
}
/* Head: logo centred in a header-high bar with a soft divider */
#offcanvas [data-id="offcanvas-logo"] {
	position: sticky;
	inset-block-start: 0;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	block-size: var(--ll-header-h);
	margin: 0 calc(-1 * var(--ll-space-24)) var(--ll-space-8);
	background: var(--ll-bg);
	border-bottom: 1px solid var(--ll-hairline-soft);
	color: var(--ll-text-1);
}
/* Blocksy aligns the drawer column to the start once a text item is in it: head and locale strip span the panel */
#offcanvas [data-id="offcanvas-logo"],
#offcanvas .ct-header-text:has(.ll-mnav-locale) {
	align-self: stretch;
}
#offcanvas .ct-header-text:has(.ll-mnav-locale) {
	margin-top: auto; /* strip at the bottom of the drawer (design .mnav-locale margin-top: auto) */
}
#offcanvas [data-id="offcanvas-logo"] svg {
	block-size: var(--logo-max-height, var(--ll-logo-h-scrolled));
	inline-size: auto;
}
/* Links */
html [data-header] #offcanvas [data-id="mobile-menu"] {
	--theme-font-family: var(--ll-font);
	--theme-font-weight: var(--ll-weight-bold);
	--theme-font-size: var(--ll-h4);
	--theme-line-height: var(--ll-lh-tight);
	--theme-link-initial-color: var(--ll-text-1);
	--theme-link-hover-color: var(--ll-text-1);
	--theme-link-active-color: var(--ll-text-1);
	--mobile-menu-divider: none;
	inline-size: 100%;
}
/* Dividers like the design: on each top-level link, on the group around a submenu, none on the last link */
html [data-header] #offcanvas [data-id="mobile-menu"] > ul > li:not(.menu-item-has-children) > a,
html [data-header] #offcanvas [data-id="mobile-menu"] > ul > li.menu-item-has-children {
	border-bottom: 1px solid var(--ll-hairline-soft);
}
/* design a:last-child: the last link keeps its divider when the locale strip follows */
html [data-header] #offcanvas .ct-panel-content-inner:not(:has(.ll-mnav-locale)) [data-id="mobile-menu"] > ul > li:last-child > a {
	border-bottom: 0;
}
html [data-header] #offcanvas [data-id="mobile-menu"] > ul > li > a,
html [data-header] #offcanvas [data-id="mobile-menu"] > ul > li > .ct-sub-menu-parent > a {
	padding: var(--ll-space-16) var(--ll-space-4);
}
html [data-header] #offcanvas [data-id="mobile-menu"] .sub-menu {
	--theme-font-size: var(--ll-body);
	--theme-font-weight: var(--ll-weight-book);
	--theme-line-height: var(--ll-lh-relaxed);
	--theme-link-initial-color: var(--ll-text-2);
	--theme-link-hover-color: var(--ll-text-1);
	margin: 0;
}
html [data-header] #offcanvas [data-id="mobile-menu"] .sub-menu a {
	padding: var(--ll-space-8) var(--ll-space-4) var(--ll-space-8) var(--ll-space-16);
}
html [data-header] #offcanvas [data-id="mobile-menu"] .sub-menu li:last-child a {
	padding-block-end: var(--ll-space-16);
}
html [data-header] #offcanvas .ct-toggle-dropdown-mobile {
	--theme-icon-size: var(--ll-chevron);
	--theme-icon-color: var(--ll-text-3);
	--theme-icon-hover-color: var(--ll-text-1);
}

html [data-header] .ct-header [data-row*="middle"] > div {
	--theme-border-bottom: none;
}

/* Blur + saturation like the design; Blocksy sets backdrop-filter on #header [data-row] (ID specificity). */
#header [data-row*="middle"] {
	-webkit-backdrop-filter: var(--ll-header-blur);
	backdrop-filter: var(--ll-header-blur);
}
#header [data-transparent-row="yes"]:not([data-sticky*="yes"] *) {
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
}

/* Keyboard focus: menu links keep their square shape at rest, the ring is rounded (the menu button with its three
   bars stays square, like its icon). The submenu arrow is a 24 px button across the label: the ring goes around the
   whole menu item instead. */
:root #header .ct-menu-link:focus-visible,
:root #offcanvas .ct-menu-link:focus-visible {
	border-radius: var(--ll-r-focus);
}
#header .ct-toggle-dropdown-desktop-ghost:focus-visible {
	outline: none;
}
#header li:has(> .ct-toggle-dropdown-desktop-ghost:focus-visible) > .ct-menu-link {
	outline: var(--ll-focus-w) solid var(--ll-focus-color);
	outline-offset: var(--ll-focus-offset);
	border-radius: var(--ll-r-focus);
}
