/* ═══════════════════════════════════════════════════════════════
   Motion FX — CSS Animation Layer for 361 website2
   Zero dependencies. Coexists with 361-core.css + pages.css.
   ═══════════════════════════════════════════════════════════════ */

/* ─── Reduced Motion: kill ALL motion-fx animations ─── */
@media (prefers-reduced-motion: reduce) {
  .mfx-scroll-progress,
  [data-motion],
  [data-hover],
  .mfx-marquee-track,
  .mfx-hero-orchestrated .hero-badge,
  .mfx-hero-orchestrated .hero-title,
  .mfx-hero-orchestrated .hero-title-bold,
  .mfx-hero-orchestrated .hero-sub-group,
  .mfx-hero-orchestrated .hero-sub-line,
  .mfx-hero-orchestrated .hero-ctas,
  .mfx-hero-orchestrated .scroll-hint {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}


/* ─── 1. Scroll Progress Bar ─── */
.mfx-scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #0068f9, #1dd2e9);
  z-index: 10000;
  pointer-events: none;
  transition: none;
  will-change: width;
}


/* ─── 2. SCROLL REVEAL — CSS class-driven with spring easing ─── */
/* Spring easing: cubic-bezier(0.34, 1.56, 0.64, 1) — slight overshoot */

/* Base: hidden state */
[data-motion] {
  opacity: 0;
  transition: opacity 0.7s cubic-bezier(0.34, 1.56, 0.64, 1),
              transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Direction variants — initial transform */
[data-motion="up"]    { transform: translateY(40px); }
[data-motion="down"]  { transform: translateY(-40px); }
[data-motion="left"]  { transform: translateX(-40px); }
[data-motion="right"] { transform: translateX(40px); }
[data-motion="scale"] { transform: scale(0.85); }
[data-motion="flip"]  { transform: rotateX(15deg) translateY(20px); }
[data-motion="fade"]  { transform: none; }

/* Visible state — added by JS IntersectionObserver */
/* Specificity 0,2,0 beats [data-motion] 0,1,0 and .sa-reveal 0,1,0 */
[data-motion].mfx-visible {
  opacity: 1 !important;
  transform: none !important;
}

/* Stagger delays — set via CSS custom property from JS */
[data-motion] {
  transition-delay: var(--mfx-delay, 0s);
}


/* ─── 3. Hero initial states (before JS orchestration) ─── */
.mfx-hero-orchestrated .hero-badge,
.mfx-hero-orchestrated .hero-title,
.mfx-hero-orchestrated .hero-title-bold,
.mfx-hero-orchestrated .hero-sub-group,
.mfx-hero-orchestrated .hero-sub-line,
.mfx-hero-orchestrated .hero-ctas,
.mfx-hero-orchestrated .scroll-hint {
  opacity: 0;
  transition: opacity 0.7s cubic-bezier(0.34, 1.56, 0.64, 1),
              transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Hero visible state */
.mfx-hero-orchestrated .mfx-hero-visible {
  opacity: 1 !important;
  transform: none !important;
}


/* ─── 4. Hover Micro-interactions ─── */

/* Spring lift — cards */
[data-hover="lift"] {
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
[data-hover="lift"]:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow: 0 20px 50px rgba(0,104,249,0.18);
}

/* Spring scale — badges, tags */
[data-hover="scale"] {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
[data-hover="scale"]:hover {
  transform: scale(1.08);
}

/* Glow pulse — CTA buttons */
[data-hover="glow"] {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
[data-hover="glow"]:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 0 40px rgba(0,104,249,0.5), 0 8px 32px rgba(0,104,249,0.3);
}

/* Underline grow — nav links */
[data-hover="underline"] {
  position: relative;
}
[data-hover="underline"]::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, #0068f9, #1dd2e9);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
[data-hover="underline"]:hover::after {
  transform: scaleX(1);
}


/* ─── 5. Customer Badge Marquee ─── */
.mfx-marquee {
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(90deg, transparent 0%, #000 10%, #000 90%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 10%, #000 90%, transparent 100%);
}

.mfx-marquee-track {
  display: flex;
  gap: 16px;
  width: max-content;
  animation: mfx-marquee-scroll var(--marquee-duration, 40s) linear infinite;
}

.mfx-marquee:hover .mfx-marquee-track {
  animation-play-state: paused;
}

@keyframes mfx-marquee-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}


/* ─── 6. Nav morph spring transition ─── */
.nav {
  transition: padding 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
              background 0.4s ease,
              backdrop-filter 0.4s ease,
              -webkit-backdrop-filter 0.4s ease;
}


/* ─── 7. Accordion/Tab spring height ─── */
.mfx-accordion-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}
.mfx-accordion-body.open {
  grid-template-rows: 1fr;
}
.mfx-accordion-body > div {
  min-height: 0;
}


/* ─── 8. Form input focus glow ─── */
.mfx-focus-glow:focus {
  border-color: #0068f9 !important;
  box-shadow: 0 0 0 3px rgba(0,104,249,0.15), 0 0 20px rgba(0,104,249,0.1);
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}


/* ─── 9. Scroll-to-top spring pop ─── */
.scroll-top {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.3s ease;
}
.scroll-top.visible {
  transform: scale(1);
}
.scroll-top:not(.visible) {
  transform: scale(0);
}
