/* Mobile menu for the header on index, check and train (760px and below).
   The pages hide .nav-links at this width; here they become a full-screen
   panel under the header. js/nav-menu.js only toggles html.nav-open. */

.nav-burger, .nav-links .nav-login { display: none; }

@media (max-width: 760px) {
  header.nav .wrap { gap: 12px; }
  .nav-burger {
    display: inline-flex; flex: none; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
    width: 44px; height: 44px; margin: 0 -10px 0 0; padding: 0; border: 0; border-radius: 8px;
    background: none; color: #fff; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .nav-burger:active { background: rgba(255,255,255,.08); }
  .nav-burger span {
    display: block; width: 22px; height: 2px; border-radius: 2px; background: currentColor;
    transition: transform 220ms cubic-bezier(.4,0,.2,1), opacity 150ms linear;
  }
  .nav-open .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-open .nav-burger span:nth-child(2) { opacity: 0; }
  .nav-open .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* Header goes solid while open so it joins the panel */
  .nav-open .nav, .nav-open .nav.scrolled { background: var(--nav-panel, #000); border-color: rgba(255,255,255,.08); }
  .nav-open body { overflow: hidden; }

  /* Panel: everything below the header (absolute to the sticky header) */
  .nav .nav-links {
    display: flex !important; position: absolute; top: 100%; left: 0; right: 0;
    height: calc(100vh - 68px); height: calc(100dvh - 68px);
    flex-direction: column; gap: 0; margin: 0;
    padding: 8px 16px calc(24px + env(safe-area-inset-bottom));
    background: var(--nav-panel, #000); overflow-y: auto; overscroll-behavior: contain;
    visibility: hidden; opacity: 0; transform: translateY(-8px);
    transition: opacity 200ms cubic-bezier(.4,0,.2,1), transform 200ms cubic-bezier(.4,0,.2,1), visibility 0s linear 200ms;
  }
  .nav-open .nav .nav-links {
    visibility: visible; opacity: 1; transform: none;
    transition: opacity 200ms cubic-bezier(.4,0,.2,1), transform 200ms cubic-bezier(.4,0,.2,1);
  }

  /* Page links: full-width rows with a chevron */
  .nav .nav-links a:not(.nav-login) {
    position: relative; display: flex; align-items: center; min-height: 60px; padding: 0 4px;
    font-size: 21px; font-weight: 600; color: rgba(255,255,255,.8); background: none;
    border-radius: 0 !important; box-shadow: inset 0 -1px 0 rgba(255,255,255,.1);
    -webkit-tap-highlight-color: transparent;
  }
  .nav .nav-links a:not(.nav-login):active { background: rgba(255,255,255,.05); }
  .nav .nav-links a:not(.nav-login)::after {
    content: ""; width: 8px; height: 8px; margin: 0 4px 0 auto; flex: none;
    border: solid rgba(255,255,255,.4); border-width: 2px 2px 0 0; transform: rotate(45deg);
  }
  .nav .nav-links a[aria-current="page"] { color: #fff; background: none; }
  .nav .nav-links a[aria-current="page"]::before {
    content: ""; position: absolute; left: -16px; top: 18px; bottom: 18px; width: 3px; border-radius: 0 3px 3px 0;
    background: var(--brand-600);
  }

  /* Log in: full-width outline button at the bottom */
  .nav .nav-links .nav-login {
    display: flex; align-items: center; justify-content: center; min-height: 50px; margin-top: auto;
    font-size: 16px; font-weight: 600; color: #fff; background: none;
    border-radius: 10px !important; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
  }
}

/* Small phones: shrink the logo and CTA so the burger still fits */
@media (max-width: 374.98px) {
  header.nav .logo-svg { width: 104px; }
  header.nav .nav-cta .btn { padding: 0 12px; }
  header.nav .nav-cta .arr { display: none; }
}

@media (max-width: 760px) and (prefers-reduced-motion: reduce) {
  .nav .nav-links, .nav-open .nav .nav-links, .nav-burger span { transition: none; transform: none; }
}
