/* The viewport's context menu (panel/menu.js): a popover at the pointer, outside #viewer, so it
   sets its own type and button look. */
.sv-menu {
  position: fixed;
  inset: auto;
  min-width: 210px;
  max-width: min(320px, calc(100vw - 16px));
  margin: 0;
  padding: 4px;
  border: 1px solid var(--sv-border);
  border-radius: 10px;
  color: var(--sv-ink);
  background: var(--sv-surface);
  box-shadow: var(--sv-shadow);
  font: 13px/1.4 var(--sv-font);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  outline: none;
}

.sv-menu:popover-open {
  animation: sv-menu-in 90ms ease-out;
}

@keyframes sv-menu-in {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
}

.sv-menu__title {
  margin: 0;
  padding: 5px 10px 4px;
  overflow: hidden;
  color: var(--sv-faint);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sv-menu__item {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  color: inherit;
  background: none;
  font: inherit;
  text-align: left;
  cursor: default;
}

.sv-menu__label {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sv-menu__item kbd {
  color: var(--sv-faint);
  font: 11px/1 var(--sv-font);
  font-variant-numeric: tabular-nums;
}

.sv-menu__item:hover:not(:disabled),
.sv-menu__item:focus-visible {
  color: #fff;
  background: var(--sv-accent);
  outline: none;
}

.sv-menu__item:hover:not(:disabled) kbd,
.sv-menu__item:focus-visible kbd {
  color: rgb(255 255 255 / 0.8);
}

.sv-menu__item:disabled {
  color: var(--sv-faint);
  opacity: 0.6;
}

.sv-menu__sep {
  height: 1px;
  margin: 4px 6px;
  background: var(--sv-border);
}

/* Opened by a long-press: finger-sized rows. */
.sv-menu.is-touch {
  min-width: 240px;
  font-size: 15px;
}

.sv-menu.is-touch .sv-menu__item {
  min-height: 44px;
  padding: 0 14px;
}

.sv-menu.is-touch .sv-menu__item kbd {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .sv-menu:popover-open {
    animation: none;
  }
}
