/* ============================================================
   SERENZA · command-palette.css
   ⌘K overlay — editorial command palette.

   Reuses the modal backdrop language from serenza-ui.css §7
   (rgba(31,42,36,.42) + 3px blur, paper surface, --shadow-md)
   and the kbd/hint vocabulary from the design-system search
   overlay, but uses the sz-command-* namespace of the app shell.

   Color discipline (60/30/10): paper dominates, forest is the
   text ink, gold is reserved for the thin active-state accent
   line — never as a surface.
   ============================================================ */

/* ---------- BACKDROP (mirrors .sz-modal-backdrop) ---------- */
.sz-command-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(31, 42, 36, .42);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(20px, 8vh, 80px) 16px;
  padding-bottom: calc(clamp(20px, 8vh, 80px) + env(safe-area-inset-bottom, 0px));
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-slow) var(--ease);
}
.sz-command-backdrop[data-open="true"] {
  opacity: 1;
  pointer-events: auto;
  animation: sz-command-fade-in var(--dur-slow) var(--ease) both;
}

/* ---------- PANEL ---------- */
.sz-command {
  width: 100%;
  max-width: 580px;
  max-height: min(70vh, 560px);
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(-8px) scale(.985);
  transition: transform var(--dur-slow) var(--ease);
}
.sz-command-backdrop[data-open="true"] .sz-command {
  transform: none;
  animation: sz-command-in var(--dur-slow) var(--ease) both;
}

@keyframes sz-command-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sz-command-in {
  from { transform: translateY(-8px) scale(.985); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* ---------- SEARCH ROW ---------- */
.sz-command__search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--paper-deep);
  flex-shrink: 0;
}
.sz-command__search > i {
  color: var(--ink-faint);
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1;
}
.sz-command__input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  font-family: var(--sans);
  font-weight: 300;
  font-size: 17px;
  color: var(--ink);
  letter-spacing: .005em;
}
.sz-command__input::placeholder { color: var(--ink-faint); }

/* ---------- RESULTS REGION ---------- */
.sz-command__results {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
  -webkit-overflow-scrolling: touch;
}

.sz-command__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* group label — discrete kicker */
.sz-command__group {
  margin: 12px 12px 4px;
  padding: 0;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  list-style: none;
}
.sz-command__group:first-child { margin-top: 2px; }

/* option — minimal editorial row, never a button (we handle click via delegation) */
.sz-command__option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius);
  border-left: 2px solid transparent;
  font-family: var(--sans);
  font-weight: 300;
  font-size: 14.5px;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  transition: background var(--dur-quick) var(--ease),
              border-color var(--dur-quick) var(--ease);
}
.sz-command__option > i {
  color: var(--ink-faint);
  font-size: 16px;
  width: 18px;
  flex: 0 0 auto;
  text-align: center;
  transition: color var(--dur-quick) var(--ease);
}
.sz-command__label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sz-command__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.sz-command__text .sz-command__label {
  flex: 0 1 auto;
}
.sz-command__sublabel {
  font-size: 11.5px;
  font-weight: 300;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.sz-command__option mark {
  background: var(--sand);
  color: var(--forest);
  border-radius: 2px;
  padding: 0 2px;
}
.sz-command__enter {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .03em;
  color: var(--ink-faint);
  opacity: 0;
  transition: opacity var(--dur-quick) var(--ease);
}

/* ACTIVE STATE — paper-deep surface (luminous), gold thin accent line.
   The gold is a 2px detail, never a dominant surface. */
.sz-command__option[data-active="true"] {
  background: var(--paper-deep);
  border-left-color: var(--gold);
}
.sz-command__option[data-active="true"] > i { color: var(--gold-deep); }
.sz-command__option[data-active="true"] .sz-command__enter { opacity: 1; }

/* EMPTY STATE — serif italic, mirrors design-system search empty */
.sz-command__empty {
  padding: 30px 16px;
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--ink-faint);
}

/* ---------- FOOTER HINT ---------- */
.sz-command__foot {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 18px;
  border-top: 1px solid var(--paper-deep);
  background: var(--paper-soft);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 11.5px;
  color: var(--ink-faint);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.sz-command__foot > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.sz-command__foot kbd {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 10px;
  letter-spacing: .03em;
  padding: 2px 6px;
  background: var(--paper);
  color: var(--ink-soft);
  border: 1px solid var(--paper-deep);
  border-radius: var(--radius);
  line-height: 1;
}

/* ---------- TRIGGERS ---------- */

/* Sidebar entry — reads as a nav link, opens the palette.
   Inherits .sz-sidebar-nav__link surface behavior; only adds
   button-reset, the inline kbd, and left-aligned content. */
.sz-sidebar-nav__link--action {
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.sz-sidebar-nav__kbd {
  margin-left: auto;
  font-family: var(--sans);
  font-weight: 400;
  font-size: 10px;
  letter-spacing: .03em;
  padding: 2px 6px;
  background: transparent;
  color: var(--paper-soft);
  border: 1px solid rgba(243, 238, 231, .18);
  border-radius: var(--radius);
  line-height: 1;
  opacity: .55;
}

/* ---------- RESPONSIVE ---------- */

/* Mobile palette: near-full width, generous gutter, iOS-safe input */
@media (max-width: 600px) {
  .sz-command {
    max-width: none;
    max-height: 80vh;
    max-height: 80dvh;
  }
  .sz-command-backdrop {
    padding: 12px;
    align-items: stretch;
  }
  .sz-command__input { font-size: 16px; /* prevents iOS auto-zoom */ }
}

/* Touch targets ≥ 44px on coarse pointers */
@media (pointer: coarse) {
  .sz-command__option { min-height: 44px; }
}

/* ---------- REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  .sz-command,
  .sz-command-backdrop {
    transition: none !important;
    animation: none !important;
  }
}
