/* ==========================================================================
   MakarenaLabs - Global Mobile Navigation System
   ========================================================================== */

/* Desktop defaults: drawer and backdrop are not rendered */
.mobile-nav-backdrop,
.mobile-nav-drawer {
  display: none;
}

/* Services navigation item in desktop header */
.navlinks .services-trigger,
.nav .navlinks .services-trigger {
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  font-family: inherit !important;
  font-size: inherit !important;
  font-weight: 600 !important;
  color: inherit !important;
  cursor: pointer !important;
  line-height: inherit !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  transition: color 0.2s ease !important;
}

.navlinks .services-trigger:hover,
.nav .navlinks .services-trigger:hover {
  color: #168cfb !important;
}

@media (max-width: 850px) {
  /* Prevent background scrolling when mobile menu is open */
  body.mobile-nav-open {
    overflow: hidden !important;
  }

  /* Universal header and nav normalization across all pages */
  .nav,
  .about-header .nav,
  .news-header .nav,
  .products-header .nav,
  .contact-header .nav,
  .home-header .nav,
  .hero .nav,
  .article-site-header .nav {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 16px !important;
    position: relative !important;
    z-index: 100 !important;
  }

  /* Brand Logo on mobile */
  .nav .brand,
  .nav .brand-logo {
    display: inline-flex !important;
    align-items: center !important;
  }
  .nav .brand-logo {
    width: auto !important;
    max-width: 140px !important;
    height: 38px !important;
    object-fit: contain !important;
  }

  /* Hide individual desktop nav text links in the top bar to avoid overflow */
  .nav .navlinks {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin-left: auto !important;
    margin-right: 8px !important;
  }

  .nav .navlinks > a,
  .nav .navlinks .services-trigger {
    display: none !important;
  }

  /* Keep MKLABS button accessible in the header bar */
  .nav .navlinks .out,
  .nav .navlinks .mklabs-trigger {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.04em !important;
    padding: 8px 12px !important;
    border-radius: 9999px !important;
    border: 1px solid rgba(75, 161, 255, 0.45) !important;
    background: rgba(10, 27, 55, 0.75) !important;
    color: #4ba1ff !important;
    cursor: pointer !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    white-space: nowrap !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
  }

  .nav .navlinks .out:hover,
  .nav .navlinks .mklabs-trigger:hover {
    background: #0d3268 !important;
    color: #fff !important;
    border-color: #6baeff !important;
  }

  /* Hamburger toggle button */
  .nav .mobile,
  .nav > .mobile,
  .mobile-menu-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 42px !important;
    height: 42px !important;
    padding: 0 !important;
    border-radius: 12px !important;
    background: rgba(14, 38, 76, 0.7) !important;
    border: 1px solid rgba(145, 184, 245, 0.35) !important;
    color: #fff !important;
    font-size: 20px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  .nav .mobile:hover,
  .nav .mobile:focus-visible,
  .mobile-menu-toggle:hover,
  .mobile-menu-toggle:focus-visible {
    background: rgba(22, 60, 120, 0.85) !important;
    border-color: #4ba1ff !important;
    color: #7ac0ff !important;
    transform: scale(1.04) !important;
    outline: none !important;
  }

  .nav .mobile[aria-expanded="true"],
  .mobile-menu-toggle[aria-expanded="true"] {
    background: rgba(30, 80, 160, 0.9) !important;
    border-color: #6baeff !important;
    color: #fff !important;
    box-shadow: 0 0 20px rgba(75, 161, 255, 0.45) !important;
  }

  /* Backdrop Overlay */
  .mobile-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 18, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s ease, visibility 0.28s ease;
  }

  .mobile-nav-backdrop.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  /* Mobile Drawer Panel */
  .mobile-nav-drawer {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 84px;
    left: 14px;
    right: 14px;
    max-height: calc(100vh - 105px);
    overflow-y: auto;
    background: linear-gradient(135deg, rgba(8, 22, 48, 0.97) 0%, rgba(3, 10, 24, 0.98) 100%);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid rgba(145, 184, 245, 0.3);
    border-radius: 24px;
    padding: 20px 18px 22px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-16px) scale(0.97);
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .mobile-nav-drawer.is-active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
  }

  /* Drawer Header */
  .mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 14px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(145, 184, 245, 0.14);
  }

  .mobile-nav-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #7ba3d6;
  }

  .mobile-nav-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #adc5e7;
    font-size: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s;
  }

  .mobile-nav-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
  }

  /* Nav Links List */
  .mobile-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .mobile-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #e3efff;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-nav-link:hover,
  .mobile-nav-link:focus-visible {
    background: rgba(75, 161, 255, 0.14);
    border-color: rgba(75, 161, 255, 0.4);
    color: #fff;
    transform: translateX(4px);
    outline: none;
  }

  .mobile-nav-link[aria-current="page"] {
    background: linear-gradient(135deg, rgba(22, 136, 255, 0.3), rgba(75, 161, 255, 0.15));
    border-color: #3b82f6;
    color: #fff;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.25);
  }

  .mobile-nav-link .link-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 9999px;
    background: #1688ff;
    color: #fff;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .mobile-nav-link .link-arrow {
    color: #6baeff;
    font-size: 14px;
    transition: transform 0.2s;
  }

  .mobile-nav-link:hover .link-arrow {
    transform: translateX(3px);
  }

  /* Drawer Footer */
  .mobile-nav-footer {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(145, 184, 245, 0.14);
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .mobile-nav-mklabs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, #10346a, #091d3c);
    border: 1px solid rgba(107, 174, 255, 0.4);
    color: #9cd0ff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
  }

  .mobile-nav-mklabs:hover {
    background: linear-gradient(135deg, #164388, #0c2854);
    color: #fff;
    border-color: #6baeff;
  }

  .mobile-nav-contact-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    color: #8daed6;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s;
  }

  .mobile-nav-contact-cta:hover {
    color: #fff;
  }

  .mobile-nav-contact-cta span {
    color: #39ef86;
    font-weight: 700;
  }
}
