/* BOOKMARKS */
/*
**	The first portion of each of the comments below is a unique identifier that you can search for to jump to the desired section
**
**
*/
/***************** edit-top-menu-mobile; ********************/
/* The main editable sections for the main menu are found below
** 	When editing, try to contain your changes to the divs
*/
/* ;edit-top-menu-marked; 				--  rules for the menu elements in the selected element's chain ie if a child element is the current page, it and it's parent are both 'marked'*/
/* ;edit-top-menu-hover; 				--  styles for 'on hover' , often the same rules as 'this-is-the-page' */
/* ;edit-top-menu-this-is-the-page; 		--  styles for the currently selected page (distinct from the currently selected chain of elements as defined above in marked*/

/* note that this style sheet is organized mobile first with descktop versions overriding mobile styles in a mediaquery */

/* ;edit-top-menu-parent-divs;			--  styles for top level elements (parent) */
/* ;edit-top-menu-child-divs; 			--  styles for nested elements (child) */
/* ;edit-top-menu-gchild-divs; 			--  styles for deepest nested elements (gchild) */

/* ;edit-top-menu-parent-divs-desktop; 	--	override mobile styles for top-row desktop presentation */

/******************** edit-side-menu; **************************/
/* sidebar-menu divs follow the above
**	I've included all the typical segments but many, by default, are likely empty. If still empty for a site, be sure to remove them before going live
**	;edit-top-menu-marked;				-- Note, the top row element is always marked on the sidebar; it acts as a heading in this context.
** 	;edit-top-menu-this-is-the-page;		
**	;edit-top-menu-parent-divs;
**	;edit-top-menu-child-divs; 
**	;edit-top-menu-gchild-divs;
*/

/* top menu structure 

<ul .menu-parent-row> (top row)
	<li .has-arrow>  		(child with gchildren)
		<div>
			<span> | <a>
			<span .menu-button>
		<ul .menu-child-row>
			<li>
				<div>
					<span> | <a>
			<li .has-arrow>
				<div>
					<span> | <a>
					<span .menu-button>
				<ul .menu-gchild-row>
					<li>
						<div>
							<span> | <a>
					<li>
						<div>
							<span> | <a>
				
	<li>					(leaf child)
		<div>
			<span> | <a>
Each li contains a 
	div - which contains the link (or protolink) and optionally a button
		It is this div that should be targeted for styling backgrounds, padding, margins, borders, etc
	ul 	- the ul only exists if the li is a parent to another tier of children
*/

/* color definitions found at the top of atf.core.css */
.cms-nav {
  /* menu arrows */
  --menu-top-arrow-color: black;
  --menu-top-arrow-background: transparent;

  --menu-side-arrow-color: var(--brand-b-color);
  --menu-side-arrow-background: transparent;

  --menu-child-arrow-color: var(--brand-b-color);
  --menu-child-arrow-background: transparent;

  --menu-background: var(--brand-b);
  --menu-color: var(--brand-b-color);
  --menu-background-highlight: var(--brand-b-hover);
  --menu-color-highlight: var(--brand-b-hover-color);

  --menu-side-heading-background: var(--brand-a);
  --menu-side-heading-color: var(--brand-a-color);
  z-index: 1;
}

.menu-state {
  /* used by js during resize to know if we are seeing the hamburger(0) or fullwidth(1) version. Set as 0 here and 1 in the media query later */
  /* this approach allows us to work of mediaquery values without js needing to know what widths are set here for the mediaqueries */
  min-width: 0px; /* false: not fullwidth */
}

/* DEFINE nav wrapper and hamburger */
/* nav wrapper */
#top-nav-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

#top-nav-wrap.hamburger-open {
  position: absolute;
  top: 0;
  justify-content: space-between;
  /* width: 100%; */
  width: calc(100% + 195px);
  box-sizing: border-box;
  right: 0;
  align-items: start;
}

#top-nav {
  display: none;
}

/* Conceal sidebar navigation at mobile widths */
#side-nav {
  display: none;
}
@media only screen and (min-width: 900px) {
  /* ;sidebar-cutoff;  using 900px */
  #side-nav {
    display: unset;
  }
}

/* hamburger */
.hamburger-open #top-nav {
  flex-basis: 100%;
  display: unset;
  max-height: calc(100vh - 1rem);
  overflow-y: auto;
}

#hamburger-wrap {
  display: block;
  padding: 0.5em;
  background: white;
}

.hamburger {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 30px;
  height: 30px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  overflow: hidden;
}

.hamburger-line {
  width: 100%;
  height: 3px;
  background: #0e4f7b;
  transition: all 0.2s ease-in-out;
}

.hamburger .hamburger-line::before,
.hamburger .hamburger-line::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 3px;
  left: 0;
  background: #0e4f7b;
  transition: all 0.2s ease-in-out;
}

.hamburger .hamburger-line::before {
  transform: translateY(-7px);
}

.hamburger .hamburger-line::after {
  transform: translateY(7px);
}

/*  ANIMATION for Hamburger Menu  */
.hamburger-open .hamburger .hamburger-line {
  transform: translateX(-50px);
  background: transparent;
}
.hamburger-open .hamburger .hamburger-line::before {
  transform: rotate(45deg) translate(35px, -35px);
}
.hamburger-open .hamburger .hamburger-line::after {
  transform: rotate(-45deg) translate(35px, 35px);
}
/* end hamburger */

.cms-nav ul {
  padding: 0;
  margin: 0;
  list-style: none;
}

.cms-nav li {
  padding: 0;
  margin: 0;
  position: relative;
}

/* unset all sitewide <a> and <span> styles to allow menu rules to take over */
.cms-nav a,
.cms-nav span {
  text-decoration: unset;
  color: unset;
  font-weight: unset;
  transition: unset;
  cursor: pointer;

  font-size: 0.9rem;
  font-weight: 500;
  /* text-transform: uppercase; */
}

#top-nav.cms-nav ul.menu-parent-row {
  display: flex;
  flex-direction: column;
}

#top-nav.cms-nav li > ul {
  display: flex;
  flex-direction: column;
  min-width: 300px;
}

/* styling-divs-begin mobile*/

/* core styles, applies to top-nav and side-nav, all elements */
.cms-nav div {
  color: var(--brand-b-color);
  background: var(--brand-b);
  padding: 0.4rem 0.75rem;
  font-weight: 300;
}
.cms-nav .marked-group > div {
  background: #555e;
  color: var(--brand-b-hover-color);
}
.cms-nav div:hover,
.cms-nav li.this-is-the-page > div {
  background: var(--brand-b-hover);
  color: var(--brand-b-hover-color);
}

/* start expandable elements closed */
.cms-nav .menu-parent-row ul li > div {
  /* base rules, setting menu items in closed presentation: 0 for height, padding height, and line height */
  white-space: nowrap; /* prevent button wrapping to bottom */
  display: flex;
  justify-content: space-between;
  line-height: 0; /* appear closed when not clicked */
  overflow: hidden; /* appear closed when not clicked */
  padding-top: 0;
  padding-bottom: 0;
  height: 0; /* appear closed when not clicked */
  transition: color 0.25s, padding-top 0.5s, padding-bottom 0.5s,
    line-height 0.5s;
  /* base styles */
  color: #0000; /* while closed, transparent color for smooth fade-in */
}

/* elements with arrows */
.cms-nav li.with-arrow > div {
  padding-right: 0.5rem; /* remove div padding because button has enough already*/
}

/* force top level items to close instantly, prevents top level menu items retaining hover while opening one and closing another */
body:not(.is-mobile)
  #top-nav-wrap:not(.hamburger-open)
  #top-nav.cms-nav
  .menu-parent-row
  > li:not(.arrow-clicked)
  ul
  li
  > div {
  transition: unset;
}

/***************** edit-top-menu-mobile; ********************/

/* base open styles */
.cms-nav li.arrow-clicked > ul > li > div,
#side-nav.cms-nav .menu-parent-row > li > ul > li > div {
  /* with arrow clicked, regulate how it appears as open by setting padding and line heights and unsetting height. (animation occurs based on padding and line-height */
  height: unset;
  padding-top: 0.5rem; /* padding when open */
  padding-bottom: 0.5rem;
  line-height: 1.5rem;
  color: var(--brand-b-color);
}

/* ;edit-top-menu-marked; */
.cms-nav li.arrow-clicked > ul > li.marked-group > div {
  color: var(--brand-b-color);
}
/* ;edit-top-menu-hover; */
/* ;edit-top-menu-this-is-the-page; */
.cms-nav li.arrow-clicked > ul > li > div:hover,
.cms-nav li.arrow-clicked > ul > li.this-is-the-page > div {
  color: var(--brand-b-hover-color);
}

/* ;edit-top-menu-parent-divs; */
#top-nav.cms-nav .menu-parent-row > li > div {
  border-bottom: 1px solid #aaa;
}
#top-nav.cms-nav .menu-parent-row > li > div:hover {
}

/* ;edit-top-menu-child-divs; */
/* child specific rules for padding, color, background, etc */
/* child closed */
.cms-nav ul.menu-child-row > li > div {
  padding-left: 1rem; /* padding must be set in closed position so it doesn't jank when opening */
}
/* child open */
.cms-nav li.arrow-clicked > .menu-child-row > li > div {
  border-bottom: 1px solid #aaa; /* border-bottom must be set on open case so it doesn't display when closed */
}
/* child hover */
.cms-nav li.arrow-clicked > .menu-child-row > li > div:hover {
}

/* edit-top-menu-gchild-divs; */
/* grand-child specific rules for padding, color, background, etc */
/* child closed */
.cms-nav ul.menu-gchild-row > li > div {
  /* background set in closed case so it doesn't flicker on slide open */
  /* color with zero opacity so it can fade into opaque */
  padding-left: 2rem; /* indent grand-children */
}
/* gchild open */
.cms-nav li.arrow-clicked > .menu-gchild-row > li > div {
  border-bottom: 1px solid #aaa;
}
/* gchild hover */
.cms-nav li.arrow-clicked > .menu-gchild-row > li > div:hover {
}

/********************** edit-side-menu; *******************/
/* Typically, the sidemenu is not displayed on mobile. If a site requires them on mobile, the rules presented here are for mobile with desktop overrides in the media query below */

/*	;edit-side-menu-marked; */
#side-nav.cms-nav .menu-parent-row > li > ul > li.marked-group > div,
#side-nav.cms-nav li.arrow-clicked > ul > li.marked-group > div {
  color: var(--brand-b-color);
}

/* 	;edit-side-menu-this-is-the-page;		*/
#side-nav.cms-nav .menu-parent-row > li > ul > li.this-is-the-page > div,
#side-nav.cms-nav li.arrow-clicked > ul > li.this-is-the-page > div {
  color: var(--brand-b-hover-color);
}

/*	;edit-side-menu-parent-divs; */
#side-nav.cms-nav .menu-parent-row > li > div {
  border-bottom: 1px solid #aaa;
  background: var(--brand-a);
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--brand-a-color);
  padding-top: 1em;
  padding-bottom: 1em;
}

#side-nav.cms-nav .menu-parent-row > li > div > a {
  font-size: 1.2rem;
  font-weight: 600;
}

#side-nav.cms-nav .menu-parent-row > li > div:hover {
  /* currently uses same as top-menu, set above */
}

/*	;edit-side-menu-child-divs; */
#side-nav.cms-nav .menu-child-row > li > div {
  border-bottom: 1px solid #aaa;
  padding-left: 1rem;
}
#side-nav.cms-nav .menu-child-row > li > div:hover {
  /* currently uses same as top-menu, set above */
}
/*	;edit-side-menu-gchild-divs; */
#side-nav.cms-nav .menu-gchild-row > li > div {
  /* don't set border here, it is set when opened, only */
  padding-left: 2rem;
}
#side-nav.cms-nav .menu-gchild-row > li > div:hover {
  /* currently uses same as top-menu, set above */
}

/* DEFINE Menu Buttons (span) */
.cms-nav .menu-button {
  position: relative;
  display: inline-block;
  width: 2rem;
  float: right;
}

.cms-nav .menu-button > span {
  position: relative;
  width: 1rem;
  height: 1rem;
  display: block;
}
.cms-nav .menu-button > span:before {
  transform: rotate(245deg);
}
.cms-nav .menu-button > span:after {
  transform: rotate(-65deg);
}
.cms-nav .menu-button > span:before,
.cms-nav .menu-button > span:after {
  display: block;
  content: "";
  position: absolute;
  bottom: 0;
  background: black;
  width: 0.8rem;
  height: 0.2rem;
  transform-origin: 0.1rem center;
  transition: transform 0.5s, bottom 0.5s;
  border-radius: 1rem;
  left: 1rem;
}

/* open on click */
.cms-nav li.arrow-clicked > div > .menu-button > span:before,
.cms-nav li.arrow-clicked > div > .menu-button > span:after 
/* top menu-top row open on hover */ {
  bottom: 0.5rem;
}
.cms-nav li.arrow-clicked > div > .menu-button > span:before {
  transform: rotate(70deg);
}
.cms-nav li.arrow-clicked > div > .menu-button > span:after {
  transform: rotate(110deg);
}

/* set colors for buttons */
#top-nav .menu-parent-row > .with-arrow > div > .menu-button,
#top-nav .menu-child-row > .with-arrow > div > .menu-button {
  background: var(--menu-child-arrow-background); /* button background */
}
#top-nav .menu-parent-row > .with-arrow > div > .menu-button > span::before,
#top-nav .menu-parent-row > .with-arrow > div > .menu-button > span::after,
#top-nav .menu-child-row > .with-arrow > div > .menu-button > span::before,
#top-nav .menu-child-row > .with-arrow > div > .menu-button > span::after {
  background: var(--menu-child-arrow-color); /* button color */
}

#side-nav .menu-child-row > .with-arrow > div > .menu-button {
  background: var(--menu-side-arrow-background); /* button background */
}
#side-nav .menu-child-row > .with-arrow > div > .menu-button > span::before,
#side-nav .menu-child-row > .with-arrow > div > .menu-button > span::after {
  background: var(--menu-side-arrow-color); /* button color */
}

/****************************** MEDIA QUERIES ***************************************/

/* all declarations for transition to desktop */
/* adjust this value to change when desktop nav starts */
/* @media only screen and (min-width: 600px) { */

@media only screen and (min-width: 1186px) {
  .menu-state {
    /* used by js during resize to know if we are seeing the hamburger(0) or fullwidth(1) version. */
    min-width: 1px; /* true: fullwidth menu version*/
  }
  #top-nav-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  #top-nav-wrap.hamburger-open {
    position: unset;
    top: unset;
    width: unset;
    right: unset;
    justify-content: right;
  }

  #top-nav-wrap.hamburger-open #top-nav {
    flex-basis: unset;
    background: unset;
    max-height: unset;
    overflow-y: unset;
  }

  #top-nav {
    display: unset;
  }

  #top-nav.cms-nav ul.menu-parent-row {
    display: flex;
    flex-direction: row;
    margin-right: -1rem;
  }

  #top-nav.cms-nav ul.menu-child-row {
    position: absolute;
  }
  /* right adjust for right most element(s) */
  /* the number of elements to include here will depend on the width of the elements */
  #top-nav li:nth-last-child(-n + 5) > .menu-child-row {
    /* right: 0; */
  }

  #hamburger-wrap {
    display: none;
  }

  body:not(.is-mobile)
    #top-nav.cms-nav
    .menu-parent-row
    > .with-arrow
    > div
    > .menu-button {
    display: none;
  }

  /* ;edit-top-menu-parent-divs-desktop; */
  #top-nav.cms-nav .menu-parent-row > li > div {
    border-bottom: none;
    background: transparent;
    /* padding-right: 1em;  */
    color: black;
  }

  /* #top-nav.cms-nav .menu-parent-row > li.marked-group > div:after,
	#top-nav.cms-nav .menu-parent-row > li:hover > div:after {
		width: 50%;
		content: '';
		border: 1px solid var(--brand-a);
		position: absolute;
		left: 50%;
		top: .55rem;
		transform: translateX(-50%);
	} */

  #top-nav.cms-nav .menu-parent-row > li.marked-group a,
  #top-nav.cms-nav .menu-parent-row > li:hover a {
    color: #476e96;
  }

  #top-nav.cms-nav .menu-child-row > li a {
    color: #fff !important;
  }

  /* set colors for buttons */
  #top-nav .menu-parent-row > .with-arrow > div > .menu-button {
    background: var(--menu-top-arrow-background); /* button background */
  }
  #top-nav .menu-parent-row > .with-arrow > div > .menu-button > span::before,
  #top-nav .menu-parent-row > .with-arrow > div > .menu-button > span::after {
    background: var(--menu-top-arrow-color); /* button color */
  }
}
