/**
 * @file
 * Core's remaining AJAX throbbers, drawn as the site's busy dots.
 *
 * Buttons never reach core's throbber: biopama_libraries/busy-ajax-progress
 * draws the dots on the button itself. What is left is the throbber core puts
 * beside a select, a checkbox or a webform "submit once" button, and the
 * autocomplete field's own indicator. Core's markup is untouched; only its
 * GIFs are replaced. The dots take the text colour and pulse with the motion
 * tokens (biopama_libraries/motion: --biopama-dot-*, @keyframes
 * biopama-dots); at --biopama-motion 0 they stand still.
 */

/* Beside a control: a box of no width, so nothing beside it moves. */
:root .ajax-progress-throbber {
  display: inline-block;
  float: none;
  inline-size: 0;
  padding: 0;
  overflow: visible;
  vertical-align: middle;
  white-space: nowrap;
}

:root .ajax-progress-throbber .throbber {
  display: inline-block;
  inline-size: 2.25em;
  block-size: 1em;
  margin-inline-start: 0.5rem;
  padding: 0;
  background-image:
    radial-gradient(circle closest-side, color-mix(in srgb, currentcolor calc(var(--biopama-dot-1, 1) * 100%), transparent) 92%, transparent),
    radial-gradient(circle closest-side, color-mix(in srgb, currentcolor calc(var(--biopama-dot-2, 1) * 100%), transparent) 92%, transparent),
    radial-gradient(circle closest-side, color-mix(in srgb, currentcolor calc(var(--biopama-dot-3, 1) * 100%), transparent) 92%, transparent);
  background-position: 0 50%, 50% 50%, 100% 50%;
  background-repeat: no-repeat;
  background-size: 0.45em 0.45em;
  animation: biopama-dots calc(var(--biopama-duration-slow, 320ms) * 3 * var(--biopama-motion, 1)) linear infinite;
}

/* Its message is kept for screen readers; there is no room for it on screen. */
:root .ajax-progress-throbber .message {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* An autocomplete field while it asks: the dots at its end. */
:root.js input.form-autocomplete.ui-autocomplete-loading {
  background-image:
    radial-gradient(circle closest-side, color-mix(in srgb, currentcolor calc(var(--biopama-dot-1, 1) * 100%), transparent) 92%, transparent),
    radial-gradient(circle closest-side, color-mix(in srgb, currentcolor calc(var(--biopama-dot-2, 1) * 100%), transparent) 92%, transparent),
    radial-gradient(circle closest-side, color-mix(in srgb, currentcolor calc(var(--biopama-dot-3, 1) * 100%), transparent) 92%, transparent);
  background-position: calc(100% - 2em) 50%, calc(100% - 1.3em) 50%, calc(100% - 0.6em) 50%;
  background-repeat: no-repeat;
  background-size: 0.45em 0.45em;
  animation: biopama-dots calc(var(--biopama-duration-slow, 320ms) * 3 * var(--biopama-motion, 1)) linear infinite;
}

:root.js[dir="rtl"] input.form-autocomplete.ui-autocomplete-loading {
  background-position: 0.6em 50%, 1.3em 50%, 2em 50%;
}

@media (forced-colors: active) {
  :root .ajax-progress-throbber .throbber,
  :root.js input.form-autocomplete.ui-autocomplete-loading {
    background-image: none;
  }
}
