/* Keep the open menu on screen while the browser loads the selected page. */
@media (prefers-reduced-motion: no-preference) and (scripting: enabled) {
  @view-transition { navigation: auto; }

  .menu-disclosure.is-navigating .menu-panel {
    view-transition-name: menu-sheet;
    border-bottom-color: #efff39;
    box-shadow: inset 0 -2px #efff39, 0 12px 24px rgb(0 0 0 / .10);
  }
  .menu-links a.is-destination { color: #efff39; }
  .menu-links a.is-destination span:last-child { transform: translate(4px, -4px); }

  /* The menu is a separate snapshot. Its lower edge uncovers the live page. */
  ::view-transition-old(root) {
    animation: menu-page-out 320ms ease-out both;
    mix-blend-mode: normal;
  }
  ::view-transition-new(root) {
    animation: menu-page-in 560ms cubic-bezier(.2,.76,.22,1) both;
    mix-blend-mode: normal;
  }
  ::view-transition-group(menu-sheet) { z-index: 1; animation: none; }
  ::view-transition-image-pair(menu-sheet) { overflow: hidden; }
  ::view-transition-old(menu-sheet) {
    height: 100%;
    animation: menu-sheet-lift 580ms cubic-bezier(.65,0,.19,1) both;
  }
  @keyframes menu-page-out { to { opacity: 0; } }
  @keyframes menu-page-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
  }
}

@media (prefers-reduced-motion: no-preference) {
  /* On browsers without document snapshots, match the outgoing panel's footprint. */
  html.menu-arriving::after {
    content: "";
    position: fixed;
    pointer-events: none;
    z-index: 110;
    inset: var(--menu-top) 0 auto;
    height: var(--menu-height);
    background: linear-gradient(to top, #efff39 2px, #111 2px);
    animation: menu-curtain-lift 420ms cubic-bezier(.55,0,.22,1) forwards;
  }
  @keyframes menu-sheet-lift {
    from { transform: translateY(0); }
    to { transform: translateY(-100%); }
  }
  @keyframes menu-curtain-lift {
    from { clip-path: inset(0); }
    to { clip-path: inset(0 0 100%); }
  }
}
