/* ==========================================================================
   Menú móvil — corrección de posicionamiento y tema oscuro
   ========================================================================== */

@media (max-width: 991px) {
  /* El backdrop-filter del header crea un containing block para los hijos
     position: fixed. En móvil lo desactivamos para que .navbar-mobile cubra
     todo el viewport en lugar de quedar recortado contra el header. */
  body.home-refresh #header,
  body.news-refresh #header {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: rgba(9, 11, 16, 0.96);
  }

  body.nav-open {
    overflow: hidden;
  }

  .mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    color: #fff;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s ease, background-color 0.2s ease;
  }

  .mobile-nav-toggle:hover,
  .mobile-nav-toggle:focus-visible {
    color: var(--home-gold, #ffd000);
    background: rgba(255, 208, 0, 0.1);
  }

  .mobile-nav-toggle:focus-visible {
    outline: 2px solid var(--home-gold, #ffd000);
    outline-offset: 2px;
  }

  .navbar-mobile {
    background: rgba(5, 7, 11, 0.86);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    animation: mobileNavOverlayIn 0.22s ease both;
  }

  .navbar-mobile .mobile-nav-toggle {
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    color: var(--home-gold, #ffd000);
    background: rgba(20, 24, 32, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
  }

  .navbar-mobile ul {
    top: 76px;
    right: 16px;
    bottom: auto;
    left: 16px;
    max-height: calc(100vh - 92px);
    max-height: calc(100dvh - 92px);
    padding: 1rem;
    background: rgba(16, 20, 27, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
    overflow-y: auto;
    overscroll-behavior: contain;
    animation: mobileNavPanelIn 0.28s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  .navbar-mobile li + li {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
  }

  .navbar-mobile a,
  .navbar-mobile a:focus {
    padding: 0.9rem 1rem;
    color: #f4f5f6;
    font-family: 'Merriweather Sans', 'Dubai', system-ui, sans-serif;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    transition: color 0.2s ease, background-color 0.2s ease, padding-left 0.2s ease;
  }

  .navbar-mobile a:hover,
  .navbar-mobile a:focus-visible,
  .navbar-mobile .active,
  .navbar-mobile li:hover > a {
    color: var(--home-gold, #ffd000);
    background: rgba(255, 208, 0, 0.08);
    padding-left: 1.15rem;
  }

  .navbar-mobile .active {
    color: var(--home-gold, #ffd000);
  }

  body.nav-open .whatsapp-float {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  @keyframes mobileNavOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  @keyframes mobileNavPanelIn {
    from {
      opacity: 0;
      transform: translateY(-8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .navbar-mobile,
    .navbar-mobile ul {
      animation: none;
    }

    .mobile-nav-toggle,
    .navbar-mobile a {
      transition: none;
    }
  }
}
