/* =====================================================
   motion.css  -  subtle UI animation, shared by every page.

   - Only `transform` and `opacity` are animated (GPU friendly, no layout work).
   - Durations stay between 0.3s and 0.8s; nothing loops or runs forever.
   - Modals fade/slide in when they get `.active`, buttons give press feedback,
     sections fade up once as they scroll into view (see motion.js).
   - `prefers-reduced-motion: reduce` switches ALL of it off (bottom of file).
   ===================================================== */

:root {
  --motion-fast: 0.3s;
  --motion-base: 0.45s;
  --motion-slow: 0.7s;
  --motion-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- Buttons: hover lift + press feedback ---------- */
button,
.btn,
a.btn,
[role="button"] {
  transition-property: transform, box-shadow, background-color, border-color, color, opacity, filter;
  transition-timing-function: var(--motion-ease);
}
/* One consistent 0.3s feel on every button (individual pages used 0.15-0.2s or none). */
button:not(:disabled),
.btn:not(:disabled),
[role="button"] {
  transition-duration: var(--motion-fast) !important;
}
button:not(:disabled):not([aria-disabled="true"]):active,
.btn:not(:disabled):active,
[role="button"]:not([aria-disabled="true"]):active {
  transform: scale(0.97);
}

/* ---------- Modals: backdrop fades, card rises ---------- */
@keyframes motion-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes motion-pop-in {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.confirm-modal-overlay.active,
.modal-overlay.active,
.rate-modal-overlay.active,
.inspection-modal-overlay.active {
  animation: motion-fade-in var(--motion-fast) ease-out both;
}
.confirm-modal-overlay.active > *,
.modal-overlay.active > *,
.rate-modal-overlay.active > *,
.inspection-modal-overlay.active > * {
  animation: motion-pop-in var(--motion-base) var(--motion-ease) both;
}

/* ---------- Dropdowns / menus ---------- */
@keyframes motion-drop-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.account-dropdown:not([hidden]) {
  animation: motion-drop-in var(--motion-fast) var(--motion-ease) both;
}

/* ---------- Messages ---------- */
.form-status:not(:empty),
.field-error:not(:empty) {
  animation: motion-fade-in var(--motion-fast) ease-out both;
}

/* ---------- Table rows (first 20 only, so long tables stay cheap) ---------- */
@keyframes motion-row-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
tbody tr:nth-child(-n+20) {
  animation: motion-row-in var(--motion-base) var(--motion-ease) both;
}

/* ---------- Sections / panels: fade up once when scrolled into view ---------- */
/* Hidden ONLY after motion.js has marked the page (so no JS = everything stays visible). */
.motion-ready .reveal:not(.in-view) {
  opacity: 0;
  transform: translateY(18px);
}
.motion-ready .reveal {
  transition: opacity var(--motion-slow) var(--motion-ease), transform var(--motion-slow) var(--motion-ease);
  transition-delay: var(--reveal-delay, 0s);
}
.motion-ready .reveal.in-view {
  opacity: 1;
  transform: none;
}

/* ---------- Accessibility: reduced motion turns everything off ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  button, button:not(:disabled), .btn, .btn:not(:disabled), [role="button"] {
    transition-property: none !important;
    transition-duration: 0s !important;
  }
  .motion-ready .reveal:not(.in-view) { opacity: 1 !important; transform: none !important; }
}
