/*
 * Site header — two layouts from one markup tree.
 *
 * .site-header--sidebar : front page. Fixed vertical rail on desktop; content
 *                         is offset by body.myco-has-sidebar.
 * .site-header--bar     : every other page. Classic fixed horizontal bar.
 *
 * Below 1024px BOTH collapse to the same fixed top bar + slide-in panel.
 */

.site-header {
	position: fixed;
	z-index: var(--myco-z-header);
	top: 0;
	right: 0;
	left: 0;
	background: var(--myco-color-white);
	box-shadow: var(--myco-shadow-soft);
}

.site-header a {
	text-decoration: none;
}

.site-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	max-width: var(--myco-container-wide);
	min-height: var(--myco-header-height);
	margin: 0 auto;
	padding: 0 var(--myco-space-lg);
	gap: var(--myco-space-md);
}

/* Offset for the fixed bar; desktop sidebar mode resets it. */
body {
	padding-top: var(--myco-header-height);
}

/* ---------- Branding ---------- */

.site-header__logo {
	display: block;
	line-height: 0;
}

.site-header__logo img,
.site-header__logo .custom-logo {
	display: block;
	width: auto;
	max-width: 170px;
	height: auto;
}

/* ---------- Toggle (hamburger) ---------- */

.site-header__toggle {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	padding: 0;
	border: 0;
	background: none;
	color: var(--myco-color-heading);
	cursor: pointer;
}

/* Without JS the panel is never gated, so hide the toggle and let nav flow. */
html:not(.js) .site-header__toggle {
	display: none;
}

.site-header__toggle-bars,
.site-header__toggle-bars::before,
.site-header__toggle-bars::after {
	display: block;
	width: 1.35rem;
	height: 2px;
	background: currentColor;
	transition: transform var(--myco-transition), background var(--myco-transition);
}

.site-header__toggle-bars::before,
.site-header__toggle-bars::after {
	position: absolute;
	content: "";
}

.site-header__toggle-bars::before {
	transform: translateY(-0.45rem);
}

.site-header__toggle-bars::after {
	transform: translateY(0.45rem);
}

.site-header__toggle[aria-expanded="true"] .site-header__toggle-bars {
	background: transparent;
}

.site-header__toggle[aria-expanded="true"] .site-header__toggle-bars::before {
	transform: rotate(45deg);
}

.site-header__toggle[aria-expanded="true"] .site-header__toggle-bars::after {
	transform: rotate(-45deg);
}

/* ---------- Nav panel (mobile) ---------- */

html.js .site-header__nav {
	position: fixed;
	z-index: var(--myco-z-menu);
	top: var(--myco-header-height);
	right: 0;
	bottom: 0;
	left: 0;
	display: flex;
	overflow-y: auto;
	flex-direction: column;
	gap: var(--myco-space-xl);
	padding: var(--myco-space-xl) var(--myco-space-lg);
	background: var(--myco-color-white);
	transform: translateX(-100%);
	transition: transform var(--myco-transition), visibility 0s linear var(--myco-transition);
	visibility: hidden;
}

html.js .site-header__nav.is-open {
	transform: translateX(0);
	transition: transform var(--myco-transition), visibility 0s linear 0s;
	visibility: visible;
}

.site-header__menu {
	display: flex;
	flex-direction: column;
	gap: var(--myco-space-xs);
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-header__menu a {
	display: block;
	padding: var(--myco-space-sm) 0;
	border-bottom: 1px solid var(--myco-color-border);
	color: var(--myco-color-heading);
	font-family: var(--myco-font-sans);
	font-size: var(--myco-font-size-lg);
	font-weight: 400;
	letter-spacing: 0.02em;
	transition: color var(--myco-transition);
}

.site-header__menu a:hover,
.site-header__menu a:focus-visible,
.site-header__menu .current-menu-item > a,
.site-header__menu .current_page_item > a {
	color: var(--myco-color-primary);
}

/* Nested submenu (depth 2). */
.site-header__menu .sub-menu {
	margin: 0;
	padding: 0 0 0 var(--myco-space-md);
	list-style: none;
}

.site-header__menu .sub-menu a {
	font-size: var(--myco-font-size-base);
}

/* ---------- Header phone ---------- */

.site-header__phone {
	display: inline-flex;
	align-items: center;
	gap: var(--myco-space-xs);
	color: var(--myco-color-heading);
	font-family: var(--myco-font-sans);
	font-size: var(--myco-font-size-sm);
	white-space: nowrap;
	transition: color var(--myco-transition);
}

.site-header__phone:hover,
.site-header__phone:focus-visible {
	color: var(--myco-color-primary);
}

.site-header__phone svg {
	width: 1rem;
	height: 1rem;
	color: var(--myco-color-primary);
}

/* ---------- Social ---------- */

.site-header__social {
	display: none;
}

.site-header__social-list {
	display: flex;
	gap: var(--myco-space-md);
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-header__social-list a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--myco-color-muted);
	transition: color var(--myco-transition);
}

.site-header__social-list a:hover,
.site-header__social-list a:focus-visible {
	color: var(--myco-color-primary);
}

.site-header__social-list svg {
	width: 1rem;
	height: 1rem;
}

body.has-open-menu {
	overflow: hidden;
}

/* ==========================================================================
   DESKTOP (>= 1024px)
   ========================================================================== */

@media (min-width: 1024px) {

	body.has-open-menu {
		overflow: auto;
	}

	.site-header__toggle {
		display: none;
	}

	html.js .site-header__nav,
	.site-header__nav {
		position: static;
		overflow: visible;
		padding: 0;
		background: none;
		transform: none;
		visibility: visible;
	}

	.site-header__menu a {
		padding: 0;
		border-bottom: 0;
		font-size: var(--myco-font-size-base);
	}

	.site-header__social {
		display: block;
	}

	/* ----- Classic bar (inner pages) ----- */

	.site-header--bar .site-header__nav {
		display: flex;
		flex: 1 1 auto;
		flex-direction: row;
		align-items: center;
		justify-content: flex-end;
		gap: var(--myco-space-xl);
	}

	.site-header--bar .site-header__menu {
		flex-direction: row;
		align-items: center;
		gap: var(--myco-space-xl);
	}

	/* Keep the phone inline with the menu rather than wrapping below it. */
	.site-header--bar .site-header__nav-contact {
		flex: 0 0 auto;
		order: 1;
	}

	.site-header--bar .site-header__menu .sub-menu {
		position: absolute;
		display: none;
		min-width: 14rem;
		padding: var(--myco-space-sm) var(--myco-space-md);
		background: var(--myco-color-white);
		box-shadow: var(--myco-shadow-card);
	}

	.site-header--bar .site-header__menu li:hover > .sub-menu,
	.site-header--bar .site-header__menu li:focus-within > .sub-menu {
		display: block;
	}

	.site-header--bar .site-header__social {
		padding-left: var(--myco-space-lg);
		border-left: 1px solid var(--myco-color-border);
	}

	/* ----- Fixed sidebar rail (front page) ----- */

	body.myco-has-sidebar {
		padding-top: 0;
	}

	.site-header--sidebar {
		right: auto;
		bottom: 0;
		width: var(--myco-sidebar-width);
	}

	.site-header--sidebar .site-header__inner {
		flex-direction: column;
		align-items: flex-start;
		justify-content: space-between;
		height: 100%;
		max-width: none;
		padding: var(--myco-space-2xl) var(--myco-space-xl);
	}

	.site-header--sidebar .site-header__nav {
		display: flex;
		flex: 1 1 auto;
		flex-direction: column;
		justify-content: center;
		width: 100%;
		gap: var(--myco-space-xl);
	}

	.site-header--sidebar .site-header__menu {
		gap: var(--myco-space-md);
	}

	.site-header--sidebar .site-header__menu a::before {
		display: inline-block;
		width: 0;
		height: 1px;
		margin-right: 0;
		background: var(--myco-color-primary);
		content: "";
		transition: width var(--myco-transition), margin-right var(--myco-transition);
		vertical-align: middle;
	}

	.site-header--sidebar .site-header__menu a:hover::before,
	.site-header--sidebar .site-header__menu a:focus-visible::before,
	.site-header--sidebar .site-header__menu .current-menu-item > a::before {
		width: 1.15rem;
		margin-right: var(--myco-space-xs);
	}

	.site-header--sidebar .site-header__social {
		width: 100%;
	}

	/* Push page content clear of the rail. */
	body.myco-has-sidebar .site-main,
	body.myco-has-sidebar .site-footer {
		margin-left: var(--myco-sidebar-width);
	}
}
