/**
 * Mega Menu Styles
 * Full-width dropdown panels with column grid, highlight chips, and mobile accordion.
 */

/* ══════════════════════════════════════
   DESKTOP  (≥ 961 px)
   ══════════════════════════════════════ */
@media (min-width: 961px) {

    /* Let mega-menu position relative to site-header, not the li */
    .menu-item[class*="mega-menu--"] {
        position: static !important;
    }

    /* ── Panel ──────────────────────────── */
    .menu-item .hs-mega-menu {
        display: none;
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        width: 100%;
        z-index: 1000;
        background: #fff;
        border-top: 3px solid var(--hs-accent, #0a84ff);
        border-bottom: 1px solid var(--hs-border, #e5e7eb);
        box-shadow:
            0 8px 32px rgba(0, 0, 0, 0.10),
            0 2px 8px rgba(0, 0, 0, 0.06);
        animation: hs-mega-slide 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    /* Bridge: invisible area above the panel prevents mouseout gap on scroll */
    .menu-item .hs-mega-menu::before {
        content: '';
        position: absolute;
        top: -20px;
        left: 0;
        right: 0;
        height: 20px;
    }

    /* Keep the li as a hover zone even at edges */
    .menu-item[class*="mega-menu--"] > a {
        padding-bottom: 12px;
        margin-bottom: -12px;
    }

    /* Show on hover / focus-within */
    .menu-item:hover > .hs-mega-menu,
    .menu-item:focus-within > .hs-mega-menu {
        display: block;
    }

    @keyframes hs-mega-slide {
        from { opacity: 0; transform: translateY(6px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    /* ── Inner wrapper ─────────────────── */
    .hs-mega-menu__inner {
        max-width: var(--hs-content-max, 1200px);
        margin: 0 auto;
        padding: 1.5rem 1.5rem 1rem;
    }

    /* ── Column grid ───────────────────── */
    .hs-mega-menu__grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
        gap: 1.5rem 2rem;
        max-height: 420px;
        overflow-y: auto;
    }

    /* Subtle scrollbar */
    .hs-mega-menu__grid::-webkit-scrollbar {
        width: 4px;
    }
    .hs-mega-menu__grid::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.12);
        border-radius: 4px;
    }

    /* ── Column heading ────────────────── */
    .hs-mega-menu__col h3 {
        margin: 0 0 0.5rem;
        padding-bottom: 0.4rem;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--hs-accent, #0a84ff);
        border-bottom: 2px solid rgba(10, 132, 255, 0.15);
    }

    .hs-mega-menu__col h3 a {
        color: inherit;
        text-decoration: none;
    }
    .hs-mega-menu__col h3 a:hover {
        text-decoration: underline;
    }

    /* ── Column links ──────────────────── */
    .hs-mega-menu__col ul {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .hs-mega-menu__col li {
        margin: 0;
    }

    .hs-mega-menu__col li a {
        display: block;
        padding: 0.25rem 0 0.25rem 0;
        font-size: 13px;
        color: var(--hs-text, #0b1220);
        text-decoration: none;
        border-radius: 4px;
        transition: padding-left 0.2s, color 0.15s, background 0.15s;
    }

    .hs-mega-menu__col li a:hover {
        padding-left: 8px;
        color: var(--hs-accent, #0a84ff);
        background: rgba(10, 132, 255, 0.05);
    }

    /* ── Highlight blocks (chips) ──────── */
    .hs-mega-menu__bottom {
        display: flex;
        flex-wrap: wrap;
        gap: 1.2rem 2rem;
        margin-top: 1rem;
        padding-top: 0.8rem;
        border-top: 1px solid var(--hs-border, #e5e7eb);
    }

    .hs-mega-menu__highlight h3 {
        margin: 0 0 0.35rem;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--hs-muted, #51607a);
        border-bottom: none;
        padding-bottom: 0;
    }

    .hs-mega-menu__highlight ul {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .hs-mega-menu__highlight li a {
        display: inline-block;
        padding: 0.2rem 0.55rem;
        font-size: 12px;
        color: var(--hs-accent, #0a84ff);
        background: rgba(10, 132, 255, 0.07);
        border: 1px solid rgba(10, 132, 255, 0.15);
        border-radius: 999px;
        text-decoration: none;
        transition: background 0.15s, border-color 0.15s;
    }

    .hs-mega-menu__highlight li a:hover {
        background: rgba(10, 132, 255, 0.14);
        border-color: rgba(10, 132, 255, 0.3);
    }

    /* ── Footer CTA ────────────────────── */
    .hs-mega-menu__footer {
        margin-top: 0.8rem;
        padding-top: 0.7rem;
        border-top: 1px solid var(--hs-border, #e5e7eb);
        text-align: right;
    }

    .hs-mega-menu__footer a {
        display: inline-flex;
        align-items: center;
        gap: 0.3rem;
        padding: 0.45rem 1.1rem;
        font-size: 13px;
        font-weight: 600;
        color: #fff;
        background: linear-gradient(135deg, var(--hs-accent, #0a84ff), var(--hs-accent-2, #00c7be));
        border-radius: 999px;
        text-decoration: none;
        transition: box-shadow 0.2s, transform 0.15s;
    }

    .hs-mega-menu__footer a:hover {
        box-shadow: 0 4px 14px rgba(10, 132, 255, 0.35);
        transform: translateY(-1px);
    }

    /* Hide mobile elements on desktop */
    .hs-mega-menu-mobile {
        display: none !important;
    }
}

/* ══════════════════════════════════════
   MOBILE  (≤ 960 px)
   ══════════════════════════════════════ */
@media (max-width: 960px) {

    .menu-item .hs-mega-menu {
        position: static;
        display: block;
        box-shadow: none;
        border: none;
        background: transparent;
        padding: 0;
        width: 100%;
        margin-top: 0.25rem;
    }

    /* Hide the desktop grid on mobile */
    .hs-mega-menu__inner {
        display: none !important;
    }

    /* Show the mobile accordion */
    .hs-mega-menu-mobile {
        display: block !important;
        padding-left: 0;
        border-left: 2px solid var(--hs-accent, #0a84ff);
        margin-left: 0.5rem;
    }

    .hs-mega-menu-mobile__title {
        display: none;
    }

    .hs-mobile-nav-group {
        border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    }
    .hs-mobile-nav-group:last-child {
        border-bottom: none;
    }

    /* Toggle (summary) */
    .hs-mobile-nav-group summary {
        cursor: pointer;
        padding: 0.7rem 1rem;
        font-weight: 600;
        font-size: 14px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        transition: background 0.2s, color 0.2s;
        border-radius: 6px;
        color: var(--hs-text, #0b1220);
    }

    .hs-mobile-nav-group summary:hover,
    .hs-mobile-nav-group[open] summary {
        background: rgba(10, 132, 255, 0.06);
        color: var(--hs-accent, #0a84ff);
    }

    /* Hide default marker */
    .hs-mobile-nav-group summary::-webkit-details-marker {
        display: none;
    }
    .hs-mobile-nav-group summary::marker {
        display: none;
        content: '';
    }
    .hs-mobile-nav-group summary::after {
        content: '+';
        font-size: 1.1rem;
        font-weight: 300;
        line-height: 1;
        opacity: 0.4;
        transition: transform 0.3s, opacity 0.2s;
    }
    .hs-mobile-nav-group[open] summary::after {
        transform: rotate(45deg);
        opacity: 1;
        color: var(--hs-accent, #0a84ff);
    }

    /* Children list */
    .hs-mobile-nav-group ul {
        padding: 0.3rem 0 0.5rem 1.2rem;
        margin: 0;
        list-style: none;
        animation: hs-mobile-slide 0.2s ease-out;
    }

    .hs-mobile-nav-group li {
        margin-bottom: 0.3rem;
    }

    .hs-mobile-nav-group li a {
        font-size: 14px;
        color: var(--hs-muted, #51607a);
        text-decoration: none;
        display: block;
        padding: 0.25rem 0.5rem;
        border-radius: 4px;
        transition: background 0.15s, color 0.15s, transform 0.15s;
    }

    .hs-mobile-nav-group li a:hover,
    .hs-mobile-nav-group li a:active {
        color: var(--hs-accent, #0a84ff);
        background: rgba(10, 132, 255, 0.06);
        transform: translateX(4px);
    }

    @keyframes hs-mobile-slide {
        from { opacity: 0; transform: translateY(-4px); }
        to   { opacity: 1; transform: translateY(0); }
    }
}
