@use 'sass:math';
@use '@ongov/ontario-design-system-global-styles/dist/styles/scss/1-variables/global.variables' as globalVariables;
@use '@ongov/ontario-design-system-global-styles/dist/styles/scss/1-variables/spacing.variables' as spacing;
@use '@ongov/ontario-design-system-global-styles/dist/styles/scss/1-variables/colours.variables' as colours;
@use '@ongov/ontario-design-system-global-styles/dist/styles/scss/1-variables/breakpoints.variables' as breakpoints;
@use '@ongov/ontario-design-system-global-styles/dist/styles/scss/1-variables/fonts.variables' as fonts;
@use '@ongov/ontario-design-system-global-styles/dist/styles/scss/1-variables/z-index.variables' as zIndex;
@use '@ongov/ontario-design-system-global-styles/dist/styles/scss/2-tools/functions/global.functions' as globalFunctions;
@use '@ongov/ontario-design-system-global-styles/dist/styles/scss/1-variables/font-weights.variables' as fontWeights;
@use '@ongov/ontario-design-system-global-styles/dist/styles/scss/1-variables/typography.variables';

.ontario-header.ontario-application-header {
	height: 3.125rem;
	z-index: 5;
}

.ontario-application-header__logo,
.ontario-application-header__logo a,
.ontario-application-header__lang-toggle,
.ontario-application-subheader__container,
.ontario-application-subheader__menu-container,
.ontario-application-subheader__menu {
	display: flex;
}

.ontario-application-header__logo img {
	width: globalFunctions.px-to-rem(100);
	height: globalFunctions.px-to-rem(25);
}

.ontario-application-header__lang-toggle {
	justify-content: flex-end;

	a {
		font-size: globalFunctions.px-to-rem(16);
		line-height: globalFunctions.px-to-rem(22);
		height: auto;
		padding: spacing.$spacing-2 spacing.$spacing-3;
	}
}

.ontario-application-subheader {
	padding: (spacing.$spacing-2 + spacing.$spacing-3) 0;
	background-color: darken(colours.$ontario-colour-white, 75);
	overflow: hidden;
	position: relative;
	z-index: 5;

	@media screen and (min-width: breakpoints.$medium-breakpoint) {
		z-index: zIndex.$ontario-z-index-neutral;
	}

	& > .ontario-row {
		position: relative;
	}
}

.ontario-application-subheader .ontario-header-button {
	display: flex;
}

.ontario-application-subheader .ontario-header-button {
	background-color: colours.$ontario-greyscale-70;

	.ontario-icon {
		width: 2rem;
		height: 2rem;
		margin-bottom: spacing.$spacing-0;
	}

	&:hover {
		background-color: colours.$ontario-greyscale-60;
	}

	&:active {
		background-color: colours.$ontario-colour-black;
	}
}

.ontario-application-subheader__heading {
	padding: math.div(spacing.$spacing-3, 2) spacing.$spacing-0;
	@extend %h4-styles;
	margin-bottom: spacing.$spacing-0;
	max-width: 65%;

	a {
		color: colours.$ontario-colour-white;
		font-weight: fontWeights.$ontario-font-weights-semi-bold;
		text-decoration: none;

		&:hover,
		&:active,
		&:visited {
			color: colours.$ontario-colour-white;
			text-decoration: underline;
		}
	}
}

.ontario-application-subheader__container {
	align-items: center;
	justify-content: space-between;
}

.ontario-application-subheader__menu {
	list-style: none;
	margin: spacing.$spacing-0;
	padding-left: spacing.$spacing-0;
	align-items: center;
}

.ontario-application-subheader__menu li {
	padding: spacing.$spacing-0;
	margin-left: spacing.$spacing-4;
}

.ontario-application-subheader__menu a {
	border-radius: globalVariables.$global-radius;
	color: colours.$ontario-colour-white;
	display: block;
	font-family: fonts.$ontario-font-open-sans;
	font-size: globalFunctions.px-to-rem(18);
	font-weight: fontWeights.$ontario-font-weights-semi-bold;
	height: globalVariables.$standard-input-height;
	line-height: globalFunctions.px-to-rem(23);
	padding: spacing.$spacing-3;
	text-decoration: none;
	white-space: nowrap;

	&.ontario-link--active {
		border-radius: globalVariables.$global-radius globalVariables.$global-radius 0 0;
		border-bottom: globalFunctions.px-to-rem(4) solid colours.$ontario-colour-white;
	}

	&:hover {
		color: colours.$ontario-colour-white;
		background-color: colours.$ontario-greyscale-60;
	}

	&:active {
		color: colours.$ontario-colour-white;
		background-color: colours.$ontario-colour-black;
	}
}

.ontario-overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	background: rgba(0, 0, 0, 0.6);
	width: 100%;
	height: 100%;
	z-index: zIndex.$ontario-z-index-behind-high;
}

.ontario-navigation--open {
	.ontario-application-subheader .ontario-header-button:first-of-type {
		display: none;
	}

	.ontario-application-subheader .ontario-header-button:last-of-type {
		display: flex;
	}

	@media screen and (max-width: breakpoints.$medium-breakpoint) {
		.ontario-application-subheader-menu__container {
			position: relative;
			z-index: 3;
		}
	}

	.ontario-overlay {
		display: block;

		@media screen and (min-width: breakpoints.$medium-breakpoint) {
			display: none;
		}
	}
}

.ontario-application-subheader__menu-container .ontario-header__menu-toggle {
	margin-left: spacing.$spacing-4;
}
