/* FitInFinance motion system (Phase 1). Loaded after brand.css on every page, with assets/motion.js.
   Rules: only transform and opacity move; small interactions 160-250ms, reveals 500ms; ease-out for
   anything entering; hover lifts only on devices with a real pointer; nothing here hides content
   unless motion.js is running (html.m-on). Reduced motion: site.css and index.html already cut
   every duration to near zero, and motion.js skips the reveals. */
:root { --m-ease: cubic-bezier(.23, 1, .32, 1); }

/* ---------- Buttons: quick, and they answer a press ---------- */
.btn, .sh-cta, .db-btn {
  transition: transform 160ms var(--m-ease), background-color 200ms ease, border-color 200ms ease, color 200ms ease, box-shadow 200ms ease;
}
.btn:active:not([disabled]), .sh-cta:active, .db-btn:active { transform: scale(.97); }
.sh-nav a { transition: background-color 200ms ease, color 200ms ease; }

/* Sending: the label gives way to a fast spinner, the button keeps its size */
.btn[aria-busy="true"] { position: relative; color: transparent !important; pointer-events: none; }
.btn[aria-busy="true"] > * { visibility: hidden; }
.btn[aria-busy="true"]::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border-radius: 50%; border: 2px solid var(--black); border-right-color: transparent;
  animation: m-spin 600ms linear infinite;
}
@keyframes m-spin { to { transform: rotate(360deg); } }

/* Sent: the confirmation eases in and the tick draws itself */
.cap-done { animation: m-rise 300ms var(--m-ease) both; }
.cap-tick { display: block; width: 36px; height: 36px; margin: 0 0 12px; }
.cap-tick circle { fill: var(--gold); }
.cap-tick path { fill: none; stroke: var(--black); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 16; stroke-dashoffset: 16; animation: m-draw 350ms var(--m-ease) 180ms forwards; }
@keyframes m-draw { to { stroke-dashoffset: 0; } }
@keyframes m-rise { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Cards: a gentle lift, a gold edge, faster than before ---------- */
.card { transition-duration: 300ms; }
.cards a, .start-card, .hr-grid a, .rs-card { transition: transform 250ms var(--m-ease), border-color 250ms ease, background-color 250ms ease, box-shadow 250ms ease; }
@media (hover: hover) and (pointer: fine) {
  .card:hover { border-color: var(--gold); box-shadow: 0 24px 48px -32px rgba(0, 0, 0, .7); }
  .hr-grid a:hover { transform: translateY(-4px); }
}
/* Touch screens: a tap must not leave a card or button stuck in its lifted state */
@media (hover: none) {
  .btn:hover, .sh-cta:hover, .card:hover, .cards a:hover { transform: none; }
}

/* ---------- Home hero: the offer settles in, in order, within half a second ---------- */
html.js:not(.reduced) .intro > * { animation: m-rise 450ms var(--m-ease) both; }
html.js:not(.reduced) .intro > :nth-child(2) { animation-delay: 50ms; }
html.js:not(.reduced) .intro > :nth-child(3) { animation-delay: 100ms; }
html.js:not(.reduced) .intro > :nth-child(4) { animation-delay: 150ms; }
html.js:not(.reduced) .intro > :nth-child(n+5) { animation-delay: 200ms; }

/* ---------- Scroll reveals (motion.js adds html.m-on, tags elements and cleans up after) ---------- */
html.m-on [data-m] { opacity: 0; transform: translateY(14px); }
html.m-on [data-m].m-in { opacity: 1; transform: none; transition: opacity 500ms var(--m-ease), transform 500ms var(--m-ease); transition-delay: var(--m-d, 0ms); }

/* ---------- Back to top ---------- */
.m-top {
  position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 50;
  width: 44px; height: 44px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(243, 240, 232, .32); background: var(--navy); color: var(--cream);
  display: grid; place-items: center;
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity 200ms ease, transform 200ms var(--m-ease), visibility 0s linear 200ms, background-color 200ms ease;
}
.m-top.is-on { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.m-top:active { transform: scale(.94); }
.m-top svg { width: 16px; height: 16px; }
@media (hover: hover) and (pointer: fine) { .m-top:hover { background: var(--navy-hover); } }
/* Phones: sit above the sticky guide or review bar */
@media (max-width: 760px) { .m-top { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); } }
