:root {
    --flyout_header_height: 96px;
    --flyout_footer_height: 83px;

    //Nav Top level
    --main_menu_link_padding_top: 20px;
    --main_menu_link_padding_side: 20px;
    --main_menu_link_spacing: calc(var(--main_menu_link_padding_side) * 2);
    --main_menu_link_icon_padding: 24px;

    --main_menu_sub_link_padding_top: 8px;
    --main_menu_sub_link_padding_side: 0;

    --main_menu_sub_menu_padding: 24px 0;

    //Grid
    --main_menu_sub_gutter: 32px;
    --main_menu_sub_gutter_spacing: calc(var(--main_menu_sub_gutter) / 2);

    //Colours
    --main_menu_sub_menu_bg_color: @dark_color;
    --main_menu_sub_menu_text_color: #fff;
    --main_menu_sub_menu_highlight_color: @primary_color;
    --main_menu_top_level_highlight_color: @secondary_color;

    //Font
    --main_menu_font_size: 14;
    --main_menu_line_height: 14px;

    --main_menu_sub_menu_font_size: 14;
    --main_menu_sub_menu_line_height: 14px;

    //Icons
    --main_menu_icon_weight: @global_fa_font_weight;

    //Borders
    --main_menu_sub_menu_border_top: 1.5px solid @border_color_alt;
    --main_menu_sub_menu_border_bottom: none;
    --main_menu_sub_menu_shadow: 0 8px 8px -6px rgba(0,0,0,0.32);

    //Menu buttons
    --main_menu_button_width: 32px;
    --main_menu_button_height: 48px;
    --main_menu_button_padding: 12px 16px;

    //Animation
    --main_menu_sub_menu_anim: visibility 400ms linear, opacity 400ms linear;
}

/*
 * Secondary Navigation Menu
 */
.secondaryMenuNavigation {
    display: none;

    @media @flyout {
        display: block;
        clear: both;
        max-width: 100%;
    }
}


.flyoutButton  {
    position: relative;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    height: var(--main_menu_button_height);
    padding: var(--main_menu_button_padding);
    width: var(--main_menu_button_width);
    transition: all 200ms linear;

    &:hover {
        color: var(--primary_color);
    }

    @media @flyout {
        padding: 16px 0;
        height: 56px;
    }

    .innerButton {
        width: 100%;
        height: 100%;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    i {
        color: var(--text_color);
        transition: color 200ms linear;
		width: 25px;
		height: 16px;

		svg {
			width: 100%;
			height: 100%;
		}
    }

    i.openButton {
        display: inline-block;

        .flyoutActive & {
            display: none;
        }
    }

    i.closeButton {
        display: none;

        .flyoutActive & {
            display: inline-block;
        }
    }

}


/*
* Flyout — shared base for menu groups and lists (header + footer)
 */

.siteMenu__group,
.siteMenu__list {
	.rems(18);
	font-style: normal;
	line-height: 25.278px;

	// Chevron icons are hidden by default and only shown where explicitly
	// styled to (currently the desktop mega-menu link list). No !important
	// needed because nothing re-enables them globally.
	.siteMenu__icon {
		display: none;
		position: relative;
		width: 8px;
		height: 8px;

		svg {
			width: 100%;
			height: auto;
			position: absolute;
			top: 50%;
			left: 50%;
			transform: translate(-50%, -50%)
		}
	}

	.siteMenu__link {
		color: var(--flyout_link_color);
		font-style: normal;
		font-weight: 500;
		font-size: inherit;
		line-height: inherit;
		text-align: left;
		letter-spacing: initial;
		text-transform: none;
		display: block;

		&:hover, &:focus-visible, &:active {
			color: color-mix(in srgb, var(--highlight_color), var(--darken_mixin_color) 8%);
		}
	}

	@media @above_flyout {
		.siteMenu__icon {
			color: var(--menu_chevron_color);
			margin-left: 7px;
		}
	}

	@media @flyout {
		.rems(16);
		line-height: 1.1em;

		.siteMenu__link {
			padding: 10px 0;

			&:not(.button) {
				color: var(--flyout_link_color_mobile);
			}

			.siteMenu__icon {
				width: 0.5359em;
				height: 0.5359em;
				border-radius: 100%;
				background: var(--primary_color);
				color: #fff;
				position: relative;
				top: -0.1em;
				min-width: 12px;
				min-height: 12px;

				svg {
					width: 0.2em;
					height: 0.2em;
					min-width: 4.5px;
					min-height: 4.5px;
				}
			}

			&.isClickable.open {
				color: var(--highlight_color);
			}
		}
	}
}

/*
 * Menu group modifiers
 */
.siteMenu__group {

	@media @above_flyout {
		&--links {
			display: none;
		}
	}

	@media @flyout {
		&--primary {
			margin: 45px 0;
			.rems(28);
			line-height: 1em;

			.siteMenu__dropdown .siteMenu__dropdown {
				.rems(16);
				line-height: 1.1em;
			}
		}

		&--links {
			display: flex;
			margin: auto 0 45px;
		}
	}

	&--secondary {
		font-weight: 700;
		.rems(12);
		line-height: 12px;
	}
}

/*
 * Header-scoped menu structure. The menu renders inside .headerInnerWrap and
 * the desktop dropdown / mega-menu layout is anchored to that ancestor.
 */
.headerInnerWrap {

	/* Desktop top-level horizontal row (was .mainMenu > .dropdownWrap > ul) */
	@media @above_flyout {
		.siteMenu__list {
			display: flex;
			width: ~"calc(100% + 43px)";
			margin: 0 -21.5px;

			& > .siteMenu__item {
				display: flex;
				align-items :center;
				padding: 0 21.5px;

				.secondaryMenuWrap & {
					position: relative;
					padding: 0 12.5px;
				}

				& > .siteMenu__link {
					white-space: nowrap;
					display: flex;
					align-items: center;
					.rems(20);
					font-weight: 600;
					line-height: 25px;
					position: relative;
				}

				&.siteMenu__item--mobile-only {
					display: none;
				}
			}
		}
	}

	/*
	 * Top-level items are positioned to anchor their dropdowns.
	 * Mega items stay static so the mega panel centres on the nav.
	 */
	.siteMenu__list > .siteMenu__item {
		position: relative;

		&.siteMenu__item--mega {
			position: static;
		}
	}

	/*
	 * Menu items (was .menus / .menuItem / .megaMenuItem)
	 */
	.siteMenu__item {

		font-size: inherit;
		line-height: inherit;
		font-weight: 500;


		&:hover > .siteMenu__dropdown {
			opacity: 1;
			visibility: visible;
			pointer-events: auto;
			transition: opacity 200ms linear, visibility 200ms linear;
		}

		.siteMenu__dropdown .siteMenu__link {
			font-size: inherit;
			line-height: inherit;
			font-weight: inherit;
			color: var(--flyout_link_color);
			white-space: nowrap;

			@media @flyout {
				color: var(--flyout_link_color_mobile);
			}

			&:hover, &:active, &:focus, &.active {
				color: var(--highlight_color);
				transition: color 200ms linear;
			}
		}

		@media @above_flyout {

			.siteMenu__link--active {
				color: var(--highlight_color);

				&:hover, &:focus, &:active {
					color: color-mix(in srgb, var(--highlight_color), var(--black_color) 8%);
				}
			}

			.siteMenu__dropdown {
				position: absolute;
				border: 1.5px solid var(--secondary_color);
				padding: 10px 0;
				border-radius: 10px;
				background: #fff;
				min-width: 180px;

				opacity: 0;
				visibility: hidden;
				pointer-events: none;
				transition: opacity 200ms linear, visibility 200ms linear;

				.siteMenu__link {
					padding: 0.7em 16px;
					display: flex;
					align-items: center;
				}

				&--level1 {
					top: 100%;
					left: 0;
					margin-top: 16px;

					&:before {
						content: "";
						display: block;
						width: 100%;
						height: 16px;
						position: absolute;
						right: 0;
						left: 0;
						bottom: 100%;
					}

					&.flyoutOnly {
						display: none;
					}
				}

				&--level2 {
					top: -1.5px;
					left: 100%;
				}

				&--level3 {
					top: -3px;
					left: 100%;
				}

				&--level2, &--level3 {

					margin-left: 8px;

					&:before {
						content: "";
						display: block;
						width: 8px;
						height: 100%;
						position: absolute;
						right: 100%;
						top: 0;
					}
				}
			}

			/* Desktop mega panel — decorative flex/grid layout */
			.siteMenu__mega {
				display: flex;
				position: absolute;
				top: 100%;
				left: 50%;
				transform: translateX(-50%);
				height: auto;
				min-height: 0;
				width: 100%;
				max-width: 1299px;
				background: transparent;
				padding: 0;
				margin: 0;
				border-radius: 0 0 27px 27px;
				box-shadow: 0 11px 24px 0 rgba(0, 0, 0, 0.10), 0 43px 43px 0 rgba(0, 0, 0, 0.09), 0 98px 59px 0 rgba(0, 0, 0, 0.05), 0 174px 69px 0 rgba(0, 0, 0, 0.01), 0 271px 76px 0 rgba(0, 0, 0, 0.00);
				overflow: hidden;

				opacity: 0;
				visibility: hidden;
				pointer-events: none;
				transition: opacity 300ms, visibility 300ms;

				&--visible {
					opacity: 1;
					visibility: visible;
					pointer-events: auto;
					transition: opacity 300ms, visibility 300ms;
				}

				.siteMenu__mega-inner {
					width: 100%;
					display: flex;
					height: 100%;
					padding: 0;
					z-index: 2;

					&:before, &:after {
						display: none;
					}
				}

				.siteMenu__mega-info {
					display: flex;
					flex: 0 0 25.6356%;
					flex-direction: column;
					background: var(--primary_color);
					width: 100%;
					height: auto;
					padding: 57px 32px;
					position: relative;
					color: #fff;

					.siteMenu__mega-title {
						color: inherit;
						.rems(32);
						font-weight: 500;
						line-height: 39.308px;
						letter-spacing: -0.244px;
						margin: 0;
						position: relative;
						z-index: 2;
					}

					.siteMenu__mega-action {

						position: relative;
						z-index: 2;
						padding: 49px 0 0;

						.siteMenu__mega-view-all {

							.rems(19);
							padding: 16.1px 22.3px;

							margin: 0;
							width: auto;
							color: var(--primary_color);
							background: linear-gradient(109deg, #F5F5F5 0%, #E4E4E4 100%);
							transition: all 200ms linear;

							&:after {
								background: #fff;
							}

							&:hover, &:focus-visible, &:active  {
								color: var(--primary_color);
								transition: all 200ms linear;
							}
						}
					}
				}

				.siteMenu__mega-menus {
					background: #fff;
					flex: 1 1 100%;
					padding: 48px 50px 37px 50px;
					min-height: 320px;
				}

				.siteMenu__mega-list {

					display: flex;
					flex-direction: row;
					flex-wrap: wrap;
					padding: 0 0 0 16px;
					float: none;
					clear: both;
					flex: 0 0 100%;
					height: auto;
					width: ~"calc(100% + 32px)";
					margin: 0 -16px;

					&:before, &:after {
						display: none;
					}

					.siteMenu__mega-link {
						padding: 0.6em 16px 0.6em 20px;
						display: flex;
						align-items: center;
						position: relative;
						.rems(24);
						font-weight: 500;
						line-height: 25.278px;
						color: var(--primary_color);


						&:hover, &:active, &:focus-visible, .active {
							color: var(--highlight_color);
							transition: color 200ms linear;

							svg {
								color: var(--highlight_color);
								transition: color 200ms linear;
							}
						}
					}

					.siteMenu__mega-item {
						list-style: none;
						width: 50%;
					}

					.siteMenu__icon {
						position: absolute;
						top: 13px;
						left: 0;
						margin: 0;
						color: inherit;
						display: inline-block;
						width: 12px;
						height: 26px;


						svg {
							width: 100%;
							height: 100%;
							color: var(--primary_color);
							transition: color 200ms linear;

							path {
								fill: currentColor;
							}
						}
					}
				}
			}

			&--mega:hover > .siteMenu__mega {
				opacity: 1;
				visibility: visible;
				pointer-events: auto;
				transition: opacity 300ms, visibility 300ms;
			}

			&--mega {

				& > .siteMenu__link {
					position: relative;

					&:after {
						content: "";
						position: absolute;
						top: 100%;
						left: -24px;
						right: -24px;
						height: 42px;
						width: ~"calc(100% + 48px)";
						background: transparent;
					}
				}
			}
		}

		@media all and (max-width: calc(var(--wrapper_width) + var(--page_side_padding))) {
			.siteMenu__mega {
				.siteMenu__mega-inner {
					padding: 0;
				}
			}
		}

		@media @flyout {

			.siteMenu__dropdown {

				padding: 8px 0 8px 8px;

				&--level1 {
					&.flyoutOnly {
						display: block;
					}
				}
			}

			/*
			 * Mobile mega degrades to a plain vertical accordion sub-menu.
			 * Hidden by default, shown when the accordion .open state is set
			 * (mirrors how the old .dropdownWrap was toggled on mobile).
			 */
			.siteMenu__mega {
				display: none;
				position: static;
				transform: none;
				width: auto;
				max-width: none;
				min-height: 0;
				background: transparent;
				box-shadow: none;
				border-radius: 0;
				overflow: visible;
				margin: 0;
				padding: 8px 0 8px 8px;
				opacity: 1;
				visibility: visible;
				pointer-events: auto;
				transition: none;

				.siteMenu__mega-inner {
					display: block;
					width: auto;
					height: auto;
					padding: 0;
				}

				.siteMenu__mega-info {
					display: none;
				}

				.siteMenu__mega-menus {
					background: transparent;
					padding: 0;
					min-height: 0;
				}

				.siteMenu__mega-list {
					display: block;
					width: auto;
					margin: 0;
					padding: 0;

					.siteMenu__mega-item {
						width: 100%;
					}

					.siteMenu__mega-link {
						display: block;
						padding: 10px 0;
						.rems(16);
						line-height: 1.1em;
						color: var(--flyout_link_color_mobile);

						&:hover, &:active, &:focus-visible, .active {
							color: var(--highlight_color);
							transition: color 200ms linear;
						}
					}
				}
			}

			.siteMenu__link.open ~ .siteMenu__mega,
			&.open > .siteMenu__mega,
			.siteMenu__mega.open {
				display: block;
			}
		}

		&--has-children {

			.siteMenu__link {

				&:after {

					@media @flyout {
						content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M137.4 374.6c12.5 12.5 32.8 12.5 45.3 0l128-128c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8L32 192c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l128 128z" fill="%23fff"/></svg>');
						display: inline-block;
						width: 16px;
						height: 16px;
						position: relative;
						top: 3px;
						left: 6px;
						transform: rotate(0deg);
						transition: transform 200ms linear;
						transform-origin: 5px 17px;
					}
				}

				&.open {
					&:after {
						@media @flyout {
							transform: rotate(-90deg);
							transition: transform 200ms linear;
							transform-origin: 5px 17px;
						}
					}
				}
			}
		}
	}
}

/*
 * Flyout container (was .flyoutWrap)
 */
.siteMenu {
	@media @above_flyout {
        width: 100%;
		display: flex;
		align-items: center;
		justify-content: center;
		height: 100%;

        .siteMenu__header, .flyoutFooter {
            display: none;
        }

		.mobileMenu {
			display: none;

			&.siteMenu__group--primary {
				display: block;
			}
		}

		.mobileTitle {
            display: none;
        }
    }

	@media @flyout {
        position: fixed;
		top: 0;
		left: -24px;
		bottom: 0;
		height: 100vh;
		width: 50vw;
		max-width: 360px;
		background: var(--flyout_background_mobile);
		backdrop-filter: blur(10px);
		filter: drop-shadow(4px 4px 16px rgba(0,0,0,0.24));
		border-radius: 0 35px 35px 0;
		transform: translateX(-100%);
        transition: transform 600ms, opacity var(--flyout_transition_time), visibility var(--flyout_transition_time);
        overflow: hidden;
        padding: 0;
        color: var(--flyout_text_color_mobile);
		z-index: 9999999;
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
		display: flex;
		flex-direction: column;

        .flyoutInitialised & {
			transition: transform 600ms, opacity var(--flyout_transition_time) ease-in-out, visibility var(--flyout_transition_time) ease-in-out;
		}

		.flyoutActive & {
			transform: translateX(0);
			opacity: 1;
			visibility: visible;
			pointer-events: auto;
		}

        .siteMenu__header {
			position: relative;
			z-index: 2;
            border-bottom: none;
            flex: 0 0 92px;
            height: auto;
			padding: 32px 56px 32px 24px;
			border-bottom: 1px solid color-mix(in srgb, var(--fade_mixin_color), var(--flyout_text_color_mobile) 4%);

            .siteMenu__header-top {
				display: flex;

				& > h2 {
					.rems(24);
					line-height: 1.2em;
					color: var(--flyout_text_color_mobile);
					margin: 0;
					width: 100%;
					padding: 0;
					flex: 1 1 100%;
					padding-right: 24px;
				}

                .flyoutButton {
					border: none;
					background: transparent;
					color: var(--flyout_text_color_mobile);
					position: absolute;
					top: 50%;
					right: 10px;
					width: 48px;
					height: 48px;
					margin: 0;
					padding: 0;
					transition: color 200ms linear;
					cursor: pointer;
					transform: translateY(-50%);

					i {
						width: 24px;
						height: 24px;
						display: flex;
						align-items: center;
						justify-content: center;
						position: absolute;
						top: 50%;
						left: 50%;
						transform: translate(-50%,-50%);
						margin: 0;
						color: inherit;

						svg {
							width: 100%;
							height: 100%;
						}
					}

					&:hover, &:active, &:focus-visible {
						color: var(--highlight_color);
					}
                }
            }
        }

		.siteMenu__body {
			flex: 1 1 100%;
			padding: 24px 24px 48px 24px;
			overflow-y: auto;
			position: relative;
			z-index: 2;
		}
    }

	@media @mobile {
		width: 100%;
		max-width: 400px;
		left: 0;
	}
}

.siteMenu__background {
	display: none;

	@media @flyout {
		position: absolute;
		bottom: 0;
		left: 0;
		width: 100%;
		height: auto;
		z-index: 0;
		display: flex;
		align-items: flex-end;
		opacity: 0.2;

		svg {
			width: 100%;
			height: auto;
		}
	}
}

