/* ─────────────────────────────────────────
   MOBILE MENU — shared by the law library, blog and dika pages
   (index.html carries its own copy inline). Pairs with nav-menu.js,
   which adds the menu button to the page's .navbar.
   Selectors start with .navbar so they win over each page's own
   .navbar-nav rules without !important.
───────────────────────────────────────── */
.navbar .hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  padding: 0;
  flex-shrink: 0;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.navbar .hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--navy, #1B3A8B);
  border-radius: 2px;
  transition: transform .2s ease-out, opacity .2s ease-out;
}

/* open: the three bars fold into a close mark */
.navbar .hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.navbar .hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.navbar .hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.navbar .hamburger:focus-visible,
.navbar .nav-link:focus-visible,
.navbar .nav-cta:focus-visible {
  outline: 2px solid var(--navy, #1B3A8B);
  outline-offset: 2px;
}

.navbar .nav-cta { white-space: nowrap; }

.navbar .nav-cta-mobile { display: none; }

/* in-page jumps land below the sticky navbar, not under it */
section[id] { scroll-margin-top: 72px; }

/* just above the switch the full row is tight: trim the link padding */
@media (min-width: 1024px) and (max-width: 1199px) {
  .navbar .nav-link { padding-left: 10px; padding-right: 10px; }
}

/* the links stop fitting beside the brand below 1024px: switch to the menu button */
@media (max-width: 1023px) {
  .navbar .navbar-nav { display: none; }
  .navbar .hamburger { display: flex; }

  .navbar .nav-cta-mobile {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 16px;
    margin: 0 8px 0 auto;
    background: var(--red, #B71C1C);
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    border-radius: 8px;
    white-space: nowrap;
    text-decoration: none;
  }
  .navbar .nav-cta-mobile:focus-visible { outline: 2px solid var(--navy, #1B3A8B); outline-offset: 2px; }

  .navbar.nav-open .navbar-nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    padding: 12px 20px 20px;
    background: var(--white, #ffffff);
    border-bottom: 1px solid var(--gray-border, #e5e7eb);
    box-shadow: 0 12px 24px rgba(0,0,0,.1);
  }

  .navbar.nav-open .nav-link { font-size: 16px; padding: 12px 8px; }
  .navbar.nav-open .nav-cta { order: -1; margin: 0 0 8px; padding: 14px 16px; font-size: 16px; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .navbar .hamburger span { transition: none; }
}
