/* Navigation continues the existing header instead of replacing it. */
.menu-footer,
.menu-backdrop { display: none; }

@media screen and (max-width: 800px) {
  html.menu-open,
  body.menu-open { overscroll-behavior: none; overflow-anchor: none; }
  html.menu-open { overflow: hidden; scrollbar-gutter: stable; }
  /* A second scroll container on body would unstick the scrolled header. */
  body.menu-open { overflow: visible; }
  body.menu-open .site-header {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: var(--header);
    border-bottom-color: transparent;
  }
  .menu-toggle { position: relative; z-index: 5; }
  .menu-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: var(--menu-top, 75px) 0 0;
    z-index: 3;
    background: rgb(173 194 206 / 55%);
    touch-action: none;
  }
  .site-header #navigation.open {
    display: flex;
    position: fixed;
    inset: var(--menu-top, 75px) 0 auto;
    z-index: 4;
    width: auto;
    height: auto;
    max-height: calc(100vh - var(--menu-top, 75px) - 12px);
    max-height: calc(100dvh - var(--menu-top, 75px) - 12px);
    margin: 0;
    padding: 16px var(--page-gutter) max(24px, env(safe-area-inset-bottom));
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    overflow: auto;
    overscroll-behavior: contain;
    border: 0;
    border-radius: 0 0 var(--radius-panel) var(--radius-panel);
    background: var(--header);
    color: var(--ink);
    box-shadow: none;
    scroll-padding: 16px;
  }
  #navigation.open > * { flex-shrink: 0; }
  .site-header #navigation.open > a:not(.button) {
    display: flex;
    align-items: center;
    min-height: 48px;
    margin: 0;
    padding: 8px 0;
    border: 0;
    color: var(--ink);
    font-size: var(--type-heading-size);
    font-weight: 700;
    line-height: var(--type-heading-leading);
    letter-spacing: -.015em;
    text-transform: none;
    overflow-wrap: anywhere;
  }
  .site-header #navigation.open > .button {
    justify-content: space-between;
    min-height: 48px;
    margin: 8px 0 0;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: var(--type-ui-size);
    line-height: var(--type-ui-leading);
  }
  #navigation.open .menu-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    color: var(--muted);
  }
  .menu-footer img { width: 32px; height: 32px; flex: 0 0 32px; }
  .menu-footer p { margin: 0; font-size: var(--type-caption-size); line-height: 1.5; overflow-wrap: anywhere; }
  #navigation.open :focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
  #navigation.open > a:not(.button):hover { color: var(--accent); }
}
@media print {
  .menu-backdrop,
  .menu-footer,
  .site-header #navigation.open { display: none !important; }
  html.menu-open,
  body.menu-open { overflow: visible; }
}
