/*
 * BuenTheme — menus.css
 * Menú, mega menú, overlay y cajón. Se carga en el head de todo el sitio: la cabecera lo usa en cada página.
 * Extraído de style.css en 2.6.148. En 2.6.149 se quitaron dos fallback antiguos.
 */

/* Soporte para el bloque Menú BuenTheme (buentheme/menu) cuando se usa dentro de cabeceras.
   Sprint M2: variables --bt-menu-* desde meta del CPT. */
.buentheme-menu-block,
.buentheme-menu-block.wp-block-navigation {
    display: flex;
    align-items: center;
    --bt-menu-gap: 1.25em;
    --bt-menu-font-size: inherit;
    --bt-menu-font-weight: inherit;
    --bt-menu-fg: inherit;
    --bt-menu-fg-hover: var(--wp--preset--color--accent-1, #3b82f6);
    --bt-menu-fg-active: var(--wp--preset--color--accent-1, #3b82f6);
    --bt-menu-dropdown-min-width: 220px;
    --bt-menu-dropdown-radius: 8px;
    --bt-menu-dropdown-bg: var(--wp--preset--color--bg-2, #ffffff);
    --bt-menu-cta-bg: var(--wp--preset--color--accent-1, #3b82f6);
    --bt-menu-cta-color: var(--wp--preset--color--text-3, #ffffff);
    --bt-menu-cta-bg-hover: color-mix(in srgb, var(--bt-menu-cta-bg) 82%, #000);
    --bt-menu-cta-color-hover: var(--bt-menu-cta-color);
    --bt-menu-cta-radius: 8px;
    --bt-menu-cta-pad-x: 16px;
    --bt-menu-cta-pad-y: 8px;
    --bt-menu-cta-weight: 600;
    --bt-menu-cta-font-size: 14px;
}

.buentheme-menu-block ul,
.buentheme-menu-block .wp-block-navigation__container,
.buentheme-menu-block .wp-block-navigation-item {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Desktop / cerrado: una sola fila horizontal (sin wrap a 2 líneas) */
.buentheme-menu-block.wp-block-navigation > ul,
.buentheme-menu-block > ul,
.buentheme-menu-block .wp-block-navigation__container {
    display: flex;
    gap: var(--bt-menu-gap, 1.25em);
    align-items: center;
    flex-direction: row;
    flex-wrap: nowrap;
}

/* CPT Menú: el layout de Gutenberg pone su propio gap; forzar --bt-menu-gap en el lienzo. */
.editor-styles-wrapper .wp-block-navigation.has-buentheme-menu-design.is-layout-flex,
.editor-styles-wrapper .wp-block-navigation.has-buentheme-menu-design .wp-block-navigation__container,
.editor-styles-wrapper .wp-block-navigation.has-buentheme-menu-design .wp-block-navigation__responsive-container-content,
.editor-styles-wrapper .buentheme-mega-menu.has-buentheme-menu-design .buentheme-mega-menu__list {
    gap: var(--bt-menu-gap, 1.25em) !important;
}

.editor-styles-wrapper .wp-block-navigation.buentheme-menu-type-vertical.has-buentheme-menu-design,
.editor-styles-wrapper .wp-block-navigation.buentheme-menu-type-vertical.has-buentheme-menu-design .wp-block-navigation__container {
    flex-direction: column !important;
    align-items: flex-start !important;
}

/* Overlay móvil abierto: siempre columna (evita menú “mal formado” horizontal) */
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-dialog,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,
.wp-block-navigation-overlay.is-menu-open .wp-block-navigation__responsive-dialog,
.wp-block-navigation-overlay.is-menu-open .wp-block-navigation__responsive-container-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    box-sizing: border-box !important;
}

.buentheme-menu-block .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container,
.buentheme-menu-block .wp-block-navigation__responsive-container.is-menu-open > ul,
.buentheme-menu-block .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content > ul,
.buentheme-menu-block .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-dialog > ul,
.buentheme-menu-block .wp-block-navigation__responsive-container.is-menu-open ul,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content > ul,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-dialog > ul,
.wp-block-navigation__responsive-container.is-menu-open ul.wp-block-navigation__container,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-page-list,
.wp-block-navigation-overlay.is-menu-open .wp-block-navigation__container,
.wp-block-navigation-overlay.is-menu-open ul.wp-block-navigation__container,
.wp-block-navigation-overlay.is-menu-open ul {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    flex-wrap: nowrap !important;
    gap: 0.15rem !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

/* Submenús del overlay: también columna (no anular con row del desktop) */
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container,
.wp-block-navigation-overlay.is-menu-open .wp-block-navigation__submenu-container {
    display: none;
    position: static !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    flex-direction: column !important;
    box-shadow: none !important;
    border: none !important;
    left: auto !important;
    top: auto !important;
}

.buentheme-menu-block .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item,
.wp-block-navigation__responsive-container.is-menu-open li,
.wp-block-navigation-overlay.is-menu-open .wp-block-navigation-item,
.wp-block-navigation-overlay.is-menu-open li {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    flex: 0 0 auto !important;
    float: none !important;
}

.buentheme-menu-block .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item > a,
.buentheme-menu-block .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item > a,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item > button,
.wp-block-navigation-overlay.is-menu-open .wp-block-navigation-item > a,
.wp-block-navigation-overlay.is-menu-open .wp-block-navigation-item__content,
.wp-block-navigation-overlay.is-menu-open .wp-block-navigation-item > button {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0.85rem 0.5rem !important;
    box-sizing: border-box;
    white-space: normal !important;
}

.buentheme-menu-block a,
.buentheme-menu-block .wp-block-navigation-item__content {
    text-decoration: none;
    font-size: var(--bt-menu-font-size, inherit);
    font-weight: var(--bt-menu-font-weight, inherit);
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

/* Color base de items (nivel superior) — no fuerza submenús */
.buentheme-menu-block.has-menu-fg .wp-block-navigation__container > .wp-block-navigation-item > a,
.buentheme-menu-block.has-menu-fg .wp-block-navigation__container > .wp-block-navigation-item > button,
.buentheme-menu-block.has-menu-fg > ul > .wp-block-navigation-item > a {
    color: var(--bt-menu-fg, inherit);
}

/* Hover: solo color */
.buentheme-menu-block.has-menu-hover-color .wp-block-navigation__container > .wp-block-navigation-item > a:hover,
.buentheme-menu-block.has-menu-hover-color .wp-block-navigation__container > .wp-block-navigation-item > button:hover,
.buentheme-menu-block.has-menu-hover-color > ul > .wp-block-navigation-item > a:hover {
    color: var(--bt-menu-fg-hover, var(--wp--preset--color--accent-1, #3b82f6));
}

/* Hover: underline */
.buentheme-menu-block.has-menu-hover-underline .wp-block-navigation__container > .wp-block-navigation-item > a,
.buentheme-menu-block.has-menu-hover-underline > ul > .wp-block-navigation-item > a {
    background-image: linear-gradient(currentColor, currentColor);
    background-position: 0 100%;
    background-repeat: no-repeat;
    background-size: 0 2px;
    transition: background-size 0.2s ease, color 0.2s ease;
    padding-bottom: 2px;
}

.buentheme-menu-block.has-menu-hover-underline .wp-block-navigation__container > .wp-block-navigation-item > a:hover,
.buentheme-menu-block.has-menu-hover-underline > ul > .wp-block-navigation-item > a:hover {
    background-size: 100% 2px;
    color: var(--bt-menu-fg-hover, var(--bt-menu-fg, inherit));
}

/* Hover: fondo pill */
.buentheme-menu-block.has-menu-hover-bg .wp-block-navigation__container > .wp-block-navigation-item > a,
.buentheme-menu-block.has-menu-hover-bg > ul > .wp-block-navigation-item > a {
    padding: 6px 12px;
    border-radius: 6px;
}

.buentheme-menu-block.has-menu-hover-bg .wp-block-navigation__container > .wp-block-navigation-item > a:hover,
.buentheme-menu-block.has-menu-hover-bg > ul > .wp-block-navigation-item > a:hover {
    background-color: color-mix(in srgb, var(--bt-menu-fg-hover, #3b82f6) 12%, transparent);
    color: var(--bt-menu-fg-hover, var(--wp--preset--color--accent-1, #3b82f6));
}

/* Activo / current: solo la página actual (no el padre ni [class*="current"]). */
.buentheme-menu-block .wp-block-navigation-item.current-menu-item > a,
.buentheme-menu-block .wp-block-navigation-item.current-menu-item > .wp-block-navigation-item__content,
.buentheme-menu-block .wp-block-navigation-item .wp-block-navigation-item__content[aria-current="page"] {
    color: var(--bt-menu-fg-active, var(--wp--preset--color--accent-1, #3b82f6));
    font-weight: 600;
}

/* CTA: último item de nivel superior como botón */
.buentheme-menu-block.has-menu-cta-last .wp-block-navigation__container > .wp-block-navigation-item:last-child > a,
.buentheme-menu-block.has-menu-cta-last > ul > .wp-block-navigation-item:last-child > a {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: var(--bt-menu-cta-pad-y, 8px) var(--bt-menu-cta-pad-x, 16px) !important;
    border-radius: var(--bt-menu-cta-radius, 8px) !important;
    background-color: var(--bt-menu-cta-bg, var(--wp--preset--color--accent-1, #3b82f6)) !important;
    color: var(--bt-menu-cta-color, var(--wp--preset--color--text-3, #ffffff)) !important;
    font-weight: var(--bt-menu-cta-weight, 600) !important;
    font-size: var(--bt-menu-cta-font-size, 14px) !important;
    line-height: 1.25 !important;
    text-decoration: none !important;
    background-image: none !important;
    white-space: nowrap;
}

.buentheme-menu-block.has-menu-cta-last .wp-block-navigation__container > .wp-block-navigation-item:last-child > a:hover,
.buentheme-menu-block.has-menu-cta-last .wp-block-navigation__container > .wp-block-navigation-item:last-child > a:focus-visible,
.buentheme-menu-block.has-menu-cta-last > ul > .wp-block-navigation-item:last-child > a:hover,
.buentheme-menu-block.has-menu-cta-last > ul > .wp-block-navigation-item:last-child > a:focus-visible {
    color: var(--bt-menu-cta-color-hover, var(--bt-menu-cta-color, var(--wp--preset--color--text-3, #ffffff))) !important;
    background-color: var(--bt-menu-cta-bg-hover, color-mix(in srgb, var(--bt-menu-cta-bg, var(--wp--preset--color--accent-1, #3b82f6)) 82%, #000)) !important;
}

/* CTA en overlay / drawer: conserva aspecto de botón, a ancho completo */
.buentheme-menu-block.has-menu-cta-last .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container > .wp-block-navigation-item:last-child > a,
.buentheme-menu-block.has-menu-cta-last .wp-block-navigation-overlay.is-menu-open .wp-block-navigation__container > .wp-block-navigation-item:last-child > a {
    display: flex !important;
    width: 100% !important;
    max-width: 100% !important;
    justify-content: center !important;
    margin-top: 0.5rem;
    padding: var(--bt-menu-cta-pad-y, 8px) var(--bt-menu-cta-pad-x, 16px) !important;
    border-radius: var(--bt-menu-cta-radius, 8px) !important;
    background-color: var(--bt-menu-cta-bg, var(--wp--preset--color--accent-1, #3b82f6)) !important;
    color: var(--bt-menu-cta-color, var(--wp--preset--color--text-3, #ffffff)) !important;
    font-weight: var(--bt-menu-cta-weight, 600) !important;
    font-size: var(--bt-menu-cta-font-size, 14px) !important;
    white-space: normal !important;
}

/* Estilos premium para los submenús de BuenTheme.
   Columna y absolute: la barra de escritorio no debe meter este ul en la fila. */
.buentheme-menu-block .wp-block-navigation__submenu-container {
    position: absolute !important;
    flex-direction: column !important;
    align-items: stretch !important;
    background-color: var(--bt-menu-dropdown-bg, var(--wp--preset--color--bg-2, #ffffff)) !important;
    border: 1px solid var(--wp--preset--color--bg-3, #e2e8f0) !important;
    border-radius: var(--bt-menu-dropdown-radius, 8px) !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.08) !important;
    padding: 8px 0 !important;
    min-width: var(--bt-menu-dropdown-min-width, 220px) !important;
    margin-top: 12px !important;
}

/* Puente invisible para mantener el hover al mover el mouse desde el item padre al submenú */
.buentheme-menu-block .wp-block-navigation__submenu-container::before {
    content: "" !important;
    position: absolute !important;
    top: -20px !important;
    left: 0 !important;
    right: 0 !important;
    height: 20px !important;
    background: transparent !important;
    z-index: -1 !important;
}

.buentheme-menu-block .wp-block-navigation__submenu-container .wp-block-navigation-item {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
}

.buentheme-menu-block .wp-block-navigation__submenu-container .wp-block-navigation-item a {
    display: block !important;
    padding: 10px 20px !important;
    font-size: 14px !important;
    color: var(--wp--preset--color--text-1, #1e293b) !important;
    transition: background-color 0.2s ease, color 0.2s ease !important;
    border-radius: 6px !important;
    margin: 2px 8px !important;
    font-weight: 400 !important;
    background-image: none !important;
}

.buentheme-menu-block .wp-block-navigation__submenu-container .wp-block-navigation-item a:hover {
    background-color: var(--wp--preset--color--bg-1, #f8fafc) !important;
    color: var(--bt-menu-fg-hover, var(--wp--preset--color--accent-1, #3b82f6)) !important;
    text-decoration: none !important;
}

/* Variantes por tipo */
.buentheme-menu-type-vertical,
.buentheme-menu-type-vertical.wp-block-navigation {
    flex-direction: column;
    align-items: flex-start;
}

.buentheme-menu-type-vertical > ul,
.buentheme-menu-type-vertical.wp-block-navigation > ul,
.buentheme-menu-type-vertical .wp-block-navigation__container {
    flex-direction: column;
    gap: var(--bt-menu-gap, 0.5em);
    align-items: flex-start;
}

/* CTA en vertical: full width del item */
.buentheme-menu-type-vertical.has-menu-cta-last .wp-block-navigation__container > .wp-block-navigation-item:last-child,
.buentheme-menu-type-vertical.has-menu-cta-last > ul > .wp-block-navigation-item:last-child {
    width: 100%;
    margin-top: 0.5em;
}

/* ==========================================================================
   CTA tipo «Botón de BuenBotón»
   BuenTheme Blocks añade <li class="bt-menu-cta-buenboton"> al final de la lista
   con el HTML de [buenboton id]. El botón conserva su diseño (colores, icono, texto);
   aquí solo se fija posición inline, alto de la barra y ancho completo en el panel.
   Si reemplaza al CTA actual, el último ítem original lleva .bt-menu-cta-replaced.
   ========================================================================== */
.bt-menu-cta-replaced {
    display: none !important;
}

.bt-menu-cta-buenboton {
    display: flex;
    align-items: center;
    position: static;
    flex: 0 0 auto;
}

/* BuenBoton pone width:100% al contenedor por breakpoint; en la barra va a lo que mida el botón. */
.bt-menu-cta-buenboton .buenchat-wa-container {
    position: static !important;
    width: auto !important;
    margin: 0;
}

/* Alto de la barra: sin min-height forzado; el tamaño (padding y fuente) es el del botón. */
.bt-menu-cta-buenboton .buenchat-wa-button,
.bt-menu-cta-buenboton .buenchat-wa-selector-btn {
    min-height: 0 !important;
    line-height: 1.25 !important;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
}

/* core/navigation y los colores de cabecera (.has-header-fg-*, especificidad 0,4,1) pintan
   los enlaces del menú: se devuelven los colores de BuenBoton con un selector más específico
   (sin !important, así una clase propia del botón con !important sigue mandando). */
li.bt-menu-cta-buenboton[data-bt-menu-cta] a.buenchat-wa-button.buenchat-wa-button-primary {
    color: #ffffff;
}

li.bt-menu-cta-buenboton[data-bt-menu-cta] a.buenchat-wa-button.buenchat-wa-button-secondary {
    color: #333333;
}

li.bt-menu-cta-buenboton[data-bt-menu-cta] a.buenchat-wa-link.buenchat-wa-link,
li.bt-menu-cta-buenboton[data-bt-menu-cta] a.buenchat-wa-selector-btn.buenchat-wa-selector-btn {
    color: #25d366;
}

li.bt-menu-cta-buenboton[data-bt-menu-cta] a.buenchat-wa-link.buenchat-wa-link:hover {
    color: #20ba5a;
}

li.bt-menu-cta-buenboton[data-bt-menu-cta] a.buenchat-wa-selector-btn.buenchat-wa-selector-btn:hover {
    color: #ffffff;
}

.bt-menu-cta-buenboton .buenchat-wa-selector-label,
.bt-menu-cta-buenboton .buenchat-wa-selector-title {
    margin-bottom: 0.25em;
}

/* Panel móvil (hamburguesa): mismo hueco que el CTA actual, a ancho completo. */
.wp-block-navigation__responsive-container.is-menu-open .bt-menu-cta-buenboton,
.wp-block-navigation-overlay.is-menu-open .bt-menu-cta-buenboton {
    margin-top: 0.5rem !important;
}

.wp-block-navigation__responsive-container.is-menu-open .bt-menu-cta-buenboton .buenchat-wa-container,
.wp-block-navigation-overlay.is-menu-open .bt-menu-cta-buenboton .buenchat-wa-container {
    display: flex !important;
    width: 100% !important;
}

.wp-block-navigation__responsive-container.is-menu-open .bt-menu-cta-buenboton .buenchat-wa-button,
.wp-block-navigation__responsive-container.is-menu-open .bt-menu-cta-buenboton .buenchat-wa-selector,
.wp-block-navigation__responsive-container.is-menu-open .bt-menu-cta-buenboton .buenchat-wa-selector-select,
.wp-block-navigation-overlay.is-menu-open .bt-menu-cta-buenboton .buenchat-wa-button,
.wp-block-navigation-overlay.is-menu-open .bt-menu-cta-buenboton .buenchat-wa-selector,
.wp-block-navigation-overlay.is-menu-open .bt-menu-cta-buenboton .buenchat-wa-selector-select {
    width: 100% !important;
    min-height: 44px !important;
    justify-content: center;
    white-space: normal;
}

/* Menú vertical: el botón ocupa el ancho del ítem, como el CTA actual. */
.buentheme-menu-type-vertical .bt-menu-cta-buenboton {
    width: 100%;
    margin-top: 0.5em;
}

/* ==========================================================================
   Sprint M3 — Mega menú (paneles full-bleed + navigation clásico mejorado)
   ========================================================================== */

.buentheme-menu-type-mega-menu,
.buentheme-mega-menu {
    position: relative;
}

/* Items con hijos / panel */
.buentheme-menu-type-mega-menu .wp-block-navigation-item.has-child,
.buentheme-menu-type-mega-menu .wp-block-navigation-submenu,
.buentheme-mega-menu-item.has-mega-panel {
    position: relative;
}

/* Panel clásico (core/navigation submenu) en modo mega */
.buentheme-menu-type-mega-menu .wp-block-navigation-item.has-child > .wp-block-navigation__submenu-container,
.buentheme-menu-type-mega-menu .wp-block-navigation-submenu > .wp-block-navigation__submenu-container {
    display: none;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    z-index: 1200 !important;
    min-width: min(640px, 92vw) !important;
    max-width: min(1100px, 96vw) !important;
    padding: 1.25rem 1.5rem !important;
    margin-top: 0.5rem !important;
    background: var(--bt-menu-dropdown-bg, var(--wp--preset--color--bg-2, #fff)) !important;
    border: 1px solid var(--wp--preset--color--bg-3, #e2e8f0) !important;
    border-radius: var(--bt-menu-dropdown-radius, 8px) !important;
    box-shadow:
        0 20px 40px -12px rgba(15, 23, 42, 0.14),
        0 8px 16px -8px rgba(15, 23, 42, 0.08) !important;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.25rem 1.5rem;
    box-sizing: border-box !important;
}

/* Cuando está abierto (JS o :focus-within) */
.buentheme-menu-type-mega-menu .wp-block-navigation-item.has-child.is-mega-open > .wp-block-navigation__submenu-container,
.buentheme-menu-type-mega-menu .wp-block-navigation-item.has-child:focus-within > .wp-block-navigation__submenu-container,
.buentheme-menu-type-mega-menu .wp-block-navigation-submenu.is-mega-open > .wp-block-navigation__submenu-container,
.buentheme-mega-menu-item.is-mega-open > .buentheme-mega-panel {
    display: grid !important;
}

.buentheme-mega-menu-item.is-mega-open > .buentheme-mega-panel {
    display: block !important;
}

/* Full-width: JS ajusta left/width; fallback CSS bajo el nav */
.buentheme-menu-type-mega-menu.has-mega-full-width .wp-block-navigation-item.has-child > .wp-block-navigation__submenu-container,
.buentheme-mega-menu.has-mega-full-width .buentheme-mega-panel {
    border-radius: 0 0 var(--bt-menu-dropdown-radius, 8px) var(--bt-menu-dropdown-radius, 8px) !important;
}

/* Sub-links en panel mega clásico: una columna por item, no lista estrecha */
.buentheme-menu-type-mega-menu .wp-block-navigation__submenu-container > .wp-block-navigation-item {
    width: auto !important;
    min-width: 140px;
}

.buentheme-menu-type-mega-menu .wp-block-navigation__submenu-container > .wp-block-navigation-item > a {
    padding: 8px 10px !important;
    margin: 0 !important;
    border-radius: 6px !important;
    font-size: 14px !important;
}

/* Contenido rico del panel (Disposición de fila, etc.) */
.buentheme-mega-panel__inner {
    width: 100%;
}

.buentheme-mega-panel__inner .buentheme-row,
.buentheme-mega-panel__inner .buentheme-row-container {
    max-width: 100%;
}

/* Evitar overflow hidden del header sobre paneles mega */
.buentheme-header-wrapper:has(.buentheme-menu-type-mega-menu),
.buentheme-header-wrapper:has(.buentheme-mega-menu) {
    overflow: visible !important;
}

@media (max-width: 781px) {
    .buentheme-menu-type-mega-menu .wp-block-navigation-item.has-child > .wp-block-navigation__submenu-container,
    .buentheme-mega-panel {
        position: static !important;
        left: auto !important;
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        box-shadow: none !important;
        grid-template-columns: 1fr !important;
    }
}

/* Efecto Sticky */
.buentheme-header-wrapper.is-position-sticky {
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;
}

/* Modo "después del scroll": empieza en flujo normal; JS activa fixed + spacer */
.buentheme-header-wrapper.is-position-sticky.is-sticky-after-scroll:not(.is-header-fixed-active) {
    position: relative !important;
    top: auto !important;
}

.buentheme-header-wrapper.is-position-sticky.is-sticky-after-scroll.is-header-fixed-active {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 1000 !important;
}

/* Ajuste para evitar solapamientos con la barra de administración de WordPress */
.admin-bar .buentheme-header-wrapper.is-position-sticky {
    top: 32px !important;
}

.admin-bar .buentheme-header-wrapper.is-position-sticky.is-sticky-after-scroll:not(.is-header-fixed-active) {
    top: auto !important;
}

.admin-bar .buentheme-header-wrapper.is-position-sticky.is-sticky-after-scroll.is-header-fixed-active {
    top: 32px !important;
}

@media screen and (max-width: 782px) {
    .admin-bar .buentheme-header-wrapper.is-position-sticky {
        top: 46px !important;
    }

    .admin-bar .buentheme-header-wrapper.is-position-sticky.is-sticky-after-scroll:not(.is-header-fixed-active) {
        top: auto !important;
    }

    .admin-bar .buentheme-header-wrapper.is-position-sticky.is-sticky-after-scroll.is-header-fixed-active {
        top: 46px !important;
    }
}

/* Estado scrolled / sticky-active (compat + Sprint 1) */
.buentheme-header-wrapper.is-position-sticky.is-sticky-active,
.buentheme-header-wrapper.is-position-sticky.is-header-scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
    background-color: var(--buentheme-header-sticky-bg-rgba, var(--wp--preset--color--bg-2)) !important;
}

/* Shrink real: solo cuando el motor añade is-header-shrunk (meta shrink_enabled) */
.buentheme-header-wrapper.has-header-shrink.is-header-shrunk .buentheme-header-main {
    padding-top: var(--buentheme-header-shrink-padding, 12px) !important;
    padding-bottom: var(--buentheme-header-shrink-padding, 12px) !important;
}

/* Hide on scroll down / reveal on scroll up */
.buentheme-header-wrapper.has-hide-on-scroll.is-header-hidden {
    transform: translateY(-100%);
    box-shadow: none !important;
    pointer-events: none;
}

.buentheme-header-wrapper.has-hide-on-scroll:not(.is-header-hidden) {
    transform: translateY(0);
    pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
    .buentheme-header-wrapper,
    .buentheme-header-wrapper .buentheme-header-main,
    .buentheme-header-wrapper .wp-block-site-logo img,
    .buentheme-header-wrapper .custom-logo-link img,
    .buentheme-header-wrapper .custom-logo {
        transition: none !important;
    }

    .buentheme-header-wrapper.has-hide-on-scroll.is-header-hidden {
        transform: none;
        pointer-events: auto;
    }
}

/* Variación de Estilo de Bloque: Cabecera Transparente */
.buentheme-header-wrapper.is-style-transparent-header {
    position: absolute !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000 !important;
    background-color: var(--buentheme-header-trans-bg-rgba, transparent) !important;
    border-bottom: none !important;
}

.buentheme-header-wrapper.is-style-transparent-header .buentheme-header-top {
    border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
}

/* Ajuste automático para que el contenido empiece arriba si hay cabecera transparente activa */
body.has-transparent-header main,
body.has-transparent-header .wp-site-blocks > main {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* Hacer que los bloques contenedores internos de la cabecera sean transparentes para que no bloqueen el fondo transparente/pegajoso */
.is-style-transparent-header .wp-block-group,
.is-style-transparent-header .wp-block-columns,
.is-style-transparent-header .wp-block-column,
.is-style-transparent-header .buentheme-row-container,
.is-style-transparent-header .buentheme-row-inner-wrapper,
.buentheme-header-wrapper.is-sticky-active .wp-block-group,
.buentheme-header-wrapper.is-sticky-active .wp-block-columns,
.buentheme-header-wrapper.is-sticky-active .wp-block-column,
.buentheme-header-wrapper.is-sticky-active .buentheme-row-container,
.buentheme-header-wrapper.is-sticky-active .buentheme-row-inner-wrapper {
    background-color: transparent !important;
    background: transparent !important;
}

/* Transición a Estado Sólido cuando es Sticky y está Activo (Scrolled) */
.is-style-transparent-header.is-position-sticky.is-sticky-active {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    background-color: var(--buentheme-header-sticky-bg-rgba, var(--wp--preset--color--bg-2)) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
    border-bottom: 1px solid var(--wp--preset--color--bg-3) !important;
}

.is-style-transparent-header.is-position-sticky.is-sticky-active .buentheme-header-top {
    border-bottom: 1px solid var(--wp--preset--color--bg-3) !important;
}

/* Soporte para borde inferior personalizado de la cabecera (sobrescribe estados transparentes y pegajosos) */
.buentheme-header-wrapper.has-custom-border,
.buentheme-header-wrapper.has-custom-border.is-sticky-active,
.buentheme-header-wrapper.has-custom-border.is-header-scrolled,
.is-style-transparent-header.is-position-sticky.is-sticky-active.has-custom-border {
    border-bottom: var(--buentheme-header-border-width, 1px) var(--buentheme-header-border-style, solid) var(--buentheme-header-border-color, #e2e8f0) !important;
}

/* ==========================================================================
   BREAKPOINTS PERSONALIZADOS PARA EL BLOQUE DE NAVEGACIÓN (FSE)
   ========================================================================== */

/*
 * Menú cerrado: ocultar botón X.
 * Chrome (logo+cuenta) en escritorio se integra en UNA fila con los links.
 */
.wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__responsive-container-close,
.wp-block-navigation-overlay:not(.is-menu-open) .wp-block-navigation__responsive-container-close {
    display: none !important;
}

/* ==========================================================================
   BARRA DE MENÚ — posiciones independientes (TODOS los breakpoints)
   Logo | Enlaces | Cuenta/Carrito | Hamburguesa
   Clases en <nav>: has-buentheme-bar-layout + bt-bar-logo-* + bt-bar-links-*
   + bt-bar-actions-* + bt-bar-toggle-*

   Importante:
   - Logo y acciones del slot (.buentheme-bar-logo / .buentheme-bar-actions)
     permanecen visibles en tablet/móvil (modo hamburguesa). Antes se ocultaban
     bajo el breakpoint y el logo solo aparecía al abrir el overlay.
   - El order de la hamburguesa aplica en todos los anchos (no solo ≥600px),
     para que no salte de derecha (tablet) a izquierda (móvil).
   ========================================================================== */

/* Slots de barra: base (visibles con has-buentheme-bar-layout). */
.buentheme-bar-logo,
.buentheme-bar-actions {
	display: none;
	align-items: center;
	flex: 0 0 auto;
	min-width: 0;
	gap: 4px;
	box-sizing: border-box;
}
.buentheme-bar-logo .buentheme-drawer-brand,
.buentheme-bar-logo .buentheme-drawer-brand__logo {
	display: flex !important;
	align-items: center;
	min-width: 0;
}
/* Solo logo en flujo — no forzar visible/altura en duales absolute */
.buentheme-bar-logo img:not(.buentheme-logo-transparent):not(.buentheme-logo-scrolled),
.buentheme-bar-logo .custom-logo:not(.buentheme-logo-transparent):not(.buentheme-logo-scrolled) {
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
	height: auto !important;
	max-width: 100%;
	object-fit: contain;
}
.buentheme-bar-actions .buentheme-drawer-actions {
	display: flex !important;
	align-items: center;
	gap: 4px;
	margin: 0 !important;
	padding: 0 !important;
	border: none !important;
	width: auto !important;
}

/* Nav como flexbar: anula justify del bloque core (items-justified-*) */
.wp-block-navigation.buentheme-menu-block.has-buentheme-bar-layout,
.buentheme-menu-block.has-buentheme-bar-layout {
	position: relative !important;
	display: flex !important;
	flex-direction: row !important;
	flex-wrap: nowrap !important;
	align-items: center !important;
	justify-content: flex-start !important;
	width: 100% !important;
	max-width: 100% !important;
	gap: 0.75rem !important;
	box-sizing: border-box !important;
}

/*
 * Slots SIEMPRE visibles con layout de barra (escritorio, tablet y móvil).
 * Incluye has-breakpoint-always (hamburguesa permanente).
 */
.wp-block-navigation.has-buentheme-bar-layout > .buentheme-bar-logo,
.wp-block-navigation.has-buentheme-bar-layout > .buentheme-bar-actions,
.buentheme-menu-block.has-buentheme-bar-layout > .buentheme-bar-logo,
.buentheme-menu-block.has-buentheme-bar-layout > .buentheme-bar-actions {
	display: flex !important;
}

/* Respetar “ocultar” en meta de barra */
.wp-block-navigation.has-buentheme-bar-layout.bt-bar-logo-hide > .buentheme-bar-logo,
.buentheme-menu-block.has-buentheme-bar-layout.bt-bar-logo-hide > .buentheme-bar-logo {
	display: none !important;
}
.wp-block-navigation.has-buentheme-bar-layout.bt-bar-actions-hide > .buentheme-bar-actions,
.buentheme-menu-block.has-buentheme-bar-layout.bt-bar-actions-hide > .buentheme-bar-actions {
	display: none !important;
}

/* Chrome interno del drawer: solo con menú abierto (evita logo duplicado en desktop cerrado) */
.wp-block-navigation.has-buentheme-bar-layout
	.wp-block-navigation__responsive-container:not(.is-menu-open)
	.buentheme-drawer-chrome {
	display: none !important;
}

/* —— Posiciones (todos los breakpoints) —— */
.bt-bar-logo-left > .buentheme-bar-logo {
	order: 1;
	margin-inline-end: 0.25rem;
}
.bt-bar-logo-center > .buentheme-bar-logo {
	order: 20;
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	z-index: 2;
	pointer-events: auto;
}
.bt-bar-logo-right > .buentheme-bar-logo {
	order: 40;
}

/* Hamburguesa: order + empuje al borde (si no, un solo ítem queda a la izquierda) */
.bt-bar-toggle-left > .wp-block-navigation__responsive-container-open {
	order: 0;
	margin-inline-end: 0.5rem;
	margin-inline-start: 0;
}
.bt-bar-toggle-right > .wp-block-navigation__responsive-container-open {
	order: 50;
	margin-inline-start: auto;
}

/* Si hay acciones a la derecha + toggle a la derecha, el auto va en acciones */
.bt-bar-actions-right.bt-bar-toggle-right > .buentheme-bar-actions {
	order: 40;
	margin-inline-start: auto;
}
.bt-bar-actions-right.bt-bar-toggle-right > .wp-block-navigation__responsive-container-open {
	margin-inline-start: 0;
}

/* Enlaces (escritorio / sobre el breakpoint) */
.bt-bar-links-left > .wp-block-navigation__responsive-container:not(.is-menu-open),
.bt-bar-links-center > .wp-block-navigation__responsive-container:not(.is-menu-open),
.bt-bar-links-right > .wp-block-navigation__responsive-container:not(.is-menu-open) {
	order: 10;
	flex: 1 1 auto !important;
}
.bt-bar-links-left > .wp-block-navigation__responsive-container:not(.is-menu-open) {
	justify-content: flex-start !important;
}
.bt-bar-links-center > .wp-block-navigation__responsive-container:not(.is-menu-open) {
	justify-content: center !important;
}
.bt-bar-links-right > .wp-block-navigation__responsive-container:not(.is-menu-open) {
	justify-content: flex-end !important;
}
.bt-bar-links-left > .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__container,
.bt-bar-links-left > .wp-block-navigation__responsive-container:not(.is-menu-open) ul:not(.wp-block-navigation__submenu-container) {
	justify-content: flex-start !important;
	margin-inline: 0 !important;
}
.bt-bar-links-center > .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__container,
.bt-bar-links-center > .wp-block-navigation__responsive-container:not(.is-menu-open) ul:not(.wp-block-navigation__submenu-container) {
	justify-content: center !important;
	margin-inline: auto !important;
}
.bt-bar-links-right > .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__container,
.bt-bar-links-right > .wp-block-navigation__responsive-container:not(.is-menu-open) ul:not(.wp-block-navigation__submenu-container) {
	justify-content: flex-end !important;
	margin-inline-left: auto !important;
	margin-inline-right: 0 !important;
}

/* Acciones */
.bt-bar-actions-left > .buentheme-bar-actions {
	order: 2;
}
.bt-bar-actions-center > .buentheme-bar-actions {
	order: 15;
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	z-index: 2;
}
.bt-bar-actions-right > .buentheme-bar-actions {
	order: 30;
}

/* Escritorio: contenedor de enlaces en fila (sin arrastrar logo/acciones de los slots) */
@media (min-width: 600px) {
	.wp-block-navigation.has-buentheme-bar-layout:not(.has-breakpoint-always)
		.wp-block-navigation__responsive-container:not(.is-menu-open) {
		display: flex !important;
		flex-direction: row !important;
		flex-wrap: nowrap !important;
		align-items: center !important;
		width: auto !important;
		max-width: none !important;
		min-width: 0 !important;
		height: auto !important;
		margin: 0 !important;
		padding: 0 !important;
		background: transparent !important;
		box-shadow: none !important;
		overflow: visible !important;
		position: static !important;
		inset: auto !important;
	}
	.wp-block-navigation.has-buentheme-bar-layout:not(.has-breakpoint-always)
		.wp-block-navigation__responsive-container:not(.is-menu-open)
		.wp-block-navigation__responsive-close,
	.wp-block-navigation.has-buentheme-bar-layout:not(.has-breakpoint-always)
		.wp-block-navigation__responsive-container:not(.is-menu-open)
		.wp-block-navigation__responsive-dialog,
	.wp-block-navigation.has-buentheme-bar-layout:not(.has-breakpoint-always)
		.wp-block-navigation__responsive-container:not(.is-menu-open)
		.wp-block-navigation__responsive-container-content {
		display: flex !important;
		flex-direction: row !important;
		flex-wrap: nowrap !important;
		align-items: center !important;
		width: auto !important;
		max-width: none !important;
		height: auto !important;
		margin: 0 !important;
		padding: 0 !important;
		background: transparent !important;
		box-shadow: none !important;
		overflow: visible !important;
		position: static !important;
		inset: auto !important;
	}
	.wp-block-navigation.has-buentheme-bar-layout:not(.has-breakpoint-always)
		.wp-block-navigation__responsive-container:not(.is-menu-open)
		.wp-block-navigation__container,
	.wp-block-navigation.has-buentheme-bar-layout:not(.has-breakpoint-always)
		.wp-block-navigation__responsive-container:not(.is-menu-open)
		ul:not(.wp-block-navigation__submenu-container) {
		display: flex !important;
		flex-direction: row !important;
		flex-wrap: nowrap !important;
		align-items: center !important;
		gap: var(--bt-menu-gap, 1.25em) !important;
		width: auto !important;
		margin: 0 !important;
	}

	/*
	 * Desktop: si el toggle está oculto y hay enlaces, no empujar acciones
	 * con margin-auto del toggle (está display:none). Las acciones right
	 * ya se alinean vía order; los enlaces flex:1 rellenan el centro.
	 */
	.bt-bar-actions-right:not(.has-breakpoint-always) > .buentheme-bar-actions {
		margin-inline-start: 0;
	}
}

/* Legacy fallback (sin has-buentheme-bar-layout): una fila con chrome aplanado */
@media (min-width: 600px) {
    .wp-block-navigation:not(.has-buentheme-bar-layout):not(.has-breakpoint-always) .wp-block-navigation__responsive-container:not(.is-menu-open) {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 1rem !important;
        width: 100% !important;
    }
    .wp-block-navigation:not(.has-buentheme-bar-layout):not(.has-breakpoint-always) .wp-block-navigation__responsive-container:not(.is-menu-open) .buentheme-drawer-chrome {
        display: contents !important;
    }
    .wp-block-navigation:not(.has-buentheme-bar-layout):not(.has-breakpoint-always) .wp-block-navigation__responsive-container:not(.is-menu-open) .buentheme-drawer-brand {
        order: 1;
        flex: 0 0 auto !important;
        display: flex !important;
        align-items: center !important;
        min-width: 0;
    }
    .wp-block-navigation:not(.has-buentheme-bar-layout):not(.has-breakpoint-always) .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__responsive-close,
    .wp-block-navigation:not(.has-buentheme-bar-layout):not(.has-breakpoint-always) .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__responsive-dialog,
    .wp-block-navigation:not(.has-buentheme-bar-layout):not(.has-breakpoint-always) .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__responsive-container-content {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        order: 2;
        flex: 1 1 auto !important;
        width: auto !important;
        max-width: none !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        overflow: visible !important;
        position: static !important;
        inset: auto !important;
    }
    .wp-block-navigation:not(.has-buentheme-bar-layout):not(.has-breakpoint-always) .wp-block-navigation__responsive-container:not(.is-menu-open) .buentheme-drawer-actions {
        order: 3;
        flex: 0 0 auto !important;
        display: flex !important;
        align-items: center !important;
        margin-left: auto !important;
        gap: 4px !important;
    }
    .wp-block-navigation:not(.has-buentheme-bar-layout):not(.has-breakpoint-always) .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__container,
    .wp-block-navigation:not(.has-buentheme-bar-layout):not(.has-breakpoint-always) .wp-block-navigation__responsive-container:not(.is-menu-open) ul:not(.wp-block-navigation__submenu-container) {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: var(--bt-menu-gap, 1.25em) !important;
        width: auto !important;
    }
}

@media (min-width: 782px) {
    .wp-block-navigation.has-breakpoint-782:not(.has-buentheme-bar-layout) .wp-block-navigation__responsive-container:not(.is-menu-open) {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 1rem !important;
        width: 100% !important;
    }
    .wp-block-navigation.has-breakpoint-782:not(.has-buentheme-bar-layout) .wp-block-navigation__responsive-container:not(.is-menu-open) .buentheme-drawer-chrome {
        display: contents !important;
    }
    .wp-block-navigation.has-breakpoint-782:not(.has-buentheme-bar-layout) .wp-block-navigation__responsive-container:not(.is-menu-open) .buentheme-drawer-brand {
        order: 1;
        flex: 0 0 auto !important;
    }
    .wp-block-navigation.has-breakpoint-782:not(.has-buentheme-bar-layout) .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__responsive-close,
    .wp-block-navigation.has-breakpoint-782:not(.has-buentheme-bar-layout) .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__responsive-dialog,
    .wp-block-navigation.has-breakpoint-782:not(.has-buentheme-bar-layout) .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__responsive-container-content {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        order: 2;
        flex: 1 1 auto !important;
        width: auto !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        overflow: visible !important;
        position: static !important;
    }
    .wp-block-navigation.has-breakpoint-782:not(.has-buentheme-bar-layout) .wp-block-navigation__responsive-container:not(.is-menu-open) .buentheme-drawer-actions {
        order: 3;
        flex: 0 0 auto !important;
        margin-left: auto !important;
    }
    .wp-block-navigation.has-breakpoint-782:not(.has-buentheme-bar-layout) .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__container {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
    }
}

/* ==========================================================================
   BREAKPOINTS — default WP es 600px; el tema usa has-breakpoint-N (siempre
   se añade, p.ej. has-breakpoint-782) para alinear con el CPT de menú.
   ========================================================================== */

/* Fallback sin clase: mismo comportamiento que 600px de core */
@media (min-width: 600px) {
    .wp-block-navigation:not([class*="has-breakpoint-"]):not(.has-breakpoint-always) .wp-block-navigation__responsive-container-open:not(.always-shown) {
        display: none !important;
    }
    .wp-block-navigation:not([class*="has-breakpoint-"]):not(.has-breakpoint-always) .wp-block-navigation__responsive-container:not(.is-menu-open) {
        display: flex !important;
        position: relative !important;
        width: auto !important;
        height: auto !important;
        inset: auto !important;
        background: transparent !important;
        transform: none !important;
        opacity: 1 !important;
        overflow: visible !important;
        z-index: auto !important;
        padding: 0 !important;
        box-shadow: none !important;
    }
}
@media (max-width: 599px) {
    .wp-block-navigation:not([class*="has-breakpoint-"]) .wp-block-navigation__responsive-container-open {
        display: flex !important;
    }
    .wp-block-navigation:not([class*="has-breakpoint-"]) .wp-block-navigation__responsive-container:not(.is-menu-open) {
        display: none !important;
    }
}

/* --- 1. Breakpoint: 600px --- */
@media (min-width: 600px) {
    .wp-block-navigation.has-breakpoint-600 .wp-block-navigation__responsive-container-open:not(.always-shown) {
        display: none !important;
    }
    .wp-block-navigation.has-breakpoint-600 .wp-block-navigation__responsive-container:not(.is-menu-open) {
        display: flex !important;
        position: relative !important;
        inset: auto !important;
        width: auto !important;
        height: auto !important;
        background: transparent !important;
        transform: none !important;
        opacity: 1 !important;
        overflow: visible !important;
        z-index: auto !important;
        padding: 0 !important;
        box-shadow: none !important;
    }
}
@media (max-width: 599px) {
    .wp-block-navigation.has-breakpoint-600 .wp-block-navigation__responsive-container-open {
        display: flex !important;
    }
    .wp-block-navigation.has-breakpoint-600 .wp-block-navigation__responsive-container:not(.is-menu-open) {
        display: none !important;
    }
}

/* Desktop closed helper (sin display:contents — rompe Interactivity API / clicks) */
/* --- 2. 768 --- */
@media (min-width: 768px) {
    .wp-block-navigation.has-breakpoint-768 .wp-block-navigation__responsive-container-open:not(.always-shown) { display: none !important; }
    .wp-block-navigation.has-breakpoint-768 .wp-block-navigation__responsive-container:not(.is-menu-open) {
        display: flex !important; position: relative !important; inset: auto !important;
        width: auto !important; height: auto !important; background: transparent !important;
        transform: none !important; opacity: 1 !important; overflow: visible !important;
        z-index: auto !important; padding: 0 !important; box-shadow: none !important;
    }
}
@media (max-width: 767px) {
    .wp-block-navigation.has-breakpoint-768 .wp-block-navigation__responsive-container-open { display: flex !important; }
    .wp-block-navigation.has-breakpoint-768 .wp-block-navigation__responsive-container:not(.is-menu-open) { display: none !important; }
}

/* --- 2b. 782 (default BuenTheme / menú CPT) --- */
@media (min-width: 782px) {
    .wp-block-navigation.has-breakpoint-782 .wp-block-navigation__responsive-container-open:not(.always-shown) { display: none !important; }
    .wp-block-navigation.has-breakpoint-782 .wp-block-navigation__responsive-container:not(.is-menu-open) {
        display: flex !important; position: relative !important; inset: auto !important;
        width: auto !important; height: auto !important; background: transparent !important;
        transform: none !important; opacity: 1 !important; overflow: visible !important;
        z-index: auto !important; padding: 0 !important; box-shadow: none !important;
    }
}
@media (max-width: 781px) {
    .wp-block-navigation.has-breakpoint-782 .wp-block-navigation__responsive-container-open { display: flex !important; }
    .wp-block-navigation.has-breakpoint-782 .wp-block-navigation__responsive-container:not(.is-menu-open) { display: none !important; }
}

/* --- 3. 992 --- */
@media (min-width: 992px) {
    .wp-block-navigation.has-breakpoint-992 .wp-block-navigation__responsive-container-open:not(.always-shown) { display: none !important; }
    .wp-block-navigation.has-breakpoint-992 .wp-block-navigation__responsive-container:not(.is-menu-open) {
        display: flex !important; position: relative !important; inset: auto !important;
        width: auto !important; height: auto !important; background: transparent !important;
        transform: none !important; opacity: 1 !important; overflow: visible !important;
        z-index: auto !important; padding: 0 !important; box-shadow: none !important;
    }
}
@media (max-width: 991px) {
    .wp-block-navigation.has-breakpoint-992 .wp-block-navigation__responsive-container-open { display: flex !important; }
    .wp-block-navigation.has-breakpoint-992 .wp-block-navigation__responsive-container:not(.is-menu-open) { display: none !important; }
}

/* --- 4. 1024 --- */
@media (min-width: 1024px) {
    .wp-block-navigation.has-breakpoint-1024 .wp-block-navigation__responsive-container-open:not(.always-shown) { display: none !important; }
    .wp-block-navigation.has-breakpoint-1024 .wp-block-navigation__responsive-container:not(.is-menu-open) {
        display: flex !important; position: relative !important; inset: auto !important;
        width: auto !important; height: auto !important; background: transparent !important;
        transform: none !important; opacity: 1 !important; overflow: visible !important;
        z-index: auto !important; padding: 0 !important; box-shadow: none !important;
    }
}
@media (max-width: 1023px) {
    .wp-block-navigation.has-breakpoint-1024 .wp-block-navigation__responsive-container-open { display: flex !important; }
    .wp-block-navigation.has-breakpoint-1024 .wp-block-navigation__responsive-container:not(.is-menu-open) { display: none !important; }
}

/* --- 5. 1200 --- */
@media (min-width: 1200px) {
    .wp-block-navigation.has-breakpoint-1200 .wp-block-navigation__responsive-container-open:not(.always-shown) { display: none !important; }
    .wp-block-navigation.has-breakpoint-1200 .wp-block-navigation__responsive-container:not(.is-menu-open) {
        display: flex !important; position: relative !important; inset: auto !important;
        width: auto !important; height: auto !important; background: transparent !important;
        transform: none !important; opacity: 1 !important; overflow: visible !important;
        z-index: auto !important; padding: 0 !important; box-shadow: none !important;
    }
}
@media (max-width: 1199px) {
    .wp-block-navigation.has-breakpoint-1200 .wp-block-navigation__responsive-container-open { display: flex !important; }
    .wp-block-navigation.has-breakpoint-1200 .wp-block-navigation__responsive-container:not(.is-menu-open) { display: none !important; }
}

/* --- 6. Breakpoint: siempre (.has-breakpoint-always) --- */
.wp-block-navigation.has-breakpoint-always .wp-block-navigation__responsive-container-open {
    display: flex !important;
}
.wp-block-navigation.has-breakpoint-always .wp-block-navigation__responsive-container:not(.is-menu-open) {
    display: none !important;
}

/* --- 7. Breakpoint: nunca (.has-breakpoint-never) --- */
.wp-block-navigation.has-breakpoint-never .wp-block-navigation__responsive-container-open {
    display: none !important;
}
.wp-block-navigation.has-breakpoint-never .wp-block-navigation__responsive-container:not(.is-menu-open) {
    display: flex !important;
}

/* Sprint M5 / E4 — overflow solo donde hace falta (no * global). */
.buentheme-header-wrapper,
.buentheme-header-wrapper .buentheme-menu-block,
.buentheme-header-wrapper .wp-block-navigation,
.buentheme-header-wrapper .wp-block-navigation__container,
.buentheme-header-wrapper .wp-block-navigation-item,
.buentheme-header-wrapper .buentheme-mega-menu,
.buentheme-header-wrapper .buentheme-mega-menu__list,
.buentheme-header-wrapper .buentheme-row-container,
.buentheme-header-wrapper .buentheme-row-inner-wrapper {
    overflow: visible;
}

/* La Sección dinámica guarda overflow:hidden en línea (save.js).
   Si contiene un menú con submenús o mega menú, ese recorte corta el desplegable.
   !important es necesario para ganarle al estilo en línea. */
.buentheme-dynamic-section:has(.wp-block-navigation .has-child),
.buentheme-dynamic-section:has(.buentheme-mega-menu),
.buentheme-dynamic-section:has(.buentheme-menu-block) {
    overflow: visible !important;
}

/* Restaurar scroll en overlay móvil abierto */
.wp-block-navigation__responsive-container.is-menu-open,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-dialog,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,
.wp-block-navigation-overlay.is-menu-open {
    overflow: auto !important;
}

/* ==========================================================================
   PERSONALIZACIÓN DE FONDO DE MENÚ DE SUPERPOSICIÓN (OVERLAY) Y GLASSMORPHISM
   ========================================================================== */

/* Configurar transiciones para efectos y animaciones de superposición */
.wp-block-navigation__responsive-container,
.wp-block-navigation-overlay {
    transition: transform var(--buentheme-overlay-anim-duration, 0.28s) cubic-bezier(0.16, 1, 0.3, 1), 
                opacity var(--buentheme-overlay-anim-duration, 0.28s) ease-in-out,
                backdrop-filter var(--buentheme-overlay-anim-duration, 0.28s) ease-in-out !important;
}

/* Fondo por defecto del modal abierto — sólido (nunca heredar transparente del header) */
.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open,
.wp-block-navigation.has-modal-open .wp-block-navigation__responsive-container,
.wp-block-navigation .wp-block-navigation-overlay.is-menu-open {
    background-color: var(--buentheme-overlay-bg-color, var(--wp--preset--color--bg-2, #fff)) !important;
    backdrop-filter: blur(var(--buentheme-overlay-blur, 0px)) !important;
    -webkit-backdrop-filter: blur(var(--buentheme-overlay-blur, 0px)) !important;
    color: var(--wp--preset--color--text-1, #1e293b);
}

/* Fondo para el menú de superposición en cabeceras transparentes cuando no hay variable de color explícita */
.buentheme-header-wrapper.is-style-transparent-header .wp-block-navigation__responsive-container.is-menu-open:not([style*="--buentheme-overlay-bg-color"]),
.buentheme-header-wrapper.is-style-transparent-header .wp-block-navigation-overlay.is-menu-open:not([style*="--buentheme-overlay-bg-color"]) {
    background-color: var(--buentheme-header-trans-bg-solid, var(--wp--preset--color--bg-2)) !important;
}

/* Fondo para el menú de superposición en cabeceras pegajosas (sticky) cuando no hay variable de color explícita */
.buentheme-header-wrapper.is-sticky-active .wp-block-navigation__responsive-container.is-menu-open:not([style*="--buentheme-overlay-bg-color"]),
.buentheme-header-wrapper.is-sticky-active .wp-block-navigation-overlay.is-menu-open:not([style*="--buentheme-overlay-bg-color"]) {
    background-color: var(--buentheme-header-sticky-bg-solid, var(--wp--preset--color--bg-2)) !important;
}

/* --- CLASES DE ANIMACIÓN PARA SUPERPOSICIÓN MÓVIL --- */
/* Solo en contenedores MODAL (hidden-by-default) y CERRADOS.
   Nunca en el menú de escritorio always-shown (rompe layout y “parece sin estilos”). */
.wp-block-navigation__responsive-container.hidden-by-default.buentheme-overlay-anim-slide-right:not(.is-menu-open),
.wp-block-navigation-overlay.hidden-by-default.buentheme-overlay-anim-slide-right:not(.is-menu-open) {
    transform: translateX(100%);
    opacity: 0;
}
.wp-block-navigation__responsive-container.hidden-by-default.buentheme-overlay-anim-slide-left:not(.is-menu-open),
.wp-block-navigation-overlay.hidden-by-default.buentheme-overlay-anim-slide-left:not(.is-menu-open) {
    transform: translateX(-100%);
    opacity: 0;
}
.wp-block-navigation__responsive-container.hidden-by-default.buentheme-overlay-anim-fade:not(.is-menu-open),
.wp-block-navigation-overlay.hidden-by-default.buentheme-overlay-anim-fade:not(.is-menu-open) {
    opacity: 0;
}
.wp-block-navigation__responsive-container.hidden-by-default.buentheme-overlay-anim-scale:not(.is-menu-open),
.wp-block-navigation-overlay.hidden-by-default.buentheme-overlay-anim-scale:not(.is-menu-open) {
    transform: scale(0.92);
    opacity: 0;
}

/* --- REESTABLECER ESTADOS EN ESCRITORIO (MIN-WIDTH) PARA CADA BREAKPOINT --- */

/* Reset para Breakpoint: 600px */
@media (min-width: 600px) {
    .wp-block-navigation.has-breakpoint-600 .wp-block-navigation__responsive-container {
        transform: none !important;
        opacity: 1 !important;
    }
}

/* Reset para Breakpoint: 768px */
@media (min-width: 768px) {
    .wp-block-navigation.has-breakpoint-768 .wp-block-navigation__responsive-container {
        transform: none !important;
        opacity: 1 !important;
    }
}

/* Reset para Breakpoint por defecto de WordPress: 782px (bloques sin clase de breakpoint) */
@media (min-width: 782px) {
    .wp-block-navigation:not([class*="has-breakpoint-"]) .wp-block-navigation__responsive-container {
        transform: none !important;
        opacity: 1 !important;
    }
}

/* Reset para Breakpoint: 992px */
@media (min-width: 992px) {
    .wp-block-navigation.has-breakpoint-992 .wp-block-navigation__responsive-container {
        transform: none !important;
        opacity: 1 !important;
    }
}

/* Reset para Breakpoint: 1024px */
@media (min-width: 1024px) {
    .wp-block-navigation.has-breakpoint-1024 .wp-block-navigation__responsive-container {
        transform: none !important;
        opacity: 1 !important;
    }
}

/* Reset para Breakpoint: 1200px */
@media (min-width: 1200px) {
    .wp-block-navigation.has-breakpoint-1200 .wp-block-navigation__responsive-container {
        transform: none !important;
        opacity: 1 !important;
    }
}

/* Reset para Breakpoint: nunca (has-breakpoint-never) - Se aplica siempre */
.wp-block-navigation.has-breakpoint-never .wp-block-navigation__responsive-container {
    transform: none !important;
    opacity: 1 !important;
}

/* Breakpoint always: animación solo en modal cerrado (hidden-by-default) */
.wp-block-navigation.has-breakpoint-always .wp-block-navigation__responsive-container.hidden-by-default.buentheme-overlay-anim-slide-right:not(.is-menu-open),
.wp-block-navigation.has-breakpoint-always .wp-block-navigation-overlay.hidden-by-default.buentheme-overlay-anim-slide-right:not(.is-menu-open) {
    transform: translateX(100%);
    opacity: 0;
}
.wp-block-navigation.has-breakpoint-always .wp-block-navigation__responsive-container.hidden-by-default.buentheme-overlay-anim-slide-left:not(.is-menu-open),
.wp-block-navigation.has-breakpoint-always .wp-block-navigation-overlay.hidden-by-default.buentheme-overlay-anim-slide-left:not(.is-menu-open) {
    transform: translateX(-100%);
    opacity: 0;
}
.wp-block-navigation.has-breakpoint-always .wp-block-navigation__responsive-container.hidden-by-default.buentheme-overlay-anim-fade:not(.is-menu-open),
.wp-block-navigation.has-breakpoint-always .wp-block-navigation-overlay.hidden-by-default.buentheme-overlay-anim-fade:not(.is-menu-open) {
    opacity: 0;
}
.wp-block-navigation.has-breakpoint-always .wp-block-navigation__responsive-container.hidden-by-default.buentheme-overlay-anim-scale:not(.is-menu-open),
.wp-block-navigation.has-breakpoint-always .wp-block-navigation-overlay.hidden-by-default.buentheme-overlay-anim-scale:not(.is-menu-open) {
    transform: scale(0.92);
    opacity: 0;
}

/*
 * ESTADO ABIERTO — modal a pantalla completa.
 * Importante: no depende de .buentheme-menu-block padre.
 * Liberamos containing-block del header (transform/filter) vía body.buentheme-nav-open.
 */
.wp-block-navigation__responsive-container.is-menu-open,
.wp-block-navigation.has-modal-open .wp-block-navigation__responsive-container,
.wp-block-navigation-overlay.is-menu-open {
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    width: 100vw !important;
    height: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 100000 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important;
    opacity: 1 !important;
    box-sizing: border-box !important;
    overflow: hidden !important; /* el scroll va al panel/dialog */
}

/* Admin bar: no tapar la barra de WP */
.admin-bar .wp-block-navigation__responsive-container.is-menu-open,
.admin-bar .wp-block-navigation.has-modal-open .wp-block-navigation__responsive-container,
.admin-bar .wp-block-navigation-overlay.is-menu-open {
    top: 32px !important;
    height: calc(100vh - 32px) !important;
    height: calc(100dvh - 32px) !important;
}
@media screen and (max-width: 782px) {
    .admin-bar .wp-block-navigation__responsive-container.is-menu-open,
    .admin-bar .wp-block-navigation.has-modal-open .wp-block-navigation__responsive-container,
    .admin-bar .wp-block-navigation-overlay.is-menu-open {
        top: 46px !important;
        height: calc(100vh - 46px) !important;
        height: calc(100dvh - 46px) !important;
    }
}

/*
 * Liberar containing block del header mientras el menú está abierto.
 * Solo el wrapper (y wrappers de layout intermedios), NUNCA * (rompe logo/menú).
 * transform / filter / backdrop-filter en ancestros atrapan position:fixed.
 */
html.buentheme-nav-open .buentheme-header-wrapper,
body.buentheme-nav-open .buentheme-header-wrapper,
body.buentheme-nav-open .buentheme-header-wrapper.has-hide-on-scroll,
body.buentheme-nav-open .buentheme-header-wrapper.is-header-hidden,
body.buentheme-nav-open .buentheme-header-wrapper.has-header-blur,
body.buentheme-nav-open .buentheme-header-wrapper.is-position-sticky,
body.buentheme-nav-open .buentheme-header-wrapper.is-style-transparent-header,
body.buentheme-nav-open .buentheme-header-wrapper.is-header-fixed-active,
body.buentheme-nav-open .buentheme-header-wrapper > .wp-block-group,
body.buentheme-nav-open .buentheme-header-wrapper .buentheme-row-container,
body.buentheme-nav-open .buentheme-header-wrapper .buentheme-row-inner-wrapper {
    transform: none !important;
    will-change: auto !important;
    filter: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    perspective: none !important;
    contain: none !important;
}

/* --- ALTERNANCIA RESPONSIVA DE MENÚS (ESCRITORIO VS MÓVIL ALTERNATIVO) --- */
/* Sprint M4: unificado vía data-mobile-bp en .buentheme-menu-pair (default 782). */
.buentheme-menu-wrapper-mobile {
    display: none !important;
}
.buentheme-menu-wrapper-desktop {
    display: block !important;
}

.buentheme-menu-pair {
    display: contents; /* los wrappers siguen siendo hijos lógicos */
}

/* Por defecto / data-mobile-bp="782" */
@media (max-width: 781px) {
    .buentheme-menu-pair[data-mobile-bp="782"] .buentheme-menu-wrapper-desktop,
    .buentheme-menu-pair:not([data-mobile-bp]) .buentheme-menu-wrapper-desktop {
        display: none !important;
    }
    .buentheme-menu-pair[data-mobile-bp="782"] .buentheme-menu-wrapper-mobile,
    .buentheme-menu-pair:not([data-mobile-bp]) .buentheme-menu-wrapper-mobile {
        display: block !important;
    }
}
@media (max-width: 599px) {
    .buentheme-menu-pair[data-mobile-bp="600"] .buentheme-menu-wrapper-desktop { display: none !important; }
    .buentheme-menu-pair[data-mobile-bp="600"] .buentheme-menu-wrapper-mobile { display: block !important; }
}
@media (max-width: 767px) {
    .buentheme-menu-pair[data-mobile-bp="768"] .buentheme-menu-wrapper-desktop { display: none !important; }
    .buentheme-menu-pair[data-mobile-bp="768"] .buentheme-menu-wrapper-mobile { display: block !important; }
}
@media (max-width: 991px) {
    .buentheme-menu-pair[data-mobile-bp="992"] .buentheme-menu-wrapper-desktop { display: none !important; }
    .buentheme-menu-pair[data-mobile-bp="992"] .buentheme-menu-wrapper-mobile { display: block !important; }
}
@media (max-width: 1023px) {
    .buentheme-menu-pair[data-mobile-bp="1024"] .buentheme-menu-wrapper-desktop { display: none !important; }
    .buentheme-menu-pair[data-mobile-bp="1024"] .buentheme-menu-wrapper-mobile { display: block !important; }
}
@media (max-width: 1199px) {
    .buentheme-menu-pair[data-mobile-bp="1200"] .buentheme-menu-wrapper-desktop { display: none !important; }
    .buentheme-menu-pair[data-mobile-bp="1200"] .buentheme-menu-wrapper-mobile { display: block !important; }
}

/* ==========================================================================
   Sprint M4 — Off-canvas premium (drawer / fullscreen / top)
   ========================================================================== */

/* Body scroll lock */
html.buentheme-nav-open,
body.buentheme-nav-open {
    overflow: hidden !important;
}
body.buentheme-nav-open {
    position: fixed;
    width: 100%;
    left: 0;
    right: 0;
}

/* Chrome del drawer (logo + iconos nativos WC) — en overlay abierto ocupa 100%.
   En escritorio cerrado el media query de arriba usa display:contents + width:auto. */
.buentheme-drawer-chrome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 4px 16px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--wp--preset--color--bg-3, #e2e8f0);
    width: 100%;
    box-sizing: border-box;
}
.wp-block-navigation__responsive-container.is-menu-open .buentheme-drawer-chrome {
    display: flex !important;
    flex-direction: row !important;
    width: 100% !important;
    border-bottom: 1px solid var(--wp--preset--color--bg-3, #e2e8f0) !important;
    padding: 4px 4px 16px !important;
    margin-bottom: 8px !important;
}
.buentheme-drawer-brand {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1 1 auto;
}
.buentheme-drawer-brand__logo .custom-logo-link,
.buentheme-drawer-brand__logo a {
    position: relative !important;
    display: block !important;
    align-items: initial;
    line-height: 0;
    max-width: 100%;
    width: fit-content;
    height: auto;
    min-height: 0;
}
/* Solo default en flujo; duales absolute (ver bloque dual logo arriba) */
.buentheme-drawer-brand__logo .custom-logo-link img:not(.buentheme-logo-transparent):not(.buentheme-logo-scrolled),
.buentheme-drawer-brand__logo img:not(.buentheme-logo-transparent):not(.buentheme-logo-scrolled),
.buentheme-drawer-brand__logo .custom-logo:not(.buentheme-logo-transparent):not(.buentheme-logo-scrolled) {
    display: block !important;
    /* Default suave; si hay --buentheme-header-logo-width gana la regla .has-logo-width */
    max-height: var(--buentheme-header-logo-max-height, 80px);
    max-width: min(100%, var(--buentheme-header-logo-width, 160px));
    width: var(--buentheme-header-logo-width, auto);
    height: auto !important;
    object-fit: contain !important;
    /* No transform:scale — no reduce la caja de layout y “infla” la fila */
    transform: none !important;
    transform-origin: left center;
    margin: 0 !important;
    padding: 0 !important;
}
.buentheme-drawer-brand__title {
    font-weight: 700;
    font-size: 1.05rem;
    color: inherit;
    text-decoration: none;
}

/* Acciones nativas: mini-cart + customer-account
 *
 * El mini-cart se inyecta con render_block() desde el gestor de menús (no como
 * bloque en el template). Los estilos de WooCommerce a veces no llegan a la
 * página (combine/UCSS LiteSpeed o encolado tardío) y el SVG queda sin tamaño
 * ni fill fiable: al hover se ve el recuadro del botón vacío. Forzamos color,
 * fill y dimensiones aquí para que el icono sea siempre visible.
 */
.buentheme-drawer-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    flex: 0 0 auto;
    margin-left: auto;
}
.buentheme-drawer-actions .wp-block-woocommerce-mini-cart,
.buentheme-drawer-actions .wp-block-woocommerce-customer-account,
.buentheme-drawer-actions .wc-block-mini-cart,
.buentheme-drawer-actions .wc-block-customer-account {
    display: inline-flex !important;
    align-items: center;
    margin: 0 !important;
}
.buentheme-drawer-actions .wc-block-mini-cart__button,
.buentheme-bar-actions .wc-block-mini-cart__button,
.wc-block-mini-cart .wc-block-mini-cart__button,
.buentheme-drawer-actions .wc-block-customer-account__account-icon,
.buentheme-drawer-actions .wc-block-customer-account a,
.buentheme-drawer-actions a.buentheme-drawer-action--account-fallback,
.buentheme-drawer-actions a.buentheme-drawer-action--cart-fallback {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    min-width: 40px;
    padding: 0.35rem !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 8px;
    text-decoration: none !important;
    /* Header fg (si hay) → color de menú → color heredado del chrome */
    color: var(--buentheme-header-fg, var(--bt-menu-fg, inherit)) !important;
    font-size: 16px;
    line-height: 1;
    /* Invitados / Delay JS: el icono debe ser siempre clickeable */
    pointer-events: auto !important;
    cursor: pointer !important;
    position: relative !important;
    z-index: 6 !important;
}
.buentheme-drawer-actions .wc-block-mini-cart__button:hover,
.buentheme-bar-actions .wc-block-mini-cart__button:hover,
.wc-block-mini-cart .wc-block-mini-cart__button:hover,
.wp-block-woocommerce-mini-cart .wc-block-mini-cart__button:hover,
.wc-block-mini-cart__button:hover,
.buentheme-drawer-actions .wc-block-customer-account a:hover,
.buentheme-drawer-actions a.buentheme-drawer-action--account-fallback:hover,
.buentheme-drawer-actions a.buentheme-drawer-action--cart-fallback:hover {
    background: var(--wp--preset--color--bg-3, rgba(15, 23, 42, 0.08)) !important;
}

/* Transiciones e interactividad en hover para botón, icono y badge */
.wc-block-mini-cart__button {
    transition: background-color 0.2s ease, transform 0.2s ease !important;
}
.wc-block-mini-cart__badge {
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s ease, filter 0.2s ease !important;
}
.wc-block-mini-cart__button:hover .wc-block-mini-cart__badge,
.wc-block-mini-cart__badge:hover {
    transform: scale(1.15) !important;
    filter: brightness(1.1);
}
.wc-block-mini-cart__button:hover .wc-block-mini-cart__icon {
    transform: scale(1.06);
    transition: transform 0.2s ease;
}
/*
 * Contenedor del icono + badge: ancla de posición.
 * Debe medir solo el icono (24×24) para que top/right del badge
 * queden siempre en la esquina superior derecha, con o sin CSS de WC.
 */
.buentheme-drawer-actions .wc-block-mini-cart__quantity-badge,
.buentheme-bar-actions .wc-block-mini-cart__quantity-badge,
.wc-block-mini-cart .wc-block-mini-cart__quantity-badge {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 24px !important;
    height: 24px !important;
    flex: 0 0 24px !important;
    line-height: 0 !important;
    overflow: visible !important;
}

/*
 * Badge del mini-cart (contador).
 *
 * WC usa left:100% + margin-left:-44% + translateY(-50%) → el punto de anclaje
 * cambia según si el CSS de WC carga (reload) o solo el nuestro (AJAX).
 * Anclamos con top/right fijos al contenedor del icono (esquina sup. derecha).
 *
 * Colores: paleta del tema (accent-1 / text-3).
 * Override: --buentheme-mini-cart-badge-bg / --buentheme-mini-cart-badge-fg.
 */
.buentheme-drawer-actions .wc-block-mini-cart__badge,
.buentheme-bar-actions .wc-block-mini-cart__badge,
.wc-block-mini-cart .wc-block-mini-cart__badge {
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: absolute !important;
    /* Esquina superior derecha del icono (anclaje estable vs left%/translate de WC) */
    top: -5px !important;
    right: -7px !important;
    left: auto !important;
    bottom: auto !important;
    margin: 0 !important;
    transform: none !important;
    z-index: 2 !important;
    min-width: 1.15rem !important;
    width: auto !important;
    height: 1.15rem !important;
    padding: 0 0.28rem !important;
    border-radius: 999px !important;
    font-size: 0.7rem !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    /* Paleta del tema (misma lógica que botones accent) */
    background-color: var(
        --buentheme-mini-cart-badge-bg,
        var(--wp--preset--color--accent-1, hsl(220, 90%, 56%))
    ) !important;
    color: var(
        --buentheme-mini-cart-badge-fg,
        var(--wp--preset--color--text-3, #ffffff)
    ) !important;
}

/* Sin ítems: no círculo vacío (ni texto ni pastilla) */
.buentheme-drawer-actions .wc-block-mini-cart__badge[hidden],
.buentheme-bar-actions .wc-block-mini-cart__badge[hidden],
.wc-block-mini-cart .wc-block-mini-cart__badge[hidden],
.buentheme-drawer-actions .wc-block-mini-cart__badge:empty,
.buentheme-bar-actions .wc-block-mini-cart__badge:empty,
.wc-block-mini-cart .wc-block-mini-cart__badge:empty {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    min-width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

/*
 * Carrito / checkout / pedido recibido: ocultar badge por completo.
 * Excluir explícitamente tienda/catálogo/ficha por si el body arrastra clases raras.
 */
body.woocommerce-cart:not(.woocommerce-shop):not(.post-type-archive-product):not(.single-product) .wc-block-mini-cart__badge,
body.woocommerce-checkout:not(.woocommerce-shop):not(.single-product) .wc-block-mini-cart__badge,
body.woocommerce-order-received .wc-block-mini-cart__badge,
body.woocommerce-cart:not(.woocommerce-shop):not(.post-type-archive-product):not(.single-product) .buentheme-drawer-actions .wc-block-mini-cart__badge,
body.woocommerce-checkout:not(.woocommerce-shop):not(.single-product) .buentheme-drawer-actions .wc-block-mini-cart__badge,
body.woocommerce-order-received .buentheme-drawer-actions .wc-block-mini-cart__badge,
body.woocommerce-cart:not(.woocommerce-shop):not(.post-type-archive-product):not(.single-product) .buentheme-bar-actions .wc-block-mini-cart__badge,
body.woocommerce-checkout:not(.woocommerce-shop):not(.single-product) .buentheme-bar-actions .wc-block-mini-cart__badge,
body.woocommerce-order-received .buentheme-bar-actions .wc-block-mini-cart__badge {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    min-width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

/* Tienda / catálogo / ficha: el badge debe poder mostrarse (anula ocultados residuales) */
body.woocommerce-shop .wc-block-mini-cart__badge:not([hidden]):not(:empty),
body.post-type-archive-product .wc-block-mini-cart__badge:not([hidden]):not(:empty),
body.tax-product_cat .wc-block-mini-cart__badge:not([hidden]):not(:empty),
body.tax-product_tag .wc-block-mini-cart__badge:not([hidden]):not(:empty),
body.single-product .wc-block-mini-cart__badge:not([hidden]):not(:empty),
body.buentheme-wc-catalog .wc-block-mini-cart__badge:not([hidden]):not(:empty) {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    min-width: 1.15rem !important;
    height: 1.15rem !important;
    padding: 0 0.28rem !important;
    overflow: visible !important;
}

/*
 * Variables del drawer mini-cart (WC).
 * NO tocar left/transform del panel: WC anima con left:100% + translateX.
 * Forzar transform:translateX(0) o right:0 rompía la animación (overshoot).
 */
.wc-block-components-drawer__screen-overlay,
[data-wp-key="wc-mini-cart-overlay"],
.wc-block-mini-cart__drawer {
    --drawer-width: 480px;
    --neg-drawer-width: -480px;
}

/* Icono del carrito: tamaño + fill aunque falte mini-cart.css de WC */
.buentheme-drawer-actions .wc-block-mini-cart__icon,
.buentheme-bar-actions .wc-block-mini-cart__icon {
    display: block !important;
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    margin: 0 !important;
    flex: 0 0 auto;
    color: inherit !important;
    fill: currentColor !important;
    overflow: visible !important;
    visibility: visible !important;
    opacity: 1 !important;
}
.buentheme-drawer-actions .wc-block-mini-cart__icon *,
.buentheme-bar-actions .wc-block-mini-cart__icon * {
    fill: currentColor !important;
    stroke: none;
}
/* Icono de cuenta (SVG nativo WC) */
.buentheme-drawer-actions .wc-block-customer-account svg,
.buentheme-drawer-actions .wc-block-customer-account__account-icon svg,
.buentheme-bar-actions .wc-block-customer-account svg,
.buentheme-bar-actions .wc-block-customer-account__account-icon svg {
    display: block !important;
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    color: inherit !important;
    fill: currentColor !important;
    visibility: visible !important;
    opacity: 1 !important;
}
.buentheme-drawer-actions .wc-block-customer-account svg *,
.buentheme-drawer-actions .wc-block-customer-account__account-icon svg *,
.buentheme-bar-actions .wc-block-customer-account svg *,
.buentheme-bar-actions .wc-block-customer-account__account-icon svg * {
    fill: currentColor !important;
}
/* Header con color de primer plano: mismos iconos que la hamburguesa */
.buentheme-header-wrapper.has-header-fg-default .buentheme-drawer-actions .wc-block-mini-cart__button,
.buentheme-header-wrapper.has-header-fg-scrolled .buentheme-drawer-actions .wc-block-mini-cart__button,
.buentheme-header-wrapper.has-header-fg-default .buentheme-drawer-actions .wc-block-customer-account a,
.buentheme-header-wrapper.has-header-fg-scrolled .buentheme-drawer-actions .wc-block-customer-account a,
.buentheme-header-wrapper.has-header-fg-default .buentheme-drawer-actions a.buentheme-drawer-action--account-fallback,
.buentheme-header-wrapper.has-header-fg-scrolled .buentheme-drawer-actions a.buentheme-drawer-action--account-fallback,
.buentheme-header-wrapper.has-header-fg-default .buentheme-drawer-actions a.buentheme-drawer-action--cart-fallback,
.buentheme-header-wrapper.has-header-fg-scrolled .buentheme-drawer-actions a.buentheme-drawer-action--cart-fallback {
    color: var(--buentheme-header-fg, inherit) !important;
}
.buentheme-header-wrapper.has-header-fg-default .buentheme-drawer-actions .wc-block-mini-cart__icon,
.buentheme-header-wrapper.has-header-fg-scrolled .buentheme-drawer-actions .wc-block-mini-cart__icon,
.buentheme-header-wrapper.has-header-fg-default .buentheme-drawer-actions .wc-block-customer-account svg,
.buentheme-header-wrapper.has-header-fg-scrolled .buentheme-drawer-actions .wc-block-customer-account svg {
    color: var(--buentheme-header-fg, inherit) !important;
    fill: var(--buentheme-header-fg, currentColor) !important;
}
.buentheme-drawer-actions .dashicons {
    width: 24px;
    height: 24px;
    font-size: 24px;
    line-height: 1;
}

/* Evitar que el flex horizontal del menú afecte a los iconos del chrome */
.buentheme-drawer-chrome,
.buentheme-drawer-actions {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
}

/* Drawer: panel lateral con ancho variable */
.wp-block-navigation__responsive-container.buentheme-overlay-mode-drawer.is-menu-open,
.wp-block-navigation-overlay.buentheme-overlay-mode-drawer.is-menu-open {
    background: rgba(15, 23, 42, 0.45) !important;
    backdrop-filter: blur(2px) !important;
    -webkit-backdrop-filter: blur(2px) !important;
    align-items: stretch !important;
    justify-content: flex-end !important; /* panel a la derecha por defecto */
}
.wp-block-navigation__responsive-container.buentheme-overlay-mode-drawer.is-menu-open .wp-block-navigation__responsive-close,
.wp-block-navigation__responsive-container.buentheme-overlay-mode-drawer.is-menu-open .wp-block-navigation__responsive-dialog {
    width: min(var(--buentheme-overlay-width, 85%), 420px) !important;
    max-width: 100% !important;
    height: 100% !important;
    margin-left: auto !important;
    margin-right: 0 !important;
    background-color: var(--buentheme-overlay-bg-color, var(--wp--preset--color--bg-2, #fff)) !important;
    box-shadow: -12px 0 40px rgba(15, 23, 42, 0.18);
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
}
.wp-block-navigation__responsive-container.buentheme-overlay-mode-drawer.is-menu-open .wp-block-navigation__responsive-container-content {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 1.25rem 1.25rem 2rem !important;
    overflow: auto !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
    background-color: transparent !important;
    box-shadow: none !important;
}
/* Si no hay .responsive-close wrapper (estructura WP variable), el content es el panel */
.wp-block-navigation__responsive-container.buentheme-overlay-mode-drawer.is-menu-open > .wp-block-navigation__responsive-container-content {
    width: min(var(--buentheme-overlay-width, 85%), 420px) !important;
    margin-left: auto !important;
    background-color: var(--buentheme-overlay-bg-color, var(--wp--preset--color--bg-2, #fff)) !important;
    box-shadow: -12px 0 40px rgba(15, 23, 42, 0.18);
}
/* Drawer desde la izquierda cuando anim es slide-left */
.wp-block-navigation__responsive-container.buentheme-overlay-mode-drawer.buentheme-overlay-anim-slide-left.is-menu-open {
    justify-content: flex-start !important;
}
.wp-block-navigation__responsive-container.buentheme-overlay-mode-drawer.buentheme-overlay-anim-slide-left.is-menu-open .wp-block-navigation__responsive-close,
.wp-block-navigation__responsive-container.buentheme-overlay-mode-drawer.buentheme-overlay-anim-slide-left.is-menu-open .wp-block-navigation__responsive-dialog,
.wp-block-navigation__responsive-container.buentheme-overlay-mode-drawer.buentheme-overlay-anim-slide-left.is-menu-open > .wp-block-navigation__responsive-container-content {
    margin-left: 0 !important;
    margin-right: auto !important;
    box-shadow: 12px 0 40px rgba(15, 23, 42, 0.18);
}

/* Fullscreen */
.wp-block-navigation__responsive-container.buentheme-overlay-mode-fullscreen.is-menu-open,
.wp-block-navigation-overlay.buentheme-overlay-mode-fullscreen.is-menu-open {
    background-color: var(--buentheme-overlay-bg-color, var(--wp--preset--color--bg-2, #fff)) !important;
}
.wp-block-navigation__responsive-container.buentheme-overlay-mode-fullscreen.is-menu-open .wp-block-navigation__responsive-dialog,
.wp-block-navigation__responsive-container.buentheme-overlay-mode-fullscreen.is-menu-open .wp-block-navigation__responsive-container-content {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    padding: 1.5rem !important;
    overflow: auto !important;
}

/* Panel top */
.wp-block-navigation__responsive-container.buentheme-overlay-mode-top.is-menu-open {
    align-items: flex-start !important;
    background: rgba(15, 23, 42, 0.4) !important;
}
.wp-block-navigation__responsive-container.buentheme-overlay-mode-top.is-menu-open .wp-block-navigation__responsive-dialog,
.wp-block-navigation__responsive-container.buentheme-overlay-mode-top.is-menu-open .wp-block-navigation__responsive-container-content {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: min(85vh, 720px) !important;
    margin: 0 !important;
    border-radius: 0 0 16px 16px;
    background-color: var(--buentheme-overlay-bg-color, var(--wp--preset--color--bg-2, #fff)) !important;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
    padding: 1.25rem 1.5rem 1.75rem !important;
    overflow: auto !important;
}
.wp-block-navigation__responsive-container.buentheme-overlay-mode-top.buentheme-overlay-anim-slide-right,
.wp-block-navigation__responsive-container.buentheme-overlay-mode-top.buentheme-overlay-anim-slide-left {
    transform: translateY(-100%);
    opacity: 0;
}
.wp-block-navigation__responsive-container.buentheme-overlay-mode-top.is-menu-open {
    transform: translateY(0) scale(1) !important;
    opacity: 1 !important;
}

/* Accordion: solo con el overlay abierto.
   La clase vive en el contenedor responsive también en escritorio cerrado.
   Si estas reglas aplican ahí, el <ul> del submenú queda en el flujo (position:static)
   y el botón pasa a width:100%. La barra horizontal se parte: el logo tapa el
   primer ítem y los chevrones quedan sueltos. */
.wp-block-navigation__responsive-container.buentheme-overlay-accordion:is(.is-menu-open, .buentheme-nav-portal, :popover-open) .wp-block-navigation-item.has-child > .wp-block-navigation__submenu-container,
.wp-block-navigation__responsive-container.buentheme-overlay-accordion:is(.is-menu-open, .buentheme-nav-portal, :popover-open) .buentheme-mega-menu-item.has-mega-panel > .buentheme-mega-panel {
    display: none !important;
    position: static !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    box-shadow: none !important;
    border: none !important;
    margin: 0 !important;
    padding: 0.35rem 0 0.35rem 0.75rem !important;
    background: transparent !important;
}
.wp-block-navigation__responsive-container.buentheme-overlay-accordion:is(.is-menu-open, .buentheme-nav-portal, :popover-open) .wp-block-navigation-item.has-child.is-acc-open > .wp-block-navigation__submenu-container,
.wp-block-navigation__responsive-container.buentheme-overlay-accordion:is(.is-menu-open, .buentheme-nav-portal, :popover-open) .buentheme-mega-menu-item.has-mega-panel.is-acc-open > .buentheme-mega-panel {
    display: block !important;
}
.wp-block-navigation__responsive-container.buentheme-overlay-accordion:is(.is-menu-open, .buentheme-nav-portal, :popover-open) .wp-block-navigation-item.has-child > a,
.wp-block-navigation__responsive-container.buentheme-overlay-accordion:is(.is-menu-open, .buentheme-nav-portal, :popover-open) .wp-block-navigation-item.has-child > button {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.wp-block-navigation__responsive-container.buentheme-overlay-accordion:is(.is-menu-open, .buentheme-nav-portal, :popover-open) .wp-block-navigation-item.has-child > a::after,
.wp-block-navigation__responsive-container.buentheme-overlay-accordion:is(.is-menu-open, .buentheme-nav-portal, :popover-open) .buentheme-mega-menu-item.has-mega-panel > a::after {
    content: "";
    width: 0.45em;
    height: 0.45em;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    opacity: 0.7;
    flex-shrink: 0;
    margin-left: 0.5rem;
}
.wp-block-navigation__responsive-container.buentheme-overlay-accordion:is(.is-menu-open, .buentheme-nav-portal, :popover-open) .wp-block-navigation-item.has-child.is-acc-open > a::after,
.wp-block-navigation__responsive-container.buentheme-overlay-accordion:is(.is-menu-open, .buentheme-nav-portal, :popover-open) .buentheme-mega-menu-item.has-mega-panel.is-acc-open > a::after {
    transform: rotate(-135deg);
}

/* Hamburguesa → X */
.buentheme-hamburger {
    position: relative;
}
.buentheme-hamburger-bars {
    display: none;
    width: var(--buentheme-hamburger-icon-size, 24px);
    height: var(--buentheme-hamburger-icon-size, 24px);
    position: relative;
}
.buentheme-hamburger-bars span {
    position: absolute;
    left: 15%;
    right: 15%;
    height: var(--buentheme-hamburger-line-thickness, 2px);
    background: currentColor;
    border-radius: 1px;
    transition: transform 0.25s ease, opacity 0.2s ease, top 0.25s ease;
}
.buentheme-hamburger-bars span:nth-child(1) { top: 28%; }
.buentheme-hamburger-bars span:nth-child(2) { top: 48%; }
.buentheme-hamburger-bars span:nth-child(3) { top: 68%; }

/* Si hay barras CSS, ocultar SVG nativo opcionalmente cuando open */
.buentheme-hamburger.is-open .buentheme-hamburger-bars,
.buentheme-hamburger:not(.is-open) .buentheme-hamburger-bars {
    display: inline-block;
}
.buentheme-hamburger.is-open svg {
    opacity: 0;
    position: absolute;
    width: 0 !important;
    height: 0 !important;
}
.buentheme-hamburger:not(.is-open) svg {
    /* mantener SVG cerrado si se prefiere; barras también visibles para transición uniforme */
}
.buentheme-hamburger .buentheme-hamburger-bars {
    display: inline-block;
}
.buentheme-hamburger:not(.is-open) svg {
    display: none;
}
.buentheme-hamburger.is-open .buentheme-hamburger-bars span:nth-child(1) {
    top: 48%;
    transform: rotate(45deg);
}
.buentheme-hamburger.is-open .buentheme-hamburger-bars span:nth-child(2) {
    opacity: 0;
}
.buentheme-hamburger.is-open .buentheme-hamburger-bars span:nth-child(3) {
    top: 48%;
    transform: rotate(-45deg);
}

.buentheme-lazy-mobile-slot:empty {
    min-height: 0;
}

/* ==========================================================================
   Sprint M5 — Badges, iconos, active trail, drawer actions
   ========================================================================== */

.buentheme-nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.35em;
    vertical-align: middle;
    font-size: 1.1em;
    line-height: 1;
}
.buentheme-nav-icon.dashicons {
    width: 1.1em;
    height: 1.1em;
    font-size: 1.1em;
}
.buentheme-nav-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 0.4em;
    padding: 0.1em 0.45em;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1.4;
    vertical-align: middle;
    white-space: nowrap;
}
.buentheme-nav-badge--accent {
    background: color-mix(in srgb, var(--wp--preset--color--accent-1, #3b82f6) 18%, transparent);
    color: var(--wp--preset--color--accent-1, #2563eb);
}
.buentheme-nav-badge--success {
    background: #dcfce7;
    color: #15803d;
}
.buentheme-nav-badge--warning {
    background: #fef3c7;
    color: #b45309;
}
.buentheme-nav-badge--danger {
    background: #fee2e2;
    color: #b91c1c;
}
.buentheme-nav-badge--neutral {
    background: #f1f5f9;
    color: #475569;
}

/* Active trail: ítem actual, no ancestros (un padre no debe verse activo en todas las hijas). */
.buentheme-menu-block .wp-block-navigation-item.current-menu-item > a,
.buentheme-menu-block .wp-block-navigation-item.current-menu-item > .wp-block-navigation-item__content,
.buentheme-menu-block a.current-menu-item,
.buentheme-mega-menu-item.current-menu-item > a {
    color: var(--bt-menu-fg-active, var(--wp--preset--color--accent-1, #3b82f6));
    font-weight: 600;
}

/* Legacy text buttons (por si quedan en caché vieja) — ocultar en favor de bloques nativos */
.buentheme-drawer-action:not(.wp-block-woocommerce-mini-cart):not(.wp-block-woocommerce-customer-account) {
    /* se mantiene por compat; preferir bloques WC */
}

/* ==========================================================================
   PERSONALIZACIÓN DE ICONO HAMBURGUESA (FSE)
   ========================================================================== */

/* Botón de apertura (hamburguesa) */
.wp-block-navigation .wp-block-navigation__responsive-container-open {
    color: var(--buentheme-hamburger-color) !important;
    background-color: var(--buentheme-hamburger-bg) !important;
    padding: var(--buentheme-hamburger-padding) !important;
    border-radius: 4px !important;
    transition: all 0.25s ease-in-out;
}

/* Forzar que el SVG herede el color del texto si se ha especificado y aplicar tamaño */
.wp-block-navigation .wp-block-navigation__responsive-container-open svg {
    fill: currentColor !important;
    width: var(--buentheme-hamburger-icon-size, 24px) !important;
    height: var(--buentheme-hamburger-icon-size, 24px) !important;
    transition: width 0.25s ease, height 0.25s ease;
}

/* Modificar las líneas (rects) del SVG del menú */
.wp-block-navigation .wp-block-navigation__responsive-container-open svg rect {
    width: var(--buentheme-hamburger-line-width, 16px) !important;
    x: calc(12px - (var(--buentheme-hamburger-line-width, 16px) / 2)) !important;
    height: var(--buentheme-hamburger-line-thickness, 1.5px) !important;
    transition: width 0.25s ease, x 0.25s ease, height 0.25s ease;
}
