/* Hide mobile-only elements by default (desktop) */
.mobile-topbar,
#mobile-overlay,
#mobile-drawer,
#mobile-menu-btn {
  display: none !important;
}

/* Mobile-specific header/menu styles - only apply on small screens */
@media (max-width: 991px) {
  /* Ensure mobile elements are visible inside the mobile media query */
  .mobile-topbar,
  #mobile-overlay,
  #mobile-drawer,
  #mobile-menu-btn { display: block !important; }
  
  :root{
    --mobile-drawer-width: 320px;
    --brand-color: #223248;
    --muted: #9aa5b2;
    --accent: #c33;
  }

  .mobile-overlay{
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity .22s ease, visibility .22s ease;
    z-index: 998;
  }
  .mobile-overlay.open{
    opacity: 1;
    visibility: visible;
  }

  /* Mobile top bar containing visible logo and menu button */
  .mobile-topbar{
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    height: 70px;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 10px 18px;
    background: #ffffff;
    z-index: 1002;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  }
  
  .mobile-topbar__logo{ 
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: center !important;
    order: 1 !important;
  }
  
  .mobile-topbar__logo img{ 
    height: 65px;
    display: block;
    width: auto;
    max-width: 250px;
  }

  /* Menu button styling - properly positioned in topbar */
  .mobile-topbar .menu-btn-toggle.menu-toggle{ 
    position: relative !important;
    right: auto !important;
    top: auto !important;
    flex: 0 0 auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 50px !important;
    height: 50px !important;
    background: #ffffff !important;
    border: 2px solid var(--brand-color) !important;
    border-radius: 8px !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    z-index: 1003 !important;
    cursor: pointer;
    transition: all 0.3s ease;
    order: 2 !important;
  }
  
  .mobile-topbar .menu-btn-toggle.menu-toggle:hover{
    background: var(--brand-color) !important;
  }
  
  .mobile-topbar .menu-btn-toggle.menu-toggle:hover .menu-toggle-icon i{
    color: #ffffff !important;
  }
  
  .mobile-topbar .menu-btn-toggle .menu-toggle-icon{ 
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .mobile-topbar .menu-btn-toggle .menu-toggle-icon i{ 
    font-size: 22px;
    color: var(--brand-color) !important;
    transition: color 0.3s ease;
  }

  /* Prevent JS from hiding the menu button on scroll for mobile topbar */
  .mobile-topbar .menu-toggle.is-hidden,
  .mobile-topbar .menu-toggle.is-hidden.menu-btn-toggle {
    display: inline-flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    pointer-events: auto !important;
  }

  /* Adjust drawer to appear below the topbar */
  .mobile-drawer{ 
    top: 70px;
    height: calc(100vh - 70px);
  }

  /* Prevent content from hiding under topbar */
  body{ 
    padding-top: 70px;
  }

  .mobile-drawer{
    position: fixed;
    left: 0;
    width: var(--mobile-drawer-width);
    max-width: 90vw;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    transform: translateX(-110%);
    transition: transform .28s cubic-bezier(.2,.9,.3,1);
    z-index: 999;
    display: flex;
    flex-direction: column;
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
  }
  
  .mobile-drawer.open{
    transform: translateX(0);
  }

  .mobile-drawer__header{
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 16px;
    border-bottom: 1px solid #f0f0f0;
  }
  
  .mobile-drawer__logo img{ 
    height: 36px;
    display: block;
  }
  
  .mobile-drawer__close{ 
    background: transparent;
    border: 0;
    font-size: 20px;
    color: var(--brand-color);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-drawer__nav{ 
    padding: 8px 0;
    overflow: auto;
    flex: 1;
  }
  
  .mobile-nav{ 
    list-style: none;
    margin: 0;
    padding: 8px;
  }
  
  .mobile-nav__item{ 
    border-bottom: 1px solid #f3f3f3;
  }
  
  .mobile-nav__item a{ 
    display: block;
    padding: 16px;
    color: var(--brand-color);
    text-decoration: none;
    font-weight: 400;
  }

  .mobile-nav__row{ 
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
  }
  
  .mobile-nav__link{ 
    padding: 16px;
    display: inline-block;
    color: var(--brand-color);
    font-weight: 400;
    text-decoration: none;
    font-family: 'Andomania', 'Inter', sans-serif;
    flex: 1;
  }
  
  .mobile-nav__toggle{ 
    background: transparent;
    border: 0;
    padding: 12px;
    font-size: 14px;
    color: var(--muted);
    transform: rotate(0);
    transition: transform .18s ease;
    cursor: pointer;
  }
  
  .mobile-nav__toggle[aria-expanded="true"]{ 
    transform: rotate(90deg);
    color: var(--brand-color);
  }

  .mobile-submenu{ 
    list-style: none;
    padding-left: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height .28s ease;
  }
  
  .mobile-nav__item.open .mobile-submenu{ 
    max-height: 900px;
  }
  
  .mobile-submenu li a{ 
    padding: 12px 28px;
    display: block;
    color: #41515f;
    font-weight: 300;
    border-bottom: 1px solid #f7f7f7;
    font-family: 'Gilmer', 'Inter', sans-serif;
  }

  .mobile-drawer__footer{ 
    margin-top: auto;
    padding: 12px 16px;
    border-top: 1px solid #f3f3f3;
  }
  
  .mobile-social{ 
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 8px;
  }
  
  .mobile-social li a{ 
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: #f6f6f6;
    color: var(--brand-color);
    transition: all 0.3s ease;
  }
  
  .mobile-social li a:hover{
    background: var(--brand-color);
    color: #ffffff;
  }

  .mobile-nav__cta .rts-btn{ 
    display: block;
    margin: 12px 16px;
    text-align: center;
  }

  /* Hide legacy icons that could still appear inside nav links */
  .mobile-drawer .dropdown-icon{ 
    display: none !important;
  }

  /* Lock page scroll when drawer is open */
  .mobile-drawer-open, 
  html.mobile-drawer-open, 
  body.mobile-drawer-open{ 
    height: 100%;
    overflow: hidden;
  }
}

/* Desktop styles remain unchanged */
@media (min-width: 992px) {
  .menu-btn-toggle.menu-toggle{ 
    position: fixed;
    right: 16px;
    top: 14px;
    background: #ffffff;
    border-radius: 10px;
    padding: 8px 10px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    z-index: 1001;
    border: 0;
  }
}