/* Frame Chicago, mobile navigation.
   Lives in its own file because the homepage loads css/theme.css while
   every other page loads assets/theme.css. One file, so they cannot drift.
   Selectors double the class on purpose: several pages carry an inline
   <style> that re-hides the nav, and inline blocks load after this file. */

/* ─────────────────────────────────────────────────────────────────── */
/* MOBILE NAVIGATION                                                    */
/* Below 600px the nav was display:none with no way to open it, so the  */
/* only reachable page from a phone was Upload. This adds the menu.     */
/* ─────────────────────────────────────────────────────────────────── */

.site-header .nav-toggle {
  display: none;              /* desktop: the inline nav is already there */
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  margin: 0;
  background: none;
  border: 1px solid var(--fc-ink);
  color: var(--fc-ink);
  cursor: pointer;
  justify-self: end;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}
.nav-toggle:focus-visible { outline: 2px solid var(--fc-accent); outline-offset: 2px; }

.nav-toggle-bars { display: block; position: relative; width: 18px; height: 12px; }
.nav-toggle-bars span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: currentColor;
  transition: transform 240ms cubic-bezier(.22,.61,.36,1), opacity 160ms linear;
}
.nav-toggle-bars span:nth-child(1) { top: 0; }
.nav-toggle-bars span:nth-child(2) { top: 5.25px; }
.nav-toggle-bars span:nth-child(3) { top: 10.5px; }

.site-header.nav-open .nav-toggle-bars span:nth-child(1) { transform: translateY(5.25px) rotate(45deg); }
.site-header.nav-open .nav-toggle-bars span:nth-child(2) { opacity: 0; }
.site-header.nav-open .nav-toggle-bars span:nth-child(3) { transform: translateY(-5.25px) rotate(-45deg); }

@media (max-width: 600px) {
  .site-header.site-header .nav-toggle { display: inline-flex; }

  .site-header.site-header {
    position: relative;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
  }

  /* The drawer: overrides the earlier display:none for nav and .nav-links */
  .site-header.site-header > nav {
    display: block;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 60;
    background: var(--fc-paper);
    border-bottom: 1px solid var(--fc-ink);
    max-height: 0;
    overflow: hidden;
    visibility: hidden;
    transition: max-height 300ms cubic-bezier(.22,.61,.36,1), visibility 0s linear 300ms;
  }
  .site-header.site-header.nav-open > nav {
    max-height: min(78vh, 560px);
    overflow-y: auto;
    visibility: visible;
    transition: max-height 320ms cubic-bezier(.22,.61,.36,1), visibility 0s linear 0s;
    box-shadow: 0 18px 40px -24px rgba(26, 22, 18, 0.45);
  }

  .site-header.site-header > nav .nav-links {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    /* Some pages carry their own header CSS that shrink-wraps this list,
       so the drawer's width is pinned here rather than left to inherit. */
    width: 100%;
    max-width: none;
    padding: 4px 0 8px;
    margin: 0;
    font-size: 13px;
    letter-spacing: 0.08em;
  }
  .site-header.site-header > nav .nav-links li { border-top: 1px solid var(--fc-divider); width: 100%; }
  .nav-links li:first-child { border-top: none; }
  .site-header.site-header > nav .nav-links a {
    display: block;
    padding: 15px var(--gutter);
    min-height: 44px;              /* comfortable tap target */
    line-height: 1.2;
  }
  .site-header.site-header > nav .nav-links a:active { background: var(--fc-paper-2); }
}

@media (prefers-reduced-motion: reduce) {
  .nav-toggle-bars span,
  .site-header.site-header > nav { transition: none !important; }
}
