/* Mega menu of the new header (redesign #9). Desktop panels open on hover, focus and click;
   the mobile side bar lists the same items grouped by column. */

/* colours come from the design system (ds.css): light and dark without extra rules */
.mm {
    --mm-surface: var(--ds-surface, #fff);
    --mm-ink: var(--ds-ink, #111d32);
    --mm-muted: var(--ds-muted, #566277);
    --mm-group: var(--ds-subtle, #6b778c);
    --mm-hover: var(--ds-bg-soft, #f5f7fa);
    --mm-hover-line: var(--ds-line, #dce2ec);
    --mm-icon-bg: var(--ds-bg-accent, #edf2ff);
    margin-left: auto;
}
.mm__list {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.mm__top {
    position: static;
}
.mm__trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 28px 14px;
    border: 0;
    background: none;
    font-family: var(--font-secondary);
    font-size: 16px;
    font-weight: 500;
    color: var(--body-bg);
    cursor: pointer;
    transition: color .2s;
}
/* the header is transparent over the hero (white text) and white when sticky (dark text):
   keep the theme colour and mark the open item with an underline */
.mm__trigger:hover,
.mm__top.is-open > .mm__trigger,
.mm__trigger[aria-current="page"] {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 8px;
}
.mm__trigger:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
    border-radius: 6px;
}
.mm__link:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: 6px;
}
.mm__chevron {
    width: 10px;
    height: 10px;
    transition: transform .2s;
}
.mm__top.is-open .mm__chevron {
    transform: rotate(180deg);
}

/* panel: centred under the header, as wide as its columns need */
.mm__panel {
    position: absolute;
    top: 100%;
    left: 50%;
    z-index: 95;
    width: max-content;
    max-width: min(1180px, calc(100vw - 32px));
    padding: 24px;
    border-radius: 12px;
    background: var(--mm-surface);
    box-shadow: var(--ds-shadow, 0 16px 40px rgba(17, 29, 50, .08));
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 8px);
    transition: opacity .2s, transform .2s, visibility .2s;
}
.mm__top.is-open > .mm__panel {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}
.mm__cols {
    display: grid;
    grid-template-columns: repeat(var(--cols, 1), minmax(200px, 1fr));
    gap: 8px 24px;
}
.mm__col {
    min-width: 0;
}
.mm__group {
    margin: 0 0 8px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--mm-group);
}
.mm__items {
    margin: 0;
    padding: 0;
    list-style: none;
}
.mm__link {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--mm-ink);
    text-decoration: none;
    transition: border-color .2s, background .2s;
}
a.mm__link:hover {
    border-color: var(--mm-hover-line);
    background: var(--mm-hover);
    color: var(--mm-ink);
}
.mm__icon {
    flex: none;
    width: 40px;
    height: 40px;
    padding: 8px;
    border-radius: 8px;
    background: var(--mm-icon-bg);
    color: var(--ds-link, #2155f5);
}
span.mm__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
span.mm__icon .icon {
    width: 22px;
    height: 22px;
}
.mm__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.mm__label {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.35;
}
.mm__desc {
    font-size: 13px;
    line-height: 1.4;
    color: var(--mm-muted);
}
.mm__badge {
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--ds-warn-soft, #fff1d6);
    color: var(--ds-warn, #7a4b00);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
}
.mm__link.is-soon .mm__icon {
    filter: grayscale(.6);
    opacity: .75;
}
span.mm__link.is-soon {
    cursor: default;
}
/* drafts are seen only by a signed-in admin */
/* the top items look like on prod (the dev site shows the future site); links inside keep a light hint */
.mm__link.is-draft {
    opacity: .85;
    border-style: dashed;
    border-color: #c5cbd6;
}
.mm__badge--draft {
    background: #eceff3;
    color: #4a5565;
}

@media (max-width: 1366px) {
    .mm__trigger {
        padding-left: 10px;
        padding-right: 10px;
    }
}
@media (max-width: 1200px) {
    .mm__trigger {
        font-size: 15px;
    }
    .mm__cols {
        grid-template-columns: repeat(min(var(--cols, 1), 3), minmax(210px, 1fr));
    }
}
@media (max-width: 991px) {
    .mm {
        display: none;
    }
}
@media (prefers-reduced-motion: reduce) {
    .mm__panel,
    .mm__chevron {
        transition: none;
    }
}

/* mobile side bar */
.mm-mobile__group {
    margin: 14px 0 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #5b6b7f;
}
.mm-mobile__item {
    display: flex !important;
    align-items: center;
    gap: 10px;
}
.mm-mobile__item .mm__icon,
.mm-mobile__item img {
    width: 28px;
    height: 28px;
    padding: 4px;
    border-radius: 6px;
    background: #F0F0FF;
}
.mm-mobile__item .mm__badge {
    margin-left: auto;
}

/* panels are positioned against the header row */
.rts-header__wrapper {
    position: relative;
}

/* sticky header is white: dark menu text, as the theme does for its own menu */
.rts-header.header-sticky .mm__trigger {
    color: var(--btc);
}
.mm-mobile__item span.mm__icon .icon {
    width: 18px;
    height: 18px;
}
