#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: 109.75rem;
	--_logo-width: 10.875rem;

	position: fixed;
	top: 0;
	width: 100%;
	z-index: 9;
	display: grid;
	background-color: hsla(0, 0%, 100%);

	@media (width < 96.875rem) {
		& {
			box-shadow: 0 0.625rem 1.25rem -0.5rem hsl(0, 0%, 80%);
		}		
	}

	@media (width >= 96.875rem) {
		.scrolled & {
			box-shadow: 0 0.625rem 1.25rem -0.5rem hsl(0, 0%, 80%);
		}		
	}

	.dc-content {
		justify-self: center;
		display: grid;
		align-items: center;
		max-width: calc(var(--max-width) + (2 * var(--padding-rl)));
		padding: 0.8rem 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);
}

.top-links.wide {
	grid-area: links;
}

.burger-wrapper {
	display: none;
	grid-area: burger;
}

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

		.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 (62.5rem <= width < 96.875rem) { /* 1000px to 1549px */
	#masthead {
		.dc-content {
			grid-template-columns: var(--_logo-width) var(--burger-width) auto;
			grid-template-areas: 'logo burger links';
		}
	}
}

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

	.scrolled #masthead {
		--_logo-width: 18.125rem;
	}
}

@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 {
	display: grid;
	justify-items: center;
	gap: 1.0625rem;
	position: relative;
	max-width: 18.75rem;
	justify-self: center;
	padding-block: 1.875rem 1.0625rem;

	a {
		display: flex;
		align-items: center;
		font-size: 0.875rem;
		font-weight: 500;
		line-height: 1;

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

		.email > & {
			line-height: 2;
			padding-inline: 2em;
			background-color: hsl(0, 0%, 100%);
			border: 1px solid var(--clr-gray-border);
			border-radius: 0.3em;
			padding-left: 4.8em;
			background-image: url(../images/icon-email-gray.png);
			background-repeat: no-repeat;
			background-position: 2em center;

			&:hover,
			&:focus {
				color: hsl(0, 0%, 100%);
				background-color: hsl(0, 0%, 0%);
				border-color: hsl(0, 0%, 0%);
				background-image: url(../images/icon-Email-white.png);
			}
		}

		&.phone {
			display: grid;
			gap: 0.33em;
			font-weight: 700;
			font-size: 1.5rem;
			text-align: center;
			margin-top: 0.4375rem;

			&::after {
				content: 'SPEAK WITH AN ATTORNEY';
				font-family: var(--ff-secondary);
				font-weight: 300;
				font-size: 0.5em;
				color: var(--clr-main);
			}

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

				span {
					text-decoration: underline;
				}
			}
		}
	}

	.menu-top-menu-container {
		width: 100%;

		a {
			justify-content: center;
			color: hsl(0, 0%, 100%);
			line-height: 2;
			background-color: var(--clr-red);
			border: 1px solid var(--clr-red);
			border-radius: 0.3em;

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

	li {
		list-style-type: none;
	}

	@media (width >= 62.5rem) { /* 1000px */
		& {
			row-gap: 0.5rem;
			column-gap: 5rem;
		}

		&.wide {
			padding-block: 0;
		}
	}

	@media (62.5rem <= width < 96.875rem) { /* 1000px to 1549px */
		&.mobile {
			justify-items: left;
			justify-self: left;
			margin-left: 1.25rem;

			.email,
			.menu-top-menu-container {
				display: none;
			}
		}

		&.wide {
			display: grid;

			.phone {
				display: none;
			}
		}
	}

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

		&.wide {
			grid-template-columns: 1fr auto;
			grid-template-areas:
				'phone email'
				'phone topLink';
			align-items: center;


			.phone {
				display: grid;
				grid-area: phone;
			}

			.email {
				grid-area: email;
			}

			.menu-top-menu-container {
				grid-area: topLink;
			}
		}
	}
}
/***** 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: 40rem;
		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;
	}
}

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

	.top-links {
		max-width: none;
	}

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

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

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

	> li > span a { /* Level 1 */
		font-family: var(--ff-secondary);
		text-transform: uppercase;
	}

	> .showSubMenu > span a {
		font-weight: 700;
		color: var(--clr-blue);
	}

	.sub-menu {
		a:has(.menu-item-description) {
			font-weight: 500 !important;
			line-height: 1.4 !important;

			span {
				display: block;
				/* margin-top: 0.4em; */
				font-weight: 300 !important;
			}
		}
	}

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

		a:hover,
		a:focus {
			background-color: var(--clr-blue-light);
			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;
				--_dimension: 2.5rem;
				width: var(--_dimension);
				height: var(--_dimension);
				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;

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

				.sub-menu a {
					padding-left: 2rem;
				}
			}
		}
		
		.menu-item-has-children > .sub-menu {
			height: auto;
			max-height: 0;
			visibility: hidden;
			overflow: hidden;

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

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

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

			> li {
				> span a {
					padding-inline: 1.25rem;
					padding-block: 0.94em 1.06em;

					&::after {
						display: none;
					}
				}

				&:hover,
				&:focus-within {
					> span a {
						font-weight: 700;
						color: var(--clr-link);
						text-decoration: none;
					}
				}
			}

			.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 {
				> .sub-menu {
					position: absolute;
					top: 100%;
					padding-block: 0.5rem;
					background-color: hsl(0, 0%, 100%);
					box-shadow: 0px 1px 10px hsl(0, 0%, 80%);
				}

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


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

				a {
					font-size: 0.875rem;
					font-weight: 300;
					color: hsl(0, 0%, 0%);
					line-height: 1.4;
					padding-inline: 1.25rem;
					padding-block: 0.5em;

					&:hover,
					&:focus {
						background-color: var(--clr-blue-light);
					}
				}
			}

			.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 *************/
