/*
 * The right-click menu (js/context-menu.js), in the Graphics tokens so it
 * follows the dark and light themes. Same surface, radius and shadow as the
 * site's other menus (the account menu, .qa-menu) and popovers.
 */

.cm {
  position: fixed;
  z-index: 1300;
  min-width: 200px;
  max-width: 320px;
  overflow-y: auto;
  padding: 4px;
  border: var(--hairline) solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  box-shadow: var(--shadow-popover);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--text-md);
  line-height: 1.3;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}

.cm-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  white-space: nowrap;
  cursor: default;
  outline: none;
}

.cm.has-checks .cm-item {
  padding-left: 6px;
}

.cm-item:focus,
.cm-item.is-open {
  background: var(--surface-hover);
}

.cm-item[aria-disabled='true'] {
  color: var(--text-faint);
}

.cm-item[aria-disabled='true']:focus {
  background: transparent;
}

.cm-item.is-danger {
  color: var(--danger);
}

.cm-item.is-danger:focus {
  background: var(--danger-wash);
}

.cm-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cm-check {
  display: inline-flex;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  color: var(--text);
}

.cm-ic {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cm-ic .cm-fill {
  fill: currentColor;
  stroke: none;
}

.cm-more {
  flex: 0 0 auto;
  margin-right: -4px;
  color: var(--text-muted);
}

.cm-item kbd {
  margin-left: 16px;
  color: var(--text-faint);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
}

.cm-sep {
  height: var(--hairline);
  margin: 4px 2px;
  background: var(--border);
}

.cm-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 10px 5px;
  color: var(--text);
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
}

.cm-head span {
  color: var(--text-muted);
  font-weight: var(--weight-regular);
}

.cm.has-checks .cm-head {
  padding-left: 30px;
}

/* A long press on a phone: rows a finger can hit. */
.cm.is-touch .cm-item {
  min-height: 40px;
}

@media (pointer: coarse) {
  .cm-item {
    min-height: 36px;
  }
}

/* The library row the menu is about, while it is open. */
.lib-row.cm-target {
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

.ham-tr.cm-target {
  background: var(--surface-hover);
}

/* Rename and Delete from the menu (app.openModal). */
.cm-modal .cm-form,
.cm-modal .cm-text {
  margin: 0;
}

.cm-field {
  display: grid;
  gap: 6px;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.cm-field .input {
  width: 100%;
}

.cm-text {
  color: var(--text);
  font-size: var(--text-md);
  line-height: var(--leading-ui);
}

.cm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* Long presses on these open the menu, so the phone's own callout and text selection stay out of the way. */
#lib-list .lib-row,
#stage-2d,
#stage-3d {
  -webkit-touch-callout: none;
}
