/* ==========================================================================
   Finflow v2 — shared components
   ========================================================================== */

/* ─── Button ──────────────────────────────────────────────────────────────
   Sitewide CTA microinteraction (from the original site):
   - a fill sweeps in via ::before            (cubic-bezier(0.76,0,0.24,1))
   - the label nudges left 2px
   - the arrow grows from max-width:0

   Markup:
   <a class="btn btn-primary" href="…">
     <span class="btn-label">Book a walkthrough</span>
     <span class="btn-arrow" aria-hidden="true"><i class="ti ti-arrow-right"></i></span>
   </a>
   ──────────────────────────────────────────────────────────────────────── */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: color 0.2s ease, border-color 0.22s ease;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  transition: transform 0.32s var(--ease-sweep);
  will-change: transform;
}

.btn-label {
  position: relative;
  z-index: 1;
  transition: transform 0.22s ease;
}

.btn-arrow {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateX(-6px);
  transition:
    max-width 0.26s var(--ease-sweep),
    opacity   0.20s ease 0.06s,
    transform 0.26s var(--ease-sweep);
}
.btn-arrow i { font-size: 15px; }

.btn:hover .btn-label,
.btn:focus-visible .btn-label { transform: translateX(-2px); }

.btn:hover .btn-arrow,
.btn:focus-visible .btn-arrow {
  max-width: 22px;
  opacity: 1;
  transform: translateX(4px);
}

/* Primary — solid blue, darker blue sweeps down from the top */
.btn-primary {
  background: var(--blue-600);
  color: #ffffff;
}
.btn-primary::before {
  background: var(--blue-700);
  transform: translateY(-101%) translateZ(0);
}
.btn-primary:hover::before,
.btn-primary:focus-visible::before { transform: translateY(0) translateZ(0); }

/* Ghost — outlined, pale blue sweeps up from the bottom */
.btn-ghost {
  gap: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 400;
  border: 1px solid var(--border-strong);
  transition: color 0.22s ease, border-color 0.22s ease;
}
.btn-ghost::before {
  background: var(--accent-soft);
  transform: translateY(101%);
}
.btn-ghost:hover,
.btn-ghost:focus-visible { color: var(--accent-text); border-color: var(--accent-line); }
.btn-ghost:hover::before,
.btn-ghost:focus-visible::before { transform: translateY(0); }
.btn-ghost .btn-arrow { transform: translateX(-4px); }
.btn-ghost:hover .btn-label,
.btn-ghost:focus-visible .btn-label { transform: none; }
.btn-ghost:hover .btn-arrow,
.btn-ghost:focus-visible .btn-arrow { transform: translateX(0); }

/* Outline — the original site's "Talk to an expert" button (.btn-footer-ghost).
   Hover: a soft fill sweeps up from the bottom (same easing as the other
   buttons) while the border and text darken.
   Theme-aware: dark values are the original ones.                        */
.btn-outline {
  --btn-o-text:         var(--text-secondary);
  --btn-o-text-hover:   var(--text-primary);
  --btn-o-line:         var(--border-strong);
  --btn-o-line-hover:   rgba(10,47,107,0.30);
  --btn-o-fill-hover:   var(--blue-50);

  padding: 12px 22px;
  font-weight: 400;
  color: var(--btn-o-text);
  background: transparent;
  border: 1px solid var(--btn-o-line);
  transition: border-color 0.22s ease, color 0.22s ease;
}
:root[data-theme="dark"] .btn-outline,
[data-header-tone="dark"] .btn-outline {
  --btn-o-text:         rgba(255,255,255,0.75);
  --btn-o-text-hover:   #ffffff;
  --btn-o-line:         rgba(255,255,255,0.2);
  --btn-o-line-hover:   rgba(255,255,255,0.35);
  --btn-o-fill-hover:   rgba(255,255,255,0.08);
}
.btn-outline::before {
  background: var(--btn-o-fill-hover);
  transform: translateY(101%);
}
.btn-outline:hover,
.btn-outline:focus-visible {
  color: var(--btn-o-text-hover);
  border-color: var(--btn-o-line-hover);
}
.btn-outline:hover::before,
.btn-outline:focus-visible::before { transform: translateY(0); }
/* No label nudge; an optional .btn-arrow slides in without overshoot */
.btn-outline:hover .btn-label,
.btn-outline:focus-visible .btn-label { transform: none; }
.btn-outline .btn-arrow { transform: translateX(-4px); }
.btn-outline:hover .btn-arrow,
.btn-outline:focus-visible .btn-arrow { transform: translateX(4px); }

/* Sizes */
.btn-sm {
  padding: 8px 18px;
  font-size: 13.5px;
}
.btn-sm .btn-arrow i { font-size: 14px; }
.btn-sm:hover .btn-arrow,
.btn-sm:focus-visible .btn-arrow { max-width: 20px; }

.btn-block { width: 100%; }

/* ─── Scroll reveal ───────────────────────────────────────────────────────
   The original site's .anim-el: fade + rise as it enters the viewport.
   data-delay="ms" staggers it. Hidden only when JS runs (html.has-js), so
   content never disappears if scripts fail. js/core/reveal.js adds
   .is-visible.                                                            */
.has-js .anim-el {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity   0.65s var(--ease-out),
    transform 0.65s var(--ease-out);
}
.has-js .anim-el.is-visible {
  opacity: 1;
  transform: translateY(0);
}
/* Directional variants: slide in from a side margin while fading in.
   Used for two-column layouts, so each side arrives from its own edge. */
.has-js .anim-el.anim-from-left  { transform: translateX(-56px); }
.has-js .anim-el.anim-from-right { transform: translateX(56px); }
.has-js .anim-el.anim-from-left,
.has-js .anim-el.anim-from-right {
  transition:
    opacity   0.8s var(--ease-out),
    transform 0.9s var(--ease-out);
}
.has-js .anim-el.anim-from-left.is-visible,
.has-js .anim-el.anim-from-right.is-visible { transform: none; }
@media (prefers-reduced-motion: reduce) {
  .has-js .anim-el,
  .has-js .anim-el.anim-from-left,
  .has-js .anim-el.anim-from-right { opacity: 1; transform: none; transition: none; }
}
