/* =========================================================================
   Project Taste — palette.css
   Styles the ⌘K / Ctrl+K command palette (built dynamically in router.js)
   plus a couple of shared micro-animations (spin) used by loading states.

   Markup produced by router.js:
     .palette-overlay > .palette
       > .palette-search  (i.bi-search + input#paletteInput)
       > ul.palette-list
           > li.palette-item(.is-active)
               > i.bi + span.palette-item-name + span.palette-item-cat
           > li.palette-empty
   ========================================================================= */

/* ==========================================================================
   1. OVERLAY — full-screen dim + blur, centers the palette near the top
   ========================================================================== */
.palette-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-palette);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh var(--sp-4) var(--sp-4);
  background: rgba(8, 11, 16, 0.45);
  backdrop-filter: blur(4px) saturate(140%);
  -webkit-backdrop-filter: blur(4px) saturate(140%);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-base) var(--ease),
              visibility var(--dur-base) var(--ease);
}
.palette-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

/* ==========================================================================
   2. PALETTE PANEL — the floating card
   ========================================================================== */
.palette {
  width: 100%;
  max-width: 560px;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transform: translateY(-8px) scale(0.98);
  opacity: 0;
  transition: transform var(--dur-base) var(--ease-out),
              opacity var(--dur-base) var(--ease);
}
.palette-overlay.is-open .palette {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* ==========================================================================
   3. SEARCH ROW
   ========================================================================== */
.palette-search {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.palette-search .bi-search {
  font-size: var(--fs-lg);
  color: var(--text-subtle);
  flex-shrink: 0;
}
.palette-search input {
  flex: 1 1 auto;
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--fs-lg);
  font-weight: var(--fw-medium);
}
.palette-search input::placeholder { color: var(--text-subtle); }

/* ==========================================================================
   4. RESULT LIST
   ========================================================================== */
.palette-list {
  list-style: none;
  margin: 0;
  padding: var(--sp-2);
  overflow-y: auto;
  flex: 1 1 auto;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text);
  scroll-margin: var(--sp-2);
  transition: background-color var(--dur-fast) var(--ease);
}
.palette-item .bi {
  font-size: var(--fs-md);
  color: var(--text-subtle);
  flex-shrink: 0;
  transition: color var(--dur-fast) var(--ease);
}
.palette-item-name {
  flex: 1 1 auto;
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.palette-item-cat {
  flex-shrink: 0;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--text-subtle);
  text-transform: capitalize;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0.1em 0.6em;
}

/* Active (keyboard-highlighted or hovered) row */
.palette-item.is-active,
.palette-item:hover {
  background: var(--accent-tint);
  color: var(--accent);
}
.palette-item.is-active .bi,
.palette-item:hover .bi { color: var(--accent); }
.palette-item.is-active .palette-item-cat,
.palette-item:hover .palette-item-cat {
  border-color: transparent;
  background: var(--accent-tint-2);
  color: var(--accent-strong);
}

/* Empty state */
.palette-empty {
  padding: var(--sp-5);
  text-align: center;
  color: var(--text-subtle);
  font-size: var(--fs-sm);
}

/* ==========================================================================
   5. FOOTER HINTS (optional row router.js may add later)
   Uses kbd styling from theme.css. Kept here for completeness.
   ========================================================================== */
.palette-hints {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-2) var(--sp-4);
  border-top: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--text-subtle);
}
.palette-hints span {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
}

/* ==========================================================================
   6. SHARED MICRO-ANIMATIONS
   ========================================================================== */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ==========================================================================
   7. RESPONSIVE
   ========================================================================== */
@media (max-width: 560px) {
  .palette-overlay { padding: 8vh var(--sp-3) var(--sp-3); }
  .palette { max-height: 70vh; }
  .palette-search input { font-size: var(--fs-md); }
  .palette-item-cat { display: none; }   /* save width on small phones */
}
