/* HMS-312 command palette */

.command-palette {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(92vw, 28rem);
  max-height: min(70vh, 26rem);
  padding: 0;
  overflow: hidden;
  background: var(--wa-color-surface-default);
  border: 1px solid var(--wa-color-surface-border);
  border-radius: 0.75rem;
  box-shadow: 0 1rem 2rem rgb(0 0 0 / 0.25);
}

.command-palette::backdrop {
  background: rgb(0 0 0 / 0.45);
}

.command-palette__panel {
  display: flex;
  flex-direction: column;
  /* Web Awesome's native.css makes open dialogs `display: flex` with
     `align-items: start`; without an explicit width the panel shrink-wraps
     to its content and the right third of the dialog is dead space. */
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.command-palette__input {
  width: 100%;
  padding: 1rem;
  border: 0;
  border-bottom: 1px solid var(--wa-color-surface-border);
  background: transparent;
  color: var(--wa-color-text-normal);
  font-size: 1rem;
  outline: none;
}

.command-palette__input::placeholder {
  color: var(--wa-color-text-quiet);
}

.command-palette__input:focus {
  box-shadow: inset 0 0 0 2px var(--wa-color-brand-fill-normal);
}

.command-palette__results {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  padding: 0.5rem 0;
  margin: 0;
}

/* native.css gives every li `margin-inline-start: 1.125em`, which would
   indent options past the input's text alignment. */
.command-palette__option {
  margin-inline-start: 0;
}

.command-palette__option-button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  width: 100%;
  padding: 0.625rem 1rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 0.9375rem;
  color: inherit;
}

.command-palette__option-label {
  font-weight: 600;
}

.command-palette__option--active .command-palette__option-button,
.command-palette__option-button:hover {
  background: var(--wa-color-brand-fill-normal);
  color: var(--wa-color-brand-on-normal);
}

.command-palette__empty {
  text-align: center;
  padding: 1rem;
  color: var(--wa-color-text-quiet);
  font-size: 0.875rem;
  margin: 0;
}

.command-palette__hint {
  border-top: 1px solid var(--wa-color-surface-border);
  padding: 0.5rem 1rem;
  color: var(--wa-color-text-quiet);
  font-size: 0.75rem;
  margin: 0;
}

.command-palette__hint kbd {
  padding: 0.125rem 0.375rem;
  border: 1px solid var(--wa-color-surface-border);
  border-radius: 0.25rem;
  background: var(--wa-color-surface-lowered);
  font-size: 0.6875rem;
  font-family: inherit;
}

@media (min-width: 40rem) {
  .command-palette {
    width: min(92vw, 32rem);
  }
}
