/* blue.works Hex Menu
 * Settings are injected as CSS variables on .bwhex (see class-frontend.php).
 * Defaults here keep the menu usable if the inline style is missing. */

.bwhex {
	--hex-max-w: 1320px;
	--hex-h: 78px;
	--hex-h-compact: 60px;
	--hex-top: 22px;
	--hex-top-compact: 12px;
	--hex-opacity: .82;
	--hex-blur: 14px;
	--hex-grad-from: #dfe3e9;
	--hex-grad-to: #ffffff;
	--hex-grad-angle: 90deg;
	--hex-text: #12366b;
	--hex-fw-top: 500;
	--hex-fw-sub: 500;
	--hex-accent: #1D57A5;
	--hex-logo: #1D57A5;
	--hex-logo-h: 44px;
	--hex-logo-h-compact: 36px;
	--hex-logo-pad: .2;
	--hex-sub-w: 460px;
	--hex-z: 1000;
	--hex-ease: cubic-bezier(.2, .7, .2, 1);

	/* current state */
	--cur-h: var(--hex-h);
	--cur-top: var(--hex-top);
	--cur-logo: var(--hex-logo-h);

	position: fixed;
	top: var(--cur-top);
	left: 50%;
	transform: translateX(-50%);
	width: min(var(--hex-max-w), calc(100% - 48px));
	height: var(--cur-h);
	z-index: var(--hex-z);
	font-family: inherit;
	line-height: 1.3;
	color: var(--hex-text);
	transition: top .45s var(--hex-ease), height .45s var(--hex-ease);
}
.bwhex.is-compact {
	--cur-h: var(--hex-h-compact);
	--cur-top: var(--hex-top-compact);
	--cur-logo: var(--hex-logo-h-compact);
}
.bwhex.is-mobile {
	--cur-h: min(var(--hex-h), 64px);
	--cur-top: min(var(--hex-top), 12px);
	--cur-logo: min(var(--hex-logo-h), 36px);
	width: calc(100% - 24px);
}
.bwhex.is-mobile.is-compact {
	--cur-h: min(var(--hex-h-compact), 56px);
	--cur-top: min(var(--hex-top-compact), 8px);
	--cur-logo: min(var(--hex-logo-h-compact), 32px);
}

/* WordPress admin bar */
body.admin-bar .bwhex { top: calc(var(--cur-top) + 32px); }
@media (max-width: 782px) {
	body.admin-bar .bwhex { top: calc(var(--cur-top) + 46px); }
}
@media (max-width: 600px) { /* admin bar scrolls away here */
	body.admin-bar .bwhex.is-compact { top: var(--cur-top); }
}

/* resets against theme styles */
.bwhex *, .bwhex *::before, .bwhex *::after { box-sizing: border-box; }
.bwhex ul, .bwhex li { list-style: none; margin: 0; padding: 0; }
.bwhex a, .bwhex a:hover, .bwhex a:focus { text-decoration: none; }
.bwhex svg { max-width: none; }
.bwhex button {
	font: inherit; color: inherit; background: none; border: 0; margin: 0;
	cursor: pointer; -webkit-appearance: none; appearance: none;
}
.bwhex :focus-visible { outline: 2px solid var(--hex-accent); outline-offset: 2px; border-radius: 6px; }

/* ───────── bar shape ─────────
 * Three stacked layers, all clipped to --hex-bar-clip (a rounded polygon
 * generated in PHP). The polygon uses cqh units and .bwhex is a size
 * container, so the pointed ends follow the height animation in pure CSS.
 *   shadow – blurred dark copy of the shape, offset downwards
 *   glass  – backdrop blur (not in Safari, see the end of this file)
 *   bg     – translucent gray→white gradient */
.bwhex { container-type: size; }
.bwhex__shadow, .bwhex__glass, .bwhex__bg, .bwhex__border { position: absolute; inset: 0; pointer-events: none; }
/* thin outline along the hexagon (ring polygon), so the bar stands out on light pages */
.bwhex__border { background: var(--hex-border-color, rgba(0, 48, 87, .18)); clip-path: var(--hex-bar-ring, none); }
.bwhex__shadow { filter: blur(12px); opacity: .2; transform: translateY(9px); }
.bwhex__shadow > i,
.bwhex__glass,
.bwhex__bg { clip-path: var(--hex-bar-clip); }
.bwhex__shadow > i { position: absolute; inset: 0; background: #0a2350; }
.bwhex__glass {
	-webkit-backdrop-filter: blur(var(--hex-blur)) saturate(140%);
	backdrop-filter: blur(var(--hex-blur)) saturate(140%);
}
.bwhex__bg {
	background: linear-gradient(var(--hex-grad-angle),
		color-mix(in srgb, var(--hex-grad-from) calc(var(--hex-opacity) * 100%), transparent),
		color-mix(in srgb, var(--hex-grad-to) calc(var(--hex-opacity) * 100%), transparent));
}

.bwhex__inner {
	position: relative;
	height: 100%;
	display: flex;
	align-items: center;
	padding-left: calc(var(--cur-h) * var(--hex-logo-pad));
	padding-right: calc(var(--cur-h) * .29 + 12px);
	transition: padding .45s var(--hex-ease);
}

/* ───────── logo ─────────
 * Animated with transform/opacity/clip only (no layout per frame):
 * the logo keeps its full size in layout and is scaled down when compact. */
.bwhex { --logo-base: var(--hex-logo-h); --logo-scale: var(--hex-logo-scale, .818); }
.bwhex.is-mobile { --logo-base: min(var(--hex-logo-h), 36px); --logo-scale: var(--hex-logo-scale-m, .889); }
.bwhex__logo {
	display: flex; align-items: center;
	height: var(--logo-base);
	color: var(--hex-logo);
	flex-shrink: 0;
	transform-origin: left center;
	transition: transform .45s var(--hex-ease);
	will-change: transform;
}
.bwhex.is-compact .bwhex__logo { transform: scale(var(--logo-scale)); }
.bwhex__mark { height: 100%; width: auto; aspect-ratio: 146.2 / 130.5; display: block; }
.bwhex__word-wrap {
	display: block;
	height: 100%;
	opacity: 1;
	clip-path: inset(0 0 0 0);
	transition: clip-path .45s var(--hex-ease), opacity .3s ease;
}
.bwhex__word { height: 100%; width: auto; aspect-ratio: 656 / 131; display: block; padding-left: 7px; }
.bwhex.is-compact .bwhex__word-wrap { opacity: 0; clip-path: inset(0 100% 0 0); pointer-events: none; }
/* layout measurement in JS: no transitions while classes are swapped */
.bwhex.is-measuring, .bwhex.is-measuring * { transition: none !important; }
/* not enough room for the full logo next to the menu: hexagon only */
.bwhex.is-tight .bwhex__word-wrap { display: none; }

/* ───────── desktop nav ───────── */
.bwhex .bwhex__nav { margin-left: auto; display: flex; align-items: center; }
.bwhex .bwhex__list { display: flex; flex-direction: row; flex-wrap: nowrap; gap: 6px; align-items: center; }
.bwhex .bwhex__item { position: relative; display: block; }
.bwhex .bwhex__link {
	display: flex; align-items: center; gap: 6px;
	padding: 10px 14px;
	color: var(--hex-text);
	font-size: var(--hex-fs-top, 16px);
	font-weight: var(--hex-fw-top);
	letter-spacing: .1px;
	white-space: nowrap;
	position: relative;
	transition: color .2s;
}
.bwhex .bwhex__link::after {
	content: ""; position: absolute; left: 14px; right: 14px; bottom: 5px;
	height: 2px; background: var(--hex-accent);
	transform: scaleX(0); transform-origin: left;
	transition: transform .25s var(--hex-ease);
}
.bwhex .bwhex__link:hover, .bwhex .bwhex__link.is-active { color: var(--hex-accent); }
.bwhex .bwhex__link:hover::after, .bwhex .bwhex__link.is-active::after { transform: scaleX(1); }
.bwhex .has-sub > .bwhex__link::after { right: 30px; }

.bwhex__chev { width: 10px; height: 10px; flex-shrink: 0; transition: transform .25s var(--hex-ease); }
.bwhex__sub-toggle { display: none; }

.bwhex__extra { display: flex; align-items: center; margin-left: 10px; }

/* language switcher */
.bwhex .bwhex__lang { display: flex; align-items: center; gap: 4px; margin-left: 10px; }
.bwhex .bwhex__lang-link {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 6px;
	color: var(--hex-text); font-size: 13px; font-weight: 600; letter-spacing: .4px;
	background: none; border: 0; box-shadow: none; opacity: 1;
}
.bwhex .bwhex__lang-link:hover, .bwhex .bwhex__lang-link.is-current { color: var(--hex-accent); }
.bwhex .bwhex__lang-link:focus:not(:focus-visible) { outline: none; }
/* flags are shown exactly as WPML provides them */
.bwhex .bwhex__lang-flag { display: block; max-width: none; }

@media (max-width: 1100px) {
	.bwhex:not(.is-mobile) .bwhex__link { padding: 10px; }
	.bwhex:not(.is-mobile) .bwhex__link::after { left: 10px; right: 10px; }
	.bwhex:not(.is-mobile) .has-sub > .bwhex__link::after { right: 26px; }
}

/* ───────── dropdown ───────── */
.bwhex__sub {
	position: absolute;
	left: -14px;
	top: calc(50% + var(--cur-h) / 2 + 12px); /* 12px below the bar */
	width: var(--hex-sub-w);
	max-width: calc(100vw - 32px);
	opacity: 0; visibility: hidden;
	transform: translateY(-8px);
	transition: opacity .22s ease, transform .3s var(--hex-ease), visibility 0s linear .3s, top .45s var(--hex-ease);
}
.bwhex__sub.is-flipped { left: auto; right: -14px; }
.bwhex__sub::before { /* hover bridge across the gap */
	content: ""; position: absolute; left: 0; right: 0; top: -40px; height: 40px;
}
.bwhex:not(.is-mobile) .has-sub:hover > .bwhex__sub,
.bwhex:not(.is-mobile) .has-sub:focus-within > .bwhex__sub,
.bwhex:not(.is-mobile) .has-sub.is-open > .bwhex__sub {
	opacity: 1; visibility: visible; transform: none;
	transition: opacity .22s ease, transform .3s var(--hex-ease), visibility 0s, top .45s var(--hex-ease);
}
.bwhex:not(.is-mobile) .has-sub:hover .bwhex__chev,
.bwhex:not(.is-mobile) .has-sub:focus-within .bwhex__chev,
.bwhex:not(.is-mobile) .has-sub.is-open .bwhex__chev { transform: rotate(180deg); }

/* Escape pressed: keep closed while still hovered/focused */
.bwhex:not(.is-mobile) .has-sub.is-dismissed > .bwhex__sub {
	opacity: 0; visibility: hidden; transform: translateY(-8px);
}
.bwhex:not(.is-mobile) .has-sub.is-dismissed .bwhex__chev { transform: none; }

.bwhex__sub-shadow { position: absolute; inset: 0; filter: blur(14px); opacity: .22; transform: translateY(10px); pointer-events: none; }
.bwhex__sub-shadow > i { position: absolute; inset: 0; background: #0a2350; clip-path: var(--hex-cut-clip); }
.bwhex__sub-panel {
	position: relative;
	clip-path: var(--hex-cut-clip);
	padding: 14px;
	-webkit-backdrop-filter: blur(var(--hex-blur)) saturate(140%);
	backdrop-filter: blur(var(--hex-blur)) saturate(140%);
}
.bwhex__sub-panel::after {
	content: ""; position: absolute; inset: 0; pointer-events: none;
	background: var(--hex-border-color, rgba(0, 48, 87, .18));
	clip-path: var(--hex-cut-ring, none);
}
.bwhex__sub-panel::before {
	content: ""; position: absolute; inset: 0; z-index: -1;
	background: linear-gradient(135deg, var(--hex-grad-from), var(--hex-grad-to));
	opacity: var(--hex-opacity);
}
.bwhex .bwhex__sub-link {
	display: grid; grid-template-columns: 34px 1fr; gap: 2px 12px; align-items: center;
	padding: 12px 14px; border-radius: 10px;
	color: var(--hex-text);
	transition: background .2s;
}
.bwhex .bwhex__sub-link:hover { background: color-mix(in srgb, var(--hex-accent) 8%, transparent); }
.bwhex__sub-icon {
	grid-row: span 2; justify-self: center;
	width: 18px; height: 22px;
	color: var(--hex-accent); opacity: .85;
	transition: transform .25s var(--hex-ease), opacity .2s;
}
.bwhex .bwhex__sub-link:hover .bwhex__sub-icon { transform: translateX(4px); opacity: 1; }
.bwhex__sub-title { font-size: var(--hex-fs-sub, 15.5px); font-weight: var(--hex-fw-sub); }
.bwhex .bwhex__sub-link:hover .bwhex__sub-title,
.bwhex .bwhex__sub-link.is-active .bwhex__sub-title { color: var(--hex-accent); }
.bwhex__sub-desc { grid-column: 2; font-size: var(--hex-fs-desc, 13px); font-weight: 400; color: #5b6b82; line-height: 1.4; }
.bwhex__sub-foot {
	margin: 8px 6px 2px; padding: 12px 10px 4px;
	border-top: 1px solid rgba(15, 42, 82, .1);
	display: flex; justify-content: space-between; align-items: center; gap: 12px;
	font-size: 13px; color: #5b6b82;
}
.bwhex .bwhex__sub-foot a { display: inline-flex; align-items: center; color: var(--hex-accent); font-size: 14px; font-weight: 500; white-space: nowrap; }
.bwhex .bwhex__sub-foot a:hover { text-decoration: underline; }
.bwhex__foot-arrow { width: 9px; height: 11px; margin-left: 6px; transition: transform .25s var(--hex-ease); }
.bwhex .bwhex__sub-foot a:hover .bwhex__foot-arrow { transform: translateX(3px); }

/* ───────── burger ───────── */
.bwhex .bwhex__burger { display: none; margin-left: auto; margin-right: -6px; padding: 10px; }
.bwhex__burger span {
	display: block; width: 24px; height: 2px; margin: 5px 0;
	background: var(--hex-text); border-radius: 2px;
	transition: transform .3s var(--hex-ease), opacity .2s;
}
.bwhex.is-menu-open .bwhex__burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.bwhex.is-menu-open .bwhex__burger span:nth-child(2) { opacity: 0; }
.bwhex.is-menu-open .bwhex__burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.bwhex__drawer-shadow { display: none; }

/* ───────── mobile drawer ───────── */
.bwhex.is-mobile .bwhex__burger { display: block; }

.bwhex.is-mobile .bwhex__nav,
.bwhex.is-mobile .bwhex__drawer-shadow {
	position: absolute; left: 0; right: 0;
	top: calc(100% + 10px);
	opacity: 0; visibility: hidden;
	transform: translateY(-8px);
	transition: opacity .22s ease, transform .3s var(--hex-ease), visibility 0s linear .3s;
}
.bwhex.is-mobile .bwhex__nav {
	display: block;
	margin: 0;
	padding: 14px 14px 18px;
	max-height: calc(100vh - var(--cur-h) - var(--cur-top) - 32px);
	max-height: calc(100dvh - var(--cur-h) - var(--cur-top) - 32px);
	overflow-y: auto;
	overscroll-behavior: contain;
	background: linear-gradient(var(--hex-grad-angle),
		color-mix(in srgb, var(--hex-grad-from) calc(var(--hex-opacity) * 100%), transparent),
		color-mix(in srgb, var(--hex-grad-to) calc(var(--hex-opacity) * 100%), transparent));
	-webkit-backdrop-filter: blur(var(--hex-blur)) saturate(140%);
	backdrop-filter: blur(var(--hex-blur)) saturate(140%);
	clip-path: var(--hex-cut-clip);
}
.bwhex.is-mobile .bwhex__drawer-shadow { display: block; filter: blur(14px); pointer-events: none; }
.bwhex.is-mobile .bwhex__drawer-shadow > i { position: absolute; inset: 0; background: #0a2350; opacity: .22; transform: translateY(10px); clip-path: var(--hex-cut-clip); }
.bwhex.is-mobile.is-menu-open .bwhex__nav,
.bwhex.is-mobile.is-menu-open .bwhex__drawer-shadow {
	opacity: 1; visibility: visible; transform: none;
	transition: opacity .22s ease, transform .3s var(--hex-ease), visibility 0s;
}

.bwhex.is-mobile .bwhex__list { display: block; }
.bwhex.is-mobile .bwhex__item {
	display: grid; grid-template-columns: 1fr auto; align-items: center;
	border-bottom: 1px solid rgba(15, 42, 82, .08);
}
.bwhex.is-mobile .bwhex__item:last-child { border-bottom: 0; }
.bwhex.is-mobile .bwhex__link { font-size: var(--hex-fs-m, 17px); padding: 14px 10px; white-space: normal; }
.bwhex.is-mobile .bwhex__sub-title { font-size: var(--hex-fs-m-sub, var(--hex-fs-sub, 15.5px)); }
.bwhex.is-mobile .bwhex__link::after { display: none; }
.bwhex.is-mobile .bwhex__chev { display: none; }
.bwhex.is-mobile .bwhex__sub-toggle {
	display: flex; align-items: center; justify-content: center;
	width: 44px; height: 44px; border-radius: 10px; color: var(--hex-text);
}
.bwhex.is-mobile .bwhex__sub-toggle svg { width: 12px; height: 12px; transition: transform .25s var(--hex-ease); }
.bwhex.is-mobile .has-sub.is-open .bwhex__sub-toggle svg { transform: rotate(180deg); }

.bwhex.is-mobile .bwhex__sub {
	grid-column: 1 / -1;
	position: static;
	width: auto; max-width: none;
	opacity: 1; visibility: visible; transform: none;
	display: none;
	transition: none;
}
.bwhex.is-mobile .has-sub.is-open > .bwhex__sub { display: block; }
.bwhex.is-mobile .bwhex__sub::before,
.bwhex.is-mobile .bwhex__sub-shadow,
.bwhex.is-mobile .bwhex__sub-panel::before,
.bwhex.is-mobile .bwhex__sub-panel::after { display: none; }
.bwhex.is-mobile .bwhex__sub-panel {
	padding: 0 0 10px;
	clip-path: none;
	-webkit-backdrop-filter: none; backdrop-filter: none;
}
.bwhex.is-mobile .bwhex__sub-link { padding: 10px; grid-template-columns: 26px 1fr; }
.bwhex.is-mobile .bwhex__sub-foot { margin: 4px 4px 0; }
.bwhex.is-mobile .bwhex__lang { margin: 10px 0 0; padding: 12px 4px 0; border-top: 1px solid rgba(15, 42, 82, .08); gap: 8px; }
.bwhex.is-mobile .bwhex__lang-link { padding: 8px; font-size: 14px; }
.bwhex.is-mobile .bwhex__extra { margin: 10px 0 0; padding: 12px 10px 0; border-top: 1px solid rgba(15, 42, 82, .08); }

/* ───────── Safari / WebKit ─────────
 * WebKit ignores clip-path and mask for backdrop-filter and blurs the whole
 * rectangle, so shaped panels get no blur there and a higher opacity instead.
 * .is-webkit is set by the inline script right after the header markup. */
.bwhex.is-webkit { --hex-opacity: var(--hex-opacity-safari, .94); }
.bwhex.is-webkit .bwhex__glass,
.bwhex.is-webkit .bwhex__sub-panel,
.bwhex.is-webkit.is-mobile .bwhex__nav {
	-webkit-backdrop-filter: none !important;
	backdrop-filter: none !important;
}

@media (prefers-reduced-motion: reduce) {
	.bwhex, .bwhex * { transition: none !important; }
}
