/****************************
 * Menu > Desktop
****************************/
.desktop-menu {
    /* clear list style */
    ul {
        & > li {
            padding:0; position:relative;

            & > :where(a,span) {
                display:inline-block; font-size:16px; color:var(--vii-color-on-primary);
            }
        }

        /* hover */
        & > li > :where(a,span):hover,
        & > li > :where(a,span):focus {color:var(--vii-color-on-primary);}

        /* current */
        & > li[class*="current"] > :where(a,span) {font-weight:700; color:var(--vii-color-on-primary);}

        /* show/hide submenu */
        & li:not(:hover) > ul.sub-menu {opacity:0; visibility:hidden; pointer-events:none;}

        /* submenu animation (search submenuAnimationDelay to edit stagger time) */
        & li[class*="has-child"]:hover > ul.sub-menu > li {
            animation:slide-fade-in .4s ease forwards;
            opacity:0;
        }

        /* has submenu arrow */
        & > li[class*="has-child"] > :where(a,span) {
            position:relative; padding-right:16px;

            &:after {
                position:absolute; right:0; top:50%;
                display:inline-block; transform:translateY(-50%);
                content:"\e931"; font-family:var(--vii-font-icomoon); font-size:.5em;
                transition:transform .3s ease;
            }
        }
        & li[class*="has-child"].active > :where(a,span):after,
        & li[class*="has-child"]:hover > :where(a,span):after {transform:translateY(-50%) rotate(180deg);}
    }
}

@keyframes slide-fade-in {
    0% {transform:translate(-15px); opacity:0;}
    100% {transform:translate(0); opacity:1;}
}

/* a11y */
.desktop-menu ul.menu > li > :where(a,span):focus-visible {
    outline:2px solid var(--vii-color-on-primary); border-radius:3px; text-decoration:none;
    background:transparent; color:var(--vii-color-on-primary);
    transition:none;
}

/****************************
 * Menu > Lv1
****************************/
.desktop-menu ul.menu {gap:0 40px;}

.desktop-menu ul.menu > li > :where(a,span) {
    display:flex; align-items:center; justify-content:center;
    padding-top:5px; padding-bottom:5px;
}


/****************************
 * Menu > Lv2
****************************/
.desktop-menu ul.sub-menu {
    top:100%;left:-20px;
    min-width:calc(100% + 40px); max-width:300px;
    background:#fff; box-shadow:0 -3px 15px 5px rgb(0 0 0 / 10%);
    border-radius:5px;
    transition:var(--vii-transition);
}
.desktop-menu ul.sub-menu > li:not(:last-child) {border-bottom:1px solid #eee;}
.desktop-menu ul.sub-menu > li > :where(a,span) {
    display:block; padding:8px 20px;
    width:max-content; max-width:100%;
}

/* pointer */
.desktop-menu ul.sub-menu:before {
    content:""; position:absolute; bottom:100%; left:20%;
    width:0; height:0;
    border-bottom:7px solid #fff;
    border-left:7px solid transparent;
    border-right:7px solid transparent;
}

/* placeholder for pointer icon */
.desktop-menu ul.sub-menu:after {
    content:""; position:absolute; left:0; bottom:100%; right:0;
    height:10px;
}

/* has submenu arrow */
.desktop-menu ul.sub-menu > li[class*="has-child"] > :where(a,span) {padding-right:40px;}
.desktop-menu ul.sub-menu > li[class*="has-child"] > :where(a,span):after {right:20px;}
.desktop-menu ul.sub-menu > li[class*="has-child"]:hover > :where(a,span):after {transform:translateY(-50%) rotate(-90deg);}


/****************************
 * Menu > Lv3
****************************/
.desktop-menu ul.sub-menu ul.sub-menu {
    left:100%; top:0;
    margin-left:10px; margin-top:0;
}

/* pointer */
.desktop-menu ul.sub-menu ul.sub-menu:before {
    right:100%; top:15%; left:auto;
    border-top:7px solid transparent;
    border-right:7px solid #fff;
    border-bottom:7px solid transparent;
}

/* placeholder for pointer icon */
.desktop-menu ul.sub-menu ul.sub-menu:after {
    top:0; bottom:0; right:100%; left:auto;
    width:10px; height:auto;
}


/****************************
 * Menu > Last menu item
****************************/
.desktop-menu ul.menu > li:last-child > ul.sub-menu {left:auto; right:-20px;}
.desktop-menu ul.menu > li:last-child > ul.sub-menu:before {left:auto; right:17.5%;}
.desktop-menu ul.menu > li:last-child > ul.sub-menu > li > :where(a,span) {margin-left:auto;}
.desktop-menu ul.menu > li:last-child > ul.sub-menu > li[class*="has-child"] > :where(a,span) {
    padding-left:40px; padding-right:20px;
}
.desktop-menu ul.menu > li:last-child > ul.sub-menu > li[class*="has-child"] > :where(a,span):after {
    right:auto; left:15px;
}
.desktop-menu ul.menu > li:last-child > ul.sub-menu > li[class*="has-child"]:hover > :where(a,span):after {
    transform:translateY(-50%) rotate(90deg);
}
.desktop-menu ul.menu > li:last-child > ul.sub-menu > li > ul.sub-menu {
    left:auto; right:100%;
    margin-left:0; margin-right:10px;
}
.desktop-menu ul.menu > li:last-child > ul.sub-menu > li > ul.sub-menu:before {
    right:-14px;
    transform:rotate(180deg); transform-origin:center;
}


/****************************
 * Menu Responsive
****************************/
@media only screen and (max-width:1380px) {
    .desktop-menu ul.menu {gap:0 25px;}
}