/* Quick-jump palette (⌘K). Colours come from the shared tokens in style_dark.css,
   so both themes keep working without a second set of overrides.

   The popup is deliberately built on this site's one modal shell: base.html
   renders it with the `settings-dialog*` classes, and every rule here only
   sizes the box or styles the list. Same argument as the changelog — reusing
   the classes is what guarantees the three popups are the same popup rather
   than near-copies that drift. This file loads after style_settings.css (see
   base.html), so these single-class rules win its single-class rules by source
   order alone. */

.nav-palette-dialog {
  /* Narrower than settings, which needs room for three cards of controls. The
     palette is a list you read top to bottom; a taller box would put the first
     and last results in the same glance for no gain. */
  width: min(660px, calc(100vw - 32px));
  height: min(72vh, 640px);
  max-height: min(72vh, 640px);
}

.nav-palette-frame {
  height: 100%;
}

/* ——— Head: kicker + the search box ——— */
.nav-palette-head {
  padding-top: 16px;
  padding-bottom: 12px;
}

.nav-palette-heading {
  flex: 1;
  min-width: 0;
}

.nav-palette-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--bg-2);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.nav-palette-search:focus-within {
  border-color: color-mix(in srgb, var(--gold) 55%, var(--line-strong));
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--cream) 6%, transparent),
    0 0 0 3px color-mix(in srgb, var(--gold) 14%, transparent);
  background: var(--bg-3);
}

.nav-palette-search-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.nav-palette-search-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.nav-palette-input {
  flex: 1;
  min-width: 0;
  padding: 11px 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--cream);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.nav-palette-input::placeholder {
  color: var(--muted);
  font-weight: 500;
}

/* ——— Body: the results list ——— */
.nav-palette-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 16px 14px;
}

.nav-palette-results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-palette-group {
  padding: 12px 8px 4px;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav-palette-group:nth-child(1) {
  padding-top: 2px;
}

.nav-palette-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--cream-dim);
  text-decoration: none;
  transition: background-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

/* Active is driven by nav_palette.js (arrows + hover), so there is no :hover
   rule that can disagree with the highlight. The marker is inset from each end,
   matching the rail's own active-row vocabulary. */
.nav-palette-option.is-active {
  color: var(--cream);
  background: var(--hover-fill);
  box-shadow:
    inset 3px 0 0 color-mix(in srgb, var(--gold) 55%, transparent),
    inset 0 0 0 1px color-mix(in srgb, var(--gold) 26%, transparent);
}

.nav-palette-option-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.nav-palette-option-meta {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav-palette-option-meta.is-locked {
  color: var(--streak-mid);
}

.nav-palette-empty {
  margin: 0;
  padding: 16px 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

/* ——— Footer: the key legend ——— */
.nav-palette-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
}

.nav-palette-key.is-tab {
  margin-left: auto;
}

.nav-palette-key kbd {
  display: inline-block;
  margin-right: 3px;
  padding: 1px 5px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--bg-2);
  color: var(--cream-dim);
  font-family: inherit;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1.5;
}

/* ——— Phone: same bottom-sheet behaviour as the shell ———
   Media queries add no specificity. The unconditional .nav-palette-dialog rule
   above would therefore beat the shell's `.settings-dialog { width: 100% }`
   from inside the 640px query, so the sheet override must be repeated here. */
@media (max-width: 640px) {
  .nav-palette-dialog {
    width: 100%;
    max-width: 100%;
    height: 92vh;
    max-height: 92vh;
  }

  .nav-palette-body {
    padding-bottom: max(14px, env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-palette-search,
  .nav-palette-option {
    transition: none;
  }
}