/* MAIN HEADER */

:root {
  --header-height: 70px;
}
header {
  /* height: var(--header-height); */
  font-family: var(--alt-font);
  display: flex;
  flex-direction: column;
  align-content: center;
  border-bottom: 2px solid var(--accent);
  position: relative;
  z-index: 100;
  position: sticky;
  left: 0;
  right: 0;
}

.header-wrapper {
  width: var(--wrapper);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  -webkit-transition: all 0.4s ease-in-out;
  transition: all 0.4s ease-in-out;
  padding: 20px 0;
}

#main-nav {
  background: var(--main);
  width: 100%;
}

.desktop-nav {
  display: block;
}

.mobile-nav {
  display: none;
}

.header-inner-wrapper a {
  display: block;
  line-height: 1;
}

nav ul {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
}

nav ul li a,
.submenu li {
  margin: 0 18px;
}

nav ul li a {
  color: var(--white);
  text-decoration: none;
  font-weight: 400;
  white-space: nowrap;
  padding: 8px 0;
  line-height: 1;
}

nav ul li a:hover {
  color: var(--accent);
}

.current-menu-item,
.current_page_item {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 0.15ch;
  text-underline-offset: 0.5ch;
}

header .nav-button a {
  color: var(--background);
  background-color: var(--main);
  border-radius: 0;
  line-height: 1;
  white-space: nowrap;
  padding: 8px 25px;
  text-transform: uppercase;
  font-weight: 600;
  transition: var(--transition);
  -webkit-transition: var(--transition);
}

header .nav-button a:hover {
  color: var(--main);
  background-color: var(--accent);
}

body.logged-in .logged-in-link {
  display: block;
}

body:not(.logged-in) .logged-in-link {
  display: none;
}

body.logged-in .not-logged-in-link {
  display: none;
}

body:not(.logged-in) .not-logged-in-link {
  display: block;
}

.nav ul li:last-of-type a {
  margin-right: 0;
}

.nav .sub-menu li:last-child a {
  margin-right: 18px;
}

.nav .sub-menu li:last-child {
  margin-bottom: 0;
}

.nav .sub-menu {
  display: none;
  position: absolute;
  z-index: 100;
  padding: 0 14px 20px 14px;
  margin: 0;
  background: var(--main);
}

.nav .sub-menu li {
  margin: 18px 0;
}

.menu-item-has-children>a::after {
  content: "";
  background-image: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8' standalone='no'%3F%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg width='100%25' height='100%25' viewBox='0 0 7437 5638' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' xml:space='preserve' xmlns:serif='http://www.serif.com/' style='fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;'%3E%3Cpath d='M0,4340.92l3718.12,-4340.92l3718.01,4340.92l-1160.84,1296.89l-2557.16,-2985.54l-2557.28,2985.54l-1160.84,-1296.89l-0.011,-0Z' style='fill:%23ffffff;fill-rule:nonzero;'/%3E%3C/svg%3E");
  height: 0.6em;
  width: 0.6em;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  display: inline-block;
  color: var(--background);
  margin-left: 0.5rem;
  transform: rotate(180deg);
}

.menu-item-has-children:hover .sub-menu {
  display: block;
}

.logo-img {
  max-width: 270px !important;
  height: auto;
}

.logo-icon {
  display: none;
}

.hamburger {
  display: none;
}

.bar {
  height: 3px;
  width: 20px;
  margin: 5px 0;
  background: var(--background);
  -webkit-transition: var(--transition);
  transition: var(--transition);
}

.nav-mobile-only {
  display: none;
}

/* For home page header */
article header li {
  margin-bottom: 0;
}


/* Header Mobile */
@media screen and (max-width: 951px) {
  :root {
  	--header-height: 70px;
  }

  .top-bar {
    display: none;
  }

  .desktop-nav {
    display: none;
  }

  .mobile-nav {
    display: block;
  }

  .mobile-search {
    display: block;
    margin-bottom: 35px !important;
  }

  header {
    height: auto;
  }

  #main-nav {
    background: var(--main);
    border-bottom: 1px solid var(--accent);
  }

  header a {
    font-size: var(--body-fs);
  }

  #main-nav>.header-wrapper {
    width: var(--wrapper);
    margin: 0 auto;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end;
    display: grid;
    grid-template-rows: var(--header-height) auto;
    grid-template-columns: auto auto;
    padding: 0;
  }

  .header-wrapper{
    height: var(--header-height);
  }

  .logo-icon {
    display: none;
  }

  .logo-img {
    display: block;
    max-height: var(--header-height);
    padding: 15px;
  }

  .nav {
    background: var(--main);
    border-bottom: 1px solid var(--accent);
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    grid-row: 2;
    grid-column-start: 1;
    grid-column-end: 3;
    position: relative;
    -webkit-transform: scaleY(0);
    transform: scaleY(0);
    -webkit-transform-origin: top;
    transform-origin: top;
    -webkit-transition: var(--transition);
    transition: var(--transition);
    z-index: 100;
	}

  .nav.active {
    transform: scaleY(1);
  }

  .header-inner-wrapper {
    width: var(--wrapper);
    height: var(--header-height);
    margin: auto;
    display: flex;
    grid-row: 1;
    grid-column-start: 1;
    grid-column-end: 3;
    justify-content: space-between;
    align-items: center;
  }

  .site-title, .hamburger {
    display: flex;
    height: var(--header-height);
    align-items: center;
  }

  .site-title a {
    display: flex;
    align-items: center;
    max-height: var(--header-height);
    max-width: 80%;
  }

	.nav ul,
  .mobile-search {
		display: block;
    padding: 0 14px;
    width: var(--wrapper);
    margin: auto;
	}

  .mobile-search {
    margin-top: 20px;
  }

	.nav ul li {
		margin: 18px 0;
	}

	.nav ul li a {
		margin: 0;
    color: var(--background);
	}

	.nav .sub-menu {
		display: block;
		position: static;
    padding-top: 14px;
    padding-left: 25px;
	}

  .sub-menu li, .sub-menu li:last-child a, .sub-menu li:first-child a {
    margin: 0;
  }

  .menu-item-has-children > a::after {
    display: none;
  }

  .nav-mobile-only {
    display: block;
  }

  .nav-search-wrapper button[type="submit"] {
    background: url('/wp-content/themes/wiaf_foundation/img/icons/search.svg');
    background-position: center;
    background-repeat: no-repeat;
  }

  .mobile-search .nav-search-wrapper button[type="submit"] {
    background: url('/wp-content/themes/wiaf_foundation/img/icons/search.svg');
    background-position: center;
    background-repeat: no-repeat;
  }
  .hamburger {
    height: var(--header-height);
  }


	.hamburger.active .bar:nth-child(2) {
    -webkit-transform: translateX(10vw);
    transform: translateX(10vw);
    opacity: 0;
	}

	.hamburger.active .bar:nth-child(1) {
		-webkit-transform: translateY(8px) rotate(405deg);
		transform: translateY(8px) rotate(405deg);
	}

	.hamburger.active .bar:nth-child(3) {
		-webkit-transform: translateY(-8px) rotate(-45deg);
		transform: translateY(-8px) rotate(-45deg);
	}
}
