/* DMC Level Up - Feature 6: button responsiveness.
   App-wide tap/pressed feedback, focus visibility, and a subtle
   CSS-only loading spinner injected by static/js/buttons.js.
   Matches the existing DMC button aesthetic (green primary,
   DMC Blue, gold accents). */

/* Faster tap response on touch devices (removes the 300ms tap delay). */
.btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform .09s ease-out, background-color .12s ease, box-shadow .12s ease, filter .12s ease;
  will-change: transform;
  user-select: none;
}

/* Instant pressed feedback: slight shrink + darken, responds in ~90ms. */
.btn:active {
  transform: scale(.96);
  filter: brightness(.9);
}

/* Keyboard users get a clear, gold focus ring. */
.btn:focus-visible {
  outline: 3px solid var(--gold, #e2b959);
  outline-offset: 2px;
}

/* While an action is pending: ignore further taps, keep label visible. */
.btn.is-loading {
  pointer-events: none;
  position: relative;
}

/* Small CSS-only spinner, prepended inside the button by buttons.js. */
.btn .btn-spinner {
  display: inline-block;
  width: .9em;
  height: .9em;
  margin-right: .45em;
  vertical-align: -.12em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: dmc-btn-spin .7s linear infinite;
}

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

/* A disabled loading submit stays readable while the form posts. */
.btn[disabled].is-loading {
  opacity: .8;
  cursor: progress;
}

/* Respect reduced-motion preferences: no scale, no darken, calmer spin. */
@media (prefers-reduced-motion: reduce) {
  .btn {
    transition: none;
    will-change: auto;
  }
  .btn:active {
    transform: none;
    filter: brightness(.96);
  }
  .btn .btn-spinner {
    animation-duration: 1.6s;
  }
}
