/* THE SEARCH FIELD — page kit, C.58j (owner 28.09.2026; the C.104 scope,
 * section 5).
 *
 * The kit field's box with a count line above it and a clearing cross
 * inside it, and three states written on the field as
 * `data-search-state`: neutral (the kit field's frame, `--field-line`),
 * active (an amber frame on its soft fill) and none (the problem red on
 * its soft fill). Every colour is a role token; the stage redefines the
 * same tokens for its dark ground, so the field reads the same way on a
 * page and in the parts finder. Colour is never the only sign: the count
 * line says how many entries the list shows, and the list says in words
 * when nothing matches. */

.kit-search {
  display: flex;
  flex-direction: column;
  gap: var(--rhythm-within);
  min-width: 0;
}

.kit-search-count {
  margin: 0;
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--ink-soft);
}

.kit-search-count:empty {
  display: none;
}

.kit-search-box {
  position: relative;
  min-width: 0;
}

.kit-search-field {
  margin: 0;
  min-width: 0;
}

.kit-search-field input {
  width: 100%;
  border: var(--hairline) solid var(--field-line);
  padding-right: var(--tap);
}

/* the cross stands inside the field, at its end, a tap wide */
.kit-search-clear {
  position: absolute;
  right: 0;
  bottom: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}

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

.kit-search[data-search-state="active"] .kit-search-field input[type="search"] {
  /* two pixels of frame without a pixel of movement: the border takes
     the colour and an inset shadow draws the second pixel inside it */
  border-color: var(--search-active);
  box-shadow: inset 0 0 0 var(--hairline) var(--search-active);
  background: var(--search-active-soft);
  color: var(--search-ink);
}

.kit-search[data-search-state="active"] .kit-search-count {
  color: var(--search-active);
}

.kit-search[data-search-state="none"] .kit-search-field input[type="search"] {
  border-color: var(--search-none);
  box-shadow: inset 0 0 0 var(--hairline) var(--search-none);
  background: var(--search-none-soft);
  color: var(--search-ink);
}

.kit-search[data-search-state="none"] .kit-search-count {
  color: var(--search-none);
}

/* The list's one line when nothing matches. */
.kit-search-empty {
  margin: 0;
  color: var(--search-none);
  font-weight: 600;
}

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