/* Redesign styles + integration override for the legacy mega menu
 * (core/_partials/menu/menu.html), reused in the redesign header.
 *
 * The compiled theme.css served here no longer ships the mega menu rules (its
 * _menu.scss isn't in the build), so we carry the drawer/panel styles here —
 * ported from core/static/core/scss/_partials/header/_menu.scss (flattened and
 * scoped under .mega-menu) — plus the fixes for living inside the redesign chrome.
 * Loaded after theme.css so these rules win the cascade. */

/* ============================================================
 * Ported mega menu drawer styles (from _menu.scss)
 * ============================================================ */
.mega-menu .container {
    max-width: 1050px;
    width: 90%;
    margin: auto;
}

.mega-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Drill-down toggles this utility via core/js/custom/mega-menu.js. */
.mega-menu .hide {
    display: none !important;
}

.mega-menu .dropdown-item {
    align-items: center;
    color: #000;
    cursor: pointer;
    display: flex;
    padding: .75rem 0;
    text-align: left;
    text-decoration: none;
    width: 100%;
}

.mega-menu .navbar .menu-items {
    background: #fff;
    height: 100%;
    left: 0;
    list-style-type: none;
    margin: 0;
    position: fixed;
    top: 0;
    transform: translate(-103%);
    transform-origin: 0 0;
    transition: visibility .3s 0s, transform .3s cubic-bezier(.77, .2, .05, 1);
    visibility: hidden;
    /* Lifted above the redesign navbar (z 4) and flash bar (z 5) so the open
     * drawer covers the chrome (legacy used z-index: 2). */
    z-index: 1000;
    width: 448px;
}

.mega-menu .navbar .menu-items hr {
    margin: 0;
}

.mega-menu .navbar .nav-container li {
    list-style: none;
}

.mega-menu .navbar .nav-container li .material-icons {
    margin: 0;
    margin-right: 8px;
}

.mega-menu .navbar .nav-container a {
    text-decoration: none;
    color: #0e2431;
    font-weight: 500;
}

.mega-menu .navbar .nav-container button {
    background: none;
    border: none;
    color: #0e2431;
    cursor: pointer;
}

.mega-menu .navbar .nav-container a:hover {
    font-weight: bolder;
}

.mega-menu .navbar .nav-container button:hover {
    font-weight: bolder;
    color: #ec7330;
}

.mega-menu .shadow-menu {
    background-color: #222020b3;
    height: 100%;
    left: 0;
    opacity: 0;
    position: fixed;
    top: 0;
    transition: all .25s;
    visibility: hidden;
    width: 100%;
    z-index: 1;
}

.mega-menu .nav-container input[type="checkbox"]:checked ~ .menu-items {
    transform: none;
    visibility: visible;
    width: calc(100vw - 32px);
}

.mega-menu .nav-container input[type="checkbox"]:checked ~ .menu-items .shadow-menu {
    opacity: 1;
    visibility: visible;
}

.mega-menu .nav-container input[type="checkbox"]:checked ~ .menu-items .l-header-layer {
    align-items: center;
    background: #fff;
    box-shadow: 0 -2px 10px 0 rgba(0, 0, 0, .2);
    display: flex;
    justify-content: space-between;
    left: 0;
    margin-bottom: 1rem;
    padding: .75rem 1rem;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 111;
}

.mega-menu .l-header-layer__menu {
    color: #6f676c;
    font-size: .875rem;
    line-height: 1.2857142857;
}

.mega-menu .nav-container input[type="checkbox"]:checked ~ .menu-items .l-header-navigation__elements {
    height: 100%;
    padding: 72px 16px 100px;
    position: relative;
    z-index: 10;
    background: #fff;
    overflow-x: auto;
    overflow-y: auto;
}

.mega-menu .mega-menu-subtitle {
    font-weight: 600;
    font-size: 23px;
    color: #ec7330;
}

.mega-menu .svg-arrow {
    fill: #222020;
    margin-left: auto;
    min-width: 16px;
    pointer-events: none;
    height: 16px;
    width: 16px;
    cursor: pointer;
}

.mega-menu .mega-menu-close {
    height: 32px;
    width: 32px;
    cursor: pointer;
}

.mega-menu .subcategory {
    margin-bottom: 0;
}

.mega-menu .l-header-navigation__sub-menu-header {
    align-items: baseline;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: .75rem 0;
}

.mega-menu .l-header-navigation__back-link {
    align-items: center;
    color: #000;
    cursor: pointer;
    display: flex;
    margin-bottom: 1rem;
    text-decoration: none;
    width: 100%;
    appearance: none;
    background-color: transparent;
    border: 0;
}

.mega-menu .svg-back {
    height: 16px;
    width: 16px;
    margin-right: 4px;
}

.mega-menu .l-header-navigation__show-all {
    text-decoration: underline !important;
    font-size: 14px !important;
}

@media screen and (min-width: 680px) {
    .mega-menu .nav-container input[type="checkbox"]:checked ~ .menu-items {
        width: 448px;
    }
}

/* ============================================================
 * Redesign integration overrides
 * ============================================================ */
/* The legacy markup wraps everything in <div class="navbar">, which redesign
 * navbar.css also targets (navy bg, padding, position:relative + z-index:4) — that
 * paints a stray bar AND traps the fixed panel in a stacking context below the
 * flash bar. Reset it to a plain, context-free wrapper. */
.mega-menu > nav > .navbar {
    position: static;
    z-index: auto;
    background: none;
    padding: 0;
}

/* The native trigger (.mega-menu-header hamburger) is unused — the redesign navbar
 * burger (#navToggle) opens the menu (core/redesign/js/header.js). Hide it and
 * collapse the in-flow checkbox so it can't intercept clicks. */
.mega-menu .mega-menu-header {
    display: none;
}
.mega-menu .nav-container {
    height: 0;
}
.mega-menu .nav-container .checkbox {
    width: 0;
    height: 0;
    margin: 0;
}
