/* Anahata v2 — search-bar. Figma: "Search bar" set. */

.search-bar {
  display: flex;
  align-items: center;
  gap: var(--a-space-2);
  width: 100%;
  min-height: var(--a-searchbar-height);
  padding: var(--a-space-2) var(--a-space-4);
  background: var(--a-surface);
  border-radius: var(--a-radius-pill);
  box-shadow: var(--a-shadow-search);
}

.search-bar__icon {
  flex: 0 0 auto;
  display: flex;
  color: var(--a-ink);
}

.search-bar__input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: var(--a-font-body);
  font-size: var(--a-fs-body);
  line-height: 1.2;
  color: var(--a-ink);
  appearance: none;
}

.search-bar__input::placeholder {
  color: var(--a-text-muted);
}

.search-bar__input:focus,
.search-bar__input:focus-visible {
  /* Dawn's *:focus-visible drew a grey box inside the pill; the pill shows
     focus itself (below) */
  outline: none;
  box-shadow: none;
}

.search-bar:focus-within {
  box-shadow: var(--a-shadow-search), inset 0 0 0 1px var(--a-border);
}

/* hide the native search clear affordance; we draw our own */
.search-bar__input::-webkit-search-cancel-button {
  appearance: none;
}

.search-bar__clear {
  flex: 0 0 auto;
  display: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: var(--a-radius-round);
  background: var(--a-ink-pure);
  color: var(--a-on-dark);
  cursor: pointer;
}

.search-bar__input:not(:placeholder-shown) ~ .search-bar__clear,
.search-bar--open .search-bar__clear {
  display: flex;
}

.search-bar__clear:focus-visible {
  outline: 2px solid var(--a-ink-pure);
  outline-offset: 2px;
  box-shadow: none;
}
