/***** Sub Nav Styling *****/
/* Sub nav is not always visible below 1280px ****/

/* general subnav styles */
.subNav {
  grid-area: subNav;
  display: flex;

  --nav-color: linear-gradient(
    90deg,
    rgba(130, 21, 26, 1) 0%,
    rgba(206, 21, 26, 1) 100%
  );
  z-index: 2;
}
.subNav > .nestedLinkList {
  background: var(--nav-color);
  width: 320px;
  height: auto;
}
.subNav :is(a, a:visited, a:active) {
  color: white;
  display: inline-block;
  text-decoration: none;
  font-size: 15px;
  padding: 15px;
}
.subNav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.subNavList {
  display: flex;
  opacity: 1;
  flex-wrap: wrap;
  /* Have the items line up top to bottom by default */
  flex-direction: column;
}
.subNavList li {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.subNavList:not(.nestedLinkList--d1) > li {
  /* Darken each layer's background iteratively */
  background: rgba(0, 0, 0, 0.3);
}
.subNavList li:last-child {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.subNavList li:has(> .nestedLinkList__manualDropDown:checked) + li, /* Prevent double border happening when dropdown occurs */
.subNav > .subNavList > li:first-child {
  /* Remove border from very top */
  border-top: 0;
}

.nestedLinkList__manualDropDown:not(:checked) ~ .subNavList {
  /* Menus should be hidden by default if their toggle is not checked */
  height: 0;
  overflow: hidden;
}

/* This handles the slideout of the subnav on smaller screens */
@media screen and (max-width: 1280px) {
  .subNav > input {
    --nav-color: rgba(206, 32, 26, 1);
  }
  .subNavList.nestedLinkList--d1.nestedLinkList--d1.nestedLinkList__manualDropDown:not(
      :checked
    )
    ~ .subNavList {
    translate: -100%;
    position: absolute;
    animation: KeepRel 0.3s;
  }
  .subNavList.nestedLinkList--d1.nestedLinkList--d1.nestedLinkList__manualDropDown:checked
    ~ .subNavList {
    translate: 0;
    position: relative;
  }
  .subNavList.nestedLinkList--d1.nestedLinkList--d1.nestedLinkList__manualDropDown:not(
      :checked
    ) {
    position: absolute;
  }
  .subNavList.nestedLinkList--d1.nestedLinkList--d1.nestedLinkList__manualDropDown:checked {
    position: relative;
    animation: slideOut 0.3s 1 ease-out;
  }
  @keyframes slideOut {
    from {
      left: calc(-100%);
    }
    to {
      left: 0;
    }
  }
  @keyframes KeepRel {
    from {
      position: relative;
    }
    to {
      position: relative;
    }
  }
}

.subNav a.nestedLinkList__item--active {
  color: #ffb738;
}
.subNav a:hover {
  color: #ffb738;
}

.subNav .nestedLinkList__item:has(> .nestedLinkList__icon) {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding-top: 5px;
  padding-bottom: 5px;
  line-height: 2em;
}
.subNav .nestedLinkList__icon {
  width: 2em;
  height: 2em;
  object-fit: contain;
}

/* Style the List Expander checkbox */
.subNav input {
  all: unset;
  cursor: pointer;

  height: 24px;
  width: 24px;
  /* height: 100%;
  width: 2em; */
  padding-left: 0.5em;
  display: flex;
  align-items: center;
  justify-content: center;
  /* background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 13.1l-8-8 2.1-2.2 5.9 5.9 5.9-5.9 2.1 2.2z'/%3E%3C/svg%3E"); */
}
/* Make it a chevron pointing right */
.subNav :is(input, input:checked):after {
  content: " ";
  display: inline-block;
  border-bottom: 2px solid #fff;
  border-right: 2px solid #fff;
  height: 12px;
  width: 12px;
  transition: transform 0.3s;
}
.subNav input:after {
  transform: rotate(-45deg) translateX(-2px) translateY(-2px);
}
.subNav input:checked:after {
  transform: rotate(45deg) translateX(-2px) translateY(-2px);
}

/* Layout the nav nestings */
.subNavList li {
  display: grid;
  opacity: 1;
  grid:
    "parent arrow" min-content
    "child child" 1fr
    / 1fr min-content;
  align-items: center;
}
.subNavList input {
  grid-area: arrow;
}
.subNavList a {
  grid-area: parent;
}
.subNavList {
  grid-area: child;
}

/********* Big Desktop Nav *****************/
@media screen and (width > 1280px) {
  .subNavList.nestedLinkList--d1.nestedLinkList--d1 {
    /* Ensure the initial menu is always displayed on big desktop */
    height: auto;
  }
  .subNav .nestedLinkList__manualDropDown.nestedLinkList--d1 {
    /* Hide the checkbox for main nav on big desktop */
    display: none;
  }
}

/*** Mobile/Smaller Desktop ***/
@media screen and (max-width: 1280px) {
  .subNav {
    justify-content: flex-end;
    flex-direction: row-reverse;
    float: left;
    max-width: 100%;
    height: fit-content;
  }

  .subNav > .nestedLinkList {
    max-width: calc(100vw - 4em);
  }

  .subNav .nestedLinkList__manualDropDown.nestedLinkList--d1 {
    /* Show the checkbox for small desktop */
    display: flex;
    opacity: 1;
  }
  .subNav > input {
    background: var(--nav-color);
    width: 145px;
    height: 3em;
    flex-direction: row-reverse;
    flex-shrink: 0;
    padding: 0;
    color: white;
    justify-content: space-evenly;
    transition: background-color 0.4s;
  }
  .subNav > input:hover {
    color: #ffb738;
    background-color: rgba(0, 0, 0, 0.8);
  }
  .subNav > input:before {
    width: 75px;
    content: "Navigation";
    padding-top: 1px; /* Slight alignment thing */
  }
  .subNav > input::before:hover .subNav > :is(input, input:checked):after {
    content: " ";
    display: inline-block;
    border-bottom: 2px solid #fff;
    border-right: 2px solid #fff;
    height: 12px;
    width: 12px;
    transition: transform 0.3s;
  }
  .subNav > input:after {
    transform: rotate(135deg) translateX(-2px) translateY(-2px);
  }

  /* Style as X when clicked */
  .subNav .nestedLinkList__manualDropDown.nestedLinkList--d1:checked {
    width: 3em;
  }
  .subNav .nestedLinkList__manualDropDown.nestedLinkList--d1:checked:before,
  .subNav .nestedLinkList__manualDropDown.nestedLinkList--d1:checked:after {
    position: absolute;
    width: 36px;
    height: 4px;
    background: white;
    border-radius: 2px;
    transition: transform 0.6s;
    cursor: pointer;
    content: "";
  }
  .subNav .nestedLinkList__manualDropDown.nestedLinkList--d1:checked:before {
    transform: rotate(45deg);
  }
  .subNav .nestedLinkList__manualDropDown.nestedLinkList--d1:checked:after {
    transform: rotate(-45deg);
  }
}
