/* The command palette and the keyboard shortcuts: cards on the desk's cream, like the find bar,
   with a plain dimmed backdrop (no blur, so nothing has to be repainted behind them). */
.palette, .shortcuts {
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: var(--chrome);
  box-shadow: 0 16px 48px rgb(0 0 0 / 0.5);
  color: var(--desk);
  font: 0.95rem/1.35 var(--font-ui);
  color-scheme: light;
}

.palette::backdrop, .shortcuts::backdrop { background: rgb(0 0 0 / 0.45); }

.palette {
  width: min(36rem, calc(100vw - 32px));
  max-height: min(32rem, 70dvh);
  margin: 12vh auto auto;
}

.palette[open] { display: flex; flex-direction: column; }

.palette__query {
  flex: none;
  width: 100%;
  padding: 0.85rem 1rem;
  border: 0;
  border-bottom: 1px solid var(--chrome-muted);
  background: transparent;
  color: var(--desk);
  font: inherit;
  font-size: max(16px, 1rem); /* iOS zooms into anything smaller */
  outline: none;
}

.palette__query::placeholder { color: var(--pencil); }

.palette__options { overflow-y: auto; padding: 0.35rem; overscroll-behavior: contain; }
.palette__places { display: contents; }

.palette__option {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.palette__option[hidden] { display: none; }
.palette__option[aria-selected="true"] { background: rgb(232 176 74 / 0.32); }

.palette__option kbd, .shortcuts kbd, .toolbar__keys kbd {
  font: inherit;
  font-size: 0.85em;
  white-space: nowrap;
}

.palette__option kbd { margin-left: auto; color: #6f6452; }
.palette__option[aria-selected="true"] kbd { color: var(--desk); }

.palette__number { flex: none; min-width: 2.5rem; color: var(--pencil); font-weight: 700; }
.palette__option--place { text-transform: uppercase; }
.palette__option--place .palette__number { text-transform: none; }

.palette__empty { margin: 0; padding: 0.9rem 1rem 1rem; color: var(--pencil); }
.palette__empty[hidden] { display: none; }

/* The shortcuts: two columns where there's room. */
.shortcuts {
  width: min(52rem, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.shortcuts__header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem 0.5rem;
  background: var(--chrome);
}

.shortcuts__heading { margin: 0; font: 800 1.3rem var(--font-ui); }

.shortcuts__close {
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.shortcuts__close:hover { background: var(--chrome-muted); }

.shortcuts__groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr));
  gap: 0 2rem;
  padding: 0 1.25rem 1.25rem;
}

.shortcuts__group { margin: 1rem 0 0.4rem; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--pencil); }

.shortcuts dl { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1rem; margin: 0; }
.shortcuts dt { white-space: nowrap; font-weight: 700; }
.shortcuts dd { margin: 0; }

.shortcuts__note { margin: 0.75rem 0 0; color: var(--pencil); font-size: 0.85rem; }

.toolbar__keys kbd { margin-left: 0.4em; opacity: 0.7; }

/* Phones have no keys to show; an iPad may have a keyboard, so it keeps them. */
@media (hover: none) and (max-width: 40rem) {
  .palette__option kbd, .toolbar__keys kbd { display: none; }
}

@media print {
  .palette, .shortcuts { display: none !important; }
}
