/* Header */
$header-content-margin: 5px;

.site-header {
	flex: 0 1 0;

	background: $primary-color;

	#header {
		padding: 0;

		#top {
			display: flex;
			flex-wrap: nowrap;
			justify-content: space-between;

			margin: auto; // allow #top to be horizontally center within the header bar
			max-width: $column-width;
		}
	}
}


.top-left {
	align-self: flex-start;
	order: 0;
	display: flex;
	flex-wrap: nowrap;

	height: $header-height;
}

#site-title {
	flex: 1 1 0;
	align-self: center;

	margin: $header-content-margin;

	a {
		display: block;
		text-align: left;
		color: white;
		padding-left: 25px;
		font-size: 0.8rem;
		font-weight: bold;
		text-transform: uppercase;
		span {
			display: block;
		}
	}
}

#logo {
	box-sizing: content-box;
	margin: $header-content-margin;
	background: url('img/logo.png') no-repeat 0 center;
	background-size: contain;
	padding-right: 25px;
	width: $top-logo-width;

	a {
		height: $header-height;
		width: $top-logo-width;
		display: block;
	}
	text-indent: -10000px;
}

#toplinks {
	align-self: flex-end;
	order: 1;
	position: relative;
	right: unset;
	left: unset;
	top: unset;
	border-radius: 0;
	border: 0;
	background: $button-background;
	padding: 0;
	box-shadow: unset;

	.logged-in,
	.login {
		display: flex;
		justify-content: center;
		align-items: center;
		text-align: center;
		// flexbug 2 on IE11 (https://github.com/philipwalton/flexbugs#flexbug-2)
		max-width: 100%;
		max-height: 100%;

		&::after {
			content: '';
			display: inline-block;
			position: absolute;
			color: $button-background;
			width: 2px;
			background: white;
			height: 30px;
			top: 25px;
		}

		a {
			flex: 1 1 50%;
			color: white;
			font-weight: bold;
			height: $header-height;

			&::before {
				content: ' ';
				font-family: 'FontAwesome';
				font-size: 2.5em;
				display: block;
				padding-top: 15px;
				font-weight: lighter;
			}
		}
	}

	.login a {
		text-transform: uppercase;
		/* Default target for connexion */
		&::before {
			content: '\f090';	// login icon
			padding-top: 12px;
		}

		&.registration {
			&::before {
				display: none;
			}
			background: url(img/pencil.png) no-repeat;
			background-size: 2em;
			background-position: center 15px;
			padding-top: 50px;
		}
	}


	.logged-in a {
		/* Default for parent of connected-user */
		background: url('img/user.png') no-repeat;
		background-size: 2em;
		background-position: center 20px;

		.connected-user {
			display: block;
			padding-top: 40px;
			text-overflow: ellipsis;
			text-transform: uppercase;
			white-space: nowrap;
			overflow: hidden;
		}

		&.logout {
			background: none;
			padding-top: 0;
			text-transform: uppercase;

			&::before {
				content: '\f08b';	// logout icon
				padding-top: 15px;
			}
		}
	}
}
@media screen and ($min-desktop-viewport) {
	.site-header {
		height: $header-height;

		#header #top {
			flex-direction: row;

			#toplinks {
				width: (100 / 3 + 0%);
			}
		}
	}
}

@media screen and ($max-mobile-viewport) {
	.site-header {
		height: $header-height * 2;

		#header #top {
			flex-direction: column;
			justify-content: space-around;

			#toplinks,
			.top-left {
				align-self: stretch;
				max-width: 100%;
			}

			.top-left {
				.sep::before {
					display: none;
				}
				#logo {
					width: 40%;
				}
			}

			#toplinks .sep {
				display: block;
			}
		}
	}
}
