/***** Sub Nav Styling *****/
/* Sub nav is not always visible below 1280px ****/

/* general subnav styles */
.subNav {
    grid-area: subNav;
    display: flex;
    --nav-color: rgb(36 61 148);
}
.subNav > .nestedLinkList {
    background-color: 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: 10px;
}
.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, .12);
}
.subNavList:not(.nestedLinkList--d1) > li {
    /* Darken each layer's background iteratively */
    background-color: rgba(0, 0, 0, 0.3);
}
.subNavList li:last-child {
    border-bottom: 1px solid rgba(255, 255, 255, .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) {
.subNavList.nestedLinkList.nestedLinkList--d1.nestedLinkList--d1 {
    height: max-content;
}

.subNavList.nestedLinkList--d1.nestedLinkList--d1.nestedLinkList__manualDropDown:not(:checked) ~ .subNavList {
    translate: -100%;
    position: relative;
}
.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;}
  }
}

.subNav a.nestedLinkList__item--active {
    color: goldenrod;
}


/* Style the List Expander checkbox */
.subNav input {
    all: unset;
    cursor: pointer;
    transition: transform .3s;

    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 .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
        / auto 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 (min-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:has(.nestedLinkList__manualDropDown.nestedLinkList--d1:checked) {
        z-index: 2; /* Have display over content and footer */
    }

    .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-color: var(--nav-color);
        width: 145px;
        height: 3em;
        flex-direction: row-reverse;
        flex-shrink: 0;

        padding: 0;
        justify-content: space-evenly;
    }
    .subNav > input:before {
        color: white;
        width: 75px;
        content: 'Navigation';
        padding-top: 1px; /* Slight alignment thing */
    }
    .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 .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-color: 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);
    }

}