/* A field that searches its options as the person types (Forms::ComboboxComponent): the text field's box with the
   chosen option's tag and a chevron after the input, and the options in a menu under it. */
.wi-combobox__field {
  cursor: text;
}
.wi-combobox__chosen {
  display: inline-flex;
  flex: none;
}
.wi-combobox__chosen:empty {
  display: none;
}
/* The menu is a popover, in the top layer and placed by the field (internal/Popover.css, popover_controller.js). */
.wi-combobox__popup {
  width: var(--wi-popover-anchor-width); /* the field's width, however long an option's label */
  max-height: min(18rem, 50vh, var(--wi-popover-room, 100vh));
  overflow-y: auto;
  --wi-popover-font-size: var(--wi-field-font-size, var(--font-size-sm));
  --wi-popover-line-height: var(--wi-field-line-height, var(--font-line-height-sm));
}
/* An option is a shared menu option (internal/Popover.css); its check shows on the chosen one only. */
.wi-popover__item.wi-combobox__option[hidden] {
  display: none;
}
.wi-combobox__option:not([aria-selected="true"]) .wi-menu-option__check {
  display: none;
}

/* On a phone the options are in a sheet (SheetComponent): the search stays above them, and they scroll on their own
   under it, each one a finger's height (48px) with its check at the end. */
.wi-combobox__search {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  padding: var(--space-2) var(--space-3);
  min-height: var(--size-control-lg);
  box-sizing: border-box;
  border-radius: var(--radius-md);
  background-color: var(--background-sunken);
}
.wi-combobox__search:focus-within {
  background-color: var(--background-surface);
  box-shadow: inset 0 0 0 var(--border-1) var(--border-strong);
}
.wi-combobox__search-icon {
  flex: none;
  width: var(--size-icon-sm);
  height: var(--size-icon-sm);
  color: var(--text-tertiary);
}
/* 16px, whatever the pointer: iOS zooms the page into a search any smaller, and a phone's width, not its pointer, opens this sheet. */
.wi-combobox__search-input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: var(--font-size-base);
  line-height: var(--font-line-height-base);
}
.wi-combobox__search-input::placeholder {
  color: var(--text-tertiary);
}
.wi-combobox__sheet-options {
  flex: 1;
  min-height: 0;
  gap: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.wi-combobox__sheet-options > li[hidden] {
  display: none;
}
/* A button, not a row: lower than the row's own hover and chosen backgrounds, which must win. */
:where(.wi-combobox__sheet-option) {
  background-color: transparent;
}
.wi-sheet .wi-popover__item.wi-combobox__sheet-option {
  width: 100%;
  min-height: var(--size-control-lg);
  padding-inline: var(--space-3);
  border: 0;
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  line-height: var(--font-line-height-base);
  text-align: left;
}
.wi-combobox__sheet-option:not([aria-current="true"]) .wi-menu-option__check {
  display: none;
}
.wi-combobox__sheet-option .wi-menu-option__check {
  width: var(--size-icon-md);
  height: var(--size-icon-md);
}
