#npc-ribbon-peekaboo,
#npc-ribbon-peekaboo-open,
#npc-ribbon-peekaboo-head-click-2,
#npc-ribbon-peekaboo-head-click-3,
#npc-ribbon-peekaboo-ribbon-click {
    position: fixed !important;
    left: -300px;
    bottom: -300px;
    width: var(--npce-gopher-width, 125px);
    height: auto;
    display: block;
    pointer-events: none !important;
    z-index: 998 !important;
    opacity: 0;
    visibility: hidden;
    transform: translate3d(0, var(--npce-gopher-hide-distance, 115px), 0);
    /* Descend at half the former speed (620ms instead of 310ms).
       Hold opacity until the slide finishes so he visibly slinks down. */
    transition:
      transform var(--npce-gopher-retreat-duration, 620ms) cubic-bezier(.22,.8,.28,1),
      opacity 0ms linear var(--npce-gopher-retreat-duration, 620ms);
    will-change: transform, opacity;
    user-select: none;
    -webkit-user-drag: none;
  }

  /* Visible during automatic, caught, and hover appearances */
#npc-ribbon-peekaboo.npc-peek-visible,
#npc-ribbon-peekaboo-open.npc-peek-visible,
#npc-ribbon-peekaboo-head-click-2.npc-peek-visible,
#npc-ribbon-peekaboo-head-click-3.npc-peek-visible,
#npc-ribbon-peekaboo-ribbon-click.npc-peek-visible {
    visibility: visible;
    opacity: 1;
    transform: translate3d(0, 0, 0);
    /* Keep the existing entrance speed unchanged. */
    transition:
      transform 310ms cubic-bezier(.22,.8,.28,1),
      opacity 120ms ease-out;
  }

  /* On a ribbon phrase click only, sink an additional 40px before navigating.
     This does not affect normal hover/timed exits or the entrance position. */
#npc-ribbon-peekaboo.npc-peek-click-exit:not(.npc-peek-visible),
#npc-ribbon-peekaboo-open.npc-peek-click-exit:not(.npc-peek-visible),
#npc-ribbon-peekaboo-head-click-2.npc-peek-click-exit:not(.npc-peek-visible),
#npc-ribbon-peekaboo-head-click-3.npc-peek-click-exit:not(.npc-peek-visible),
#npc-ribbon-peekaboo-ribbon-click.npc-peek-click-exit:not(.npc-peek-visible) {
    transform: translate3d(0, calc(var(--npce-gopher-hide-distance, 115px) + 40px), 0);
  }

  /* Desktop only */
  @media (max-width: 1024px), (hover: none) {
    #npc-ribbon-peekaboo,
    #npc-ribbon-peekaboo-open,
#npc-ribbon-peekaboo-head-click-2,
#npc-ribbon-peekaboo-head-click-3,
#npc-ribbon-peekaboo-ribbon-click {
      display: none !important;
    }
  }

  /* Reduced motion */
  @media (prefers-reduced-motion: reduce) {
    #npc-ribbon-peekaboo,
    #npc-ribbon-peekaboo-open,
#npc-ribbon-peekaboo-head-click-2,
#npc-ribbon-peekaboo-head-click-3,
#npc-ribbon-peekaboo-ribbon-click {
      transition: none !important;
      display: none !important;
    }
  }

/* Keyboard users can focus the visible toggle button without changing
   the existing pointer-events:none ribbon tracking behavior. */
#npc-ribbon-peekaboo:focus-visible,
#npc-ribbon-peekaboo-open:focus-visible,
#npc-ribbon-peekaboo-head-click-2:focus-visible,
#npc-ribbon-peekaboo-head-click-3:focus-visible,
#npc-ribbon-peekaboo-ribbon-click:focus-visible {
    outline: 2px solid #437FC1;
    outline-offset: 3px;
}

/* Peekaboo toggle affordance: images intentionally pass through pointer
   events, so show the pointer only while the mouse is inside the visible
   gopher bounds, as calculated by peekaboo.js. */
html.npc-peek-link-hover,
html.npc-peek-link-hover * {
    cursor: pointer !important;
}
