/* The search box and its results (core). It sits in the space's sidebar, under the header ("/"). */

.search {
  position: relative;
  z-index: 5;
  flex: none;
  margin: 0 0 8px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 8px;
  border-radius: 10px;
  background: var(--fill);
  color: var(--muted);
  cursor: text;
}
.search-field .ic { flex: none; }

.search-in {
  flex: 1;
  min-width: 0;
  height: 26px;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--fg);
  font: 400 13px var(--font-ui);
}
.search-in::placeholder { color: var(--placeholder); }
.search-in:disabled { opacity: .5; }
/* the native clear button: the app's own × (search.js) clears instead, where the hint was */
.search-in::-webkit-search-cancel-button { display: none; }
.search-field:focus-within { box-shadow: 0 0 0 2px var(--accent); }

.search-field .kbd { flex: none; color: var(--faint); font-size: 11px; }
.search-in:focus ~ .kbd { visibility: hidden; }
/* something typed: the × to clear it where the hint was (UI-14d), a 20 px circle 4 in from the field's end,
   centred on it (28 − 20 = 8: 4 above and below) */
.search-in:not(:placeholder-shown) ~ .kbd { display: none; }
.search-x { display: grid; flex: none; place-items: center; width: 20px; height: 20px; margin-right: -4px; padding: 0; border: 0; border-radius: 10px; color: var(--muted); cursor: default; }
.search-x[hidden] { display: none; }
@media (hover: hover) { .search-field .search-x:hover { background-color: var(--sel); color: var(--fg-strong); } }

.search-results {
  position: absolute;
  top: 32px;
  right: 0;
  left: 0;
  box-sizing: border-box;
  max-height: 380px;
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--sep);
  border-radius: 14px;
  background: var(--solid);
  box-shadow: var(--drop);
}
@media (prefers-contrast: more) {
  .search-results { border-color: var(--hc-edge); background: var(--solid-contrast); }
}

.search-results[hidden] { display: none; }

.search-results .res {
  display: block;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 10px;
  color: var(--fg);
  font: inherit;
  text-align: left;
}
/* the one Return opens: it follows the pointer and the arrow keys */
.search-results .res[aria-selected="true"] { background: var(--sel); }
.search-results .snip { display: block; overflow: hidden; font-size: 13px; line-height: 18px; text-overflow: ellipsis; white-space: nowrap; }
.search-results .where { display: block; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 15px; text-overflow: ellipsis; white-space: nowrap; }
.search-results mark { border-radius: 3px; background: var(--mark); color: var(--fg-strong); }
.search-results .none { margin: 0; padding: 10px 8px; color: var(--muted); font-size: 12px; }
.search-results .more { margin: 0; padding: 6px 8px; color: var(--muted); font-size: 11px; }

@media (hover: none) and (pointer: coarse) {
  .search-field .kbd { display: none; }
}

/* the result count, read out by screen readers only */
.search-said { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
