.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-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-navigation--dropdown & {
            position: relative;

            &::after {
                content: '';
                box-sizing: inherit;
                position: absolute;
                left: 0;
                bottom: 0;
                background: theme('colors.primary.500');
                width: 0;
                height: 2px;
                transition: width $transition-time ease-out;
            }

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

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

.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;

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

        .c-site-header--filled .c-main-navigation--dropdown & {
            color: theme('colors.primary.500');

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

    @screen xl {
        font-size: 1.625rem;

        .c-main-navigation--dropdown & {
            font-size: 1rem;
        }
    }
}

.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-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-submenu {
    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 1rem 1.5rem;
        transform: none;

        .c-main-submenu__link,
        .c-main-submenu__item {
            display: block;
        }
    }

    @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-submenu__item {
    display: none;

    @screen lg {
        display: block;
    }
}

.c-main-submenu__item + .c-main-submenu__item {
    margin-top: .75rem;
}

.c-main-submenu__link {
    font-size: 1rem;
    text-decoration: none;
    color: #fff;
    display: none;

    p {
        margin-top: 0;
    }

    @screen lg {
        display: block;

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

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

.c-main-submenu__link--is-active {
    text-decoration: underline;
}
