
.live-search-form {
  position: relative;
}

/* Popup box: holds the listbox and the "no results" message. */
.live-search-results {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  z-index: 1000;
  display: block;
  box-sizing: border-box;
  width: 315px;
  max-width: calc(100vw - 2rem);
  min-height: 3rem;
  max-height: 300px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  text-align: left;
  background: #fff;
  /* Border, not just a shadow, so the edge survives forced-colors mode. */
  border: 1px solid rgba(30, 30, 30, 0.35);
  border-radius: 3px;
  box-shadow: 0 2px 6px 0 rgba(30, 30, 30, 0.2);
}

/* The header search sits at the right edge, so open the dropdown leftward. */
.uw-header-search .live-search-results {
  left: auto;
  right: 0;
}

/* In the parent theme's mobile menu, line up with the input, and undo the
   menu's link styles (bold, large padding). */
li.uw-search-list-item .live-search-results {
  left: 1rem;
  right: auto;
  width: calc(100% - 2rem);
  max-width: 400px;
}

li.uw-search-list-item .live-search-results .live-search-result {
  padding: 10px;
  font-weight: normal;
}

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

/* Scoped tightly so nav menu link styles (mobile menu) don't leak in. */
.live-search-results .live-search-result {
  display: block;
  margin: 0;
  padding: 10px;
  color: #282728;
  font-size: 1rem;
  font-weight: normal;
  line-height: 1.4;
  letter-spacing: normal;
  text-transform: none;
  text-decoration: none;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(30, 30, 30, 0.1);
}

.live-search-results .live-search-result:last-child {
  border-bottom: 0;
}

/* Active option: a 3:1+ outline (UW red on white is 5.9:1) plus underline.
   Outlines survive forced-colors mode, unlike background colors. */
.live-search-results .live-search-result.is-active {
  background: #f7f7f7;
  outline: 2px solid #c5050c;
  outline-offset: -2px;
  text-decoration: underline;
}

@media (forced-colors: active) {
  .live-search-results .live-search-result.is-active {
    outline-color: Highlight;
  }
}

.live-search-no-results {
  margin: 0;
  padding: 1em;
  font-style: italic;
  text-align: center;
}

/* Spinner while a request is in flight. */
.live-search-results.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.25rem;
  height: 1.25rem;
  margin: -0.625rem 0 0 -0.625rem;
  border: 2px solid rgba(30, 30, 30, 0.2);
  border-top-color: rgba(30, 30, 30, 0.7);
  border-radius: 50%;
  animation: live-search-spin 0.8s linear infinite;
}

.live-search-results.is-loading > * {
  opacity: 0.3;
}

@keyframes live-search-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .live-search-results.is-loading::after {
    animation-duration: 2.4s;
  }
}
