.c-main-menu {
    display: flex;
    flex-wrap: wrap;
    font-size: .875rem;
    list-style: none;
    padding-top: 2.5rem;
    max-width: 73rem;
    margin: 0 auto;

    @screen lg {
        flex-wrap: nowrap;
        justify-content: space-around;
        padding-top: 3.5rem;

        .c-main-navigation--dropdown & {
            max-width: 100%;
            margin: 0;
            justify-content: flex-end;
            padding-top: 0;
        }

        .c-main-navigation--pinned & {
            flex-wrap: wrap;
            justify-content: inherit;
            padding: 2.5rem;
        }
    }
}

.c-main-menu__card-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem 0 4rem;
    padding: 1rem 0 2rem;
    background: rgba(#000, .25);

    a {
        display: block;
        width: 100%;
    }

    div {
        padding: 1rem 0.5rem 0;

        &:last-child {
            max-width: 13rem;
            margin-right: 0.5rem;
        }
    }

    strong {
        display: block;
        font-size: 1.25rem;
        color: #fff;
    }

    span {
        font-size: 1.0rem;
        color: #fff;
    }
}

.c-main-menu__card-text {
    flex: 0 0 auto;
}

.c-main-menu__item {
    display: none;
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, .8);

    .is-target & {
        display: block;
    }

    @screen lg {
        display: block;
        width: auto;
        border: none;

        .c-main-menu__link.current {
            &::after {
                content: '';
                box-sizing: inherit;
                position: absolute;
                left: 0;
                bottom: 0;
                width: 60%;
                height: 2px;
                transition: width $transition-time ease-out;
            }
        }

        .c-main-navigation--dropdown & {
            position: relative;

            &::after {
                content: '';
                box-sizing: inherit;
                position: absolute;
                left: 0;
                bottom: 0;
                width: 0;
                height: 2px;
                transition: width $transition-time ease-out;
            }

            /* stylelint-disable */
            &:hover,
            &:focus,
            &:focus-within {
                &::after {
                    width: 60%;
                }

                .c-main-menu__second-level {
                    left: 0;
                    visibility: visible;
                    background: #fff;
                    height: auto;
                    opacity: 1;
                    box-shadow: $box-shadow-basic;
                }
            }
            /* stylelint-enable */
        }

        .c-main-navigation--pinned & {
            width: 100%;
            border-bottom: 1px solid rgba(255, 255, 255, .8);
        }
    }
}

.c-main-menu__item + .c-main-menu__item {
    .c-main-navigation--dropdown & {
        @screen lg {
            margin-left: 1rem;
        }

        @screen xl {
            margin-left: 1.5rem;
        }
    }
}

.c-main-menu__link {
    color: #fff;
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    padding: .75rem .25rem;
    position: relative;
    display: none;
    align-items: center;
    transition: color $transition-time;
    line-height: 1.4;

    .is-target & {
        display: flex;
    }

    .c-main-navigation--uppercase & {
        text-transform: uppercase;
    }

    @screen lg {
        padding: 0 .5rem;
        margin: 0 .25rem;

        .c-main-navigation--dropdown & {
            display: flex;
            font-size: .875rem;
            padding: .5rem 0;
            margin: 0;
        }

        .c-main-navigation--pinned & {
            padding: .75rem .25rem;
            margin: 0;
        }

        &:hover,
        &:focus {
            // Primary
            .c-main-menu__link--primary & {
                color: theme('colors.primary.200');
            }

            // Secondary
            .c-main-menu__link--secondary & {
                color: theme('colors.secondary.200');
            }

            // White
            .c-main-menu__link--white & {
                color: theme('colors.primary.200');
            }

            // Gray
            .c-main-menu__link--gray & {
                color: theme('colors.gray.200');
            }

            // Dark
            .c-main-menu__link--dark & {
                color: theme('colors.dark.200');
            }
        }
    }

    @screen xl {
        font-size: 1.625rem;

        .c-main-navigation--dropdown & {
            font-size: 1.25em;
        }
    }
}

.c-main-menu__link-wrapper {
    display: flex;
    justify-content: space-between;
    margin: .25rem 0;
    padding: .25rem 0;

    @screen lg {
        margin: 0;
        padding: 0;

        .c-main-navigation--pinned & {
            margin: .25rem 0;
            padding: .25rem 0;
        }
    }

}

.c-main-menu__subnav-toggle {
    padding-right: .5rem;
    padding-left: .5rem;
    background: transparent;

    .c-icon {
        height: 1.25rem;
        width: 1.25rem;
        color: #fff;
        transition: transform $transition-time;
    }

    &[aria-expanded=true] {
        .c-icon {
            transform: rotate(180deg);
        }
    }

    @screen lg {
        display: none;

        .c-main-navigation--pinned & {
            display: block;
        }
    }
}

.c-main-menu__second-level {
    height: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-1rem);
    list-style: none;
    min-width: 12rem;
    transition: top $transition-time, transform $transition-time, opacity $transition-time;

    &:target,
    &.is-target {
        display: block;
        height: auto;
        visibility: visible;
        opacity: 1;
        padding: 0 0 1.5rem 1rem;
        transform: none;

        .c-main-menu__second-level-link,
        .c-main-menu__second-level-item {
            display: flex;
            justify-content: space-between;
            flex-wrap: wrap;
        }
    }

    @screen lg {
        visibility: visible;
        opacity: 1;
        padding: 0 1rem;
        margin-top: 2rem;
        transform: none;

        .c-main-navigation--dropdown & {
            padding: 1rem;
            margin-top: 0;
            visibility: hidden;
            opacity: 0;
            top: 100%;
            left: 0;
            position: absolute;
        }

        .c-main-navigation--pinned & {
            padding: 0;
            margin: 0;
            transition: top $transition-time, transform $transition-time, opacity $transition-time;

            &:target,
            &.is-target {
                padding: 0 0 1.5rem 1rem;
            }
        }
    }
}

.c-main-menu__third-level {
    display: none;
    flex: 0 0 100%;
    padding-left: 1rem;

    &:target,
    &.is-target {
        display: block;
    }
}

.c-main-menu__second-level-item {
    display: none;

    @screen lg {
        display: block;

        .c-main-navigation--pinned & {
            display: none;
        }
    }
}

.c-main-menu__second-level-item + .c-main-menu__second-level-item {
    margin-top: .75rem;
}

.c-main-menu__second-level-link {
    display: none;
    font-size: 1.25em;
    text-decoration: none;
    color: #fff;

    p {
        margin-top: 0;
    }

    @screen lg {
        display: block;

        .c-main-navigation--dropdown & {
            color: theme('colors.gray.800');
        }

        .c-main-navigation--pinned & {
            display: none;
        }
    }
}

.c-main-menu__second-level-link.current {
    @screen lg {
        font-weight: bold;
    }
}

.c-main-menu__second-level-link--is-active {
    text-decoration: underline;
}

.c-main-menu__third-level-link {
    font-size: 1rem;
}

// Main Menu color configuration
@screen lg {
    // Standard color for main menu item (underline border)
    .c-main-menu__item {
        &::after {
            background-color: theme('colors.primary.200');
        }
    }

    .c-main-menu__link {
        &.current {
            .c-main-menu__link--primary & {
                color: theme('colors.primary.200');
            }

            .c-main-menu__link--secondary & {
                color: theme('colors.secondary.200');
            }

            .c-main-menu__link--white & {
                color: theme('colors.primary.200');
            }

            .c-main-menu__link--gray & {
                color: theme('colors.gray.200');
            }

            .c-main-menu__link--dark & {
                color: theme('colors.dark.200');
            }
        }
    }

    // Color configuration for submenu links (hover, focus & current)
    .c-main-menu__second-level-link,
    .c-main-menu__third-level-link {
        &:hover,
        &:focus,
        &.current {
            // Primary
            .c-main-menu__link--primary & {
                color: theme('colors.primary.500');
            }

            // Secondary
            .c-main-menu__link--secondary & {
                color: theme('colors.secondary.500');
            }

            // White
            .c-main-menu__link--white & {
                color: theme('colors.primary.500');
            }

            // Gray
            .c-main-menu__link--white & {
                color: theme('colors.primary.500');
            }

            // Dark
            .c-main-menu__link--dark & {
                color: theme('colors.dark.500');
            }
        }
    }

    // Styling for main menu item (menu border) when header is not filled (at top position of page)
    .c-main-menu__link--primary {
        .c-main-menu__item {
            &::after {
                background-color: theme('colors.primary.200');
            }
        }
    }

    .c-main-menu__link--secondary {
        .c-main-menu__item {
            &::after {
                background-color: theme('colors.secondary.200');
            }
        }
    }

    .c-main-menu__link--white {
        .c-main-menu__item {
            &::after {
                background-color: theme('colors.primary.200');
            }
        }
    }

    .c-main-menu__link--gray {
        .c-main-menu__item {
            &::after {
                background-color: theme('colors.gray.200');
            }
        }
    }

    .c-main-menu__link--dark {
        .c-main-menu__item {
            &::after {
                background-color: theme('colors.dark.200');
            }
        }
    }


    // Different color values for different color configurations (primary, secondary, white, gray, dark) - settings for main menu link, main menu item (hover border) and submenu link
    .c-site-header--filled {
        // Primary
        &.c-main-menu__link--primary {
            .c-main-menu__link {
                color: theme('colors.primary.500');

                &:hover,
                &:focus {
                    color: theme('colors.primary.600');
                }

                //stylelint-disable
                &.current {
                    color: theme('colors.primary.600');
                }
                //stylelint-enable
            }

            .c-main-menu__item {
                &::after {
                    background-color: theme('colors.primary.600');
                }
            }
        }

        // Secondary
        &.c-main-menu__link--secondary {
            .c-main-menu__link {
                color: theme('colors.secondary.500');

                &:hover,
                &:focus {
                    color: theme('colors.secondary.600');
                }

                //stylelint-disable
                &.current {
                    color: theme('colors.secondary.600');
                }
                //stylelint-enable
            }

            .c-main-menu__item {
                &::after {
                    background-color: theme('colors.secondary.600');
                }
            }
        }

        // White
        &.c-main-menu__link--white {
            .c-main-menu__link {
                color: #fff;

                &:hover,
                &:focus {
                    color: theme('colors.primary.200');
                }

                //stylelint-disable
                &.current {
                    color: theme('colors.primary.200');
                }
                //stylelint-enable
            }

            .c-main-menu__item {
                &::after {
                    background-color: theme('colors.primary.200');
                }
            }
        }

        // Gray
        &.c-main-menu__link--gray {
            .c-main-menu__link {
                color: theme('colors.gray.800');

                &:hover,
                &:focus {
                    color: theme('colors.gray.600');
                }

                //stylelint-disable
                &.current {
                    color: theme('colors.gray.600');
                }
                //stylelint-enable
            }

            .c-main-menu__item {
                &::after {
                    background-color: theme('colors.gray.600');
                }
            }
        }

        // Dark
        &.c-main-menu__link--dark {
            .c-main-menu__link {
                color: theme('colors.dark.500');

                &:hover,
                &:focus {
                    color: theme('colors.dark.600');
                }

                //stylelint-disable
                &.current {
                    color: theme('colors.dark.600');
                }
                //stylelint-enable
            }

            .c-main-menu__item {
                &::after {
                    background-color: theme('colors.dark.600');
                }
            }
        }
    }
}
