/* ============================================================================
   [WP O7-F2 → V2] Spellbox Storm — Menu principal data-driven.
   Material "CONSOLE DE DOMÍNIO" (V2, aprovado a partir de
   docs/accents_mockups/menu_revamp_mockups.html): base V1 (vidro escuro,
   brackets de canto, eyebrows mono, ▸ no hover, chip de badge) + ACCENT POR
   COLUNA (--col-accent, emitido pelo twig a partir do JSON) + rodapé barra-de-status.

   Este arquivo é injetado via $document->addStyle no controller do módulo
   (?v=filemtime → sempre fresh) e carrega DEPOIS de spellbox_custom.css no
   header.twig (bloco {% for style in styles %}). Assim, em igual especificidade,
   as regras daqui VENCEM o painel claro herdado — sem tocar em spellbox_custom.css.
   As animações F2 (spxmm-holo/edge/colin) são preservadas; só herdam o material novo.
   Ganchos: a classe .open é setada pelo hover_intent_menu.js.
   ============================================================================ */

/* ---- Painel de 4 colunas (Produtos) ---- */
.mega-menu.mega-menu--cols-4 {
    min-width: 860px;
    max-width: 96vw;
}
.mega-menu.mega-menu--cols-4 .mega-menu-body {
    grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 1140px) {
    .mega-menu.mega-menu--cols-4 { min-width: 700px; }
    .mega-menu.mega-menu--cols-4 .mega-menu-body { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================================
   MATERIAL V2 — vidro escuro sobrescrevendo o painel claro de spellbox_custom.css.
   ============================================================================ */

/* Painel: vidro escuro + blur + brackets + radius assinatura (14px 6px 14px 14px) */
.mega-menu {
    min-width: 860px;
    background: rgba(18, 13, 38, 0.97);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(170, 0, 255, 0.30);
    border-radius: 14px 6px 14px 14px;
    box-shadow: 0 28px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(200, 150, 255, 0.06);
    padding: 18px 20px 8px;
}
.mega-menu.mega-menu-sm { min-width: 300px; }

/* Brackets de canto (como .station::before/after do lab) */
.mega-menu::before,
.mega-menu::after {
    content: '';
    position: absolute;
    width: 26px;
    height: 26px;
    pointer-events: none;
    z-index: 4;
}
.mega-menu::before {
    top: 6px; left: 6px;
    border-top: 2px solid #aa00ff;
    border-left: 2px solid #aa00ff;
    border-top-left-radius: 8px;
    opacity: .75;
}
.mega-menu::after {
    bottom: 6px; right: 6px;
    border-bottom: 2px solid #6200ea;
    border-right: 2px solid #6200ea;
    border-bottom-right-radius: 8px;
    opacity: .55;
}

/* Header do painel = eyebrow MONO lilás (aposenta o header escuro E o efeito theme-*).
   Os theme-* (green/orange…) têm especificidade (0,2,0) > (0,1,0), então precisam ser
   neutralizados explicitamente para não pintarem o header. */
.mega-menu-header {
    background: none;
    border-bottom: 0;
    padding: 4px 6px 14px;
}
.mega-menu.theme-purple .mega-menu-header,
.mega-menu.theme-orange .mega-menu-header,
.mega-menu.theme-green .mega-menu-header,
.mega-menu.theme-blue .mega-menu-header {
    background: none;
    border-color: transparent;
}
.mega-menu-header h3 {
    font-family: 'Cascadia Mono', ui-monospace, 'Consolas', monospace;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #c9a8ff;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}
.mega-menu-header h3 i {
    color: #aa00ff;
    font-size: 12px;
}

/* Grade de colunas */
.mega-menu-body {
    gap: 6px 14px;
    padding: 0 6px;
}

/* Colunas: accent POR COLUNA. --col-accent vem do twig (JSON); default V1 (graceful). */
.mega-menu-column {
    padding: 8px 10px 14px;
    border-right: 0;
    --hoverc: var(--col-accent, #00e5ff);
}
.mega-menu-column:hover {
    background: transparent;
}

/* Eyebrow da coluna = header mono; hairline herda o accent (color-mix como no mockup).
   min-height 48px alinha as hairlines de todas as colunas mesmo com título de 2 linhas. */
.mega-menu-title {
    font-family: 'Cascadia Mono', ui-monospace, 'Consolas', monospace;
    font-size: 11.5px;
    font-weight: 400;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--col-accent, #aa00ff);
    margin: 0 0 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid color-mix(in srgb, var(--col-accent, #aa00ff) 42%, transparent);
    display: flex;
    align-items: flex-end;
    gap: 7px;
    min-height: 48px;
}
.mega-menu-title i {
    font-size: 12px;
    opacity: .85;
}

/* Links: ▸ deslizando no hover; herdam o accent da coluna. */
.mega-menu-link {
    display: block;
    position: relative;
    padding: 7px 8px 7px 20px;
    color: #e9e9f5;
    font-size: 15px;
    font-weight: 500;
    border-radius: 7px;
    transition: color .18s ease, background .18s ease;
}
/* ▸ REDEFINE por completo a bolinha cinza herdada de spellbox_custom.css
   (width/height/background/border-radius/margin zerados; agora é um glifo absoluto). */
.mega-menu-link::before {
    content: '▸';
    position: absolute;
    left: 4px;
    top: 8px;
    width: auto;
    height: auto;
    margin: 0;
    background: none;
    border-radius: 0;
    font-size: 12px;
    line-height: 1.2;
    color: var(--hoverc);
    opacity: 0;
    transform: translateX(-5px);
    transition: opacity .18s ease, transform .18s ease;
}
.mega-menu-link:hover {
    color: var(--hoverc);
    background: color-mix(in srgb, var(--col-accent, #aa00ff) 10%, transparent);
    transform: none; /* mata o translateX(4px) herdado */
}
.mega-menu-link:hover::before {
    opacity: 1;
    transform: translateX(0);
    background: none;
    box-shadow: none;
}

/* ---- Chip de badge (opcional por link) — outline mono ---- */
.mega-menu-link .mm-badge,
.sub-item .mm-badge,
.deep-item .mm-badge {
    display: inline-block;
    font-family: 'Cascadia Mono', ui-monospace, 'Consolas', monospace;
    font-size: 9px;
    line-height: 1;
    font-weight: 400;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 3px 6px;
    border-radius: 6px;
    margin-left: 7px;
    vertical-align: 1px;
    border: 1px solid rgba(170, 0, 255, 0.5);
    color: #c9a8ff;
    background: rgba(170, 0, 255, 0.08);
}

/* Rodapé = barra de STATUS mono (só aparece nos painéis com footer no JSON). */
.mega-menu-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 8px 6px 0;
    padding: 10px 10px;
    background: rgba(10, 6, 26, 0.5);
    border-top: 1px solid rgba(170, 0, 255, 0.22);
    border-radius: 0 0 8px 8px;
}
.mega-menu-footer::before {
    content: 'STATUS · CATÁLOGO ONLINE';
    font-family: 'Cascadia Mono', ui-monospace, 'Consolas', monospace;
    font-size: 10px;
    letter-spacing: 1.5px;
    color: rgba(170, 140, 255, .7);
}
.mega-menu-footer a {
    font-family: 'Cascadia Mono', ui-monospace, 'Consolas', monospace;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: .5px;
    color: #c9a8ff;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: gap .2s ease, color .2s ease;
}
.mega-menu-footer a:hover {
    gap: 12px;
    color: #fff;
}

/* ---- Reveal holográfico F2: clip-path descendo + colunas em stagger ---- */
.nav-item-wrapper.open .mega-menu {
    animation: spxmm-holo .30s cubic-bezier(.3, 0, .2, 1) both;
}
@keyframes spxmm-holo {
    from { clip-path: inset(0 0 100% 0); }
    to   { clip-path: inset(0 0 0 0); }
}

/* Aresta de luz percorrendo a borda superior 1x (F2) — cor brand2 */
.mega-menu .mm-edge {
    position: absolute;
    top: 0;
    left: 0;
    height: 2px;
    width: 26%;
    background: linear-gradient(90deg, transparent, #aa00ff, transparent);
    opacity: 0;
    pointer-events: none;
    z-index: 3;
}
.nav-item-wrapper.open .mega-menu .mm-edge {
    animation: spxmm-edge .55s ease-out .08s 1;
}
@keyframes spxmm-edge {
    0%   { transform: translateX(-40%); opacity: 1; }
    100% { transform: translateX(360%); opacity: 0; }
}

/* Colunas entram escalonadas (40-50ms) (F2) */
.nav-item-wrapper.open .mega-menu-column {
    animation: spxmm-colin .28s ease-out both;
}
.nav-item-wrapper.open .mega-menu-column:nth-child(1) { animation-delay: .02s; }
.nav-item-wrapper.open .mega-menu-column:nth-child(2) { animation-delay: .07s; }
.nav-item-wrapper.open .mega-menu-column:nth-child(3) { animation-delay: .12s; }
.nav-item-wrapper.open .mega-menu-column:nth-child(4) { animation-delay: .17s; }
@keyframes spxmm-colin {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
   Mobile — accordion no offcanvas #mobileMenu (reusa .menu-group/.item-row/etc
   já estilizados em spellbox_custom.css). mm-col-heading em lilás (decisão do
   mockup). Sub-items ficam no hover PADRÃO: o twig mobile é plano (headings e
   links intercalados, sem wrapper de coluna), então não há escopo --col-accent
   por coluna para o hover herdar sem reestruturar o template — deixado padrão.
   ============================================================================ */
.offcanvas-cyber .menu-group .chevron {
    transition: transform .25s ease;
}
.offcanvas-cyber .menu-group .item-row[aria-expanded="true"] .chevron {
    transform: rotate(180deg);
}
.offcanvas-cyber .mm-col-heading {
    font-family: 'Rajdhani', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .10em;
    text-transform: uppercase;
    color: #aa00ff;
    padding: 10px 14px 4px;
    opacity: .9;
}

/* ---- Acessibilidade: sem movimento se o usuário pedir ---- */
@media (prefers-reduced-motion: reduce) {
    .nav-item-wrapper.open .mega-menu,
    .nav-item-wrapper.open .mega-menu .mm-edge,
    .nav-item-wrapper.open .mega-menu-column {
        animation: none !important;
    }
    .offcanvas-cyber .menu-group .chevron { transition: none !important; }
}

/* [SPX nomes 19/11] painel dentro da tela: o hover_intent_menu.js põe em --spx-mm-dx quanto empurrar o painel para ele
   não passar da borda (entre 992 e ~1320px o "Mais" e o "Produtos" vazavam e cortavam o nome inteiro dos links). O painel
   nunca passa da largura da tela e, abaixo de 1200px, o link quebra a linha em vez de vazar (acima, fica como era). */
.mega-menu {
    max-width: calc(100vw - 32px);
    transform: translateX(calc(-50% + var(--spx-mm-dx, 0px))) translateY(10px);
}
.nav-item-wrapper.open .mega-menu {
    transform: translateX(calc(-50% + var(--spx-mm-dx, 0px))) translateY(0);
}
@media (max-width: 1199.98px) {
    .mega-menu .mega-menu-link { white-space: normal; }
}
