/**
 * Vibrant Site Header - Frontend Styles
 *
 * Mobile first. The desktop header (topbar + horizontal menu) starts at
 * 1024px, the same breakpoint the hero and CTA blocks use, so the whole site
 * switches to its desktop layout at one width.
 *
 * @author  Accent - https://accentinteractive.nl
 * @package Vibrant
 * @since   1.0.0
 */

/* ==========================================================================
   Header
   ========================================================================== */

.wp-block-vibrant-site-header {
	/* Colors – theme presets with the design system as fallback. */
	--vb-sh-bg: var(--wp--preset--color--cream-50, #FBF9F3);
	--vb-sh-topbar-bg: #F0EDE4;
	--vb-sh-border: var(--wp--preset--color--green-200, #DFE5E0);
	--vb-sh-divider: #C5C9C6;
	--vb-sh-text: var(--wp--preset--color--green-900, #1D261F);
	--vb-sh-text-muted: var(--wp--preset--color--green-700, #525F55);
	--vb-sh-accent: var(--wp--preset--color--terracotta, #A23E2B);
	--vb-sh-mark-bg: var(--wp--preset--color--green-800, #2B4231);
	--vb-sh-mark-icon: var(--wp--preset--color--white, #FFFFFF);

	/* Typography */
	--vb-sh-font-display: var(--wp--preset--font-family--fraunces, "Fraunces", Georgia, serif);
	--vb-sh-font-body: var(--wp--preset--font-family--sora, "Sora", sans-serif);

	/* Layout */
	--vb-sh-max-width: 1280px;
	--vb-sh-gutter: 20px;
	--vb-sh-mark-size: 48px;

	box-sizing: border-box;
	background: var(--vb-sh-bg);
	border-bottom: 1px solid var(--vb-sh-border);
	color: var(--vb-sh-text);
}

.wp-block-vibrant-site-header *,
.wp-block-vibrant-site-header *::before,
.wp-block-vibrant-site-header *::after {
	box-sizing: border-box;
}

/* ==========================================================================
   Skip link
   ==========================================================================
   WCAG 2.4.1. Off screen until focused, then a normal looking button at the
   top left, so it is obvious what happened. */

.wp-block-vibrant-site-header .vb-site-header__skip-link {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 1001;
	padding: 12px 20px;
	background: var(--vb-sh-mark-bg);
	border-radius: 0 0 12px 0;
	font-family: var(--vb-sh-font-body);
	font-weight: 700;
	font-size: 0.875rem;
	line-height: 1.3;
	color: var(--vb-sh-mark-icon);
	text-decoration: none;
	transform: translateY(-100%);
}

.wp-block-vibrant-site-header .vb-site-header__skip-link:focus {
	transform: translateY(0);
}

/* ==========================================================================
   Focus visibility
   ==========================================================================
   WCAG 2.4.7 and 1.4.11. One ring for everything in the header, terracotta
   on cream is 6.1:1 and on white 6.4:1, so it clears the 3:1 for a focus
   indicator. Colour or underline changes alone are too easy to miss. */

.wp-block-vibrant-site-header a:focus-visible,
.wp-block-vibrant-site-header button:focus-visible,
.vb-drawer a:focus-visible,
.vb-drawer button:focus-visible {
	outline: 2px solid var(--vb-sh-accent);
	outline-offset: 2px;
}

/* The burger and the drawer close button sit on a filled shape, where the
   ring needs to clear their own background rather than the page. */
.wp-block-vibrant-site-header .vb-site-header__burger:focus-visible,
.vb-drawer .vb-drawer__close:focus-visible {
	outline-color: var(--vb-sh-text);
	outline-offset: 3px;
}

/*
 * The skip link is dark green, where terracotta would not stand out. White
 * on that green is 10.9:1, so it keeps its own ring. Placed after the shared
 * rule so it wins on equal specificity.
 */
.wp-block-vibrant-site-header .vb-site-header__skip-link:focus,
.wp-block-vibrant-site-header .vb-site-header__skip-link:focus-visible {
	outline: 2px solid var(--wp--preset--color--white, #FFFFFF);
	outline-offset: -4px;
}

/* ==========================================================================
   Utility topbar
   ========================================================================== */

/* Hidden on mobile; those links live in the drawer there. */
.vb-site-header__topbar {
	display: none;
	padding-inline: var(--vb-sh-gutter);
	background: var(--vb-sh-topbar-bg);
	border-bottom: 1px solid var(--vb-sh-border);
}

.vb-site-header__topbar-inner {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	min-height: 40px;
	max-width: var(--vb-sh-max-width);
	margin-inline: auto;
}

.vb-site-header__topbar-items {
	display: flex;
	align-items: center;
	gap: 24px;
}

/* Every item gets a hairline in front of it. */
.vb-site-header__topbar-items > * {
	position: relative;
}

.vb-site-header__topbar-items > *::before {
	content: "";
	position: absolute;
	top: 50%;
	left: -12px;
	width: 1px;
	height: 16px;
	background: var(--vb-sh-divider);
	transform: translateY(-50%);
}

.wp-block-vibrant-site-header .vb-site-header__topbar-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-family: var(--vb-sh-font-body);
	font-weight: 600;
	font-size: 0.75rem;
	line-height: 1.25;
	color: var(--vb-sh-text);
	text-decoration: none;
	box-shadow: none;
}

.wp-block-vibrant-site-header .vb-site-header__topbar-link:hover,
.wp-block-vibrant-site-header .vb-site-header__topbar-link:focus-visible {
	color: var(--vb-sh-accent);
	text-decoration: underline;
}

.vb-site-header__topbar-icon {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 13px;
	height: 13px;
	color: var(--vb-sh-text-muted);
}

.vb-site-header__topbar-icon svg {
	display: block;
	width: 100%;
	height: 100%;
}

/* Language selector. */
.vb-site-header__language {
	position: relative;
}

.wp-block-vibrant-site-header .vb-site-header__language-toggle {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	margin: 0;
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: 0;
	font-family: var(--vb-sh-font-body);
	font-weight: 600;
	font-size: 0.75rem;
	line-height: 1.25;
	color: var(--vb-sh-text);
	text-decoration: none;
	box-shadow: none;
	cursor: pointer;
}

.wp-block-vibrant-site-header .vb-site-header__language-toggle:hover,
.wp-block-vibrant-site-header .vb-site-header__language-toggle:focus-visible {
	background: transparent;
	color: var(--vb-sh-accent);
}

.vb-site-header__language.is-open .vb-site-header__chevron {
	transform: rotate(180deg);
}

/* Dropdown. */
.vb-site-header__language-list {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	z-index: 20;
	min-width: 180px;
	margin: 0;
	padding: 6px;
	list-style: none;
	background: var(--wp--preset--color--white, #FFFFFF);
	border: 1px solid var(--vb-sh-border);
	border-radius: 12px;
	box-shadow: var(--wp--preset--shadow--medium, 0 8px 16px rgba(0, 0, 0, 0.06));
}

.vb-site-header__language-list li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.wp-block-vibrant-site-header .vb-site-header__language-option {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	margin: 0;
	padding: 8px 10px;
	background: transparent;
	border: 0;
	border-radius: 8px;
	font-family: var(--vb-sh-font-body);
	font-weight: 600;
	font-size: 0.8125rem;
	line-height: 1.3;
	color: var(--vb-sh-text);
	text-align: left;
	cursor: pointer;
}

.wp-block-vibrant-site-header .vb-site-header__language-option:hover,
.wp-block-vibrant-site-header .vb-site-header__language-option:focus-visible {
	background: var(--wp--preset--color--green-100, #E5ECE6);
	color: var(--vb-sh-text);
}

.wp-block-vibrant-site-header .vb-site-header__language-option[aria-current="true"] {
	color: var(--vb-sh-accent);
}

/* Google's own widget stays out of sight; we drive it from our dropdown. */
.vb-site-header__gt-holder {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
}

/* The wrapper clips the flag, so the flag SVGs stay plain rectangles. */
.vb-site-header__flag {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 13px;
	overflow: hidden;
	border-radius: 2px;
	box-shadow: inset 0 0 0 1px rgba(29, 38, 31, 0.12);
}

.vb-site-header__flag svg {
	display: block;
	width: 18px;
	height: 13px;
}

/* An unknown code has no flag; keep the row aligned anyway. */
.vb-site-header__flag:empty,
.vb-site-header__language-option .vb-site-header__flag:not(:has(svg)) {
	box-shadow: none;
}

.vb-site-header__chevron {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 9px;
	height: 6px;
	transition: transform 0.2s ease;
}

.vb-site-header__chevron svg {
	display: block;
	width: 100%;
	height: 100%;
}

/* ==========================================================================
   Main row
   ========================================================================== */

.vb-site-header__main {
	padding: 16px var(--vb-sh-gutter);
}

.vb-site-header__main-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	max-width: var(--vb-sh-max-width);
	margin-inline: auto;
}

/* Logo. */
.wp-block-vibrant-site-header .vb-site-header__logo {
	display: inline-flex;
	flex: 0 1 auto;
	align-items: center;
	gap: 12px;
	min-width: 0;
	color: inherit;
	text-decoration: none;
	box-shadow: none;
}

.vb-site-header__logo-mark {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: var(--vb-sh-mark-size);
	height: var(--vb-sh-mark-size);
	background: var(--vb-sh-mark-bg);
	border-radius: 50%;
	color: var(--vb-sh-mark-icon);
}

.vb-site-header__logo-mark svg {
	display: block;
	width: 28px;
	height: 28px;
}

.vb-site-header__logo-text {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
	min-width: 0;
}

.vb-site-header__logo-title {
	display: block;
	font-family: var(--vb-sh-font-display);
	font-weight: 900;
	font-size: 1.25rem;
	line-height: 1.25;
	letter-spacing: 0;
	color: var(--vb-sh-text);
}

.vb-site-header__logo-subtitle {
	display: block;
	font-family: var(--vb-sh-font-body);
	font-weight: 700;
	font-size: 0.75rem;
	line-height: 1.25;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--vb-sh-accent);
}

.vb-site-header__logo-image {
	display: block;
	width: auto;
	max-width: 100%;
	max-height: 56px;
	height: auto;
}

/* ==========================================================================
   Navigation slot
   ========================================================================== */

.vb-site-header__nav {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: flex-end;
	gap: 16px;
}

/* The horizontal menu is desktop only; below that the drawer takes over. */
.vb-site-header__nav .wp-block-navigation {
	display: none;
}

.vb-site-header__nav .wp-block-navigation__container,
.vb-site-header__nav .wp-block-page-list {
	gap: 32px;
}

.wp-block-vibrant-site-header .vb-site-header__nav .wp-block-navigation-item__content {
	font-family: var(--vb-sh-font-body);
	font-weight: 600;
	font-size: 0.9375rem;
	line-height: 1.27;
	color: var(--vb-sh-text);
	text-decoration: none;
}

.wp-block-vibrant-site-header .vb-site-header__nav .wp-block-navigation-item__content:hover,
.wp-block-vibrant-site-header .vb-site-header__nav .wp-block-navigation-item__content:focus-visible {
	color: var(--vb-sh-accent);
}

/*
 * The header builds its own drawer from the desktop menu, so the separate
 * mobile drawer block is not needed here any more. Any leftover instance is
 * hidden rather than left to show a second hamburger. Safe to delete the
 * block from the header.
 */
.vb-site-header__nav .wp-block-vibrant-mobile-drawer {
	display: none !important;
}

/* ==========================================================================
   Hamburger
   ========================================================================== */

.wp-block-vibrant-site-header .vb-site-header__burger {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 10px;
	background: var(--vb-sh-mark-bg);
	border: 0;
	border-radius: 8px;
	color: var(--vb-sh-mark-icon);
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.wp-block-vibrant-site-header .vb-site-header__burger:hover,
.wp-block-vibrant-site-header .vb-site-header__burger:focus-visible {
	background: var(--vb-sh-accent);
	color: var(--vb-sh-mark-icon);
}

.wp-block-vibrant-site-header .vb-site-header__burger:focus-visible {
	outline: 2px solid var(--vb-sh-accent);
	outline-offset: 2px;
}

.vb-site-header__burger-icon {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	width: 18px;
	height: 14px;
}

.vb-site-header__burger-icon span {
	display: block;
	width: 100%;
	height: 2px;
	background: currentColor;
	border-radius: 1px;
}

/* ==========================================================================
   Drawer
   ========================================================================== */

/* Stops the page behind the drawer from scrolling. */
html.vb-drawer-is-open {
	overflow: hidden;
}

.vb-drawer {
	position: fixed;
	inset: 0;
	z-index: 1000;
}

.vb-drawer[hidden] {
	display: none;
}

.vb-drawer__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(29, 38, 31, 0.4);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.vb-drawer.is-open .vb-drawer__backdrop {
	opacity: 1;
}

.vb-drawer__sheet {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	width: min(360px, 88vw);
	background: var(--vb-sh-bg);
	box-shadow: -8px 0 32px rgba(29, 38, 31, 0.16);
	transform: translateX(100%);
	transition: transform 0.25s ease;
}

.vb-drawer.is-open .vb-drawer__sheet {
	transform: translateX(0);
}

.vb-drawer__sheet:focus {
	outline: none;
}

.vb-drawer__header {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 20px;
	border-bottom: 1px solid var(--vb-sh-border);
}

.vb-drawer__close {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	background: var(--wp--preset--color--green-100, #E5ECE6);
	border: 0;
	border-radius: 50%;
	color: var(--vb-sh-text);
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.vb-drawer__close:hover,
.vb-drawer__close:focus-visible {
	background: var(--vb-sh-accent);
	color: var(--wp--preset--color--white, #FFFFFF);
}

.vb-drawer__close svg {
	display: block;
	fill: currentColor;
}

.vb-drawer__body {
	flex: 1 1 auto;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	padding: 12px 12px 32px;
}

/* ==========================================================================
   Drawer menu
   ========================================================================== */

.vb-drawer__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.vb-drawer__item {
	margin: 0;
	padding: 0;
	list-style: none;
}

.vb-drawer__row {
	display: flex;
	align-items: center;
	gap: 4px;
}

.wp-block-vibrant-site-header .vb-drawer__link {
	display: flex;
	flex: 1 1 auto;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	width: 100%;
	min-height: 48px;
	margin: 0;
	padding: 12px;
	background: transparent;
	border: 0;
	border-radius: 12px;
	font-family: var(--vb-sh-font-body);
	font-weight: 600;
	font-size: 0.9375rem;
	line-height: 1.3;
	color: var(--vb-sh-text);
	text-align: left;
	text-decoration: none;
	box-shadow: none;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.wp-block-vibrant-site-header .vb-drawer__link:hover,
.wp-block-vibrant-site-header .vb-drawer__link:focus-visible {
	background: var(--wp--preset--color--green-100, #E5ECE6);
	color: var(--vb-sh-text);
}

/* The separate toggle next to a parent that also links somewhere. */
.wp-block-vibrant-site-header .vb-drawer__toggle {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: 12px;
	color: var(--vb-sh-text-muted);
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.wp-block-vibrant-site-header .vb-drawer__toggle:hover,
.wp-block-vibrant-site-header .vb-drawer__toggle:focus-visible {
	background: var(--wp--preset--color--green-100, #E5ECE6);
	color: var(--vb-sh-text);
}

.vb-drawer__chevron {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 12px;
	height: 8px;
	transition: transform 0.2s ease;
}

.vb-drawer__chevron svg {
	display: block;
	width: 100%;
	height: 100%;
}

.vb-drawer__item.is-open > .vb-drawer__row > .vb-drawer__toggle .vb-drawer__chevron,
.vb-drawer__item.is-open > .vb-drawer__link--toggle .vb-drawer__chevron {
	transform: rotate(180deg);
}

/* Submenu, one step in with a guide line. */
.vb-drawer__panel {
	margin: 2px 0 6px 12px;
	padding-left: 10px;
	border-left: 2px solid var(--vb-sh-border);
}

.vb-drawer__panel[hidden] {
	display: none;
}

.wp-block-vibrant-site-header .vb-drawer__panel .vb-drawer__link {
	min-height: 44px;
	font-weight: 400;
	font-size: 0.875rem;
	color: var(--vb-sh-text-muted);
}

.wp-block-vibrant-site-header .vb-drawer__panel .vb-drawer__link:hover,
.wp-block-vibrant-site-header .vb-drawer__panel .vb-drawer__link:focus-visible {
	color: var(--vb-sh-text);
}

/* ==========================================================================
   Drawer utility block
   ========================================================================== */

.vb-drawer__utility {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin-top: 20px;
	padding-top: 20px;
	border-top: 1px solid var(--vb-sh-border);
}

.wp-block-vibrant-site-header .vb-drawer__utility-link {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	padding: 10px 12px;
	border-radius: 12px;
	font-family: var(--vb-sh-font-body);
	font-weight: 600;
	font-size: 0.875rem;
	line-height: 1.3;
	color: var(--vb-sh-text);
	text-decoration: none;
	box-shadow: none;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.wp-block-vibrant-site-header .vb-drawer__utility-link:hover,
.wp-block-vibrant-site-header .vb-drawer__utility-link:focus-visible {
	background: var(--wp--preset--color--green-100, #E5ECE6);
	color: var(--vb-sh-text);
}

.vb-drawer__utility-icon {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	color: var(--vb-sh-text-muted);
}

.vb-drawer__utility-icon svg {
	display: block;
	width: 100%;
	height: 100%;
}

/* Languages as a wrapping set of chips. */
.vb-drawer__languages {
	margin-top: 12px;
	padding: 0 12px;
}

.vb-drawer__languages-title {
	margin: 0 0 8px;
	font-family: var(--vb-sh-font-body);
	font-weight: 700;
	font-size: 0.6875rem;
	line-height: 1.27;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--vb-sh-text-muted);
}

.vb-drawer__languages-list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.wp-block-vibrant-site-header .vb-drawer__language {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	background: var(--wp--preset--color--white, #FFFFFF);
	border: 1px solid var(--vb-sh-border);
	border-radius: 100px;
	font-family: var(--vb-sh-font-body);
	font-weight: 600;
	font-size: 0.8125rem;
	line-height: 1.3;
	color: var(--vb-sh-text);
	cursor: pointer;
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.wp-block-vibrant-site-header .vb-drawer__language:hover,
.wp-block-vibrant-site-header .vb-drawer__language:focus-visible {
	background: var(--wp--preset--color--green-100, #E5ECE6);
}

.wp-block-vibrant-site-header .vb-drawer__language[aria-current="true"] {
	border-color: var(--vb-sh-accent);
	color: var(--vb-sh-accent);
}

@media (prefers-reduced-motion: reduce) {

	.vb-drawer__backdrop,
	.vb-drawer__sheet,
	.vb-drawer__chevron,
	.wp-block-vibrant-site-header .vb-drawer__link,
	.wp-block-vibrant-site-header .vb-drawer__toggle,
	.wp-block-vibrant-site-header .vb-site-header__burger {
		transition: none;
	}
}

/* ==========================================================================
   Google Translate clean-up
   ==========================================================================
   Google injects a banner iframe and pushes the page down. We drive the
   widget ourselves, so all of that is suppressed. */

.skiptranslate iframe {
	display: none !important;
}

body {
	top: 0 !important;
}

#goog-gt-tt,
.goog-te-balloon-frame {
	display: none !important;
}

/* Language names keep their own language. */
.vb-site-header__language-list,
.vb-site-header__language-label {
	unicode-bidi: isolate;
}

/* Screen reader helper, local so the block does not depend on the theme. */
.wp-block-vibrant-site-header .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	border: 0;
	white-space: nowrap;
}

/* ==========================================================================
   Desktop
   ========================================================================== */

@media (min-width: 1024px) {

	.wp-block-vibrant-site-header {
		--vb-sh-gutter: clamp(24px, 5.5vw, 80px);
	}

	.vb-site-header__topbar {
		display: block;
	}

	.vb-site-header__main {
		padding-top: 24px;
		padding-bottom: 24px;
	}

	.vb-site-header__nav .wp-block-navigation {
		display: flex;
	}

	.wp-block-vibrant-site-header .vb-site-header__burger {
		display: none;
	}

	.vb-drawer {
		display: none;
	}
}
