/*
 * commandPalette.css — Cmd-K palette chrome.
 *
 * Superhuman-style centered modal anchored to the top-third of the viewport.
 * Uses the actual shell.css tokens (--card-elevated, --t1/t2/t3) so the
 * modal is opaque in BOTH themes — `--bg-e` is rgba(.,.,.,0.04) in light,
 * which would render the modal effectively transparent.
 * Motion + accent from steps 2-4: --ps-ease, --ps-elev-2, --mint family.
 */

body.ps-cmdk-locked {
  overflow: hidden;
}

.ps-cmdk-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 140ms var(--ps-ease, cubic-bezier(0.16, 1, 0.3, 1));
}

html[data-theme="light"] .ps-cmdk-overlay {
  background: rgba(26, 39, 64, 0.42);
}

.ps-cmdk-overlay.is-open {
  display: flex;
  opacity: 1;
}

.ps-cmdk-modal {
  width: min(560px, calc(100vw - 32px));
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--card-elevated, #122038);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  /* 4px top buffer so any leftover input focus ring (shell.css :focus-visible
     halo: 1.5px outline + 2px offset + 3px box-shadow ≈ 6.5px outside) has
     room to draw without being clipped by the modal's overflow:hidden. */
  padding-top: 4px;
  box-shadow: var(--ps-elev-2, 0 16px 40px rgba(0, 0, 0, 0.32));
  overflow: hidden;
  transform: translateY(-8px) scale(0.98);
  opacity: 0;
  transition:
    transform 180ms var(--ps-ease, cubic-bezier(0.16, 1, 0.3, 1)),
    opacity 180ms var(--ps-ease, cubic-bezier(0.16, 1, 0.3, 1));
}

html[data-theme="light"] .ps-cmdk-modal {
  background: var(--card-elevated, #ffffff);
  border-color: rgba(26, 39, 64, 0.10);
}

.ps-cmdk-overlay.is-open .ps-cmdk-modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* — Search row — */
.ps-cmdk-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: 56px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

html[data-theme="light"] .ps-cmdk-search {
  border-bottom-color: rgba(26, 39, 64, 0.08);
}

.ps-cmdk-search-icon {
  color: var(--t3, #6A8BA8);
  flex-shrink: 0;
}

.ps-cmdk-input {
  flex: 1;
  height: 100%;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--t1, #EAF0FC);
  font-family: inherit;
  font-size: 15px;
  letter-spacing: 0.01em;
}

/* Suppress shell.css L651 global :focus-visible ring (mint outline + 3px
   box-shadow halo). The ring's `outline-offset: 2px` pushes it OUTSIDE the
   input, where the modal's `overflow: hidden` clips it at the top edge.
   The palette's keyboard focus is implicit (you opened the modal, you can
   type) so no separate indicator is needed.

   Belt + suspenders — extra selector specificity (`.ps-cmdk-overlay`
   ancestor) AND `outline-offset: 0` to neutralise the inherited 2px push
   in case any cached CSS sniff still applies the base rule. */
.ps-cmdk-input,
.ps-cmdk-input:focus,
.ps-cmdk-input:focus-visible,
.ps-cmdk-overlay .ps-cmdk-input:focus,
.ps-cmdk-overlay .ps-cmdk-input:focus-visible {
  outline: 0 !important;
  outline-offset: 0 !important;
  box-shadow: none !important;
  border: 0 !important;
}

.ps-cmdk-input::placeholder {
  color: var(--t3, #6A8BA8);
}

.ps-cmdk-kbd-esc {
  flex-shrink: 0;
  font-family: inherit;
  font-size: 11px;
  color: var(--t2, #8BAAC8);
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.03);
  text-transform: lowercase;
}

html[data-theme="light"] .ps-cmdk-kbd-esc {
  border-color: rgba(26, 39, 64, 0.12);
  background: rgba(26, 39, 64, 0.03);
}

/* — Results list — */
.ps-cmdk-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 6px 8px;
  scrollbar-width: thin;
}

.ps-cmdk-grouphdr {
  padding: 10px 14px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--t3, #6A8BA8);
}

.ps-cmdk-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  color: var(--t1, #EAF0FC);
  transition: background-color 90ms var(--ps-ease, cubic-bezier(0.16, 1, 0.3, 1));
}

.ps-cmdk-row.is-selected {
  background: var(--mint-a10, rgba(46, 216, 168, 0.10));
  box-shadow: inset 0 0 0 1px var(--mint-a20, rgba(46, 216, 168, 0.20));
}

.ps-cmdk-row-title {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ps-cmdk-row-title mark {
  background: transparent;
  color: var(--mint, #2ed8a8);
  font-weight: 600;
}

.ps-cmdk-row-group {
  font-size: 12px;
  color: var(--t3, #6A8BA8);
  white-space: nowrap;
}

.ps-cmdk-row-hint {
  font-size: 13px;
  color: var(--t3, #6A8BA8);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  width: 16px;
  text-align: center;
  opacity: 0.6;
}

.ps-cmdk-row.is-selected .ps-cmdk-row-hint {
  color: var(--mint, #2ed8a8);
  opacity: 1;
}

/* — Empty state — */
.ps-cmdk-empty {
  padding: 28px 16px 32px;
  text-align: center;
  font-size: 13px;
  color: var(--t3, #6A8BA8);
}

/* — Footer hints — */
.ps-cmdk-footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 18px;
  padding: 8px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  color: var(--t3, #6A8BA8);
  flex-shrink: 0;
}

html[data-theme="light"] .ps-cmdk-footer {
  border-top-color: rgba(26, 39, 64, 0.08);
}

.ps-cmdk-footer kbd {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  line-height: 16px;
  padding: 0 5px;
  margin-right: 4px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
  font-family: inherit;
  font-size: 10px;
  text-align: center;
  color: var(--t2, #8BAAC8);
}

html[data-theme="light"] .ps-cmdk-footer kbd {
  border-color: rgba(26, 39, 64, 0.12);
  background: rgba(26, 39, 64, 0.03);
  color: var(--t2, #3C5268);
}

/* Mobile — palette is keyboard-led but the search box still works on touch.
   Tighten the top buffer, give more vertical room, and hide the kbd footer
   hints (no physical Enter/Esc keys to point at on a phone). */
@media (max-width: 480px) {
  .ps-cmdk-overlay {
    padding-top: 8vh;
  }
  .ps-cmdk-modal {
    max-height: 80vh;
    width: calc(100vw - 16px);
  }
  .ps-cmdk-footer {
    display: none;
  }
  .ps-cmdk-kbd-esc {
    display: none;
  }
  .ps-cmdk-row {
    height: 48px;
  }
}
