/* ─────────────────────────────────────────────────────────────────────────────
   Standing Convention #8 — every button is disabled + SPINNING until the system
   responds (no double-submit). ui-guard.js sets disabled + aria-busy="true" on
   the triggering control for the whole request (htmx / plain form submit / fetch
   via window.aa.guardButton) and clears it on response (success OR error). This
   sheet gives that in-flight state a universal spinner, so it applies to EVERY
   <button>/.btn/.mm-btn/.btn-d/.nav-icon-btn across every view with no per-view
   markup. The spinner uses currentColor, so it contrasts whatever the button's
   own background is (brand-gradient, outline, surface, icon). RTL-safe (logical
   inset), reduced-motion aware.
   ───────────────────────────────────────────────────────────────────────────── */
[aria-busy="true"] {
  position: relative !important;
  pointer-events: none;
  cursor: progress;
  opacity: .72;
}

[aria-busy="true"]::after {
  content: "";
  position: absolute;
  inset-inline-end: .6em;
  top: calc(50% - .55em);
  width: 1.1em;
  height: 1.1em;
  border: 2px solid currentColor;
  border-inline-end-color: transparent;   /* the gap that makes the ring read as spinning */
  border-radius: 50%;
  animation: aa-guard-spin .6s linear infinite;
  opacity: .85;
}

/* Centre the spinner on square/icon buttons (no text to sit beside). */
.nav-icon-btn[aria-busy="true"]::after,
.mm-ic[aria-busy="true"]::after,
.mm-fab-btn[aria-busy="true"]::after {
  inset: 0;
  margin: auto;
  top: auto;
}

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

@media (prefers-reduced-motion: reduce) {
  [aria-busy="true"]::after { animation: none; border-inline-end-color: currentColor; opacity: .5; }
}
