/* =========================================================================
   Handknitted — Header
   ========================================================================= */

.site-header {
	background: var(--hk-bg);
	/* design: 1px cyan hairline under the header (Rectangle 19 on every frame) */
	border-bottom: 1px solid var(--hk-brand);
}

.site-header__inner {
	display: flex;
	align-items: center;
	gap: clamp(1rem, 2.2vw, 2.5rem);
	min-height: 88px;
	/* The header spans the full viewport (design: logo ~60px from the left
	   edge, cart ~40px from the right) — only the gutter insets it. */
	max-width: none;
}

/* ---- Branding / logo ---------------------------------------------------- */
.site-branding {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
}
.site-branding .custom-logo-link {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
}
.site-branding img,
.site-branding .custom-logo {
	display: block;
	width: auto;
	height: clamp(40px, 3.2vw, 46px); /* 41px at 1280, the design's 46px from 1440 */
	max-width: 280px;
}

/* ---- Primary navigation ------------------------------------------------- */
.main-navigation {
	/* Nav hugs the logo (left-of-centre), matching the design; the utilities
	   cluster is pushed to the far right via margin-left:auto below. */
	flex: 0 1 auto;
	display: flex;
	justify-content: flex-start;
	margin-left: clamp(0.25rem, 1vw, 1.25rem);
}

.hk-menu {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: center;
	gap: clamp(0.9rem, 1.5vw, 2rem);
}
.hk-menu li { position: relative; }

.hk-menu a {
	display: inline-block;
	padding: 0.5rem 0.25rem;
	color: var(--hk-ink);
	/* Per design spec: Nexa Regular, 12px, line-height 100%, letter-spacing 0 */
	font-family: "Nexa", var(--hk-font);
	font-size: 12px;
	font-weight: 400;
	line-height: 1;
	letter-spacing: 0;
	text-decoration: none;
	white-space: nowrap;
	transition: color 0.15s ease;
}
.hk-menu a:hover,
.hk-menu a:focus,
.hk-menu .current-menu-item > a,
.hk-menu .current_page_item > a {
	color: var(--hk-brand);
	text-decoration: none;
}

/* Sub-menus (dropdowns) */
.hk-menu .sub-menu {
	list-style: none;
	margin: 0;
	padding: 0.5rem 0;
	position: absolute;
	top: 100%;
	left: 0;
	min-width: 200px;
	background: #fff;
	border: 1px solid var(--hk-line);
	border-radius: 8px;
	box-shadow: 0 12px 30px rgba(17, 20, 24, 0.1);
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
	z-index: 50;
}
.hk-menu li:hover > .sub-menu,
.hk-menu li:focus-within > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}
.hk-menu .sub-menu a {
	display: block;
	padding: 0.5rem 1.1rem;
	font-weight: 400;
}
.hk-menu .menu-item-has-children > a::after {
	content: "";
	display: inline-block;
	margin-left: 0.4em;
	border: 4px solid transparent;
	border-top-color: currentColor;
	transform: translateY(2px);
}

/* ---- Utilities (right cluster) ----------------------------------------- */
.site-utilities {
	flex: 0 0 auto;
	margin-left: auto; /* push the cluster to the right edge */
	display: flex;
	/* Design: search / currency / language / cart sit on the "floor" —
	   bottom-aligned with the Stores line of the contact block. */
	align-items: flex-end;
	gap: clamp(0.6rem, 1.1vw, 1.25rem);
	color: var(--hk-brand);
}
/* Optical alignment: the buttons carry bottom padding, so pull them down
   until the icon glyphs / text baselines land on the Stores line. */
.site-utilities > .hk-iconbtn,
.site-utilities > .hk-switcher { margin-bottom: -7px; }

/* Three stacked lines per the design's Menu component:
   Opening hours / ☎ phone / Stores — all small, regular weight, cyan. */
.hk-contact {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	line-height: 1.35;
	font-size: 0.75rem;      /* 12px */
	font-weight: 400;
	/* Design: ~90px of air between the contact block and the search icon. */
	/* 24px at 1280, 43px at 1440, the full 72px from 1680: the air grows
	   quickly with the viewport instead of eating the 1280 row. */
	margin-right: clamp(1rem, calc(12vw - 130px), 4.5rem);
	color: var(--hk-brand);
}
.hk-contact__phone {
	display: inline-block;
	position: relative;
	color: var(--hk-brand);
	font-weight: 400;
	text-decoration: none;
}
/* The phone icon hangs in the left margin so all three text lines
   (Opening hours / number / Stores) share the same left edge. */
.hk-contact__phone .hk-icon--phone {
	position: absolute;
	left: -17px;
	top: 50%;
	transform: translateY(-50%);
}
.hk-contact__phone:hover { text-decoration: none; color: var(--hk-brand-dark); }
.hk-contact__hours,
.hk-contact__stores {
	color: var(--hk-brand);
	text-decoration: none;
}
a.hk-contact__hours:hover,
a.hk-contact__stores:hover { text-decoration: underline; }

/* Icon buttons (search, cart) */
.hk-iconbtn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: 0;
	padding: 0.4rem;
	color: var(--hk-ink); /* design: search + cart glyphs are dark ink, not cyan */
	cursor: pointer;
	border-radius: 8px;
	position: relative;
	line-height: 0;
}
.hk-iconbtn:hover,
.hk-iconbtn:focus-visible { color: var(--hk-brand-dark); background: rgba(0, 165, 206, 0.08); text-decoration: none; }

.hk-icon { display: block; }

/* Currency / language switchers */
.hk-switcher { position: relative; }
.hk-switcher__menu {
	list-style: none;
	margin: 0;
	padding: 0.35rem 0;
	position: absolute;
	top: calc(100% + 4px);
	right: 0;
	min-width: 110px;
	background: #fff;
	border: 1px solid var(--hk-line);
	border-radius: 8px;
	box-shadow: 0 12px 30px rgba(17, 20, 24, 0.1);
	z-index: 60;
}
.hk-switcher__menu[hidden] { display: none; }
.hk-switcher__menu a {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.5rem 0.9rem;
	color: var(--hk-brand);
	font-weight: 600;
	font-size: 0.95rem;
	text-decoration: none;
	white-space: nowrap;
}
.hk-switcher__menu a:hover {
	background: rgba(0, 165, 206, 0.08);
	color: var(--hk-brand-dark);
	text-decoration: none;
}
/* WCML injects a loading spinner while switching */
.hk-switcher .wcml-spinner { position: absolute; top: 50%; right: -22px; transform: translateY(-50%); }

.hk-switcher__btn {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	background: none;
	border: 0;
	padding: 0.4rem 0.3rem;
	color: var(--hk-brand);
	font: inherit;
	font-weight: 600;
	font-size: 0.95rem;
	cursor: pointer;
	border-radius: 8px;
}
.hk-switcher__btn:hover { color: var(--hk-brand-dark); }
.hk-switcher__symbol { font-weight: 700; }
.hk-caret {
	width: 0;
	height: 0;
	border: 4px solid transparent;
	border-top-color: currentColor;
	margin-top: 3px;
}

/* Cart count badge */
.hk-cart { color: var(--hk-ink); }
.hk-cart:hover { color: var(--hk-brand); }
.hk-cart__count {
	position: absolute;
	top: -2px;
	right: -4px;
	min-width: 17px;
	height: 17px;
	padding: 0 4px;
	border-radius: 999px;
	background: var(--hk-brand-btn);
	color: #fff;
	font-size: 0.68rem;
	font-weight: 700;
	line-height: 17px;
	text-align: center;
}

/* Search panel (toggled) */
.hk-search-panel {
	border-bottom: 1px solid var(--hk-line);
	background: #fafbfc;
}
.hk-search-panel[hidden] { display: none; }
.hk-search-panel form {
	max-width: var(--hk-content-width);
	margin-inline: auto;
	padding: 1rem var(--hk-gutter);
	display: flex;
	gap: 0.5rem;
}
.hk-search-panel input[type="search"] {
	flex: 1 1 auto;
	padding: 0.7rem 1rem;
	border: 1px solid var(--hk-line);
	border-radius: 999px;
	font: inherit;
}
.hk-search-panel input[type="search"]:focus {
	outline: none;
	border-color: var(--hk-brand);
}

/* ---- Mobile menu toggle (hidden on desktop) ----------------------------- */
.hk-menu-toggle {
	display: none;
	background: none;
	border: 0;
	padding: 0.5rem;
	cursor: pointer;
	color: var(--hk-ink);
}
.hk-menu-toggle__bars,
.hk-menu-toggle__bars span {
	display: block;
}
.hk-menu-toggle__bars {
	width: 24px;
	height: 18px;
	position: relative;
}
.hk-menu-toggle__bars span {
	position: absolute;
	left: 0;
	width: 100%;
	height: 2px;
	background: currentColor;
	border-radius: 2px;
	transition: transform 0.2s ease, opacity 0.2s ease, top 0.2s ease;
}
.hk-menu-toggle__bars span:nth-child(1) { top: 0; }
.hk-menu-toggle__bars span:nth-child(2) { top: 8px; }
.hk-menu-toggle__bars span:nth-child(3) { top: 16px; }
.hk-menu-toggle[aria-expanded="true"] .hk-menu-toggle__bars span:nth-child(1) { top: 8px; transform: rotate(45deg); }
.hk-menu-toggle[aria-expanded="true"] .hk-menu-toggle__bars span:nth-child(2) { opacity: 0; }
.hk-menu-toggle[aria-expanded="true"] .hk-menu-toggle__bars span:nth-child(3) { top: 8px; transform: rotate(-45deg); }

/* =========================================================================
   Layout modes: FULL row vs COMPACT (hamburger)
   -------------------------------------------------------------------------
   FULL (default): logo | nav | utilities in one row, as designed for 1440.
   COMPACT (.site-header.is-compact): the nav moves into a panel under the
   row, opened by the hamburger; the row is logo | utilities | burger.

   The header does NOT pick the mode by a fixed breakpoint. An inline script
   in header.php (window.hkFitHeader, re-run by navigation.js on resize and
   once the web fonts land) measures the FULL row and switches to COMPACT
   whenever it would not fit with 24px to spare, and always at 860px and
   below. Longer menus, Icelandic labels or an extra utility can therefore
   never push the cart or the switchers off screen; they only bring the
   hamburger in a little earlier. Without JS the full row shows (a
   hamburger needs JS anyway).
   ========================================================================= */
.site-header.is-compact .site-header__inner {
	flex-wrap: wrap;
	gap: 0.5rem 0.75rem;
}
/* The nav's children join the header row directly: the burger sits in the
   top row, the panel drops to a full-width row of its own below. */
.site-header.is-compact .main-navigation { display: contents; }
.site-header.is-compact .site-branding { order: 1; }
.site-header.is-compact .site-utilities { order: 2; margin-left: auto; }
.site-header.is-compact .hk-menu-toggle { display: inline-flex; order: 3; margin-right: -0.5rem; }

/* In the FULL row the panel wrapper is transparent to the flex layout and
   the panel-only extras (switchers + contact copy) stay hidden. */
.hk-menu-panel { display: contents; }
.hk-menu-extras { display: none; }

.site-header.is-compact .hk-menu-panel {
	display: none;
	order: 4;
	flex-basis: 100%;
	border-top: 1px solid var(--hk-line);
	padding: 0.25rem 0 0.75rem;
}
.site-header.is-compact .main-navigation.is-open .hk-menu-panel { display: block; }

.site-header.is-compact .hk-menu {
	flex-direction: column;
	align-items: stretch;
	gap: 0;
}
.site-header.is-compact .hk-menu li { border-bottom: 1px solid var(--hk-line); }
.site-header.is-compact .hk-menu li:last-child { border-bottom: 0; }
.site-header.is-compact .hk-menu a { padding: 0.85rem 0.25rem; font-size: 1rem; }
/* Parent items with sub-menus: the link keeps navigating, a chevron button
   (injected by navigation.js) beside it toggles the sub-menu, which is
   CLOSED by default and stacks inline under the row when opened. */
.site-header.is-compact .hk-menu li.menu-item-has-children {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
}
.site-header.is-compact .hk-menu li.menu-item-has-children > a { flex: 1 1 auto; }
.site-header.is-compact .hk-menu .menu-item-has-children > a::after { display: none; } /* the button carries the chevron */
.hk-submenu-toggle { display: none; } /* desktop: hover dropdowns, no toggles */
.site-header.is-compact .hk-submenu-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 52px;
	height: 44px;
	margin-right: -0.5rem;
	border: 0;
	background: none;
	color: var(--hk-ink);
	cursor: pointer;
}
.hk-submenu-toggle svg { display: block; transition: transform 0.2s ease; }
.hk-submenu-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.hk-submenu-toggle[aria-expanded="true"] { color: var(--hk-brand); }
.hk-submenu-toggle:focus-visible { outline: 2px solid var(--hk-brand); outline-offset: -4px; border-radius: 4px; }
.site-header.is-compact .hk-menu .sub-menu {
	display: none;
	flex-basis: 100%;
	position: static;
	opacity: 1;
	visibility: visible;
	transform: none;
	box-shadow: none;
	border: 0;
	border-top: 1px solid var(--hk-line);
	padding: 0 0 0 1rem;
	min-width: 0;
	background: none;
}
.site-header.is-compact .hk-menu li.is-open > .sub-menu { display: block; }
.site-header.is-compact .hk-menu .sub-menu a {
	padding: 0.75rem 0.25rem;
	font-size: 0.9375rem;
	color: var(--hk-ink-soft);
}

/* ---- Sizes by viewport (always COMPACT at these widths) ------------------ */
@media (max-width: 860px) {
	.site-header__inner {
		min-height: 64px;
		padding-block: 0.6rem;
	}
	.site-branding img,
	.site-branding .custom-logo { height: 38px; }

	/* The contact block keeps all three lines (Opening hours / phone /
	   Stores) down to 641px; there is room for them next to the burger. */
	.site-utilities { gap: 0.5rem; }
	.site-utilities .hk-contact { margin-right: 0.5rem; }
}

/* Phones: the row keeps logo / search / cart / burger. The contact block
   and the currency + language switchers move into the hamburger panel
   (header.php renders a second copy there) instead of disappearing. */
@media (max-width: 640px) {
	.site-utilities > .hk-contact,
	.site-utilities > .hk-currency,
	.site-utilities > .hk-language { display: none; }
	.site-branding img,
	.site-branding .custom-logo { height: 34px; }
	/* No contact block left in the row: centre the icons on the logo instead
	   of the desktop's bottom alignment on the Stores line. */
	.site-utilities { align-items: center; gap: 0.25rem; }
	.site-utilities > .hk-iconbtn,
	.site-utilities > .hk-switcher { margin-bottom: 0; }

	.site-header.is-compact .main-navigation.is-open .hk-menu-extras { display: block; }
	/* The extras continue the menu list: a cyan hairline (like the header's
	   own) separates them, then Opening hours / phone / Stores as rows in
	   the menu's typography, then Currency and Language as two boxed
	   selectors with small captions. */
	.hk-menu-extras {
		border-top: 1px solid var(--hk-brand);
		margin-top: 0.5rem;
	}
	.hk-menu-extras .hk-contact {
		display: flex;
		flex-direction: column;
		align-items: stretch;
		margin: 0;
		font-size: 1rem;
		line-height: 1.2;
	}
	.hk-menu-extras .hk-contact > * {
		display: flex;
		align-items: center;
		gap: 0.6rem;
		padding: 0.85rem 0.25rem;
		border-bottom: 1px solid var(--hk-line);
		font-family: "Nexa", var(--hk-font);
		font-size: 1rem;
		color: var(--hk-brand);
		text-decoration: none;
	}
	.hk-menu-extras .hk-contact > *:hover { text-decoration: none; color: var(--hk-brand-dark); }
	.hk-menu-extras .hk-contact__phone .hk-icon--phone {
		position: static;
		transform: none;
		width: 16px;
		height: 16px;
	}
	/* Currency + language: one more row in the same voice as the rows above
	   (Nexa regular, menu size, cyan), the two values side by side with a
	   small caret each. No box, no caption. */
	.hk-menu-extras__switchers {
		display: flex;
		align-items: center;
		gap: 2rem;
		padding: 0.85rem 0.25rem;
	}
	.hk-menu-extras .hk-switcher { position: relative; }
	.hk-menu-extras .hk-switcher__btn {
		padding: 0;
		border: 0;
		border-radius: 0;
		background: none;
		gap: 0.45rem;
		font-family: "Nexa", var(--hk-font);
		font-weight: 400;
		font-size: 1rem;
		line-height: 1.2;
		color: var(--hk-brand);
	}
	.hk-menu-extras .hk-switcher__btn .hk-switcher__symbol { font-weight: 400; }
	.hk-menu-extras .hk-switcher__btn .hk-caret { border-top-color: currentColor; margin-top: 2px; }
	.hk-menu-extras .hk-switcher__btn:hover,
	.hk-menu-extras .hk-switcher__btn[aria-expanded="true"] { color: var(--hk-brand-dark); }
	.hk-menu-extras .hk-switcher__menu { left: -0.6rem; right: auto; top: calc(100% + 10px); min-width: 150px; }
	.hk-menu-extras .hk-switcher__menu a {
		font-family: "Nexa", var(--hk-font);
		font-weight: 400;
		font-size: 1rem;
		color: var(--hk-ink);
	}
	.hk-menu-extras .hk-switcher__menu .hk-switcher__symbol { font-weight: 400; }
}
