/* ☰ The section menu (navmenu.js): ChoreBoy's ☰ panel, for BuckBoy. The ☰ at the left of the top bar,
   then the logo and the section you're on; the panel is a drawer down the left side on a computer and
   drops down across the screen under the bar on a phone. */

.nav-menu-btn { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; width: 2.3rem; height: 2.3rem; padding: 0; margin-right: -.25rem; border: 0; border-radius: 999px; background: none; color: var(--text-2); cursor: pointer; }
.nav-menu-btn svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.nav-menu-btn:hover { background: var(--surface-2); color: var(--text); }
.nav-menu-btn:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 1px; }
.nav-menu-btn[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent-text); }

/* The section you're on, next to the logo. */
.top-here { display: flex; align-items: center; gap: .4rem; flex: 1 1 auto; min-width: 0; padding-left: .85rem; border-left: 1px solid var(--border); font-weight: 700; font-size: 1rem; color: var(--text); white-space: nowrap; }
.top-here-ico { flex-shrink: 0; }
.top-here-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.top-here[hidden] { display: block; visibility: hidden; border-left-color: transparent; } /* (keeps the chips at the right) */

body.logged-out .nav-menu-btn, body.in-setup .nav-menu-btn, body.logged-out .nav-menu, body.in-setup .nav-menu,
body.logged-out .top-here, body.in-setup .top-here { display: none !important; }
body.logged-out .top-tools, body.in-setup .top-tools { margin-left: auto; }

/* ---------- the panel ---------- */

.nav-menu {
  position: absolute; z-index: 45; top: calc(100% + 6px); left: 1rem;
  min-width: 240px; max-width: calc(100vw - 16px); max-height: calc(100vh - 5rem); overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 2px; padding: .35rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  transform-origin: top left;
  animation: nav-menu-in .18s cubic-bezier(.2, .8, .3, 1);
}
.nav-menu[hidden] { display: none; }
.nav-menu.closing { animation: nav-menu-out .14s ease-in forwards; pointer-events: none; }
.nav-menu-item { display: flex; align-items: center; gap: .7rem; width: 100%; padding: .6rem .75rem; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text); font: inherit; font-weight: 600; font-size: .95rem; text-align: left; cursor: pointer; }
.nav-menu-item:hover, .nav-menu-item:focus-visible { background: var(--surface-2); }
.nav-menu-item:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: -2px; }
.nav-menu-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.nav-menu-item[aria-current="page"]::after { content: '✓'; padding-left: .6rem; font-weight: 700; }
.nav-menu-item:not(:has(.nav-menu-keys))[aria-current="page"]::after { margin-left: auto; }
.nav-menu-ico { width: 1.4rem; flex-shrink: 0; text-align: center; font-size: 1.1rem; line-height: 1; }
.nav-menu-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The g-shortcut, on a computer (a keyboard): a quiet hint at the end. */
.nav-menu-keys { display: inline-flex; gap: .2rem; margin-left: auto; padding-left: .75rem; opacity: .7; }
.nav-menu-keys kbd { font-size: .72rem; padding: 0 .3rem; }
@media (hover: none), (max-width: 600px) { .nav-menu-keys { display: none; } .nav-menu-item[aria-current="page"]::after { margin-left: auto; } }

@keyframes nav-menu-in { from { opacity: 0; transform: translateY(-6px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes nav-menu-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-4px) scale(.98); } }
@keyframes nav-menu-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes nav-menu-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes nav-drawer-in { from { transform: translateX(-100%); } to { transform: none; } }
@keyframes nav-drawer-out { from { transform: none; } to { transform: translateX(-100%); } }

/* ---------- phones: across the screen, under the bar ---------- */

@media (max-width: 600px) {
  .nav-menu {
    top: 100%; left: 0; right: 0; min-width: 0; max-width: none; max-height: calc(100dvh - 4rem);
    border-width: 0 0 1px; border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: .4rem max(.6rem, env(safe-area-inset-right)) .6rem max(.6rem, env(safe-area-inset-left));
    box-shadow: var(--shadow-lg), 0 0 0 100vmax rgb(0 0 0 / .25); /* (the dim: a press on it is outside, so it closes) */
    transform-origin: top center;
  }
  .nav-menu-item { padding: .75rem .8rem; font-size: 1rem; }
  .top-here { padding-left: .5rem; gap: .3rem; font-size: .95rem; }
  .topbar .brand .brand-wordmark { width: 89px; } /* (28 px tall: room for the section's name; brand.css) */
  #account.chip > span[aria-hidden="true"]:last-child { display: none; } /* (the ▾: the picture is the button) */
  #account.chip { padding-left: .3rem; padding-right: .3rem; }
}
/* The narrowest phones: the section's icon alone (its name would be one letter and …; ☰ ticks it). */
@media (max-width: 340px) {
  .top-here-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .top-here { flex: 0 1 auto; }
  .top-tools { margin-left: auto; }
}

/* ---------- wider: a drawer down the left side, over a dimmed page ---------- */

@media (min-width: 601px) {
  /* (The bar's blur would make it the drawer's frame: none while the drawer is open.) */
  body.nav-open .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .nav-menu {
    position: fixed; z-index: 60; top: 0; bottom: 0; left: 0; right: auto;
    width: min(300px, 85vw); min-width: 0; max-width: none; max-height: none; gap: 4px;
    padding: calc(.9rem + env(safe-area-inset-top)) .6rem 1rem max(.6rem, env(safe-area-inset-left));
    border-width: 0 1px 0 0; border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    box-shadow: var(--shadow-lg), 0 0 0 100vmax rgb(0 0 0 / .32);
    transform-origin: left center;
    animation: nav-drawer-in .22s cubic-bezier(.2, .8, .3, 1);
  }
  .nav-menu.closing { animation: nav-drawer-out .16s ease-in forwards; }
  .nav-menu-item { padding: .75rem .85rem; font-size: 1rem; }
}

/* ✨ Animations: Subtle fades, Off (and reduced motion) doesn't move. */
html[data-fx="subtle"] .nav-menu { animation: nav-menu-fade-in .12s ease-out; }
html[data-fx="subtle"] .nav-menu.closing { animation: nav-menu-fade-out .1s ease-in forwards; }
html[data-fx="off"] .nav-menu, html[data-fx="off"] .nav-menu.closing { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .nav-menu, .nav-menu.closing { animation: none; }
}
@media print {
  .nav-menu-btn, .nav-menu { display: none !important; }
}
