/* palette.css — 命令面板与导航上的搜索按钮
   颜色全部取自 theme.css 的令牌，这里不写死颜色。 */

/* ------------------------------------------------ 导航里的触发按钮 */
.nav-search {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius, 8px);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.nav-search:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.nav-search kbd {
  font-family: var(--font-mono), ui-monospace, monospace;
  font-size: 11px;
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: var(--bg);
}

.nav-search kbd + kbd {
  margin-left: -2px;
}

.nav-search:focus-visible {
  outline: 2px solid var(--accent, #111);
  outline-offset: 2px;
}

@media (max-width: 760px) {
  .nav-search {
    display: none;
  }
}

/* -------------------------------------------------------- 遮罩层 */
.pal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 20px 20px;
  background: color-mix(in srgb, var(--ink, #111) 38%, transparent);
  backdrop-filter: blur(2px);
}

.pal[hidden] {
  display: none;
}

.pal-box {
  width: min(560px, 100%);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius, 8px);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  animation: pal-in 0.14s ease-out;
}

@keyframes pal-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.pal-input {
  width: 100%;
  height: 54px;
  padding: 0 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  outline: none;
}

.pal-input::placeholder {
  color: var(--muted);
}

/* --------------------------------------------------------- 结果表 */
.pal-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: min(52vh, 420px);
  overflow-y: auto;
}

.pal-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14.5px;
}

.pal-item.is-active {
  background: color-mix(in srgb, var(--ink, #111) 8%, transparent);
}

.pal-icon {
  width: 18px;
  flex: 0 0 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.pal-item.is-active .pal-icon {
  color: var(--ink);
}

.pal-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pal-url {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--font-mono), ui-monospace, monospace;
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 46%;
}

.pal-empty {
  padding: 18px 12px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.pal-hint {
  margin: 0;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.02em;
}

/* 打开时锁滚动，避免底下页面跟着动 */
html.pal-open,
html.pal-open body {
  overflow: hidden;
}

@media (max-width: 560px) {
  .pal {
    padding-top: 6vh;
  }
  .pal-url {
    display: none;
  }
}
