/*
 * The bar backgrounds stay full-bleed while their contents line up with the 1248px column the
 * footer and every section use. Below 1440 the gutter wins; above it, the extra space is split.
 */
.nordemo-header__topbar,
.nordemo-header__bar {
	padding-inline: max( var(--nordemo-gutter), calc( ( 100% - var(--nordemo-content-max) ) / 2 ) );
}

.nordemo-header__topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding-block: 4px;
	background: var(--nordemo-primary);
}

.nordemo-header__contact {
	display: flex;
	align-items: center;
	gap: 40px;
}

/* The design spaces the phone number with a leading space in the string; a gap does it properly. */
.nordemo-header__contact-item {
	display: flex;
	align-items: center;
	gap: 2px;
	font-size: 14px;
	font-weight: 500;
	line-height: normal;
	color: var(--nordemo-on-primary);
	text-decoration: none;
}

.nordemo-header__contact-item--mail {
	gap: 4px;
}

.nordemo-header__contact-icon {
	flex: none;
	display: block;
	width: 18px;
	height: 18px;
}

.nordemo-header__topbar-nav {
	display: flex;
	align-items: center;
	gap: 40px;
}

.nordemo-header__topbar-link {
	font-size: 14px;
	font-weight: 500;
	line-height: normal;
	color: var(--nordemo-on-primary);
	text-decoration: none;
}

.nordemo-header__contact-item:hover,
.nordemo-header__topbar-link:hover {
	text-decoration: underline;
}

.nordemo-header__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding-block: 16px;
	background: var(--nordemo-surface);
	/* Figma strokes sit inside the frame. An inset shadow keeps the designed box height. */
	box-shadow: inset 0 -1px 0 #dde4ed;
}

.nordemo-header__logo {
	display: block;
	flex: none;
}

.nordemo-header__logo img {
	display: block;
	width: auto;
	height: 48px;
}

.nordemo-header__nav {
	display: flex;
	align-items: center;
	gap: 32px;
}

.nordemo-header__nav-link {
	font-size: 18px;
	font-weight: 500;
	line-height: normal;
	color: var(--nordemo-primary);
	text-decoration: none;
}

.nordemo-header__nav-link:hover {
	color: var(--nordemo-primary-hover);
	text-decoration: underline;
}

.nordemo-header__cta {
	position: relative;
}

.nordemo-header__cta-button {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 2px;
	padding: 12px 8px 12px 18px;
	font-family: inherit;
	font-size: 18px;
	font-weight: 500;
	line-height: normal;
	color: var(--nordemo-primary);
	text-align: center;
	background: var(--nordemo-surface);
	border: 0;
	border-radius: var(--nordemo-radius);
	box-shadow: inset 0 0 0 1px var(--nordemo-primary);
	cursor: pointer;
}

.nordemo-header__cta-button:hover {
	color: var(--nordemo-primary-hover);
	box-shadow: inset 0 0 0 1px var(--nordemo-primary-hover);
}

.nordemo-header__cta-menu {
	position: absolute;
	top: calc(100% + 4px);
	right: 0;
	z-index: 10;
	display: flex;
	flex-direction: column;
	min-width: 100%;
	padding: 8px 25px;
	background: var(--nordemo-surface);
	/* Same dark ring as the button that opens it. */
	border: 1px solid var(--nordemo-primary);
	border-radius: 16px;
}

.nordemo-header__cta-menu[hidden] {
	display: none;
}

/*
 * The dropdown and the drawer share .nordemo-header__submenu-link so their contents cannot drift
 * apart; the modifiers carry only the differing metrics. Hairlines separate rows, never lead them.
 */
.nordemo-header__submenu-link {
	display: flex;
	align-items: center;
	gap: 10px;
	color: var(--nordemo-primary);
	text-decoration: none;
}

.nordemo-header__submenu-link--desktop {
	padding: 13px 0;
	font-size: 18px;
	line-height: 25px;
	white-space: nowrap;
}

.nordemo-header__submenu-link--desktop + .nordemo-header__submenu-link--desktop {
	box-shadow: inset 0 1px 0 #dde4ed;
}

.nordemo-header__submenu-link:hover {
	color: var(--nordemo-primary-hover);
	text-decoration: underline;
}

.nordemo-header__submenu-icon {
	flex: none;
	display: block;
	width: 22px;
	height: 22px;
}

.nordemo-header__submenu-external {
	flex: none;
	display: block;
	width: 16px;
	height: 16px;
}

.nordemo-header__toggle,
.nordemo-header__drawer {
	display: none;
}

.nordemo-menu-open {
	overflow: hidden;
}

.nordemo-header :focus-visible {
	outline: 2px solid var(--nordemo-primary);
	outline-offset: 2px;
}

.nordemo-header__topbar :focus-visible {
	outline-color: var(--nordemo-on-primary);
}

@media (max-width: 991px) {
	.nordemo-header__topbar {
		height: 12px;
		padding: 0;
	}

	.nordemo-header__contact,
	.nordemo-header__topbar-nav,
	.nordemo-header__nav {
		display: none;
	}

	.nordemo-header__bar {
		padding: 10px var(--nordemo-gutter);
		border-bottom: 0;
	}

	.nordemo-header__logo img {
		height: 30px;
	}

	.nordemo-header__toggle {
		display: block;
		padding: 0;
		color: var(--nordemo-primary);
		background: none;
		border: 0;
		cursor: pointer;
	}

	/* The hamburger becomes a cross while the drawer is open. */
	.nordemo-header__toggle-close {
		display: none;
	}

	.nordemo-header__toggle[aria-expanded='true'] .nordemo-header__toggle-open {
		display: none;
	}

	.nordemo-header__toggle[aria-expanded='true'] .nordemo-header__toggle-close {
		display: block;
	}

	/* Open menu takes over the viewport: the header becomes the full-height flex column. */
	.nordemo-header--open {
		position: fixed;
		inset: 0;
		z-index: 100;
		display: flex;
		flex-direction: column;
	}

	.nordemo-header__drawer {
		display: flex;
		flex: 1;
		flex-direction: column;
		min-height: 0;
	}

	.nordemo-header__drawer[hidden] {
		display: none;
	}

	.nordemo-header__panel {
		display: flex;
		flex: 1;
		flex-direction: column;
		justify-content: space-between;
		gap: 20px;
		padding: 8px 24px 22px;
		overflow-y: auto;
		background: var(--nordemo-surface);
	}

	.nordemo-header__panel-menu {
		display: flex;
		flex-direction: column;
		gap: 20px;
		margin: 0;
		padding: 0 0 20px;
		list-style: none;
		border-bottom: 1px solid #eaeae9;
	}

	.nordemo-header__panel-item {
		padding-top: 20px;
		border-top: 1px solid #eaeae9;
	}

	/* The bar already draws a line under itself; a second one right below it reads as double. */
	/* Only the line is dropped — the row keeps its spacing so it does not ride up under the bar. */
	.nordemo-header__panel-item:first-child {
		border-top: 0;
	}

	.nordemo-header__panel-link,
	.nordemo-header__panel-toggle {
		width: 100%;
		font-family: inherit;
		font-size: 18px;
		font-weight: 500;
		line-height: normal;
		color: var(--nordemo-primary);
		text-align: left;
		text-decoration: none;
	}

	.nordemo-header__panel-link {
		display: block;
	}

	.nordemo-header__panel-toggle {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0;
		background: none;
		border: 0;
		cursor: pointer;
	}

	.nordemo-header__panel-toggle[aria-expanded='true'] .nordemo-icon--chevron {
		transform: rotate(180deg);
	}

	.nordemo-header__submenu {
		display: flex;
		flex-direction: column;
		gap: 14px;
		margin: 20px 0 0;
		padding: 0 8px;
		list-style: none;
	}

	.nordemo-header__submenu[hidden] {
		display: none;
	}

	.nordemo-header__submenu li + li {
		padding-top: 14px;
		border-top: 1px solid #eaeae9;
	}

	/* Everything else comes from the shared .nordemo-header__submenu-link rule. */
	.nordemo-header__submenu-link {
		font-size: 16px;
		line-height: 25px;
	}

	.nordemo-header__panel-secondary {
		display: flex;
		flex-direction: column;
		gap: 14px;
	}

	.nordemo-header__panel-secondary-link {
		font-size: 16px;
		line-height: normal;
		color: var(--nordemo-primary);
		text-decoration: none;
	}

	.nordemo-header__panel-link:hover,
	.nordemo-header__panel-toggle:hover,
	.nordemo-header__submenu-link:hover,
	.nordemo-header__panel-secondary-link:hover {
		color: var(--nordemo-primary-hover);
		text-decoration: underline;
	}

	.nordemo-header__drawer-contact {
		display: flex;
		flex: none;
		flex-direction: column;
		justify-content: center;
		gap: 11px;
		padding: 12px 24px;
		background: var(--nordemo-primary);
	}

	.nordemo-header__drawer-contact .nordemo-header__contact-item {
		gap: 4px;
	}

	.nordemo-header__drawer-contact :focus-visible {
		outline-color: var(--nordemo-on-primary);
	}
}
