/* ==========================================================
   Mobile Navigation (Simple App-Style)
   Works with assets/js/app.js
   - Open state: #navList.is-open
   - Body state: body.nav-open
   - Scrim element: .navScrim (created by JS)
   ========================================================== */

@media (max-width: 860px){
  /* Keep topbar/toggle always clickable */
  .topbar{ z-index: 1200 !important; }
  .nav__toggle{ position: relative; z-index: 1201; }

  /* Toggle button (large, single-line, clear) */
  .nav__toggle{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 52px;
    min-width: 120px;
    padding: 12px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.94);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  /* Simple hamburger icon */
  .nav__toggle::before{
    content: "";
    width: 20px;
    height: 14px;
    background:
      linear-gradient(currentColor 0 0) 0 0/100% 2px,
      linear-gradient(currentColor 0 0) 0 50%/100% 2px,
      linear-gradient(currentColor 0 0) 0 100%/100% 2px;
    background-repeat: no-repeat;
    opacity: 0.90;
    flex: 0 0 auto;
  }

  /* When open, show X */
  body.nav-open .nav__toggle::before{
    content: "✕";
    width: 20px;
    height: 20px;
    background: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    opacity: 0.95;
  }

  body.nav-open .nav__toggle{
    background: rgba(255,255,255,0.14);
    border-color: rgba(255,255,255,0.20);
  }

  /* Optional scroll-lock while the menu is open */
  body.nav-open{
    overflow: hidden;
    touch-action: none;
  }

  /* Scrim (created by JS) */
  .navScrim{
    position: fixed;
    inset: 0;
    z-index: 1090;
    background: rgba(0,0,0,0.58);
    backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .16s ease;
  }
  body.nav-open .navScrim{
    opacity: 1;
    pointer-events: auto;
  }

  /* Menu panel: simple vertical list under the topbar */
  #navList.nav__list{
    position: fixed !important;
    z-index: 1100 !important;

    left: calc(var(--pad, 16px) + env(safe-area-inset-left)) !important;
    right: calc(var(--pad, 16px) + env(safe-area-inset-right)) !important;
    top: calc(var(--topbar-h, 72px) + 10px) !important;

    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;

    margin: 0 !important;
    padding: 12px !important;
    list-style: none !important;

    border-radius: 18px !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
    background: rgba(15,17,23,0.98) !important;
    box-shadow: 0 18px 50px rgba(0,0,0,0.55) !important;

    max-height: calc(100vh - (var(--topbar-h, 72px) + 24px) - env(safe-area-inset-bottom)) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;

    /* closed state */
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    visibility: hidden;
    transition: opacity 160ms ease, transform 160ms ease, visibility 0s linear 160ms;
  }

  #navList.nav__list.is-open{
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    visibility: visible;
    transition: opacity 160ms ease, transform 160ms ease;
  }

  #navList .nav__link{
    display: flex;
    align-items: center;
    justify-content: space-between;

    width: 100%;
    min-height: 46px;
    padding: 14px 14px;

    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.06);

    color: rgba(255,255,255,0.92);
    text-decoration: none;

    font-size: 17px;
    font-weight: 650;
    line-height: 1.15;
    white-space: nowrap;

    -webkit-tap-highlight-color: transparent;
  }

  #navList .nav__link::after{
    content: "→";
    opacity: 0.75;
    flex: 0 0 auto;
  }

  #navList .nav__link:focus-visible{
    outline: 3px solid rgba(255,255,255,0.14);
    outline-offset: 2px;
  }
}

@media (min-width: 861px){
  .navScrim{ display: none; }
}
