/* Command palette / quick-jump (BL-037) — see static/palette.js.
 *
 * Everything is scoped under #palette, so this sheet is inert on any page that
 * does not render the dialog. Colours come from the shared theme tokens
 * (base.html :root), so the palette follows light/dark and both registers
 * without a second palette of its own.
 */

#palette {
  width: min(38rem, calc(100vw - 2rem));
  max-height: min(30rem, calc(100vh - 6rem));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elev);
  color: var(--fg);
  box-shadow: 0 24px 60px rgb(0 0 0 / 45%);
  overflow: hidden;
}

#palette::backdrop {
  background: rgb(0 0 0 / 55%);
}

/* Anchored high rather than centred: the eye is already at the top of the page
   when Ctrl-K is pressed, and a list that grows downwards does not jump. */
#palette {
  margin-top: 12vh;
  margin-bottom: auto;
}

.palette-panel {
  display: flex;
  flex-direction: column;
  max-height: inherit;
}

.palette-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

.palette-head-icon {
  flex: 0 0 auto;
  color: var(--muted);
}

.palette-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 1.05rem;
  padding: 0.15rem 0;
}

.palette-input:focus {
  outline: none;
}

.palette-input::-webkit-search-cancel-button {
  display: none;
}

.palette-close {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  cursor: pointer;
}

.palette-close:hover,
.palette-close:focus-visible {
  color: var(--fg);
  border-color: var(--accent);
}

.palette-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
  overflow-y: auto;
  flex: 1 1 auto;
}

.palette-group {
  padding: 0.5rem 0.95rem 0.25rem;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.palette-item {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.4rem 0.95rem;
  cursor: pointer;
  border-left: 2px solid transparent;
}

.palette-item.is-active {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-left-color: var(--accent);
}

.palette-item-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.palette-item-sub {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.8rem;
}

.palette-item-all {
  color: var(--accent);
  font-size: 0.85rem;
}

.palette-empty {
  padding: 0.9rem 0.95rem;
  color: var(--muted);
}

.palette-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
  margin: 0;
  padding: 0.5rem 0.95rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
}

/* The nav's search control is also the palette trigger, and for a logged-out
   visitor there is no /search to link to, so it renders as a <button> there.
   ``.nav-bell`` was written for an <a>: reset the UA button chrome so the two
   states are pixel-identical. */
button.nav-bell {
  border: 0;
  padding: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}
