:root {
    --nav-breakpoint: 1024;
    --nav-color: #25455F;
    --nav-active-color: #f47c00;
    --nav-item-line-height: 1.5;
    --nav-font-size: 20px;
    --nav-font-weight: 600;
    --nav-icon: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M9 18l6-6-6-6"/></svg>');
    --nav-icon-background: transparent;
    --nav-mobile-background: #172b3b;
    --nav-mobile-color: #d3d6da;
    --nav-mobile-active-background: #172b3b;
    --nav-mobile-active-color: #f47c00;
    --nav-mobile-active-border-color: #f47c00;
    --nav-mobile-btn-clr: #f47c00;
    --nav-mobile-separator-color: rgb(255 255 255 / 10%);
    --nav-mobile-padding: 120px 20px 20px;
    --nav-mobile-font-size: 18px;
    --nav-mobile-backdrop-height: 80px;
    --nav-mobile-icon: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6"/></svg>');
    --nav-submenu-background: #fff;
    --nav-burger-line-color: hsl(30deg 100% 48%);
    --skip-background: #172b3b;
    --skip-color: #d3d6da;
    --skip-focus-border-color: #f47c00;
}

body {
    &:not(.navigation-open, .nav-is-desktop) .navigation-main {
        opacity: 0;
        pointer-events: none;
        visibility: hidden;
    }

    &.navigation-open {
        overflow: hidden;

        header .logo {
            position: relative;
            z-index: 7;
        }
    }
}

.nav-wrapper {
    * {
        box-sizing: border-box;
    }
}

.navigation-main {
    :is(a, strong) {
        line-height: var(--nav-item-line-height);
    }

    .skip-link {
        visibility: hidden;
    }
}

.btn-toggle-submenu {
    all: revert;
    position: absolute;
    top: 5px;
    right: 0;
    width: 44px;
    height: 44px;
    border: none;
    background: var(--nav-icon-background) !important;
    cursor: pointer;
    z-index: 1;

    &::after {
        content: '';
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100%;
        background: var(--nav-mobile-icon) no-repeat center;
        transition: transform 0.3s cubic-bezier(0.2, 0.6, 0.3, 1.1);
    }
}

.nav-burger {
    padding: 0;
    border: none;
    background: transparent;
    line-height: 1.5;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    position: relative;
    z-index: 7;

    .icon-line {
        top: 50%;
        z-index: 1;
        transform: translateY(-50%);
        transition: background-color 0.2s ease-in-out;

        &::before {
            top: calc(-1 * (0.25rem + 0.375rem));
        }

        &::after {
            bottom: calc(-1 * (0.25rem + 0.375rem));
        }
    }

    .icon-line,
    .icon-line::before,
    .icon-line::after {
        position: absolute;
        left: 50%;
        height: 0.25rem;
        width: 2.25rem;
        background: var(--nav-burger-line-color);
        border-radius: 3rem;
        transform: translateX(-50%);
    }

    .icon-line::before,
    .icon-line::after {
        z-index: 6;
        transition: transform 0.2s ease-in-out, top 0.2s ease-in-out, bottom 0.2s ease-in-out;
        content: "";
    }

    &.is-active {
        .icon-line {
            background: transparent;

            &::before {
                top: 0;
                transform: translateX(-50%) rotate(45deg);
            }

            &::after {
                bottom: 0;
                transform: translateX(-50%) rotate(-45deg);
            }
        }
    }

    &:hover {
        cursor: pointer;
    }
}

.nav-burger__inner {
    position: relative;
    width: 44px;
    height: 44px;
}

body.nav-is-mobile {
    .nav-wrapper {
        position: relative;
        z-index: 5;
    }

    .navigation-main {
        position: fixed;
        inset: 0;
        overflow: hidden auto;
        z-index: 6;
        padding: var(--nav-mobile-padding);
        background: var(--nav-mobile-background);
        color: var(--nav-mobile-color);
        line-height: 1.5;
        font-size: var(--nav-mobile-font-size);
        transition: opacity 0.15s ease-in-out, visibility 0.1s;

        &.is-active {
            &::before {
                display: block;
                content: '';
                position: fixed;
                inset: 0 0 auto;
                height: var(--nav-mobile-backdrop-height);
                backdrop-filter: blur(1px);
                z-index: 1;
            }
        }

        :is(a, strong) {
            display: inline-block;
            color: var(--nav-mobile-color) !important;
            text-decoration: unset;
            padding: 12px 10px;
            width: calc(100% - 44px);

            &:is(.active) {
                --nav-mobile-color: var(--nav-mobile-active-color);
            }
        }

        .level_1 {
            ul {
                display: none;
                flex-direction: column;
            }
        }

        .level_2 {
            li {
                padding: 0 0 0 20px;
            }
        }

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

        li {
            position: relative;
            padding: 0;

            &:not(:last-child) {
                border-bottom: 1px solid var(--nav-mobile-separator-color);
            }

            &.submenu {
                li {
                    &:first-child {
                        border-top: 1px solid var(--nav-mobile-separator-color);
                    }
                }
            }

            > .btn-toggle-submenu::after {
                transform: rotateX(180deg) rotateZ(-90deg);
            }

            &.active {
                background: var(--nav-mobile-active-background);
                color: var(--nav-mobile-active-color);
            }

            &.nav-expanded {
                > ul {
                    display: flex;
                }

                > .btn-toggle-submenu::after {
                    transform: rotateX(0deg) rotateZ(-90deg);
                }
            }
        }
    }
}

body.nav-is-desktop {
    .nav-wrapper {
        display: flex;
        align-items: center;
    }

    .navigation-main {
        a {
            text-decoration: unset;
        }

        :is(a, strong) {
            display: block;
            position: relative;
            color: var(--nav-color);
            font-size: var(--nav-font-size);
            font-weight: var(--nav-font-weight);
        }

        :is(a:hover, a:focus-visible, a.trail, strong) {
            color: var(--nav-active-color);
        }

        ul {
            display: flex;
            flex-wrap: wrap;
            gap: 1.5rem;
            list-style: none;
            padding: 0;
            margin: 0;

            li {
                &.submenu {
                    position: relative;
                }
            }

            ul {
                position: absolute;
                top: 100%;
                min-width: 270px;
                background: var(--nav-submenu-background);
                box-shadow: 1px 2px 15px 8px rgb(0 0 0 / 10%);
                gap: 0;
                z-index: 2;

                li {
                    padding: 0;

                    &.submenu {
                        padding-right: 40px;
                    }

                    &:not(:last-of-type) {
                        border-bottom: solid 1px rgb(0 0 0 / 10%);
                    }
                }

                .btn-toggle-submenu {
                    right: 0;
                    top: 0;
                    bottom: 0;
                    height: 100%;
                    width: 40px;
                }
            }
        }

        li {
            &.nav-expanded {
                > ul {
                    display: flex;
                }

                .level_2 {
                    ul {
                        top: 0;
                        left: 100%;
                        min-width: 200px;

                        &.bounds-right {
                            left: auto;
                            right: 100%;

                            /* Inherit the position down to all submenus */
                            ul {
                                left: auto;
                                right: 100%;
                            }
                        }
                    }
                }
            }
        }

        .level_1 {
            gap: 0 1.25rem;
            justify-content: flex-end;
            align-items: center;

            ul {
                display: none;
                flex-direction: column;
                border-radius: 4px;

                :is(a, strong) {
                    font-size: 1rem;
                    line-height: 1.2;
                    padding: .75rem 1rem;
                    text-decoration: none;
                    width: 100%;
                }
            }

            > li {
                padding: 5px 0;

                > .btn-toggle-submenu::after {
                    transform: rotateX(180deg) rotateZ(-90deg);
                }

                &.submenu {
                    padding-right: 20px;
                }

                &.nav-expanded {
                    > .btn-toggle-submenu::after {
                        transform: rotateX(0deg) rotateZ(-90deg);
                    }
                }
            }
        }

        .level_2 {
            &::before {
                display: block;
                content: '';
                position: absolute;
                bottom: 100%;
                left: 16px;
                margin-left: -8px;
                height: 0;
                width: 0;
                pointer-events: none;
                border: 8px solid rgb(255 255 255 / 0%);
                border-bottom-color: var(--nav-submenu-background);
            }

            &.bounds-right {
                right: 0;

                &::before {
                    left: auto;
                    right: 16px;
                }
            }

            &:not(.bounds-left, .bounds-right) {
                transform: translateX(-50%);
                left: 50%;

                &::before {
                    left: 50%;
                }
            }
        }

        .skip-link {
            visibility: visible;
            opacity: 0;
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            clip: revert;
            top: -100px;
            text-align: center;
            overflow: hidden;
            background: var(--skip-background);
            color: var(--skip-color);
            transition: top 0.15s ease-in-out;
            z-index: 6;
            text-decoration: none;

            &:focus-visible {
                width: auto;
                height: auto;
                outline-offset: 0;
                outline: 2px solid var(--skip-focus-border-color);
                padding: 6px 12px;
                top: 0;
                opacity: 1;
            }
        }
    }

    .btn-toggle-submenu {
        width: 24px;
        height: 24px;
        padding: 0;
        top: 9px;
        right: -6px;

        &::after {
            background: var(--nav-icon) no-repeat center;
        }
    }

    .nav-burger {
        display: none;
    }
}

@media (forced-colors) {
    .nav-burger {
        .icon-line,
        .icon-line::before,
        .icon-line::after {
            height: 0;
            border: 1px transparent solid;
        }

        &.is-active {
            .icon-line {
                border: 0 none;

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

    .nav-burger__inner {
        color: currentcolor;
    }
}
