/* Mobile menu: full-screen Popover panel, below 760px. */

.menu-btn {
  display: grid;
  place-content: center;
  gap: 0.3rem;
  width: 2.75rem;
  height: 2.75rem;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  transition: border-color 0.3s var(--ease);
}
.menu-btn:hover { border-color: var(--ink); }
.menu-btn span {
  display: block;
  width: 1.1rem;
  height: 1.5px;
  background: currentColor;
  border-radius: 1px;
}

@media (max-width: 759.98px) {
  .header-cta { margin-left: auto; }
}
@media (min-width: 760px) {
  .menu-btn { display: none; }
}

/* panel */
.menu {
  display: none;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: env(safe-area-inset-top) 0 max(1.5rem, env(safe-area-inset-bottom));
  border: 0;
  background: var(--paper);
  color: var(--ink);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.menu:popover-open { display: flex; flex-direction: column; }
.menu::backdrop { background: transparent; }

html:has(.menu:popover-open) { overflow: hidden; }

.menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
}

.menu-close {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 1.6rem;
  line-height: 1;
  transition: border-color 0.3s var(--ease);
}
.menu-close:hover { border-color: var(--ink); }

.menu-links {
  display: flex;
  flex-direction: column;
  padding-top: clamp(1.5rem, 6vh, 3rem);
}
.menu-links a {
  font-size: clamp(2.25rem, 10vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.1;
  padding-block: 0.85rem;
  border-bottom: 1px solid var(--line);
}
.menu-links a:first-child { border-top: 1px solid var(--line); }

.menu-foot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.25rem;
  margin-top: auto;
  padding-top: 2.5rem;
}
.menu-foot .btn { width: 100%; min-height: 3.25rem; font-size: 1rem; }

/* motion: entry in CSS, exit via .is-closing (set by site.js) */
@media (prefers-reduced-motion: no-preference) {
  .menu:popover-open { animation: menu-in 0.4s var(--ease) both; }
  .menu.is-closing { animation: menu-out 0.3s var(--ease) both; }

  .menu:popover-open .menu-links a { animation: rise 0.6s var(--ease) both; }
  .menu:popover-open .menu-links a:nth-child(2) { animation-delay: 0.05s; }
  .menu:popover-open .menu-links a:nth-child(3) { animation-delay: 0.1s; }
}

@keyframes menu-in {
  from { opacity: 0; translate: 0 -0.75rem; }
}
@keyframes menu-out {
  to { opacity: 0; translate: 0 -0.75rem; }
}
