/* The command menu: one surface that is first a search pill and then the palette. The colours of the light theme
   are here; the other themes the palette can switch to (Dark, Dusk, Paper) are below, under [data-theme]. */
:root {
  --page: #ffffff;          /* the page */
  --surface: #ffffff;       /* the pill and the palette */
  --text: #17171c;          /* the commands */
  --muted: #7c7c88;         /* group names, hints, the placeholder */
  --line: #e7e7ec;          /* the hairlines */
  --pick: #f1f1f5;          /* the band under the chosen row */
  --mark: #5b4cff;          /* the letters that match what you typed */
  --keycap: #f6f6f9;        /* the little keys */
  --ok: #19a463;            /* the tick when a command has run */
  --radius: 16px;           /* the corners of the open palette */
}

.cmdk[data-theme='dark'] {
  --surface: #17171c;
  --text: #f1f1f4;
  --muted: #8b8b97;
  --line: #2b2b33;
  --pick: #26262e;
  --mark: #a99cff;
  --keycap: #22222a;
}

.cmdk[data-theme='dusk'] {
  --surface: #1d1a3a;
  --text: #ecebff;
  --muted: #9a96c4;
  --line: #322e5c;
  --pick: #2c2857;
  --mark: #ffb68a;
  --keycap: #27234d;
}

.cmdk[data-theme='paper'] {
  --surface: #fbf6ec;
  --text: #2d2618;
  --muted: #8c8169;
  --line: #ebe1cc;
  --pick: #f2e9d6;
  --mark: #c8541c;
  --keycap: #f4ecdb;
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--text);
  font-family: 'Geist Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

/* the room the palette opens in: the pill rests in its middle */
.cmdk {
  position: relative;
  width: min(580px, calc(100vw - 32px));
  height: 440px;
  color: var(--text);
}

/* ---------------------------------------------------------------- the one surface */
.cmdk__shell {
  position: absolute;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(20, 20, 30, 0.06), 0 6px 16px -8px rgba(20, 20, 30, 0.14);
  transition: background-color 0.35s, box-shadow 0.35s;
}

.cmdk.is-open .cmdk__shell {
  box-shadow: 0 0 0 1px var(--line), 0 2px 4px rgba(20, 20, 30, 0.05), 0 28px 64px -16px rgba(20, 20, 30, 0.32);
}

/* ---------------------------------------------------------------- the pill */
.cmdk__pill {
  position: absolute;
  inset: 0 0 auto;
  height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0 10px 0 16px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  .cmdk__pill:hover {
    color: var(--text);
    background: color-mix(in srgb, var(--pick) 60%, transparent);
  }

  .cmdk__pill:hover .cmdk__key {
    transform: translateY(-1px);
    box-shadow: inset 0 -2px 0 var(--line), 0 0 0 1px var(--line), 0 2px 3px rgba(20, 20, 30, 0.08);
  }
}

.cmdk__pill:active .cmdk__key {
  transform: translateY(1px);
  box-shadow: inset 0 -1px 0 var(--line), 0 0 0 1px var(--line);
}

.cmdk__pill:focus-visible {
  outline: 2px solid var(--mark);
  outline-offset: 3px;
}

.cmdk__pilltext {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cmdk__pilltext svg {
  width: 16px;
  height: 16px;
  margin-right: 6px;
  vertical-align: -3px;
  fill: none;
  stroke: var(--ok);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cmdk__lens {
  flex: none;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.cmdk__keys {
  display: flex;
  gap: 4px;
}

/* a little key: a cap with a lip underneath */
.cmdk__key {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--keycap);
  box-shadow: inset 0 -2px 0 var(--line), 0 0 0 1px var(--line);
  color: var(--muted);
  font-family: 'Geist Mono Variable', ui-monospace, monospace;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  transition: transform 0.18s, box-shadow 0.18s, background-color 0.35s;
}

.cmdk__key--icon svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------------------------------------------------------------- the palette */
.cmdk__dialog {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}

.cmdk__dialog[hidden] {
  display: none;
}

.cmdk__head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  padding: 0 14px 0 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  transition: border-color 0.35s;
}

.cmdk__crumbs {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
}

.cmdk__crumbs:empty {
  display: none;
}

.cmdk__crumb {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  background: var(--pick);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.cmdk__crumb[aria-current='page'] {
  cursor: default;
}

.cmdk__crumb:not([aria-current='page']) {
  background: transparent;
  color: var(--muted);
}

@media (hover: hover) {
  .cmdk__crumb:not([aria-current='page']):hover {
    color: var(--text);
    background: var(--pick);
  }
}

.cmdk__crumb:focus-visible {
  outline: 2px solid var(--mark);
  outline-offset: 1px;
}

.cmdk__sep {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.6;
}

.cmdk__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  caret-color: var(--mark);
}

.cmdk__input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.cmdk__key--esc {
  font-size: 11px;
}

/* the pages: one over the other, the one behind sunk back and blurred */
.cmdk__body {
  position: relative;
  flex: none;
  overflow: hidden;
}

.cmdk__page {
  position: absolute;
  inset: 0 0 auto;
  transform-origin: 50% 0;
}

.cmdk__list {
  position: relative;
  max-height: 318px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 8px 8px;
  scrollbar-width: none;
}

.cmdk__list::-webkit-scrollbar {
  display: none;
}

/* the band under the chosen row: moved by the script on a spring */
.cmdk__pickband {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 0;
  border-radius: 10px;
  background: var(--pick);
  pointer-events: none;
  transition: background-color 0.35s;
}

.cmdk__group {
  position: relative;
  padding: 10px 10px 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.cmdk__option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 42px;
  padding: 0 10px;
  border-radius: 10px;
  color: var(--text);
  font-size: 14.5px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.cmdk__icon {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.2s;
}

.cmdk__option[aria-selected='true'] .cmdk__icon {
  stroke: var(--text);
}

/* a theme's own colours, in a small rounded square cut on the diagonal */
.cmdk__swatch {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: linear-gradient(135deg, var(--a) 0 50%, var(--b) 50% 100%);
  box-shadow: 0 0 0 1px var(--line);
}

.cmdk__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cmdk__label mark {
  background: none;
  color: var(--mark);
  font-weight: 650;
}

.cmdk__meta {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 12.5px;
}

.cmdk__meta .cmdk__key {
  min-width: 22px;
  height: 22px;
  font-size: 11px;
}

.cmdk__chev {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cmdk__tick {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--mark);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cmdk__none {
  margin: 0;
  padding: 34px 16px 40px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.cmdk__foot {
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 42px;
  margin-top: auto;
  padding: 0 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  transition: border-color 0.35s;
}

.cmdk__tip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.cmdk__tip .cmdk__key {
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  margin-right: 2px;
}

.cmdk__foot [data-backtip] {
  opacity: 0;
  transition: opacity 0.25s;
}

.cmdk.is-deep .cmdk__foot [data-backtip] {
  opacity: 1;
}

html[data-using='pointer'] .cmdk__pill:focus-visible {
  outline: none;
}

@media (max-width: 520px) {
  .cmdk {
    height: 520px;
  }

  .cmdk__key--esc,
  .cmdk__foot {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cmdk__key,
  .cmdk__shell {
    transition: background-color 0.35s;
  }
}

/* a finger: 16 pixels, so Safari on iPhone does not zoom into the field */
@media (pointer: coarse) {
  .cmdk__input {
    font-size: 16px;
  }
}
