/* ==========================================================================
   Mega menu - desktop
   Markup: templates/headers/includes/_mega-menu.template.html
   Advert card: templates/thumbs/advert/mega-menu.template.html
   ========================================================================== */

.mega-menu {
    --mega-menu-orange: #fa5617;
    --mega-menu-orange-dark: #dd3f08;
    --mega-menu-ink: #182335;
    --mega-menu-line: #e5e7eb;

    position: relative;
    background: var(--mega-menu-orange);
}

/* The dropdown is positioned against this, so every panel lines up and spans
   the same width no matter which top level item opened it. */
.mega-menu-container {
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}


/* Top level items
   ========================================================================== */

.mega-menu-items {
    display: flex;
    align-items: stretch;
    list-style: none;
    margin: 0;
    padding: 0;
}

.mega-menu-item {
    position: static;
}

.mega-menu-item-link {
    display: flex;
    align-items: center;
    gap: 9px;
    height: 54px;
    padding: 0 16px;
    border-bottom: 4px solid transparent;
    color: #fff;
    font-size: 17px;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
}

.mega-menu-item-link:hover,
.mega-menu-item-link:focus,
.mega-menu-item-has-dropdown:hover .mega-menu-item-link,
.mega-menu-item-has-dropdown:focus-within .mega-menu-item-link {
    background: var(--mega-menu-orange-dark);
    border-bottom-color: #fff;
    color: #fff;
    text-decoration: none;
}

.mega-menu-item-icon {
    line-height: 1;
}


/* Dropdown panel
   ========================================================================== */

.mega-menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 20px;
    right: 20px;
    z-index: 1000;

    /* menu items | popular brands | advert */
    grid-template-columns: 1.5fr 0.45fr 0.65fr;
    gap: 20px;

    padding: 24px;
    background: #fff;
    border: 1px solid #eceff3;
    box-shadow: 0 18px 35px rgba(23, 32, 50, 0.2);
    color: var(--mega-menu-ink);
}

.mega-menu-item-has-dropdown:hover .mega-menu-dropdown,
.mega-menu-item-has-dropdown:focus-within .mega-menu-dropdown {
    display: grid;
}


/* Column 1 - menu items, laid out in four columns
   ========================================================================== */

.mega-menu-categories {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.mega-menu-category-title {
    display: block;
    margin: 0 0 13px;
    padding-bottom: 9px;
    border-bottom: 2px solid var(--mega-menu-orange);
    color: var(--mega-menu-orange);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    text-decoration: none;
}

.mega-menu-category-title:hover {
    color: black;
    text-decoration: none;
}

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

.mega-menu-category-item a {
    display: block;
    padding: 2px 0;
    margin-bottom: 9px;
    color: var(--mega-menu-ink);
    font-size: 14px;
    text-decoration: none;
}

.mega-menu-category-item a:hover {
    color: var(--mega-menu-orange);
    text-decoration: none;
}


/* Column 2 - popular brands
   ========================================================================== */

.mega-menu-dropdown-col-brands {
    padding-left: 28px;
    border-left: 1px solid var(--mega-menu-line);
}

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

/* The group is authored as a level 2 item, so it renders inside column 1 and is
   moved across by js/mega-menu.js. Kept hidden in column 1 so it never shows up
   in the wrong place if that script has not run yet. */
.mega-menu-categories > .mega-menu-brands-group {
    display: none;
}

/* Each brand is a full width row with a rule under it. */
.mega-menu-brands-group .mega-menu-category-item > a {
    margin-bottom: 0;
    padding: 10px 0;
    border-bottom: 1px solid var(--mega-menu-line);
    font-weight: 700;
}

/* Chevron on every brand. Font Awesome 4 is loaded by the theme. */
.mega-menu-brands-group .mega-menu-category-item > a:after {
    float: right;
    color: var(--mega-menu-orange);
    font-family: FontAwesome;
    font-size: 18px;
    font-weight: normal;
    content: "\f105"; /* fa-angle-right */
}

/* Longer arrow on the view all link, sitting next to the text rather than
   pushed out to the right like the brand chevrons. */
.mega-menu-brands-group .mega-menu-brands-all > a {
    margin-top: 14px;
    padding: 0;
    border-bottom: 0;
    color: var(--mega-menu-orange);
    font-size: 14px;
    font-weight: 700;
}

.mega-menu-brands-group .mega-menu-brands-all > a:after {
    float: none;
    margin-left: 8px;
    font-family: FontAwesome;
    font-size: inherit;
    font-weight: normal;
    content: "\f178"; /* fa-long-arrow-right */
}


/* Column 3 - advert
   ========================================================================== */

.mega-menu-advert {
    align-self: start;
    overflow: hidden;
    border-radius: 7px;
    background: #202c3f;
    color: #fff;
}

/* Either a link or a plain div depending on whether the advert has a url. */
.mega-menu-advert-inner {
    display: block;
    color: inherit;
    text-decoration: none;
}

.mega-menu-advert-inner:hover {
    color: inherit;
    text-decoration: none;
}

.mega-menu-advert-image {
    aspect-ratio: 4 / 3;
    background: white;
}

.mega-menu-advert-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.mega-menu-advert-image--cover img {
    object-fit: cover;
}

.mega-menu-advert-content {
    padding: 16px;
}

.mega-menu-advert-label {
    display: block;
    color: #ffd23f;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.mega-menu-advert-title {
    margin: 7px 0;
    font-size: 21px;
    line-height: 1.05;
}

.mega-menu-advert-text {
    margin: 0 0 14px;
    color: #d9e0ea;
    font-size: 13px;
    line-height: 1.45;
}

.mega-menu-advert-button {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 3px;
    background: var(--mega-menu-orange);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

.mega-menu-advert-inner:hover .mega-menu-advert-button {
    background: var(--mega-menu-orange-dark);
}

.mega-menu-advert-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    padding: 10px;
    border: 1px dashed #ccc;
    text-align: center;
}


/* Breakpoint - desktop menu only, the mobile menu takes over below this
   ========================================================================== */

@media (max-width: 991px) {
    .mega-menu {
        display: none;
    }
}
