/* /distro - search field above the results.
   Without JavaScript: a GET form with a submit button; the server searches the whole catalogue and sends one page.
   With pages/distro-search.js the button goes away (typing searches at once, only the results are replaced) and the
   matched fragments are marked. */

.distro-search {
  display: grid; gap: var(--s-2);
  margin-bottom: var(--s-5);
  scroll-margin-top: calc(var(--header-h) + var(--s-4));
}
.distro-search [hidden] { display: none; }

.distro-search__box { display: flex; gap: var(--s-3); align-items: stretch; }
.distro-search__field { position: relative; flex: 1 1 auto; min-width: 0; }

.distro-search__input {
  min-height: 3.25rem; padding-inline: 3rem; font-size: var(--fs-md);
  -webkit-appearance: none; appearance: none;
}
.distro-search__input::-webkit-search-cancel-button,
.distro-search__input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }

.distro-search__icon {
  position: absolute; left: var(--s-4); top: 50%; transform: translateY(-50%);
  width: 1.25rem; height: 1.25rem; color: var(--text-faint); pointer-events: none;
  transition: color var(--t-fast);
}
.distro-search__field:focus-within .distro-search__icon { color: var(--accent); }

/* clear: a 44px target inside the field, at its right edge */
.distro-search__clear {
  position: absolute; top: 50%; right: .25rem; transform: translateY(-50%);
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem;
  color: var(--text-muted); text-decoration: none; border-radius: var(--radius);
  transition: color var(--t-fast), background-color var(--t-fast);
}
.distro-search__clear:hover { color: var(--accent-hot); background: var(--hover-wash); }

/* "/" hint: only where there is a keyboard, only while the field is empty */
.distro-search__key {
  position: absolute; top: 50%; right: var(--s-4); transform: translateY(-50%);
  display: none; min-width: 1.6rem; padding: .1rem .4rem; text-align: center; pointer-events: none;
  font: inherit; font-size: var(--fs-xs); line-height: 1.4; color: var(--text-faint);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
}
@media (hover: hover) and (pointer: fine) {
  .js .distro-search__key { display: block; }
}
.distro-search__input:not(:placeholder-shown) ~ .distro-search__key { display: none; }

/* typing searches at once, so the button is only for the plain form (no script, or no fetch) */
.distro-search.is-live .distro-search__submit { display: none; }

.distro-search__count { min-height: 1.5em; margin: 0; color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.5; }

/* the results are being replaced */
.distro-results[aria-busy="true"] { opacity: .65; transition: opacity var(--t-med) 200ms; }

/* letters without a match stay in place and step back */
.letters li.is-empty a { color: var(--text-faint); border-style: dashed; cursor: default; }
.letters li.is-empty a:hover { color: var(--text-faint); border-color: var(--line); }

/* matched fragments */
.distro-results mark {
  padding: 0 .08em; border-radius: 1px;
  background: color-mix(in srgb, var(--accent) 32%, transparent);
  color: var(--text-strong);
}
