/** === Main menu === */

.main-navigation {

	display: inline;

	@include media(tablet) {
		display: block;
	}

	body.page & {
		display: block;
	}

	> div {
		display: inline;
	}

	.main-menu {

		display: inline;
		margin: 0;
		padding: 0;

		> li {

			display: inline;

			> a {

				font-weight: 700;
				color: $color__link;

				+ svg {
					color: $color__link;
					margin-right: #{-0.25 * $size__spacing-unit};
				}

				&:hover {
					color: $color__link-hover;
					+ svg {
						color: $color__link-hover;
					}
				}

				&:after {
					content: ",";
					display: inline;
					color: $color__text-light;
				}
			}

			&.menu-item-has-children {

				&:after {
					content: ",";
					display: inline;
					color: $color__text-light;
				}

				& > a,
				.menu-item-has-children > a {

					&:after {
						content: "";
						display: none;
					}
				}
			}

			&:last-child> a:after {
				content: ".";
			}

			&:last-child > a {
				margin-right: 0;
			}
		}
	}

	.sub-menu {

		background: $color__link;
		color: $color__background-body;
		list-style: none;
		padding-left: 0;

		display: none;
		float: left;
		width: 100%;
		position: absolute;
		opacity: 0;
		left: -999em;
		z-index: 99999;
		-webkit-transition: opacity 0.5s ease-in-out;
		-moz-transition:    opacity 0.5s ease-in-out;
		transition:         opacity 0.5s ease-in-out;

		@include media(tablet) {
			max-width: calc(3 * (100vw / 12));
		}

		> li {

			clear: both;
			display: block;
			float: none;
			position: relative;
			word-break: break-word;

			&.menu-item-has-children {

				svg {
					position: absolute;
					right: #{0.5 * $size__spacing-unit};
					top: #{0.65 * $size__spacing-unit};
				}

				@include media(tablet) {
					.menu-item-has-children > a {

						&:after {
							content: "\203a";
						}
					}
				}
			}

			> a {
				color: $color__background-body;
				display: block;
				line-height: $font__line-height-heading;
				padding: calc( .5 * #{$size__spacing-unit} ) $size__spacing-unit;

				&:hover,
				&:focus {
					background: $color__link-hover;

					&:after {
						background: $color__link-hover;
					}
				}
			}
		}
	}

	.main-menu .menu-item-has-children:hover > .sub-menu,
	.main-menu .menu-item-has-children .sub-menu:hover {
		display: block;
		left: inherit;
		margin-top: -2px;
		opacity: 1;

		.sub-menu {

			margin-top: inherit;
			position: relative;
			padding-left: $size__spacing-unit;

			@include media(tablet) {
				padding-left: 0;
				position: absolute;
				left: 100%;
				top: 0;
			}
		}
	}

	/*
	 * :focus-within needs its own selector so other similar
	 * selectors don’t get ignored if a browser doesn’t recognize it
	 */
	.main-menu .menu-item-has-children:focus-within > .sub-menu {
		display: block;
		left: inherit;
		margin-top: -2px;
		opacity: 1;

		.sub-menu {

			margin-top: inherit;
			position: relative;
			padding-left: $size__spacing-unit;

			@include media(tablet) {
				padding-left: 0;
				position: absolute;
				left: 100%;
				top: 0;
			}
		}
	}
}

/* Social menu */

.social-navigation {
	margin-top: calc(#{$size__spacing-unit} / 2 );
	text-align: left;

	ul.social-links-menu {
		@include clearfix;

		display: inline-block;
		margin: 0;
		padding: 0;

		li {
			display: inline-block;
			vertical-align: bottom;
			vertical-align: -webkit-baseline-middle;
			list-style: none;

			&:nth-child(n+2) {
				margin-left: 0.1em;
			}

			a {
				border-bottom: 1px solid transparent;
				display: block;
				color: $color__text-main;
				margin-bottom: -1px;
				transition: opacity $link_transition ease-in-out;

				&:hover,
				&:active {
					color: $color__text-main;
					opacity: 0.6;
				}

				&:focus {
					color: $color__text-main;
					opacity: 1;
					border-bottom: 1px solid $color__text-main;
				}

				svg {
					display: block;
					width: 32px;
					height: 32px;

					&#ui-icon-link {
						transform: rotate(-45deg);
					}
				}
			}
		}
	}
}
