/* ============================================================================
   Mobile navigation
   ============================================================================
   Lives in its own stylesheet because the homepage carries its own inline
   copy of the site styles and does not load site.css. One file linked from
   every page beats a third hand-maintained copy of the same rules.

   Built at runtime by /js/nav.js from the links already in `nav.main`.
   ========================================================================= */

.navtoggle {
  display: none;
  position: relative;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  margin-inline-start: 4px;
  padding: 0;
  background: none;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  cursor: pointer;
  flex: 0 0 auto;
}
.navtoggle:hover { border-color: var(--ink); }
.navtoggle-bars { display: block; width: 18px; }
.navtoggle-bars i {
  display: block; height: 2px; border-radius: 2px;
  background: currentColor;
  transition: transform .2s ease, opacity .16s ease;
}
.navtoggle-bars i + i { margin-top: 4px; }
.navtoggle-sr {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
html.nav-open .navtoggle-bars i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
html.nav-open .navtoggle-bars i:nth-child(2) { opacity: 0; }
html.nav-open .navtoggle-bars i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Sits under the sticky bar (z-index 60), never over it. */
.mobnav {
  position: fixed;
  top: var(--rd-topbar-h, 68px);
  inset-inline: 0;
  z-index: 59;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 18px 40px -22px rgba(22, 19, 29, .45);
  max-height: calc(100vh - var(--rd-topbar-h, 68px));
  max-height: calc(100dvh - var(--rd-topbar-h, 68px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 20px 24px;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity .2s ease, transform .22s ease;
}
.mobnav.is-in { opacity: 1; transform: none; pointer-events: auto; }
.mobnav[hidden] { display: none !important; }

.mobnav-list { display: flex; flex-direction: column; }
.mobnav-list a {
  display: block;
  padding: 15px 2px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--body);
  font-size: 17px;
  font-weight: 600;
}
[data-lang="ar"] .mobnav-list a { font-family: var(--arabic); }
.mobnav-list a:active { color: var(--brand); }

.mobnav-cta { margin-top: 20px; }
.mobnav-cta .btn { display: block; width: 100%; text-align: center; }

html.nav-open, html.nav-open body { overflow: hidden; }

@media (max-width: 940px) {
  .navtoggle { display: inline-flex; }
  /* The demo button crowded the bar next to the logo and the language pills.
     The menu carries it instead, full width, so the CTA is not lost. */
  .tright .btn { display: none; }
}
@media (min-width: 941px) {
  .mobnav { display: none !important; }
}

/* Same reason as the chat launcher: the cookie bar is fixed to the bottom of
   the viewport and would otherwise sit on top of the open menu. */
html.nav-open #rd-consent-bar {
  opacity: 0;
  pointer-events: none;
}
