/* Phone and tablet menu (1024px and below): a sheet under the header with one row per page,
   sections that open on tap, and an account card (Dashboard when signed in, Staff login otherwise).
   Kept in its own file so rewrites of theme.css cannot wipe it. Behaviour: assets/menu.js */

.dd-toggle, .nav-acct { display: none; }

@media (max-width: 1024px) {
  /* page behind the open menu: dimmed and not scrollable */
  body.nav-open { overflow: hidden; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; z-index: 40; background: rgba(12, 10, 9, .5); animation: navFade .2s ease-out; }
  .site-header { z-index: 60; }

  /* the menu button */
  .site-header .nav-toggle { width: 46px; height: 46px; border-radius: 14px; border: 1px solid var(--s200, #e7e5e4); background: #fff; color: var(--b800, #14532d); transition: background .2s, border-color .2s, color .2s; }
  .nav-open .site-header .nav-toggle { background: var(--b800, #14532d); border-color: var(--b800, #14532d); color: #fff; }

  /* the sheet */
  .site-header .site-nav { left: 0; right: 0; top: 100%; margin: 0; padding: 6px 16px 18px; border: 0; border-top: 1px solid var(--s200, #e7e5e4); border-radius: 0 0 22px 22px; background: #fff;
    max-height: calc(100vh - 76px); max-height: calc(100dvh - 76px); overflow-y: auto; overscroll-behavior: contain; box-shadow: 0 28px 44px -24px rgba(12, 10, 9, .45); }
  .nav-open .site-header .site-nav { animation: navDrop .22s cubic-bezier(.2, .8, .2, 1); }

  /* one row per page */
  .site-header .site-nav > ul { gap: 0; margin: 0; padding: 0; }
  .site-header .site-nav > ul > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; border-bottom: 1px solid var(--s100, #f1f0ee); }
  .site-header .site-nav > ul > li > a { display: flex; align-items: center; min-height: 52px; padding: 0 6px; border-radius: 0; background: none; font-size: 1.02rem; font-weight: 600; color: var(--s900, #1c1917); }
  .site-header .site-nav > ul > li > a::after { display: none; }
  .site-header .site-nav > ul > li > a .dd-caret { display: none; }
  .site-header .site-nav > ul > li > a[aria-current="page"] { color: var(--b700, #15803d); background: none; box-shadow: none; }
  .site-header .site-nav > ul > li > a[aria-current="page"]::before { content: ""; width: 7px; height: 7px; margin-right: 10px; border-radius: 50%; background: var(--o500, #f59e0b); flex: none; }

  /* the open/close button of a section */
  .dd-toggle { display: grid; place-items: center; width: 44px; height: 44px; margin: 4px 0; padding: 0; border: 0; border-radius: 12px; background: var(--s100, #f5f5f4); color: var(--s700, #44403c); cursor: pointer; transition: background .2s, color .2s; }
  .dd-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s; }
  .is-open > .dd-toggle { background: var(--b50, #ecfdf5); color: var(--b700, #15803d); }
  .is-open > .dd-toggle svg { transform: rotate(180deg); }
  .dd-toggle:focus-visible { outline: 3px solid var(--o500, #f59e0b); outline-offset: 2px; }

  /* the links inside a section: closed until tapped */
  .site-header .site-nav .nav-dd { grid-column: 1 / -1; display: none; position: static; width: auto; max-width: none; min-width: 0; margin: 0 0 10px; opacity: 1; visibility: visible; transform: none; pointer-events: auto; }
  .site-header .site-nav li.is-open > .nav-dd { display: block; animation: navFade .2s ease-out; }
  .site-header .site-nav .nav-dd-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
  .site-header .site-nav .nav-dd-inner::before { display: none; }
  .site-header .site-nav .nav-dd-item { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 10px 6px 6px; border-radius: 12px; background: var(--s50, #fafaf9); opacity: 1; transform: none; animation: none; }
  .site-header .site-nav .nav-dd-ico { width: 32px; height: 32px; border-radius: 9px; flex: none; }
  .site-header .site-nav .nav-dd-text strong { font-size: .9rem; font-weight: 600; line-height: 1.25; color: var(--s900, #1c1917); }
  .site-header .site-nav .nav-dd-text small { display: none; }

  /* account card, join button and contact line */
  .site-header .nav-extra { gap: 10px; margin-top: 14px; padding-top: 0; border-top: 0; }
  .nav-acct { display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px; border-radius: 16px; border: 1px solid var(--s200, #e7e5e4); background: var(--s50, #fafaf9); color: var(--s900, #1c1917); text-decoration: none; }
  .nav-acct.is-in { border-color: transparent; background: linear-gradient(135deg, #166534, #14532d); color: #fff; }
  .nav-acct-av { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: #fff; color: var(--b700, #15803d); font-weight: 800; font-size: 1rem; flex: none; border: 1px solid var(--s200, #e7e5e4); }
  .nav-acct.is-in .nav-acct-av { border-color: transparent; background: var(--o500, #f59e0b); color: #1c1917; }
  .nav-acct-t { flex: 1; min-width: 0; display: grid; }
  .nav-acct-t strong { font-size: .98rem; line-height: 1.25; }
  .nav-acct-t small { font-size: .78rem; line-height: 1.3; color: var(--s500, #78716c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nav-acct.is-in .nav-acct-t small { color: rgba(255, 255, 255, .78); }
  .nav-acct > .ico { flex: none; opacity: .7; }
  .site-header .nav-extra .nav-join { min-height: 48px; border-radius: 14px; }
  .site-header .nav-contact { display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 4px 4px 0; font-size: .86rem; }
}

@media (max-width: 380px) {
  .site-header .site-nav .nav-dd-inner { grid-template-columns: 1fr; }
}

@keyframes navDrop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes navFade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .nav-open .site-header .site-nav, body.nav-open::after, .site-header .site-nav li.is-open > .nav-dd { animation: none; }
}

/* floating buttons step aside while the menu is open */
body.nav-open .omb-chat, body.nav-open .to-top, body.nav-open .member-fab { display: none !important; }
