/* li > a */

.wp-block-navigation__container .current-menu-item>a,
.wp-block-navigation__container .has-child button:hover {}

#primary-menu {
    margin: 0;
    display: flex;
    list-style: none;
    justify-content: end;

    /* 1er niveau */
    >li {
        margin: 0 22px;
        padding: 0;

        >.has-children-wrapper>.menu-item-label,
        a {
            display: flex;
            align-items: center;
            text-decoration: none;
            transition: all 200ms ease-in-out;
            padding-top: 0;
            padding-bottom: 0;
            position: relative;
            font-weight: var(--wp--custom--font-weight--extra-bold);
            font-size: .875rem;

            @media(width < 768px) {
                font-size: 1.125rem;
            }

            &:hover {
                color: var(--wp--preset--color--primary);
                cursor: pointer;
            }

        }


        &.menu-item-has-children {
            position: relative;

            >.has-children-wrapper>.menu-item-label,
            >.has-children-wrapper a {
                &:after {
                    content: '\f107';
                    display: inline-flex;
                    transform-origin: center;
                    transition: all 200ms ease-in-out;
                    font-family: 'icons';
                    font-size: 1rem;
                    margin-left: 8px;
                    font-weight: normal;
                    line-height: normal;
                    justify-content: center;
                    align-items: center;
                    z-index: 1;

                    @media(width < 1400px) {
                        width: 40px;
                        height: 40px;
                    }
                }
            }

            .go-child {
                display: none;
            }

            &:hover {
                >.has-children-wrapper a {
                    color: var(--wp--preset--color--primary);

                    &:after {
                        transform: rotate(180deg);
                        color: var(--wp--preset--color--primary);
                    }
                }

                >.sub-menu {
                    opacity: 1;
                    visibility: visible;
                }
            }
        }

        &.current-menu-ancestor,
        &.current-menu-item {

            >a,
            >p,
            >.has-children-wrapper a,
            >.has-children-wrapper p {
                color: var(--wp--preset--color--primary);
            }
        }

        /* 2eme niveau */
        >.sub-menu {
            width: max-content;
            list-style: none;
            padding: 30px 100px;
            position: absolute;
            opacity: 0;
            visibility: hidden;
            transition: all 200ms ease-in;
            z-index: 1;
            left: 50%;
            transform: translateX(-50%);
            background-color: #fff;
            box-shadow: 0px 10px 30px 0px #0000001F;
            border-radius: 15px;

            display: flex;
            flex-direction: row;
            column-gap: 80px;

            @media(width < 1400px) {
                left: 0;
                transform: none;
                width: 100%;
            }

            .go-parent {
                display: none;
            }


            >li {
                padding: 0;
                margin: 0;
                flex: 0 0 auto;

                @media(width > 1400px) {
                    &:not([id^="menu-item-"]) {
                        display: none;
                    }
                }

                a {
                    align-items: flex-start;
                    padding: 0px;
                    font-size: 1rem;
                    line-height: normal;
                    font-weight: 500;
                    border-radius: 0;
                    position: relative;

                    @media(width < 768px) {
                        font-size: 1.125rem;
                    }

                }

                &.current-menu-item {

                    >a,
                    >.go-child {
                        /* background-color: var(--wp--preset--color--primary); */
                        /* color: var(--wp--preset--color--main); */
                        font-weight: var(--wp--custom--font-weight--semibold);

                    }
                }

                &.menu-item-has-children {
                    margin: 0;

                    >.has-children-wrapper>a,
                    >.has-children-wrapper>.go-child {
                        font-weight: var(--wp--custom--font-weight--black);
                    }
                }

                .menu-item-label {
                    font-size: 1rem;
                    font-weight: var(--wp--custom--font-weight--black);

                    @media(width < 768px) {
                        font-size: 1.125rem;
                    }
                }

                /* 3eme niveau */
                >.sub-menu {

                    list-style: none;
                    padding: 0;
                    margin: 0;

                    >li {
                        padding: 0;
                        margin: 5px 0;
                        display: block;

                    }
                }

                &.menu-item-has-children {

                    >a {
                        position: relative;

                        &:after {
                            content: '\f107';
                            display: inline-flex;
                            transform-origin: center;
                            transition: all 200ms ease-in-out;
                            transform: rotate(-90deg);
                            width: 20px;
                            height: 20px;
                            font-family: 'icons';
                            margin-left: 0;
                            font-weight: normal;
                            line-height: 1;
                            justify-content: center;
                            color: #fff;
                            position: absolute;
                            right: 10px;
                        }
                    }

                    &:hover {
                        >a {
                            background-color: var(--wp--preset--color--primary);
                            color: var(--wp--preset--color--main);

                            &:after {
                                color: var(--wp--preset--color--main);
                            }
                        }

                        >.sub-menu {
                            opacity: 1;
                            visibility: visible;
                        }
                    }
                }


            }


            /* style special pour les uls qui ont seulement 2 enfants li */
            >li.menu-item-has-children {
                .sub-menu.only-two-columns {
                    max-width: 710px;
                    display: grid;
                    grid-template-columns: 1fr 1fr;
                    grid-column-gap: 80px;

                    >li:not([id^="menu-item-"]) {
                        display: none;
                    }

                    >li[id^="menu-item-"] {
                        flex: 0 0 50%;
                    }
                }
            }

        }

        &:last-child {
            margin-right: 0;

            >.sub-menu {
                left: auto;
                right: 0;
                transform: none;
            }
        }

    }

}