/* ntw-sidebar:start
   The one phone sidebar for every navtheway.com page (Ted, November 28, 2026).
   NTW Chat sets the pattern: on a phone (760px or narrower) the sidebar icon
   sits at the far left of the top bar, and tapping it slides the sidebar in
   from the left over the page. No page uses a separate "Sections" or menu
   button for its sidebar. The values here are NTW Chat's
   (docs/chat.css .chat-sidebar, .chat-sidebar-backdrop, .chat-sidebar-close),
   except that the panel is fully opaque.

   Markup: a <button class="ntw-sidebar-toggle"> holding the sidebar icon as the
   first item of the top bar's .nav-wrap (aria-controls names the panel); the
   panel (<nav> or <aside>) carries class="ntw-sidebar" and data-open; it starts
   with a .ntw-sidebar-head holding a .ntw-sidebar-close button with the same
   icon; a .ntw-sidebar-scrim sits behind it. The page's script sets data-open
   and the scrim's hidden. The Operations Console copies this file into
   worker/src/ntw-sidebar-assets.ts; scripts/test-ntw-sidebar.js keeps the two
   identical and checks every page follows the pattern. */
.ntw-sidebar-toggle,
.ntw-sidebar-close,
.ntw-sidebar-scrim {
  display: none;
}

@media (max-width: 760px) {
  .ntw-sidebar-toggle:not([hidden]),
  .ntw-sidebar-close {
    position: relative;
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--ntw-color-text-muted);
    background: transparent;
    font: inherit;
    cursor: pointer;
  }

  .ntw-sidebar-toggle svg,
  .ntw-sidebar-close svg {
    width: 20px;
    height: 20px;
  }

  .ntw-sidebar-toggle:hover,
  .ntw-sidebar-toggle:focus-visible,
  .ntw-sidebar-close:hover,
  .ntw-sidebar-close:focus-visible {
    color: var(--ntw-color-text);
    background: rgba(122, 168, 255, 0.12);
  }

  /* Far left of the top bar, the icon lined up with the page's left edge,
     and the site name right beside it. */
  .nav-wrap > .ntw-sidebar-toggle:not([hidden]) {
    margin-inline-start: -10px;
  }

  .nav-wrap > .ntw-sidebar-toggle:not([hidden]) + .brand {
    margin-inline-end: auto;
    max-width: calc(100% - 112px);
  }

  /* Something waits in another section: a small gold dot on the icon. */
  .ntw-sidebar-toggle[data-attention="true"]::after {
    content: "";
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ntw-color-gold);
  }

  /* The panel. Every property the site's phone menu sets on <nav> is set
     again here, so a <nav> sidebar keeps this shape. */
  .ntw-sidebar {
    position: fixed;
    z-index: 70;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    align-content: start;
    gap: 0.25rem;
    flex: none;
    width: min(20rem, calc(100vw - 3rem));
    min-width: 0;
    max-width: none;
    height: auto;
    max-height: 100vh;
    max-height: 100dvh;
    margin: 0;
    padding: 0.6rem 0.5rem 0.75rem;
    overflow-y: auto;
    border: 0;
    border-right: 1px solid var(--ntw-color-border);
    border-radius: 0;
    /* Opaque, so the page never shows through the panel (Ted's iPhone,
       November 28). */
    background: var(--ntw-color-surface);
    box-shadow: var(--ntw-shadow-dialog);
    opacity: 1;
    pointer-events: auto;
    visibility: hidden;
    transform: translateX(-105%);
    transform-origin: left center;
    transition: transform 160ms ease, visibility 0s linear 160ms;
  }

  /* One scrolling column: items keep their height instead of squeezing
     or wrapping into a second column on a short screen. */
  .ntw-sidebar > * {
    flex-shrink: 0;
  }

  /* Visible at once when opening, so focus can move into it; hidden only
     after the slide when closing. */
  .ntw-sidebar[data-open="true"] {
    visibility: visible;
    transform: translateX(0);
    transition: transform 160ms ease;
  }

  .ntw-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 44px;
    padding-left: 0.4rem;
  }

  .ntw-sidebar[hidden] {
    display: none;
  }

  .ntw-sidebar-head .ntw-sidebar-title {
    margin: 0;
    color: var(--ntw-color-text);
    font-size: var(--ntw-font-size-body);
    font-weight: var(--ntw-font-weight-bold);
    letter-spacing: normal;
    text-transform: none;
  }

  .ntw-sidebar-scrim:not([hidden]) {
    position: fixed;
    z-index: 60;
    inset: 0;
    display: block;
    background: rgba(4, 8, 21, 0.72);
    cursor: pointer;
  }
}

@media (max-width: 760px) and (prefers-reduced-motion: reduce) {
  .ntw-sidebar,
  .ntw-sidebar[data-open="true"] {
    transition: none;
  }
}
/* ntw-sidebar:end */
