/*
 * THE SITE'S ONE MENU (the ☰ sheet), drawn by `menuSheet()` in scripts/home-sections.ts and run by menu.js. EVERY page links this
 * file and menu.js (the homepage story included); no page draws a menu of its own (tests/home.e2e.mjs checks every built page).
 * The host (the header holding the button) carries `data-menu-host`. Only tokens.css names are read, so a page that defines
 * other names (the story's own `--accent`) maps these few on `.menu` and the open host, as story-preview.ts does.
 */

.menubtn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.menubtn:focus-visible,
.menu-sheet a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.menubtn {
  position: relative;
}
.menubtn svg {
  position: absolute;
  inset: 10px;
  transition: opacity 0.16s ease;
}
.menubtn .i-x,
.menubtn[aria-expanded="true"] .i-bars {
  opacity: 0;
}
.menubtn[aria-expanded="true"] .i-x {
  opacity: 1;
}
/* open: the header stays, on a white bar over the dim, and the panel hangs flush from its bottom edge (--sh-top / --sh-bottom are measured on open) */
[data-menu-host].open {
  z-index: 60;
}
[data-menu-host].open::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: calc(-1 * var(--sh-top, 24px));
  bottom: -12px;
  left: -16px;
  right: -16px;
  background: var(--white);
}
body.menu-open {
  overflow: hidden;
}
.menu {
  position: fixed;
  inset: 0;
  z-index: 50;
}
.menu[hidden] {
  display: none;
}
.menu-back {
  position: absolute;
  inset: 0;
  background: rgba(18, 18, 18, 0.4);
}
.menu-sheet {
  position: absolute;
  top: var(--sh-bottom, 80px);
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  padding: 0 20px 20px;
  background: var(--white);
  border-top: 1px solid var(--canvas-border);
  box-shadow: 0 16px 32px rgba(18, 18, 18, 0.12);
  animation: menu-drop 0.22s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes menu-drop {
  from {
    transform: translateY(-12px);
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .menu-sheet {
    animation: none;
  }
  .menubtn svg {
    transition: none;
  }
}
.menu-sheet a[data-menu-close] {
  justify-content: center;
  margin-top: 12px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--white);
}
.menu-sheet a[data-menu-close] span {
  display: none;
}
.menu-sheet a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  font: 500 17px var(--font-sans);
  letter-spacing: -0.3px;
  color: var(--ink);
  text-decoration: none;
}
.menu-sheet a span {
  color: var(--ink-muted);
  font-size: 22px;
}
.menu-sheet hr {
  width: 100%;
  margin: 4px 0;
  border: 0;
  border-top: 1px solid var(--canvas-border);
}
