/* Global jump: Ctrl/Cmd+K from anywhere in the app.

   Group headers borrow the app's own folder-tab motif (see .folder-tab/
   .folder-head in core/base.css: a small serif tab sitting on a colored
   rule) instead of a generic badge — the same "which folder is this" idiom
   Projects/Teams already use, just sized for a compact list. */

.command-palette-dialog {
  border: 0;
  padding: 0;
  background: transparent;
  width: min(var(--dialog-md), calc(100% - 24px));
  max-height: calc(100dvh - 48px);
  /* Anchored a fixed distance from the top, not vertically centered — a
     centered dialog would recenter (and visibly shift the input) every time
     the result count changes; anchoring means only the bottom edge moves. */
  margin-top: 14vh;
  align-self: flex-start;
}

.command-palette-dialog::backdrop { background: rgba(34, 31, 25, .34); }

.command-palette-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper-raised);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: command-palette-in .15s cubic-bezier(.2, .8, .2, 1);
}
@keyframes command-palette-in {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
}
@media (prefers-reduced-motion: reduce) {
  .command-palette-card { animation: none; }
}

.command-palette-close { position: absolute; top: 10px; right: 10px; }

.command-palette-input {
  min-height: var(--tap);
  padding: 14px 44px 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 17px;
}
.command-palette-input:focus { outline: none; }

.command-palette-results {
  max-height: min(520px, 68dvh);
  overflow-y: auto;
  padding: 6px;
  /* The standard scrolling-shadows trick: two background-attachment:local
     gradients (matching the panel color) cover the fade edges and scroll
     with the content, so they disappear once you hit either end; two
     background-attachment:scroll gradients paint a faint shadow underneath
     that only becomes visible where the content behind it has scrolled
     away — the net effect is a shadow that shows only while there's more
     to scroll to, no JS/scroll-listener needed. */
  background:
    linear-gradient(var(--paper-raised) 30%, transparent),
    linear-gradient(transparent, var(--paper-raised) 70%) 0 100%,
    linear-gradient(rgba(23, 23, 19, .12), transparent),
    linear-gradient(transparent, rgba(23, 23, 19, .12)) 0 100%;
  background-repeat: no-repeat;
  background-color: var(--paper-raised);
  background-size: 100% 24px, 100% 24px, 100% 10px, 100% 10px;
  background-attachment: local, local, scroll, scroll;
}

.command-palette-group {
  display: flex;
  margin: 14px 6px 0;
  border-bottom: 2px solid var(--kind-color, var(--line));
}
.command-palette-group:first-child { margin-top: 6px; }

.command-palette-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 3px;
  border-radius: 4px 4px 0 0;
  background: var(--kind-color, var(--muted));
  color: var(--kind-ink, #fff);
  font: 400 12px/1 var(--serif);
  letter-spacing: .01em;
}
.command-palette-tab svg { display: block; }

.command-palette-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px 7px 13px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.command-palette-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 2px;
  background: var(--kind-color, var(--muted));
  opacity: 0;
  transition: opacity .1s ease;
}
.command-palette-row.is-active,
.command-palette-row:hover { background: var(--paper); }
.command-palette-row.is-active::before,
.command-palette-row:hover::before { opacity: 1; }

.command-palette-row-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--kind-color, var(--muted)) 16%, transparent);
  color: var(--kind-color, var(--muted));
}

.command-palette-row-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.command-palette-row-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-reading);
  font-weight: 600;
}
.command-palette-row-subtitle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: var(--text-body);
}

.command-palette-empty {
  margin: 0;
  padding: 30px 16px;
  color: var(--muted);
  font: italic 400 15px/1.4 var(--serif);
  text-align: center;
}

.command-palette-hints {
  display: flex;
  gap: 18px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--text-meta);
}
