/* Shared by the recorder (index.html) and the review page (review/): buttons with every state,
   keyboard hints, quality-flag pills, the busy spinner, the loading shimmer and screen-reader-only text.
   Colours come from each page's tokens (:root). Hover styles apply only to devices that can
   hover, so they don't stick after a tap on a phone. */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px;
  border: 1px solid transparent; border-radius: 10px; padding: 10px 16px;
  font: inherit; font-weight: 600; font-size: 15px; line-height: 1.4;
  color: inherit; background: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; /* no double-tap zoom on quick repeat taps (iOS); pinch-zoom still works */
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s, transform 0.08s;
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.985); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--btn); color: var(--btn-ink); }
.btn-line { border-color: var(--edge, var(--line)); background: var(--card); } /* --edge: at least 3:1 on the card */
.btn-quiet { color: var(--muted); padding-inline: 10px; }
.btn-danger { color: var(--rec); padding-inline: 10px; }
.btn-yes { background: var(--yes); color: #fff; }
.btn-no { background: var(--no-wash); color: var(--no); border-color: var(--no-edge); }

@media (hover: hover) {
  .btn-primary:hover:not(:disabled) { background: var(--btn-hover); }
  .btn-line:hover:not(:disabled) { border-color: var(--muted); background: var(--hover-wash); }
  .btn-quiet:hover:not(:disabled) { color: var(--ink); background: var(--hover-wash); }
  .btn-danger:hover:not(:disabled) { background: var(--rec-wash); }
  .btn-yes:hover:not(:disabled) { background: var(--yes-hover); }
  .btn-no:hover:not(:disabled) { border-color: var(--no); }
}

/* A button whose action is under way: keeps its label, adds a spinner, and isn't dimmed. */
.btn.is-busy { cursor: progress; opacity: 1; }
.btn.is-busy::after, .spinner {
  content: ""; display: inline-block; flex: none;
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: ui-spin 0.7s linear infinite;
}
@keyframes ui-spin { to { transform: rotate(360deg); } }

kbd {
  font: 500 11px/1 var(--font-mono); padding: 3px 6px; border-radius: 5px;
  border: 1px solid var(--line); border-bottom-width: 2px; background: var(--card); color: var(--ink);
}
/* Hints in buttons use the label's own colour (no opacity, which took them under 4.5:1); only the
   border is lighter, where the browser can mix colours. */
.btn kbd { background: transparent; color: inherit; border-color: currentColor; margin-left: 2px; }
@supports (color: color-mix(in srgb, red, blue)) {
  .btn kbd { border-color: color-mix(in srgb, currentColor 45%, transparent); }
}

/* A clip's quality flags, as a small amber pill (same look and words on both pages). */
.flag {
  font: 600 11px/1.6 var(--font-mono); color: var(--warn); background: var(--warn-wash);
  border: 1px solid var(--warn-edge); border-radius: 999px; padding: 1px 8px; white-space: nowrap;
}

/* Placeholder shimmer while something loads. */
.shimmer {
  background: linear-gradient(100deg, var(--line) 30%, var(--hover-wash) 50%, var(--line) 70%) 0 0 / 300% 100%;
  animation: ui-shimmer 1.4s ease-in-out infinite;
}
@keyframes ui-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

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

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
  .btn:active:not(:disabled) { transform: none; }
  .shimmer { animation: none; }
  .btn.is-busy::after, .spinner { animation-duration: 2s; }
}
