/*
 * Mobile categories menu: hamburger bar + full-screen overlay (≤ 991 px).
 * Built by js/vmenu-mobile.js from the fieldvmegamenu markup; loaded last from header.tpl.
 * Revert: remove the two vmenu-mobile lines from header.tpl (this file and the JS then go unused).
 * Accent colour: --vmm-accent, set by the JS from the module title bar's computed background
 * (the theme customizer's colour); red is the fallback.
 */

html {
    --vmm-accent: #ff0000;
}

#vmm-bar,
#vmm-overlay {
    display: none;
}

@media (max-width: 991px) {
    /* The in-page vertical menus (homepage left column, category/product header copy) give way
       to the bar. The doubled id beats the theme customizer's
       "#category > #page > #header_menu.block {display:block !important}". */
    html.vmm-ready #left_column .v-megamenu-container,
    html.vmm-ready #page > #header_menu#header_menu {
        display: none !important;
    }

    html.vmm-ready #vmm-bar {
        display: block;
        position: -webkit-sticky;
        position: sticky;
        top: 0;
        z-index: 1029;
        background: #ff0000;
        background: var(--vmm-accent);
    }
    #vmm-bar .vmm-open {
        display: flex;
        align-items: center;
        width: 100%;
        min-height: 56px;
        margin: 0;
        padding: 0 16px;
        border: 0;
        background: transparent;
        color: #fff;
        font-size: 20px;
        font-weight: bold;
        text-transform: uppercase;
        text-align: left;
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
    }
    /* Labels next to an icon: line box = the capitals, so flex centring lines the letters up
       with the icon's middle bar (text-box where supported, line-height 1 otherwise). */
    .vmm-open-label,
    .vmm-title {
        line-height: 1;
        -webkit-text-box: trim-both cap alphabetic;
        text-box: trim-both cap alphabetic;
    }
    .vmm-burger,
    .vmm-burger::before,
    .vmm-burger::after {
        display: block;
        width: 26px;
        height: 3px;
        background: #fff;
        border-radius: 2px;
    }
    .vmm-burger {
        position: relative;
        flex: 0 0 26px;
        margin-right: 16px;
    }
    .vmm-burger::before,
    .vmm-burger::after {
        content: "";
        position: absolute;
        left: 0;
    }
    .vmm-burger::before { top: -8px; }
    .vmm-burger::after { top: 8px; }

    html.vmm-ready #vmm-overlay.vmm-shown {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 100000;
        background: #fff;
    }
    html.vmm-lock,
    html.vmm-lock body {
        overflow: hidden;
    }

    .vmm-head {
        display: flex;
        align-items: center;
        flex: 0 0 auto;
        min-height: 56px;
        padding-left: 16px;
        background: #ff0000;
        background: var(--vmm-accent);
        color: #fff;
    }
    .vmm-title {
        flex: 1 1 auto;
        font-size: 20px;
        font-weight: bold;
        text-transform: uppercase;
    }
    .vmm-close {
        flex: 0 0 56px;
        width: 56px;
        height: 56px;
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
        color: #fff;
        font-size: 34px;
        line-height: 56px;
        cursor: pointer;
    }

    .vmm-body {
        flex: 1 1 auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding-bottom: 32px;
    }
    #vmm-overlay ul {
        margin: 0;
        padding: 0;
        list-style: none;
    }
    #vmm-overlay li {
        margin: 0;
        border-bottom: 1px solid #ececec;
    }
    #vmm-overlay li:last-child {
        border-bottom: 0;
    }
    /* Every row is a full-width target of at least 52 px. */
    #vmm-overlay .vmm-row {
        display: flex;
        align-items: center;
        width: 100%;
        min-height: 52px;
        margin: 0;
        padding: 10px 16px;
        border: 0;
        background: transparent;
        color: #333;
        font-size: 18px;
        line-height: 1.3;
        text-align: left;
        text-decoration: none;
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.08);
    }
    #vmm-overlay .vmm-row:active {
        background: #eeeeee;
    }
    #vmm-overlay .vmm-l1 > li > .vmm-row {
        min-height: 56px;
        font-size: 19px;
        font-weight: bold;
    }
    #vmm-overlay .vmm-row > i {
        flex: 0 0 24px;
        font-size: 18px;
        margin-right: 10px;
        color: #ff0000;
        color: var(--vmm-accent);
        text-align: center;
    }
    #vmm-overlay .vmm-row > i[data-glyph]::before {
        content: attr(data-glyph);
    }
    #vmm-overlay .vmm-label {
        flex: 1 1 auto;
    }
    /* Chevron on rows that open a sub-list. */
    #vmm-overlay .vmm-toggle::after {
        content: "";
        flex: 0 0 auto;
        width: 9px;
        height: 9px;
        margin: 0 4px 4px 12px;
        border-right: 2px solid #999;
        border-bottom: 2px solid #999;
        -webkit-transform: rotate(45deg);
        transform: rotate(45deg);
        transition: transform 0.2s;
    }
    #vmm-overlay .vmm-toggle[aria-expanded="true"]::after {
        margin-bottom: -4px;
        -webkit-transform: rotate(-135deg);
        transform: rotate(-135deg);
    }
    #vmm-overlay .vmm-toggle[aria-expanded="true"] {
        color: #ff0000;
        color: var(--vmm-accent);
    }
    #vmm-overlay .vmm-sub {
        display: none;
        background: #f6f6f6;
        border-top: 1px solid #ececec;
    }
    #vmm-overlay .vmm-sub.vmm-sub-open {
        display: block;
    }
    #vmm-overlay .vmm-sub .vmm-row {
        padding-left: 30px;
    }
    #vmm-overlay .vmm-sub .vmm-sub {
        background: #ececec;
    }
    #vmm-overlay .vmm-sub .vmm-sub .vmm-row {
        padding-left: 44px;
        font-size: 17px;
    }
    #vmm-overlay .vmm-all {
        font-weight: bold;
        color: #ff0000;
        color: var(--vmm-accent);
    }
}
