/* grain/styles/cmdk.css — styles for the global command palette (cmdk.js).
   Uses only design tokens — no hardcoded colors or sizes.

   Restyle (owner, 2026-07-06 — visual only, matching logic untouched): was drifted from the
   rest of THE EDITOR's chrome on THREE counts — (1) raw --ink/--paper/--line-soft instead of the
   semantic --color-* tokens everything else here uses, so it couldn't pick up the accent hue
   under Baguette/Brioche (--color-accent overrides --ink for the flavor, never the reverse);
   (2) --font-smooth while the file-tree/tab-bar/console it sits beside are --font-mono — the
   actual "doesn't match the VS Code vibe" gap; (3) the selected row was a solid ink-invert
   block, the exact pattern DESIGN-SYSTEM §5 already rejected elsewhere (see icon-btn.css's own
   hover comment) — a loud block instead of a quiet accent wash. */
.cmdk {
  max-width: 34rem; width: calc(100% - 2rem); margin: 3rem auto auto; padding: 0;
  border: 1px solid var(--color-line); border-radius: var(--radius-md); overflow: hidden;
  background: var(--color-bg); color: var(--color-fg);
  font-family: var(--font-mono);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--ink) 22%, transparent);
  opacity: 0; transform: translateY(-0.5rem); transition: opacity .16s ease, transform .16s ease;
}
.cmdk[open] { opacity: 1; transform: translateY(0); }
@starting-style { .cmdk[open] { opacity: 0; transform: translateY(-0.5rem); } }
.cmdk::backdrop { background: color-mix(in srgb, var(--ink) 18%, transparent); }
@media (prefers-reduced-motion: reduce) { .cmdk { transition: none; transform: none; } }

/* anchored: dropped directly beneath the title bar's search field (cmdk.js measures it on open,
   not guessed — grain/CLAUDE.md lesson 9). Reads as that field growing a results list, not a
   separate floating box: same left edge + width, flush top corners, top border dropped so the
   field's own bottom edge is the only seam. */
.cmdk--anchored {
  top: var(--cmdk-top); left: var(--cmdk-left); width: var(--cmdk-width);
  max-width: none; margin: 0;
  border-top-left-radius: 0; border-top-right-radius: 0; border-top-color: transparent;
}

.cmdk__row {
  display: flex; align-items: center; gap: var(--space-2);
  border-bottom: 1px solid var(--color-line); padding: 0 1rem;
}
.cmdk__icon { width: 1rem; height: 1rem; color: var(--color-muted); flex: none; }
.cmdk__input {
  width: 100%; box-sizing: border-box; border: 0;
  background: transparent; padding: .85rem 0;
  font-family: inherit; font-size: 1.1rem; color: inherit;
  /* no outline:none — the input is the palette's focused control; it takes the global
     :focus-visible accent ring (global.css) so keyboard focus is visible on open. */
}
.cmdk__input::placeholder { color: var(--ink-faint); }

.cmdk__list { list-style: none; margin: 0; padding: .25rem; max-height: 52vh; overflow: auto; }
.cmdk__item { display: flex; align-items: baseline; gap: .6rem; padding: .5rem .75rem; border-radius: 2px; cursor: pointer; }
/* selected = a quiet ACCENT wash (never an invert) — the same treatment as every other
   current/selected state in the shell (nav-item[aria-current], tabs, file-tree), so the
   highlight reaches the accent hue on Baguette/Brioche instead of staying flat monochrome. */
.cmdk__item.is-sel { background: color-mix(in srgb, var(--color-accent) 14%, transparent); }

.cmdk__sub { color: var(--color-muted); font-size: .85em; }

.cmdk__kind { margin-left: auto; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); }

.cmdk__empty { padding: .75rem 1rem; color: var(--color-muted); }

.cmdk__hint {
  padding: .5rem 1rem; border-top: 1px solid var(--color-line);
  font-size: .7rem; color: var(--color-muted); text-transform: uppercase; letter-spacing: .06em;
}
