/* T-PRESS-FEEDBACK (11-26-2026): buttons look pressed, busy and done.
   Paired with press-feedback (installPressFeedback). Opt out: data-pf-off. */
:where(.pf-on) :where(button, input[type="submit"], input[type="button"], input[type="reset"], [role="button"], a.btn, a.button) {
  transition: transform .09s ease, filter .09s ease, box-shadow .09s ease, background-color .15s ease;
  -webkit-tap-highlight-color: transparent;
}

/* 1. Pressed: sinks like a physical button (smaller, darker, shadow inside). */
.pf-on .pf-press:not(:disabled):not([aria-disabled="true"]),
.pf-on :where(button, input[type="submit"], input[type="button"], [role="button"], a.btn, a.button):not(:disabled):not([aria-disabled="true"]):not([data-pf-off]):active {
  transform: translateY(1.5px) scale(.96) !important;
  filter: brightness(.9) saturate(1.08);
  box-shadow: inset 0 3px 7px rgba(0, 0, 0, .30), inset 0 1px 2px rgba(0, 0, 0, .22) !important;
}

/* Links, cards, tiles and rows (T-PRESS-FEEDBACK-2): a block sinks a little, inline text dims. */
.pf-on .pf-press-soft {
  transform: scale(.98) !important;
  filter: brightness(.95);
  transition: transform .08s ease, filter .08s ease !important;
}
.pf-on .pf-press-text { opacity: .55 !important; transition: opacity .08s ease !important; }

/* 2. Working and 3. Done: an overlay covers the label while it lasts. */
.pf-on .pf-busy,
.pf-on .pf-done { position: relative !important; }
/* A busy button still receives presses, so a form with new values can be sent again; a repeat is ignored. */
.pf-on .pf-done { pointer-events: none; }
.pf-on .pf-busy { cursor: progress !important; opacity: 1 !important; }
.pf-on .pf-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 10px;
  border-radius: inherit;
  background: inherit;
  color: var(--pf-fg, inherit);
  font: inherit;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  pointer-events: none;
}
.pf-on .pf-small .pf-overlay { font-size: .85em; gap: 6px; }
.pf-on .pf-busy .pf-overlay { background-color: var(--pf-bg, #fff); }
.pf-on .pf-spinner {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: pf-spin .7s linear infinite;
}
.pf-on .pf-done .pf-overlay {
  background: linear-gradient(135deg, #16a34a, #0e9f6e);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, .28);
  animation: pf-pop .32s cubic-bezier(.2, 1.4, .4, 1);
}
.pf-on .pf-error {
  animation: pf-shake .45s ease;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .35) !important;
}

@keyframes pf-spin { to { transform: rotate(360deg); } }
@keyframes pf-pop { 0% { transform: scale(.85); opacity: .4; } 100% { transform: scale(1); opacity: 1; } }
@keyframes pf-shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

@media (prefers-reduced-motion: reduce) {
  .pf-on .pf-press, .pf-on .pf-press-soft, .pf-on :where(button, [role="button"], a.btn, a.button):active { transform: none !important; }
  .pf-on .pf-spinner { animation-duration: 1.6s; }
  .pf-on .pf-done .pf-overlay, .pf-on .pf-error { animation: none; }
}
