#nav-modal {
    position: fixed;
    width: 100dvw;
    height: 100dvh;
    top: 0;
    background: rgba(0, 0, 0, 0);
    display: none;
    z-index: -1;
    transition: all var(--trans-duration) linear;
}

.showMobileMenu #nav-modal {
    background: rgba(0, 0, 0, 0.5);
    display: block;
    z-index: 99998;
}

#masthead {
	--max-width: 108.75rem;
	--_logo-width: 12.5625rem;

	position: fixed;
	top: 0;
	width: 100%;
	z-index: 9;
	display: grid;
	background-color: hsla(0, 0%, 100%);
	box-shadow: 0 0.625rem 1.25rem -0.5rem hsl(0, 0%, 50%);

	.dc-content {
		justify-self: center;
		display: grid;
		--_padding-rl: 1.75rem;
		padding: 0.8rem var(--_padding-rl);
		max-width: calc(114.125rem + (2 * var(--_padding-rl)));
		grid-template-columns: var(--_logo-width) var(--burger-width);
		grid-template-areas: 'logo burger';
		justify-content: space-between;
		z-index: 99999;

		.logo-content {
			grid-area: logo;
			z-index: 999999;
		}
	}

	ul {
		margin-bottom: unset;
	}
}

#header-content {
    position: relative;
    display: block;
    background-color: hsl(0, 0%, 100%);
    z-index: 99999;
}

#header-links {
	--max-width: 87.5rem;

	grid-area: hl;
	width: 100%;
	max-width: calc(var(--max-width) - 1.75rem * 2);
}

.burger-wrapper {
	display: none;
}

@media (width >= 46.875rem) { /* 750px */
	#masthead {
		--_logo-width: 16.75rem;

		.scrolled & {
			box-shadow: 0 0.625rem 1.25rem -0.5rem hsl(0, 0%, 50%);
		}

		.dc-content {
			padding-block: 1.5rem 1.875rem;
			transition: padding var(--trans-duration) linear;
		}

		.scrolled & .dc-content {
			padding-top: 1.5rem;
		}
	}

	.burger-wrapper {
		justify-self: flex-end;
	}
}

@media (width < 96.875rem) { /* 1550px */
	.top-links.wide {
		display: none;
	}
}

@media (width >= 103.125rem) { /* 1650px */
	#masthead {
		--_logo-width: 22.625rem;
	}
}

/***** Menu Modal **********/
.close-icon {
    position: absolute;
    display: grid;
    align-content: center;
    --_dimension: 1.5rem;
    width: var(--_dimension);
    height: var(--_dimension);
    top: 0.5rem;
    right: 0.5rem;
    border: 3px solid var(--clr-link);
    border-radius: 50%;
    background-color: transparent;
    cursor: pointer;

	visibility: hidden;
	opacity: 0;

	span {
		position: relative;
		font-family: var(--ff-secondary);
		font-size: var(--_dimension);
		line-height: 1;
	}

	&:hover,
	&:focus-visible {
		outline: none;
		border-color: hsl(0, 0%, 0%);

		span {
			color: hsl(0, 0%, 0%);
		}
	}

	&:focus-visible {
		visibility: visible;
		opacity: 1;
	}
}

.showMobileMenu .close-icon {
	visibility: visible;
}

.close-button {
    display: block;
    background: var(--background-button);
    font-size: 1rem;
    font-weight: 600;
    color: var(--clr-button);
    border-radius: 100vw;
	border: none;
    padding: 0 1em;
    line-height: 2em;
    position: absolute;
	bottom: 0.25rem;
	right: 0.25rem;
    cursor: pointer;
    transition: var(--trans-duration) linear;

	opacity: 0;

	&:hover,
	&:focus {
		background-color: hsl(0, 0%, 0%);
	}

	&:focus {
		opacity: 1;
	}
}
/***** end Menu Modal ******/


/***** Top Links ********/
.top-links {
	&.mobile {
		display: grid;
		position: relative;

		a {
			display: flex;
			align-items: center;
			font-size: 1.125rem;
			font-weight: 400;
			color: hsl(0, 0%, 0%);
			line-height: 1;
			padding-block: 0.75em;
			padding-left: 1.25rem;
			border-top: 1px solid var(--clr-gray-border);

			&:hover,
			&:focus {
				text-decoration: none;
				font-weight: 700;
				color: hsl(0, 0%, 100%);
				background-color: var(--clr-link);
				outline: none;
			}

			&::before {
				margin-right: 0.625rem;
			}

			&.phone {
				&::before {
					content: url(../images/icon-Phone-black.png);
				}

				&:hover,
				&:focus {
					&::before {
						content: url(../images/icon-Phone-white.png);
					}
				}
			}

			&.search-button {
				&::before {
					content: url(../images/icon-Spy-Glass-black.png);
					margin-right: 0.7rem;
					padding-left: 0.3rem;
				}

				&:hover,
				&:focus {
					&::before {
						content: url(../images/icon-Spy-Glass-white.png);
					}
				}
			}

			.contact &::before {
				content: url(../images/icon-Email-black.png);
				padding-left: 0.4rem;
			}

			.contact &:hover::before,
			.contact &:focus::before {
				content: url(../images/icon-Email-white.png);
			}
		}
	}

	li {
		list-style-type: none;
	}

	@media (width >= 96.875rem) { /* 1550px */
		&.mobile {
			display: none;
		}

		&.wide {
			grid-area: topLinks;
			display: flex;
			align-items: center;

			#top-menu {
				display: flex;
			}

			* {
				font-size: 0.9375rem;
			}

			.contact a,
			.phone {
				color: hsl(0, 0%, 100%);
				line-height: 2em;
				background-color: var(--clr-gray);

				&:hover,
				&:focus {
					text-decoration: none;
					background-color: hsl(0, 0%, 0%);
				}
			}

			.contact a {
				display: block;
				padding-inline: 2em 1.6em;
				border-top-left-radius: 1em;
				border-bottom-left-radius: 1em;
				border-right: 1px solid hsl(0, 0%, 100%);
			}

			.phone {
				padding-inline: 1.34em;
				background-color: var(--clr-gray);
				border-top-right-radius: 1em;
				border-bottom-right-radius: 1em;
			}

			#search-button {
				display: flex;
				align-items: center;
				font-weight: 400;
				color: hsl(0, 0%, 0%);
				padding-left: 3.7em;

				&::before {
					content: url(../images/icon-Spy-Glass-black_35.png);
					margin-right: 0.6em;
				}
			}
		}
	}
}
/***** end Top Links ****/


/***** Main Menu ***********/
.nav-content {
	display: grid;
	background-color: hsl(0, 0%, 100%);
}

@media (width < 96.875rem) { /* 1550px */
	.nav-content {
		max-height: calc(90dvh - var(--ht-header));
	    overflow-y: scroll;
	}

	#header-links {
		position: absolute;
		justify-self: center;
		visibility: hidden;
		max-width: 38.125rem;
		top: -100dvh;
		transition: all var(--trans-duration) linear;
	}

	.showMobileMenu #header-links {
		visibility: visible;
		top: var(--ht-header);
		box-shadow: 0 0 12px hsl(0deg 0% 84%);
	}

	.burger-wrapper {
		display: flex;
		/* grid-area: burger; */
	}
}

@media (width >= 96.875rem) { /* 1550px */
	#header-links {
		grid-area: mainMenu;
	}

	#masthead {
		.dc-content {
			grid-template-columns: var(--_logo-width) 1fr auto;
			grid-template-areas: 'logo mainMenu topLinks';
			padding-block: 1.125rem;
		}
	}
}

.main-menu {
	li {
		position: relative;
		list-style-type: none;
	}
	
	a {
		display: block;
		font-size: 1.125rem;
		font-weight: 400;
		color: hsl(0, 0%, 0%);
		line-height: 1;
		padding-block: 0.75em;
		padding-left: 1.25rem;

		&:hover,
		&:focus {
			text-decoration: none;
		}
	}

	> li > span a {
		text-transform: uppercase;
	}

	@media (width < 96.875rem) { /* 1550px */
		> li {
			border-top: 1px solid var(--clr-gray-border);
		}

		a:hover,
		a:focus {
			font-weight: 700;
			color: hsl(0, 0%, 100%);
			background-color: var(--clr-link);
			outline: none;
		}

		.menu-item-has-children {
			display: grid;
			grid-template-columns: 1fr auto;
			grid-template-areas:
				'heading button'
				'submenu submenu';

			> span {
				grid-area: heading;
			}

			> .toggle-button {
				grid-area: button;
				display: block;
				position: absolute;
				right: 0;
				width: 2.8125rem;
				height: 2.8125rem;
				text-align: center;
				font-size: 2rem;
				color: #fff;
				background-color: hsl(0, 0%, 74%);
				border: none;
				cursor: pointer;
				z-index: 999;

				&::after {
					content: '+';
				}

				&[aria-expanded="true"]::after {
					content: '-';
				}
			}

			> .sub-menu {
				grid-area: submenu;
				border-bottom: 1px solid var(--clr-gray-border);

				.toggle-button {
					height: 2.5rem;
					background-color: hsl(0, 0%, 84%);
					display: none;
				}

				.sub-menu a {
					padding-left: 2rem;
				}
			}
		}
		
		.menu-item-has-children > .sub-menu {
			height: auto;
			max-height: 0;
			visibility: hidden;
			overflow: hidden;
			border-top: 1px solid #ccc;

			a {
				font-weight: 300;
				font-size: 1rem;
			}
		}

		.showSubMenu > .sub-menu {
			transition: all var(--trans-duration) linear;
			visibility: visible;
			max-height: 100rem;
		}
	}

	@media (width >= 96.875rem) { /* 1550px */
		& {
			display: flex;
			gap: 1.125rem;
			justify-content: center;

			> li {
				display: flex;
				justify-content: center;

				> span a {
					padding-inline: 1.25rem;
					padding-block: 0.94em 1.06em;
					border: 1px solid transparent;

					&:hover,
					&:focus {
						background-color: hsl(0, 0%, 100%);
						color: hsl(0, 0%, 0%);
						text-decoration: none;
						border-color: #939393;
					}

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

			> .menu-item-has-children {
				isolation: isolate;

				> span a {
					&:hover,
					&:focus {
						border-bottom-color: transparent;
					}
				}

				> .sub-menu {
					z-index: -1;
				}
			}

			.menu-item-has-children > .toggle-button {
				background: none;
				border: 0;
				color: #fff;
				cursor: pointer;
				position: absolute;
				right: 0;
				height: 100%;
				display: inline-block;
				top: 0.25em;
				margin-left: 0.25em;
				opacity: 0;
			}

			.toggle-button .arrow-down {
				display: block;
				width: 0;
				height: 0;
				border-top: 8px solid hsl(0, 0%, 0%);
				border-right: 6px solid transparent;
				border-left: 6px solid transparent;
				margin: 0.25em;
			}

			.menu-item-has-children > .toggle-button:focus {
				opacity: 1;
			}

			> .menu-item-has-children:has(.menu-item-has-children) {
				> .sub-menu {
					display: flex;
					gap: 2.5rem;
					left: -680px;

					li {
						flex-basis: 120px;
						flex-shrink: 0;
					}

					@media (width >= 106.25rem) { /* 1700px */
						& {
							left: -820px;

							li {
								flex-basis: 140px;
							}
						}
					}
				}
			}

			> .menu-item-has-children {
				> .sub-menu {
					position: absolute;
					top: 100%;
					padding: 2.5rem 1.75rem;
					background-color: hsl(0, 0%, 100%);
					box-shadow: 0px 1px 10px hsl(0, 0%, 80%);
			}

				&:hover {
					.sub-menu {
						transition: all var(--trans-duration) linear;
						max-height: 100vh;
						visibility: visible;
					}
				}
			}


			> .menu-item-has-children > .sub-menu {
				height: auto;
				max-height: 0;
				visibility: hidden;
				overflow: hidden;

				a {
					font-size: 1rem;
					font-weight: 300;
					color: hsl(0, 0%, 0%);
					line-height: 1.4;
					padding-left: 0;

					&:hover,
					&:focus {
						color: var(--clr-gold);
					}
				}

				.menu-item-has-children {
					> span a {
						font-family: var(--ff-encode-sans-semi-cond);
						font-weight: 600;
						font-size: 1.125rem;
						line-height: 1.2;
						text-transform: uppercase;
						min-height: 4.375rem;

						&:hover,
						&:focus {
							color: var(--clr-link);
						}
					}

					.sub-menu a {
						font-size: 0.75rem;

						&:hover,
						&:focus {
							color: hsl(0, 0%, 0%);
							text-decoration: underline;
						}
					}
				}
			}

			.showSubMenu > .sub-menu {
				transition: all var(--trans-duration) linear;
				visibility: visible;
				max-height: 100rem;
			}

			& > .showSubMenu > .sub-menu {
				margin-bottom: 1rem;
			}
		}
	}
}

.child-menu-icon {
	cursor: pointer;
	background: unset; /* unset default button styling */
	border: unset;
	position: absolute;
	right: 5rem;
	border-left: 1px solid hsl(0, 0%, 100%);
	border-right: 1px solid hsl(0, 0%, 100%);
}

.child-menu-icon.arrow {
	--_border-width: 0.7em;
	width: 5rem;
	height: 2.8125rem;
	top: 0;
}

.child-menu-icon.arrow::after {
	color: hsl(0, 0%, 100%);
	margin-left: 0;
}

.showSubMenu .child-menu-icon.arrow::after {
	transform: rotate(-180deg);
}
/***** end Main Menu *******/


/***** Logo *****************/
.logo-content {
	a {
		display: block;
	
		&:hover,
		&:focus {
			text-decoration: none;
	
			.logo-img {
				scale: 1.1;
			}
		}
	
	}

	.logo-img {
		width: 100%;
		max-width: var(--_logo-width);
		height: auto;
		transition: all var(--trans-duration) linear;
	}
}
/***** end Logo *************/
