﻿/* =========================================
   Lotus Global Menu
   ========================================= */

.lotus-global-nav {
    width: 100%;
    position: relative;
    z-index: 1000;
}

.lotus-global-menu {
    display: flex;
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}

.lotus-global-menu > li {
    flex: 1;
    position: relative;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* 親メニュー */
.lotus-global-menu > li > a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 8px 12px;
    box-sizing: border-box;

    color: #222;
    background: #fff;
    text-decoration: none;
    text-align: center;
    border-right: 1px solid #ddd;
}

/* 子メニュー */
.lotus-global-menu .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;

    width: 100%;
    min-width: 220px;
    margin: 0;
    padding: 0;

    list-style: none;
    background: #fff;
    box-shadow: 0 5px 15px rgba(0,0,0,.12);
}

/* PCではホバーで開く */
@media (min-width: 769px) {

    .lotus-global-menu > li:hover > .sub-menu,
    .lotus-global-menu > li:focus-within > .sub-menu {
        display: block;
    }

    .lotus-global-menu .sub-menu li {
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .lotus-global-menu .sub-menu a {
        display: block;
        padding: 15px 18px;
        color: #222;
        background: #fff;
        text-decoration: none;
        border-bottom: 1px solid #eee;
    }

    .lotus-global-menu .sub-menu a:hover {
        background: #f7f7f7;
    }
}

/* PC：親メニューの境界を明確に */
.lotus-global-menu {
    border-top: 1px solid #cfcfcf;
    border-bottom: 1px solid #cfcfcf;
}

.lotus-global-menu > li {
    border-right: 1px solid #cfcfcf;
}

.lotus-global-menu > li:first-child {
    border-left: 1px solid #cfcfcf;
}

/* 親リンクの既存borderと二重にしない */
.lotus-global-menu > li > a {
    border-right: 0;
}

/* ホバー中の親を薄く強調 */
.lotus-global-menu > li:hover > a,
.lotus-global-menu > li:focus-within > a {
    background: #f5f5f5;
}

/* =========================================
   Smartphone
   親メニューは横3列、子メニューは全幅展開
   ========================================= */
@media screen and (max-width: 768px) {
    #branding {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    .lotus-global-nav {
        position: relative;
        clear: both;
        float: none;
        width: 100%;
        height: auto;
        margin: 0;
    }

    .lotus-global-menu {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        position: relative;
        float: none;
        clear: both;
        width: 100%;
        height: auto;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .lotus-global-menu > li {
        position: static !important;
        float: none !important;
        width: auto !important;
        height: auto !important;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .lotus-global-menu > li > a {
        display: flex !important;
        position: relative;
        z-index: 2;
        align-items: center;
        justify-content: center;
        width: 100% !important;
        min-height: 48px;
        padding: 8px 3px;
        box-sizing: border-box;
        color: #222;
        background: #fff;
        text-decoration: none;
        text-align: center;
        white-space: nowrap;
        border-right: 1px solid #ddd;
        border-bottom: 1px solid #ddd;
        cursor: pointer;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0,0,0,.08);
    }

    .lotus-global-menu > li:last-child > a {
        border-right: 0;
    }

    .lotus-global-menu > .menu-item-has-children > a::after {
        content: "▼";
        margin-left: 4px;
        font-size: 9px;
    }

    .lotus-global-menu > .menu-item-has-children.is-open > a::after {
        content: "▲";
    }

    /* 子メニューは通常フロー。透明な当たり判定を残さない */
    .lotus-global-menu .sub-menu {
        display: none !important;
        position: static !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        float: none !important;
        width: 100% !important;
        min-width: 0 !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        list-style: none;
        visibility: visible !important;
        opacity: 1 !important;
        transform: none !important;
        z-index: auto !important;
        background: #f7f7f7;
        box-shadow: none;
    }

    /*
     * 開いた親だけ3列分の幅を取り、
     * 親リンクは元の1列幅、子メニューはその下で全幅。
     */
    .lotus-global-menu > li.is-open {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .lotus-global-menu > li:nth-child(1).is-open > a { grid-column: 1; }
    .lotus-global-menu > li:nth-child(2).is-open > a { grid-column: 2; }
    .lotus-global-menu > li:nth-child(3).is-open > a { grid-column: 3; }

    .lotus-global-menu > li.is-open > .sub-menu {
        display: block !important;
        grid-column: 1 / -1;
    }

    .lotus-global-menu .sub-menu > li {
        position: static !important;
        float: none !important;
        width: 100% !important;
        height: auto !important;
        margin: 0;
        padding: 0;
    }

    .lotus-global-menu .sub-menu > li > a {
        display: block !important;
        position: static !important;
        width: 100% !important;
        box-sizing: border-box;
        padding: 13px 18px;
        color: #222;
        background: #f7f7f7;
        text-decoration: none;
        text-align: left;
        border-bottom: 1px solid #e5e5e5;
    }
}
