/* Mobile hamburger panel — keep items stacked and left-aligned.
   Do NOT set .mobile-menu { display:block } (it overrides Tailwind flex).
   Breakpoint is 1240px, not Tailwind's md (768px): the 8–9 link desktop menu
   plus the brand needs ~1200px, so tablets were overflowing / wrapping. */
#menuBtn.mobile-menu { display: none; }
#mobileNav.mobile-menu { display: none; }

@media (max-width: 1240px) {
  .desktop-menu { display: none !important; }
  #menuBtn.mobile-menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    line-height: 1;
    background: none;
    border: 1px solid rgba(0, 0, 0, .1);
    cursor: pointer;
  }
  #mobileNav.mobile-menu.flex {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    width: 100%;
    gap: 0 !important;
    max-height: calc(100dvh - 64px);
    overflow-y: auto;
    overscroll-behavior: contain;
    box-shadow: 0 16px 30px rgba(0, 0, 0, .08);
  }
  #mobileNav .nav-link {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 48px;
    text-align: left;
    padding: 0;
    border-bottom: 1px solid rgba(0, 0, 0, .06);
    background: none;
    cursor: pointer;
  }
  #mobileNav .nav-link:last-child { border-bottom: 0; }
}

@media (max-width: 768px) {
  nav .brand-title {
    font-size: 1.15rem;
    max-width: 9.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  nav .brand-logo { height: 2.25rem; }
}

/* Site-wide small-screen safety net */
@media (max-width: 768px) {
  html, body { overflow-x: hidden; }
  img, video, iframe { max-width: 100%; }
  input, select, textarea { font-size: 16px; } /* prevents iOS zoom-on-focus */
  .scroll-top { right: 16px !important; bottom: max(16px, env(safe-area-inset-bottom)) !important; }
}
