/* Site header and phone menu (functions/header.php).
 *
 * Desktop keeps the parent theme's look: the wrappers below use
 * display:contents so the logo, menu and search sit exactly where they did.
 * Phones (up to 991.98px, the parent's breakpoint) get a menu button and the
 * same <nav> as a full-height sheet.
 */

:root {
	--aduk-header-ink: #313139;
	--aduk-header-paper: var(--bgcolor-expanded-panel, #fff);
	--aduk-header-line: rgba(49, 49, 57, .1);
	--aduk-header-accent: #8b491f;
	--aduk-header-speed: .18s;
}

.aduk-header .aduk-menu,
.aduk-header .aduk-header__tools {
	display: contents;
}

.aduk-header .aduk-menu__foot,
.aduk-header .aduk-menu-toggle {
	display: none;
}

/* Language switcher: a native <details>. */
.aduk-lang {
	position: relative;
	color: inherit;
}

.aduk-lang__toggle {
	display: flex;
	align-items: center;
	gap: 7px;
	min-height: 44px;
	padding: 0 4px;
	cursor: pointer;
	list-style: none;
	color: inherit;
	font-size: 16px;
	line-height: 1;
}

.aduk-lang__toggle::-webkit-details-marker {
	display: none;
}

.aduk-lang__toggle:focus-visible,
.aduk-menu-toggle:focus-visible,
.aduk-menu__social a:focus-visible,
.aduk-lang__link:focus-visible {
	outline: 2px solid var(--aduk-header-accent);
	outline-offset: 2px;
}

.aduk-lang__globe {
	flex: none;
}

.aduk-lang__list {
	position: absolute;
	z-index: 2;
	min-width: 180px;
	margin: 0;
	padding: 6px 0;
	list-style: none;
	background: var(--aduk-header-paper);
	border: 1px solid var(--aduk-header-line);
	box-shadow: 0 10px 30px rgba(0, 0, 0, .08);
}

.aduk-lang--bar {
	margin-left: 12px;
}

.aduk-lang--bar .aduk-lang__list {
	top: 100%;
	right: 0;
}

.aduk-lang--sheet .aduk-lang__list {
	bottom: 100%;
	left: 0;
	margin-bottom: 6px;
}

.aduk-lang__link {
	display: block;
	padding: 10px 16px;
	color: var(--aduk-header-ink);
	font-size: 17px;
	line-height: 1.2;
	text-decoration: none;
}

.aduk-lang__link:hover,
.aduk-lang__link[aria-current] {
	color: var(--aduk-header-accent);
}

@media (max-width: 991.98px) {
	/* Header row: logo, search, language (when the sheet is closed), menu button. */
	.aduk-header .navi-logo,
	.aduk-header .aduk-header__tools,
	.aduk-header .aduk-menu-toggle {
		position: relative;
		z-index: 2;
	}

	.aduk-header .aduk-header__tools {
		display: flex;
		align-items: center;
	}

	.aduk-header .aduk-header__tools .aduk-lang {
		display: none;
	}

	.aduk-header .aduk-menu-toggle {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 44px;
		height: 44px;
		margin: 0 -11px 0 0;
		padding: 0;
		border: 0;
		background: none;
		color: var(--aduk-header-ink);
		cursor: pointer;
		-webkit-tap-highlight-color: transparent;
	}

	.aduk-menu-toggle__icon {
		position: relative;
		display: block;
		width: 20px;
		height: 14px;
	}

	.aduk-menu-toggle__icon span {
		position: absolute;
		left: 0;
		width: 100%;
		height: 1.5px;
		background: currentColor;
		transition: transform var(--aduk-header-speed) ease, opacity var(--aduk-header-speed) ease;
	}

	.aduk-menu-toggle__icon span:nth-child(1) { top: 0; }
	.aduk-menu-toggle__icon span:nth-child(2) { top: 6.25px; }
	.aduk-menu-toggle__icon span:nth-child(3) { top: 12.5px; }

	.aduk-menu-open .aduk-menu-toggle__icon span:nth-child(1) { transform: translateY(6.25px) rotate(45deg); }
	.aduk-menu-open .aduk-menu-toggle__icon span:nth-child(2) { opacity: 0; }
	.aduk-menu-open .aduk-menu-toggle__icon span:nth-child(3) { transform: translateY(-6.25px) rotate(-45deg); }

	/* The sheet: same <nav>, fixed under the header row, never taller than the visible viewport. */
	#header .aduk-menu {
		position: fixed;
		z-index: 1;
		inset: 0;
		display: flex;
		flex-direction: column;
		height: 100vh;
		height: 100dvh;
		padding: calc(var(--header-height-mobile, 55px) + 8px) 20px env(safe-area-inset-bottom, 0px);
		overflow-y: auto;
		overscroll-behavior: contain;
		background: var(--aduk-header-paper);
		visibility: hidden;
		opacity: 0;
		transform: translateY(-8px);
		transition: opacity var(--aduk-header-speed) ease, transform var(--aduk-header-speed) ease, visibility 0s linear var(--aduk-header-speed);
	}

	.aduk-menu-open #header .aduk-menu {
		visibility: visible;
		opacity: 1;
		transform: none;
		transition-delay: 0s;
	}

	#header .aduk-menu .navi-header {
		display: block;
		margin: 0;
	}

	#header .aduk-menu .navi-header .menu {
		margin: 0;
		padding: 0;
	}

	#header .aduk-menu .navi-header .menu > li {
		display: block;
		float: none;
		margin: 0;
		line-height: 1;
		border-bottom: 1px solid var(--aduk-header-line);
	}

	#header .aduk-menu .navi-header .menu > li > a {
		display: block;
		padding: 16px 0;
		color: var(--aduk-header-ink);
		font-size: 34px;
		line-height: 1.05;
		letter-spacing: -.015em;
	}

	#header .aduk-menu .navi-header .menu > li.hire-chat-button > a,
	#header .aduk-menu .navi-header .menu > li.current-menu-item > a {
		color: var(--aduk-header-accent);
	}

	#header .aduk-menu .navi-header .sub-menu {
		position: static;
		display: block;
		visibility: visible;
		opacity: 1;
		margin: 0 0 12px;
		padding: 0;
		background: none;
		box-shadow: none;
		transform: none;
	}

	#header .aduk-menu .navi-header .sub-menu a {
		display: block;
		padding: 8px 0;
		font-size: 20px;
	}

	#header .aduk-menu__foot {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 16px;
		margin-top: auto;
		padding: 14px 0 18px;
		border-top: 1px solid var(--aduk-header-line);
		color: var(--aduk-header-ink);
		font-size: 16px;
	}

	.aduk-menu__social {
		display: flex;
		gap: 20px;
		margin: 0 0 0 auto;
		padding: 0;
		list-style: none;
	}

	.aduk-menu__social a {
		display: flex;
		align-items: center;
		min-height: 44px;
		color: inherit;
		text-decoration: none;
	}

	/* Open: plain header row on the sheet, default logo even on pages with a light logo over art. */
	.aduk-menu-open #header {
		background: var(--aduk-header-paper);
	}

	.aduk-menu-open #header .logo-image-alt,
	.aduk-menu-open #header .logo-image-alt-mobile {
		display: none !important;
	}

	.aduk-menu-open #header .logo-image-default {
		display: block !important;
		opacity: 1 !important;
	}

	html.aduk-menu-open,
	html.aduk-menu-open body {
		overflow: hidden;
	}

	/* Back on scroll up: the header pins to the top while scrolling up, slides away going down. */
	#header.aduk-header--pinned {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		background: var(--aduk-header-paper);
		box-shadow: 0 1px 0 var(--aduk-header-line);
		transition: transform var(--aduk-header-speed) ease;
	}

	#header.aduk-header--pinned.aduk-header--away {
		transform: translateY(-100%);
	}

	#header.aduk-header--pinned .logo-image-alt,
	#header.aduk-header--pinned .logo-image-alt-mobile {
		display: none !important;
	}

	#header.aduk-header--pinned .logo-image-default {
		display: block !important;
		opacity: 1 !important;
	}
}

@media (min-width: 992px) {
	.aduk-header .aduk-header__tools .aduk-lang__toggle {
		font-size: inherit;
	}
}

@media (prefers-reduced-motion: reduce) {
	#header .aduk-menu,
	#header.aduk-header--pinned,
	.aduk-menu-toggle__icon span {
		transition: none !important;
	}

	#header .aduk-menu {
		transform: none;
	}
}
