$desktop-gray-header-height: 90px;
$mobile-top-links-height: 2rem;

body.has-header-background #header {
	background-position-x: 30%;
	background-size: contain;
	@media($max-mobile-viewport) {
		background-image: none;
	}
}

div#top {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	@media ($min-desktop-viewport) {
		padding-right: $nav-menu-side * 1.5;
	}
	@media ($min-desktop-viewport) {
		height: $desktop-gray-header-height;
	}
}

h1#logo.has-logo {
	padding: 10px 0;
	flex-grow: 1;
}

#toplinks {
	position: static;
	display: flex;
	align-items: center;
	word-spacing: 1em;

	@media ($max-mobile-viewport) {
		order: -1;
		min-height: 2em;
		flex: 1 0 100%;
		max-width: none;
		margin: 0 -0.7rem;
		padding: 0 0.7rem;
	}

	@media($min-desktop-viewport) {
		height: $nav-menu-side;
		padding: 0.5em 1.5em;
		border-radius: $nav-menu-side / 2;
	}

	a {
		color: $orange-dark;
		&:first-child {
			font-weight: bold;
		}
	}
}

.site-nav {
	position: fixed;
	width: 100%;
	z-index: 102;
}

.gru-nav-wrapper {
	@extend .page-width;
	position: relative;
	@media ($max-mobile-viewport) {
		max-width: none;
	}
}

#nav {
	margin: 0;
	position: absolute;
	width: $nav-menu-side;
	height: $desktop-gray-header-height;
	top: 0;
	right: 0.7rem;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: top 400ms;

	@media ($max-mobile-viewport) {
		body:not(.scrolled) & {
			top: $mobile-top-links-height;
		}
	}
}

div.gru-nav {
	.gru-nav-button {
		position: relative;
		display: block;
		line-height: 0;
		top: 0;
		left: 0;
		border-radius: 50%;
		border: 6px solid transparent;

		+ ul {
			&::before {
				content: none;
			}

			display: flex;
			flex-wrap: wrap;
			left: auto;
			right: 0;
			transform: translateX(100%);
			min-width: calc((100% - #{$width}) / 2 + 420px);
			padding-top: 50px;
		}
	}
}

.pf-page-header {
	&--default {
		display: flex;
		flex-wrap: wrap;
		align-items: end;

		&::before {
			background: url('img/cloud.svg');
			content: "";
			position: absolute;
			height: 264px;
			width: 342px;
			top: -10px;
			left: 50px;
			z-index: -1;

			@media($max-mobile-viewport) {
				top: 0;
				left: 10px;
			}
		}
	}

	&--title {
		margin: 0;
		@media($max-mobile-viewport) {
			font-size: $fz-3;
		}
	}

	&--picture {
		width: 100px;
		margin-right: 1rem;
		@media($max-mobile-viewport) {
			width: 35px;
		}
	}

	&--description {
		margin-top: 0.5rem;
		flex-basis: 100%;
	}
}

body.page-template-homepage {
	.site-header {
		background: transparent;
	}

	#header {
		@media ($min-desktop-viewport) {
			background: var(--page-picture);
			background-repeat: no-repeat;
			background-position-y: 50px;
			background-size: 100%;
		}
		@media($min-desktop-viewport) {
			height: 550px;
			margin-bottom: -180px;
		}
	}

	#top {
		align-items: flex-end;
		@media ($min-desktop-viewport) {
			height: auto;
			flex-wrap: nowrap;
		}
	}
	h1#logo.has-logo {
		@media($max-mobile-viewport) {
			text-align: center;
		}
		a::before {
			width: 260px;
			height: 150px;
			@media($max-mobile-viewport) {
				width: 200px;
				height: 114px;
			}
		}
	}

	#toplinks {
		background: $gray-light;
		@media ($min-desktop-viewport) {
			position: absolute;
			right: $nav-menu-side * 1.5;
			top: ($desktop-gray-header-height - $nav-menu-side) / 2;
		}
	}

	.pf-header-description {
		font-weight: bold;
		text-align: center;
		font-size: $fz-1;
		flex: 1 1 auto;

		@media($max-mobile-viewport) {
			padding: 1rem;
			font-size: $fz-3;
		}

		@media($min-desktop-viewport) {
			flex: 1 1 50%;
			padding-bottom: 10px;
		}
	}
}
