.as-visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.as-form {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

/* Square corners (no border-radius) to match the ACCESS support site's inputs. */
.as-input {
  flex: 1 1 auto;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: 1px solid #767676;
}

/*
 * The submit button carries the host theme's `btn btn-primary` classes (set in
 * search.js), so when embedded it inherits that site's primary-button style
 * automatically — ACCESS yellow on the support site, whatever brand another
 * tenant defines elsewhere. Those theme rules use !important and fully override
 * what follows.
 *
 * The rules below are only a FALLBACK for the standalone test page, which has no
 * theme and no .btn definition. They approximate the ACCESS primary button
 * (uppercase, bold, square, thick yellow border, invert-on-hover) so the test
 * page still looks on-brand. Do not rely on these when embedded; the host theme
 * owns the button there.
 */
.as-form button {
  display: inline-block;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.5rem 2.5rem;
  border-radius: 0;
  border: 4px solid #ffc42d;
  text-transform: uppercase;
  line-height: 1.5;
  text-align: center;
  cursor: pointer;
  user-select: none;
  background-color: #ffc42d;
  color: #232323;
  transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out,
    border-color 0.15s ease-in-out;
}

.as-form button:hover,
.as-form button:focus {
  background-color: #fff;
  color: #232323;
  border-color: #232323;
}

.as-count {
  margin: 0.75rem 0 0.25rem;
  font-size: 0.9em;
  color: #333;
}

.as-results {
  list-style: none;
  padding: 0;
  margin: 0;
}

.as-result {
  padding: 0.75rem 0;
  border-bottom: 1px solid #ddd;
}

.as-result:last-child {
  border-bottom: none;
}

.as-title {
  font-size: 1.05em;
  font-weight: 600;
  color: var(--md-teal, #107180);
  text-decoration: underline;
}

.as-title:hover,
.as-title:focus {
  color: var(--dark-teal, #1a5b6e);
}

.as-host {
  display: block;
  font-size: 0.8em;
  color: #555;
}

.as-snippet {
  margin: 0.35rem 0 0;
  color: #222;
}

.as-empty,
.as-loading {
  padding: 0.75rem 0;
  color: #444;
}

/* Inline spinner beside the result count. Retrieval runs ~1.2s, which is a
   single-module wait rather than a full-page load, so a spinner is the fitting
   indicator (NN/g put skeletons at full-page loads and spinners at 2-10s
   module loads). It also avoids claiming a result count we cannot know while
   the request is in flight — counts here range from 0 to 10.

   Held for a minimum duration in JS so a fast response does not flash it. */
.as-spinner {
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-right: 0.45rem;
  vertical-align: -0.1em;
  border: 2px solid #c9c9c9;
  border-top-color: var(--md-teal, #107180);
  border-radius: 50%;
  animation: as-spin 0.7s linear infinite;
}

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

/* Without motion, a static ring still reads as "working" beside the label. */
@media (prefers-reduced-motion: reduce) {
  .as-spinner {
    animation: none;
    border-top-color: #c9c9c9;
    opacity: 0.6;
  }
}

/* While a new search runs, the previous results stay put but dim. They are
   still readable and clickable — someone may be mid-sentence or reaching for a
   link — but the fade signals they are about to be replaced, so a stale list
   is not mistaken for the answer to the query just typed. */
.as-results[aria-busy="true"] .as-result {
  opacity: 0.6;
  transition: opacity 0.15s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .as-results[aria-busy="true"] .as-result {
    transition: none;
  }
}

/* Results fade in rather than snapping, which softens the swap from the
   waiting state without pretending to know the row count in advance. */
.as-results.as-entering .as-result {
  animation: as-fade-in 0.18s ease-out both;
}

@keyframes as-fade-in {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .as-results.as-entering .as-result {
    animation: none;
  }
}

.as-error {
  margin: 0.75rem 0 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid #b3261e;
  background: #fdecea;
  color: #611a15;
}
