/* HEADER - page header (Page/Partials/Header.html): a top bar band (search, meta links, login), then the main bar with
   the logo left and the main navigation right. It overlays the Stage, whose padding-top (_stage.scss) reserves the
   header height, so the header must stay within it. */
.header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    background-color: var(--bs-white);
}

.TopBar {
    display: none;
    border-bottom: 1px solid var(--site-gray-light);

    @media (width >= 768px) { /* md */
        display: block;
    }
}

.TopBar-container {
    display: flex;
    justify-content: flex-end;
    padding-top: 0.375rem;
    padding-bottom: 0.375rem;

    @media (width >= 992px) { /* lg */
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
}

.MainBar-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;

    @media (width >= 768px) { /* md */
        flex-wrap: nowrap;
        /* anchors the flyouts, which span the whole container below the main bar */
        position: relative;
        padding-top: 0.625rem;
        padding-bottom: 0.625rem;
    }
}

.header-logo {
    flex-shrink: 0;

    a {
        display: block;
        padding: 0.25rem;
    }
}

.search-form {
    position: relative;

    input {
        height: 2.3125rem;
        padding: 0 2.75rem 0 1.25rem;
        font-size: 0.9375rem;
        color: var(--bs-body-color);
        background-color: var(--site-gray-light);
        border: 0;
        border-radius: 50rem;

        &::placeholder {
            color: var(--bs-body-color);
        }
    }

    .search-icon {
        position: absolute;
        top: 0;
        right: 0.5rem;
        width: 2rem;
        height: 100%;
        background: url('../../Img/lupe.png') no-repeat center;
        border: 0;
        border-radius: 50rem;
    }
}

.meta-navigation {
    display: flex;
    align-items: center;
    font-size: 0.9375rem;

    ul {
        display: flex;
        align-items: center;
        list-style: none;
        margin: 0;
        padding: 0 0 0 0.5rem;

        a {
            display: block;
            padding: 0.5rem 0.625rem;
            color: var(--bs-body-color);
            text-decoration: none;

            &:hover {
                text-decoration: underline;
            }

            @media (width >= 992px) { /* lg */
                padding-left: 1rem;
                padding-right: 1rem;
            }
        }
    }

    .search-form input {
        width: 9.375rem;

        @media (width >= 992px) { /* lg */
            width: 12.125rem;
        }
    }

    .login-button {
        margin-left: 0.5rem;
    }
}

/* Main navigation. Mobile: full-width list under the logo bar (hamburger).
   From md: one row right of the logo, 1px dividers between the items. */
#navigation {
    order: 3;
    flex: 1 0 100%;
    /* full-bleed menu; the container padding differs per breakpoint (_overrides.scss) */
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);

    @media (width >= 768px) { /* md */
        order: 0;
        flex: 0 1 auto;
        /* pulled into the container padding by the last link's padding, so its text stays flush right */
        margin: 0 -0.75rem 0 0;
    }
}

.main-navigation {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
    margin-top: 0.5rem;
    border-top: 1px solid var(--site-gray-light);

    @media (width >= 768px) { /* md */
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        /* the flyouts position against .MainBar-container instead */
        position: static;
        margin-top: 0;
        border-top: 0;
    }

    & > li {
        font-size: 1.25rem;
        border-bottom: 1px solid var(--site-gray-light);

        @media (width >= 768px) { /* md */
            font-size: 1rem;
            border-bottom: 0;

            & + li {
                border-left: 1px solid var(--site-gray-light);
            }
        }

        @media (width >= 992px) { /* lg */
            font-size: 1.25rem;
        }
    }

    & > li > a:not(.btn) {
        display: block;
        padding: 1.125rem 0.625rem;
        text-align: center;
        line-height: 1.2;
        text-decoration: none;
        color: var(--bs-body-color);

        @media (width >= 768px) { /* md */
            display: flex;
            align-items: center;
            min-height: 2.75rem;
            padding: 0 0.75rem;
        }

        @media (width >= 992px) { /* lg */
            min-height: 3.4375rem;
            padding: 0 1.5rem;
        }

        &.active,
        &:hover,
        &[aria-expanded="true"] {
            color: var(--bs-primary);
        }

        &.active {
            text-decoration: underline;
            text-decoration-thickness: 2px;
            text-underline-offset: 0.375rem;
        }
    }

    @media (width >= 768px) { /* md */
        /* room for the focus ring; no more than the container padding, so the pull of #navigation never overflows */
        & > li.last > a:not(.btn) {
            padding-right: 0.75rem;
        }
    }

    /* mobile only: search field and login button inside the opened menu */
    & > .NavSearch,
    & > .NavLogin {
        padding: 1rem 1.5rem;
        text-align: center;
    }

    & > .NavSearch:not(:has(form)) {
        display: none;
    }

    .dropdown-menu {
        border: 0;
        padding: 0;
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.176);

        @media (width >= 768px) { /* md */
            position: absolute;
            top: 100%;
            left: calc(var(--bs-gutter-x) * 0.5);
            right: calc(var(--bs-gutter-x) * 0.5);
        }

        .close-navlayer {
            display: none;
            position: absolute;
            top: 20px;
            right: 20px;
            background-color: var(--bs-white);
            background-image: url('../../Img/close.gif');
            background-repeat: no-repeat;
            background-position: center center;
            height: 40px;
            width: 40px;
            border-radius: 20px;
            color: var(--bs-primary);
            cursor: pointer;
            border: 0;

            /* hidden on mobile devices */
            @media (width >= 768px) { /* md */
                display: block;
            }
        }

        .mega-menu-content {
            background-position: right bottom;
            background-repeat: no-repeat;
            background-color: #f9f9f9;
            background-size: contain;
            font-size: 16px;
            padding: 12px;
            position: relative;
            z-index: 50;

            @media (width < 992px) { /* below lg */
                background-image: none !important;
            }

            @media (width >= 992px) { /* lg */
                min-height: 300px;
                padding: 0;
            }

            .overview-teaser {
                text-align: center;
                line-height: 1.7;
                padding: 1.25rem;

                @media (width >= 768px) { /* md */
                    text-align: left;
                }

                @media (width >= 992px) { /* lg */
                    padding: 2.5rem;
                }

                p:last-child {
                    margin-bottom: 0;
                }
            }

            .overview-menu {
                padding: 1.25rem;

                @media (width >= 992px) { /* lg */
                    padding: 2.5rem;
                }

                h3 {
                    @media (width < 576px) { /* below sm */
                        font-size: 1.375rem;
                    }
                }

                ul {
                    padding: 0;

                    li {
                        list-style-type: none;
                        font-size: 16px;
                        font-family: DaxWeb-Medi;
                        text-align: left;
                    }
                }

                a {
                    display: block;
                    padding: 4px;
                    text-decoration: none;

                    &:hover {
                        text-decoration: underline;
                    }
                }

                a::before {
                    content: "";
                    display: inline-block;
                    width: 1rem;
                    height: 1rem;
                    position: relative;
                    top: 2px;
                    margin-right: 4px;
                    background-image: url('../../Icons/arrow-right.svg');
                    background-size: 1rem 1rem;
                    background-repeat: no-repeat;
                    background-position: 50% 50%;
                }
            }
        }
    }
}

/* chevron shows that a mobile menu item opens a sub level */
.main-navigation > li > a.dropdown-toggle {
    position: relative;

    &::before {
        content: "";
        background-image: url('../../Icons/chevron-down.svg');
        background-position: 50% 50%;
        background-repeat: no-repeat;
        background-size: 2rem 2rem;
        width: 2rem;
        height: 2rem;
        position: absolute;
        top: 50%;
        right: 30px;
        margin-top: -1rem;

        @media (width >= 768px) { /* md */
            content: none;
        }
    }
}

.navigation-toggle {
    @media (width >= 768px) { /* md */
        display: none;
    }
}

/* Hamburger button (Js/script.js toggles .is-active with the menu): the "squeeze" type of the hamburgers library */
.hamburger {
    display: inline-block;
    margin: 0;
    padding: 11px 8px 5px;
    overflow: visible;
    font: inherit;
    color: inherit;
    text-transform: none;
    background-color: transparent;
    border: 0;
    cursor: pointer;
    transition-property: opacity, filter;
    transition-duration: 0.15s;
    transition-timing-function: linear;

    &:hover {
        opacity: 0.7;
    }
}

.hamburger-box {
    display: inline-block;
    position: relative;
    width: 32px;
    height: 26px;
}

.hamburger-inner {
    display: block;
    top: 50%;
    margin-top: -2px;

    &,
    &::before,
    &::after {
        position: absolute;
        width: 32px;
        height: 4px;
        background-color: var(--bs-primary);
        border-radius: 4px;
        transition-property: transform;
        transition-duration: 0.15s;
        transition-timing-function: ease;
    }

    &::before,
    &::after {
        content: "";
        display: block;
    }

    &::before {
        top: -11px;
    }

    &::after {
        bottom: -11px;
    }
}

.hamburger--squeeze {
    .hamburger-inner {
        transition-duration: 0.075s;
        transition-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);

        &::before {
            transition: top 0.075s 0.12s ease, opacity 0.075s ease;
        }

        &::after {
            transition: bottom 0.075s 0.12s ease, transform 0.075s cubic-bezier(0.55, 0.055, 0.675, 0.19);
        }
    }

    &.is-active .hamburger-inner {
        transform: rotate(45deg);
        transition-delay: 0.12s;
        transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);

        &::before {
            top: 0;
            opacity: 0;
            transition: top 0.075s ease, opacity 0.075s 0.12s ease;
        }

        &::after {
            bottom: 0;
            transform: rotate(-90deg);
            transition: bottom 0.075s ease, transform 0.075s 0.12s cubic-bezier(0.215, 0.61, 0.355, 1);
        }
    }
}
