/* The header of stackgres.io: logo, main menu, links and the mobile menu */

/* header */
nav a, nav a:visited {
    color: var(--themeText);
    font-size: var(--fontBase);
    font-weight: 500;
    text-decoration: none;
}

#mainMenu .active > a:after {
    content: " ";
    display: block;
    position: absolute;
    top: 110%;
    width: 15px;
    background: var(--horizontalGradient);
    height: 3px;
    left: 50%;
    transform: translateX(-50%);
}

#mainMenu .active > a {
    font-weight: bold;
    position: relative;
}

/* The news line at the top of the page (partials/banner.html): the
   gradient of the buttons, the sentence centered, the link bold, and the
   cross that closes it centered at the right */

/* On the light theme the text on the accent is white: so is the arrow */

#mainMenu {
    font-family: var(--fontHeading);
}

#header {
    padding: 30px 0;
    height: 90px;
    background: var(--themeHeader);
    z-index: 999999;
    box-shadow: 0px 2px 12px #0000001A;;
    position: sticky;
    position: -webkit-sticky;
    top: 0;
}

.headerLogo svg {
    width: 24px;
    position: relative;
    top: 5px;
    margin-right: 1px;
}

.headerLogo {
    font-size: 1.3rem;
}

#mainMenu {
    margin-top: 5px;
}

#header .follow {
    margin-top: 8px;
}

#mainMenu li {
    margin: 0 8px;
}

#mainMenu a:hover {
    color: var(--baseLightColor);
}

#header .follow a {
    margin-left: 15px;
}

#header .follow a:hover {
    filter: brightness(1.5);
}

#header .follow a path {
    fill: var(--baseColor);
}

/* The switch of theme, an og- icon button, floats above the go-top arrow
   and shows the theme it switches to */
.themeToggle {
    position: fixed;
    right: 27px;
    bottom: 80px;
    z-index: 10;
    border-radius: 100%;
}

:root:not([data-theme="light"]) .themeToggle .moon, [data-theme="light"] .themeToggle .sun {
    display: none;
}

/* Where the go-top arrow hides, the switch takes its place in the corner */
@media screen and (max-width: 920px) {
    .themeToggle {
        bottom: 29px;
    }
}

@media screen and (min-width: 920px) and (max-width: 1240px) {

    #header .follow {
        position: fixed;
        bottom: 130px;
        right: 27px;
        z-index: 10;
    }

    #header .follow a {
        display: block;
        width: 42px;
        height: 42px;
        line-height: 42px;
        background: var(--horizontalGradient);
        border-radius: 100%;
        margin-top: 8px;
        position: relative;
        overflow: visible;
    }

    #header .follow a svg path {
        fill: var(--onAccent);
    }

    #header .follow a span {
        display: none;
    }

    #header .follow a:hover {
        transform: scale(1.1);
        transition: all .2s ease-out;
    }

    #mainMenu {
        float: right;
    }
}

@media screen and (min-width: 921px) {
    .hideDesktop {
        display: none;
    }
}

@media screen and (max-width: 920px) {

    /* The toggle, an og- icon button, sits on the top edge of the menu sheet */
    #navToggle {
        position: absolute;
        left: 50%;
        transform: translate(-50%, calc(-100% - 8px));
    }

    #navToggle .iconClose, .menuOpen #navToggle .iconMenu {
        display: none;
    }

    .menuOpen #navToggle .iconClose {
        display: block;
    }

    .mobileMenu {
        position: fixed;
        bottom: 0;
        z-index: 999999;
        width: 100vw;
        border-top-left-radius: 25px;
        border-top-right-radius: 25px;
        max-width: none;
        max-height: 0;
        background-image: var(--verticalGradient);
        text-align: center;
        transition: all .3s ease-out;
    }

    .mobileMenu.menuOpen {
        max-height: 100vh;
        padding-bottom: 20px;
        transition: max-height .3s ease-out;
    }
    

    #header.menuOpen:before {
        position: fixed;
        width: 100%;
        height: 100%;
        background: hsl(var(--og-overlay));
        display: block;
        content: " ";
        top: 0;
        left: 0;
        opacity: .9;
        z-index: 10;
    }

    #mainMenu, #header .follow {
        display: none;
        width: 100%;
    }

    .menuOpen #mainMenu, #header.menuOpen .follow {
        display: block;
        transition: all .3s ease-out;
    }

    #logo {
        position: absolute;
        left: 100vw;
        transition: opacity .3s ease-in;
    }

    .menuOpen #logo {
        opacity: 1;
        left: 50%;
        transform: translate(-50%, -100px);
        transition: opacity .3s ease-in;
    }

    nav a, nav a:visited, nav a:hover {
        color: var(--onAccent) !important;
        font-weight: bold;
        letter-spacing: 0;
    }

    #mainMenu .active > a:after {
        background-color: var(--onAccent);
        background-image: none;
    }

    #mainMenu li {
        display: block;
        width: 100%;
        margin: 10px 0;
    }

    #mainMenu {
        padding-top: 20px;
    }

    #header .follow a {
        margin: 10px 0;
        display: block;
        color: var(--onAccent);
        background-image: none;
        -webkit-background-clip: initial;
        -webkit-text-fill-color: initial;
        font-size: 1rem;
        font-weight: bold;
        letter-spacing: 0;
    }

    #mainMenu > ul > li:last-child:after {
        display: block;
        content: " ";
        width: 50px;
        height: 2px;
        background: var(--onAccent);
        left: calc(50% - 25px);
        position: absolute;
        margin-top: 12px;
    }

    #header .follow a path {
        fill: var(--onAccent)
    }

    #mobileLogo {
        margin-left: calc(5vw + 15px);
    }

    #header {
        position: relative;
    }

}
