/* ==========================================================================
   COMMAND PALETTE (<div class="verser-command">, VerserUI.command, command.js). One search box over grouped results,
   moved through with the arrow keys (Linear, Raycast, Slack's Cmd+K). Stacked through VerserUI.overlay (kind
   'command'), so Escape and Back close it and focus goes back to what opened it.

   It opens and closes with no motion: it is a keyboard surface opened many times a day, and any animation would make
   it feel slower than the key that opened it. Hover and the lit row change at once for the same reason.

   Parts: .verser-command-scrim, .verser-command-box (the glass panel), .verser-command-head (icon + input +
   .verser-command-busy), .verser-command-list (role listbox) with .verser-command-group (a label and its
   .verser-command-item rows: .verser-command-icon, .verser-command-text > .verser-command-title + .verser-command-sub,
   .verser-command-meta), .verser-command-note (empty, error), .verser-command-foot (the key hints, mouse only).
   Placement: centred near the top on a desktop, between --verser-overlay-inset-start and -end like the dialog; on a
   phone it fills the top of the screen under the safe area, so the keyboard never covers the box.
   ========================================================================== */
.verser-command{
  position:fixed;inset:0;z-index:var(--verser-z-overlay,100);display:flex;justify-content:center;align-items:flex-start;
  box-sizing:border-box;padding-block:var(--verser-command-top,max(var(--space-2),env(safe-area-inset-top))) var(--space-2);
  padding-inline:var(--space-2);font-family:var(--font-ui);color:var(--text)
}
.verser-command[hidden]{display:none}
.verser-command-scrim{position:absolute;inset:0;background:var(--verser-command-scrim,var(--scrim))}
.verser-command-box{
  position:relative;box-sizing:border-box;display:flex;flex-direction:column;inline-size:100%;
  max-inline-size:var(--verser-command-max-inline-size,640px);
  max-block-size:var(--verser-command-max-block-size,min(560px,calc(100dvh - 2 * var(--space-2) - env(safe-area-inset-top))));
  overflow:hidden;border:1px solid var(--verser-command-border,var(--vx-hair));border-radius:var(--verser-command-radius,var(--vx-r-md));
  background:var(--verser-command-gloss,var(--surface-gloss)),var(--verser-command-fill,var(--vx-overlay));
  box-shadow:var(--verser-command-shadow,var(--vx-shadow))
}

/* ---- The search box. */
.verser-command-head{
  display:flex;align-items:center;gap:var(--space-3);flex:none;
  min-block-size:var(--verser-command-head-height,56px);padding-inline:var(--space-4);
  border-block-end:1px solid var(--verser-command-divider,var(--hairline))
}
.verser-command-head>.icon{flex:none;inline-size:20px;block-size:20px;color:var(--text-secondary)}
.verser-command-input{
  flex:1 1 auto;min-inline-size:0;block-size:100%;min-block-size:44px;margin:0;padding:0;border:0;background:none;
  color:var(--text);font-family:var(--font-ui);font-size:var(--verser-command-input-size,17px);line-height:1.3;
  text-align:start;outline:0;-webkit-appearance:none;appearance:none
}
.verser-command-input::placeholder{color:var(--vx-ink-3);opacity:1}
.verser-command-input::-webkit-search-cancel-button,.verser-command-input::-webkit-search-decoration{-webkit-appearance:none;appearance:none;display:none}
/* Reading: a thin bar under the box, never a spinner over the rows, so the rows already shown stay readable. */
.verser-command-busy{position:absolute;inset-inline:0;inset-block-start:calc(var(--verser-command-head-height,56px) - 1px);block-size:1px;overflow:hidden;opacity:0;pointer-events:none}
.verser-command-busy::after{content:"";position:absolute;inset-block:0;inline-size:30%;background:var(--selected-edge);animation:verser-command-read 1s var(--ease-in-out) infinite}
.verser-command[data-busy] .verser-command-busy{opacity:1;transition:opacity 0s 150ms}
@keyframes verser-command-read{from{inset-inline-start:-30%}to{inset-inline-start:100%}}
.verser-command-close{flex:none}

/* ---- The results. */
.verser-command-list{flex:1 1 auto;min-block-size:0;overflow-y:auto;overscroll-behavior:contain;padding:var(--space-2);scroll-padding-block:var(--space-8) var(--space-2)}
.verser-command-list:empty{display:none}
.verser-command-group+.verser-command-group{margin-block-start:var(--space-2)}
.verser-command-label{
  display:flex;align-items:center;gap:var(--space-2);margin:0;padding-block:var(--space-2) var(--space-1);padding-inline:var(--space-3);
  font-family:var(--font-mono);font-size:var(--font-size-caption);font-weight:500;line-height:1.4;color:var(--text-muted)
}
.verser-command-label:empty{display:none}
.verser-command-more{margin-inline-start:auto;padding:0;border:0;background:none;color:var(--text-secondary);font:inherit;cursor:pointer}
@media (hover:hover) and (pointer:fine){.verser-command-more:hover{color:var(--text)}}
.verser-command-more:focus-visible{outline:var(--focus-ring-width,2px) solid var(--focus-ring);outline-offset:2px;border-radius:var(--radius-xs)}
.verser-command-item{
  display:flex;align-items:center;gap:var(--space-3);box-sizing:border-box;inline-size:100%;
  min-block-size:var(--verser-command-item-height,52px);padding-block:var(--space-1);padding-inline:var(--space-3);
  border-radius:var(--verser-command-item-radius,var(--radius-sm));color:var(--text);cursor:pointer;
  -webkit-tap-highlight-color:transparent;user-select:none
}
.verser-command-item[aria-selected="true"]{background:var(--verser-command-item-on,var(--surface-fill-2))}
.verser-command-item:active{background:var(--verser-command-item-pressed,var(--surface-pressed))}
.verser-command-icon{
  display:grid;place-items:center;flex:none;inline-size:32px;block-size:32px;border-radius:var(--radius-xs);
  background:var(--surface-fill-1);color:var(--text-secondary)
}
.verser-command-icon>.icon{inline-size:18px;block-size:18px}
.verser-command-icon>.d8-mark{inline-size:18px;block-size:18px}
.verser-command-icon[data-shape="person"]{border-radius:var(--radius-pill);font-family:var(--font-ui);font-size:var(--font-size-small);font-weight:600;color:var(--text)}
.verser-command-item[data-tone="agent"] .verser-command-icon{background:var(--vx-agent-soft);color:var(--text)}
.verser-command-text{display:flex;flex-direction:column;justify-content:center;flex:1 1 auto;min-inline-size:0;gap:2px}
/* Each line lines up with the page's start edge, so a mixed list never looks ragged; its words keep their own
   direction inside a <bdi> (an English name in the Arabic interface still reads left to right). */
.verser-command-title,.verser-command-sub{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:start}
.verser-command-title{font-size:var(--verser-command-title-size,15px);font-weight:500;line-height:1.3}
.verser-command-title mark{background:none;color:inherit;font-weight:700}
.verser-command-sub{font-family:var(--font-mono);font-size:var(--font-size-meta);line-height:1.35;color:var(--text-secondary)}
.verser-command-sub:empty{display:none}
:root[dir="rtl"] .verser-command-sub,:root[dir="rtl"] .verser-command-label{font-family:var(--font-mono-rtl,var(--font-mono))}
.verser-command-meta{flex:none;font-family:var(--font-mono);font-size:var(--font-size-caption);color:var(--text-muted);white-space:nowrap}
.verser-command-meta:empty{display:none}
/* The lit row's Enter, mouse and keyboard people only. */
.verser-command-enter{flex:none;display:none;font-family:var(--font-mono);font-size:var(--font-size-meta);color:var(--text-secondary)}
@media (hover:hover) and (pointer:fine){.verser-command-item[aria-selected="true"] .verser-command-enter{display:inline}}

.verser-command-note{margin:0;padding:var(--space-6) var(--space-4);text-align:center;color:var(--text-secondary);font-size:var(--font-size-small);line-height:1.5;text-wrap:pretty}
.verser-command-note:empty{display:none}
.verser-command-note[data-tone="error"]{color:var(--warning,var(--text-secondary))}

/* ---- The key hints: a keyboard and a mouse only. */
.verser-command-foot{
  display:none;flex:none;align-items:center;gap:var(--space-4);padding-block:var(--space-2);padding-inline:var(--space-4);
  border-block-start:1px solid var(--verser-command-divider,var(--hairline));
  font-family:var(--font-mono);font-size:var(--font-size-caption);color:var(--text-muted)
}
.verser-command-foot kbd{
  display:inline-grid;place-items:center;min-inline-size:20px;block-size:20px;margin-inline-end:var(--space-1);padding-inline:4px;box-sizing:border-box;
  border:1px solid var(--vx-hair);border-radius:6px;background:var(--surface-fill-1);color:var(--text-secondary);font:inherit
}
@media (hover:hover) and (pointer:fine){.verser-command-foot{display:flex}}

/* ---- A list of key combinations and what they do (the shortcuts sheet, in a kit dialog).
   <dl class="verser-command-keys"><dt><kbd>⌘</kbd><kbd>K</kbd></dt><dd>Search everything</dd>…</dl> */
.verser-command-keys{display:grid;grid-template-columns:auto 1fr;align-items:center;gap:var(--space-2) var(--space-4);margin:0 0 var(--space-3)}
.verser-command-keys dt{display:flex;align-items:center;gap:var(--space-1);font-family:var(--font-mono);font-size:var(--font-size-caption);color:var(--text-muted)}
.verser-command-keys dd{margin:0;font-size:var(--font-size-small);color:var(--text)}
.verser-command-keys kbd,.verser-command-foot kbd{
  display:inline-grid;place-items:center;min-inline-size:22px;block-size:22px;padding-inline:5px;box-sizing:border-box;
  border:1px solid var(--vx-hair);border-radius:6px;background:var(--surface-fill-1);color:var(--text-secondary);
  font-family:var(--font-mono);font-size:var(--font-size-caption)
}

/* ---- The focus ring on the box itself (opened by the mouse, the input takes the focus; this is for a stray Tab). */
.verser-command :focus-visible{outline:var(--focus-ring-width,2px) solid var(--focus-ring);outline-offset:var(--focus-ring-offset,2px)}
.verser-command-input:focus-visible{outline:none}

/* ---- A desktop: near the top, centred between the app's sidebar and its docked panel (as the dialog is). */
@media (min-width:720px) and (min-height:501px),(min-width:720px) and (pointer:fine){
  .verser-command{
    padding-block-start:var(--verser-command-top,max(var(--space-6),12vh));
    padding-inline:calc(var(--space-4) + var(--verser-overlay-inset-start,0px)) calc(var(--space-4) + var(--verser-overlay-inset-end,0px))
  }
  .verser-command-box{max-block-size:var(--verser-command-max-block-size,min(560px,76vh))}
  .verser-command-close{display:none}
}
@media (prefers-reduced-motion:reduce){.verser-command-busy::after{animation:none;inset-inline-start:0;inline-size:100%;opacity:.6}}
@media (prefers-reduced-transparency:reduce){.verser-command-box{background:var(--vx-overlay)}}
