/* EASI MONEY · site-wide motion layer (paired with js/site-motion.js) */

:root {
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --motion-duration-long: 1.15s;
  --motion-duration-mid: 0.85s;
}

/* ----- Scroll progress (JS sets --scroll-p) ----- */
.motion-scroll-indicator {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  z-index: 10001;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    #0a0a0a,
    rgba(255, 255, 255, 0.65),
    #0a0a0a
  );
  background-size: 200% 100%;
  animation: motion-scroll-sheen 5s linear infinite;
  opacity: 0.92;
  transition: width 0.06s linear;
}

@keyframes motion-scroll-sheen {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* ----- Atmospheric grain overlay ----- */
.motion-grain {
  position: fixed;
  inset: -20%;
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s var(--ease-out-expo);
  mix-blend-mode: multiply;
  background-image:
    radial-gradient(rgba(0, 0, 0, 0.035) 0.65px, transparent 0.8px),
    radial-gradient(rgba(255, 255, 255, 0.04) 0.65px, transparent 0.8px);
  background-size: 3px 3px, 4px 4px;
  animation: motion-grain-drift 14s linear infinite;
}

html.motion-loaded .motion-grain {
  opacity: 1;
}

@keyframes motion-grain-drift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-0.35%, -0.5%); }
  50% { transform: translate(0.2%, 0.4%); }
  75% { transform: translate(0.5%, -0.2%); }
  100% { transform: translate(0, 0); }
}

/* ----- Page reveal shell ----- */
html.motion-ready:not(.motion-reduced) body {
  opacity: 0;
  transition: opacity 1.05s var(--ease-out-expo);
}

html.motion-ready:not(.motion-reduced).motion-loaded body {
  opacity: 1;
}

/* ----- Hero: monochrome light sweep + veil ----- */
html.motion-ready:not(.motion-reduced) .hero.motion-ambient::before {
  content: "";
  position: absolute;
  inset: -30% -40%;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(
      ellipse 55% 40% at 50% 40%,
      rgba(255, 255, 255, 0.45) 0%,
      transparent 62%
    ),
    radial-gradient(
      ellipse 40% 50% at 75% 60%,
      rgba(255, 255, 255, 0.2) 0%,
      transparent 55%
    );
  opacity: 0.55;
  animation: motion-hero-veil 22s ease-in-out infinite alternate;
}

@keyframes motion-hero-veil {
  0% {
    opacity: 0.45;
    transform: rotate(-3deg) scale(1);
  }
  100% {
    opacity: 0.72;
    transform: rotate(2deg) scale(1.05);
  }
}

html.motion-ready:not(.motion-reduced) .motion-hero-shine {
  -webkit-text-fill-color: transparent;
  background: linear-gradient(
    112deg,
    #0a0a0a 0%,
    #0a0a0a 38%,
    #6a6a6a 50%,
    #0a0a0a 62%,
    #0a0a0a 100%
  );
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: motion-title-sheen 9s ease-in-out infinite;
}

@keyframes motion-title-sheen {
  0%, 35% {
    background-position: 120% center;
  }
  65%, 100% {
    background-position: -60% center;
  }
}

html.motion-ready:not(.motion-reduced) .motion-hero-tag {
  opacity: 0;
  animation: motion-fade-up 1.35s var(--ease-out-expo) 0.35s forwards;
}

@keyframes motion-fade-up {
  from {
    opacity: 0;
    transform: translateY(1rem);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: none;
  }
}

html.motion-ready:not(.motion-reduced) .motion-badge-pop {
  opacity: 0;
  animation: motion-badge-rise 1.1s var(--ease-out-expo) 0.12s forwards;
}

@keyframes motion-badge-rise {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.92);
    letter-spacing: 0.42em;
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    letter-spacing: 0.2em;
  }
}

/* ----- Logo micro float ----- */
html.motion-ready:not(.motion-reduced) .motion-brand-wrap img {
  animation: motion-logo-float 7s ease-in-out infinite;
}

@keyframes motion-logo-float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

/* ----- Upgrade section reveals ----- */
html.motion-ready:not(.motion-reduced) .motion-reveal,
html.motion-ready:not(.motion-reduced) .reveal {
  opacity: 0 !important;
  transform: translate3d(0, 2rem, 0) scale(0.988) rotateX(2deg);
  transform-origin: center top;
  filter: blur(14px);
  transition:
    opacity var(--motion-duration-long) var(--ease-out-expo),
    transform var(--motion-duration-long) var(--ease-out-expo),
    filter 1s var(--ease-out-soft);
  perspective: 1200px;
}

html.motion-ready:not(.motion-reduced) .motion-reveal.is-visible,
html.motion-ready:not(.motion-reduced) .reveal.is-visible {
  opacity: 1 !important;
  transform: none !important;
  filter: blur(0) !important;
}

html.motion-ready:not(.motion-reduced) .section-title.motion-line-under,
html.motion-ready:not(.motion-reduced) h1.motion-line-under {
  position: relative;
  display: inline-block;
}

html.motion-ready:not(.motion-reduced) .section-title.motion-line-under::after,
html.motion-ready:not(.motion-reduced) h1.motion-line-under::after {
  content: "";
  display: block;
  height: 2px;
  margin-top: 0.42em;
  background: linear-gradient(90deg, #0a0a0a, rgba(10, 10, 10, 0));
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 1s var(--ease-out-expo);
}

html.motion-ready:not(.motion-reduced) .reveal.is-visible .section-title.motion-line-under::after,
html.motion-ready:not(.motion-reduced) .motion-reveal.is-visible .section-title.motion-line-under::after,
html.motion-ready:not(.motion-reduced) .reveal.is-visible h1.motion-line-under::after,
html.motion-ready:not(.motion-reduced) .motion-reveal.is-visible h1.motion-line-under::after {
  transform: scaleX(1);
}

.section--dark .section-title.motion-line-under::after,
.section--dark h1.motion-line-under::after {
  background: linear-gradient(90deg, #ffffff, rgba(255, 255, 255, 0)) !important;
}

html.motion-ready:not(.motion-reduced) .motion-reveal.is-visible .motion-line-under.motion-line-center::after {
  margin-left: auto;
  margin-right: auto;
  transform-origin: center;
}

/* ----- Stagger child blocks ----- */
html.motion-ready:not(.motion-reduced) [data-motion-stagger] > * {
  --motion-n: var(--motion-i, 0);
  opacity: 0 !important;
  transform: translate3d(0, 1.5rem, 0);
  filter: blur(8px);
  transition:
    opacity 0.9s calc(var(--motion-i, 0) * 0.068s + var(--reveal-chain, 0s)) var(--ease-out-expo),
    transform 1s calc(var(--motion-i, 0) * 0.068s + var(--reveal-chain, 0s)) var(--ease-out-expo),
    filter 0.85s calc(var(--motion-i, 0) * 0.068s + var(--reveal-chain, 0s)) var(--ease-out-soft);
}

html.motion-ready:not(.motion-reduced) .reveal.is-visible[data-motion-stagger] > *,
html.motion-ready:not(.motion-reduced) .motion-reveal.is-visible[data-motion-stagger] > * {
  opacity: 1 !important;
  transform: none !important;
  filter: none !important;
}

html.motion-ready.motion-reduced [data-motion-stagger] > * {
  opacity: 1 !important;
  transform: none !important;
  filter: none !important;
}

/* ----- Card / panel tilt-ready ----- */
html.motion-ready:not(.motion-reduced) .motion-tilt {
  transition: transform 0.65s var(--ease-out-soft), box-shadow 0.65s ease;
  transform-style: preserve-3d;
  will-change: transform;
}

/* ----- Buttons ----- */
html.motion-ready:not(.motion-reduced) .btn-solid.motion-magnetic,
html.motion-ready:not(.motion-reduced) .btn-ghost.motion-magnetic {
  transition:
    transform 0.65s var(--ease-out-soft),
    background 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease;
}

/* Footer link sweep */
html.motion-ready:not(.motion-reduced) .footer-legal a,
html.motion-ready:not(.motion-reduced) .motion-link-sweep {
  position: relative;
  border-bottom: none !important;
}

html.motion-ready:not(.motion-reduced) .footer-legal a::after,
html.motion-ready:not(.motion-reduced) .motion-link-sweep::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.55s var(--ease-out-expo);
}

html.motion-ready:not(.motion-reduced) .footer-legal a:hover::after,
html.motion-ready:not(.motion-reduced) .motion-link-sweep:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

html.motion-ready:not(.motion-reduced) .motion-legal-scope footer a {
  position: relative;
  border-bottom: none !important;
}

html.motion-ready:not(.motion-reduced) .motion-legal-scope footer a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.55s var(--ease-out-expo);
}

html.motion-ready:not(.motion-reduced) .motion-legal-scope footer a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* ----- Legal wrapper ----- */
.motion-legal-scope .wrap > *:where(h1, p, ul, footer) {
  transition: inherit;
}

/* ----- Header / footer chrome (motion + ambience) ----- */
html.motion-ready:not(.motion-reduced) .site-header .header-top::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 42%,
    rgba(255, 255, 255, 0.09) 50%,
    transparent 58%
  );
  background-size: 220% 100%;
  pointer-events: none;
  opacity: 0.55;
  mix-blend-mode: soft-light;
  animation: motion-chrome-top-sweep 18s linear infinite;
}

@keyframes motion-chrome-top-sweep {
  0% {
    background-position: 220% 0;
  }
  100% {
    background-position: -220% 0;
  }
}

html.motion-ready:not(.motion-reduced) .site-header {
  opacity: 0;
  transform: translate3d(0, -22px, 0);
  transition:
    opacity 1s var(--ease-out-expo),
    transform 1.08s var(--ease-out-expo),
    box-shadow 0.42s ease;
}

html.motion-loaded:not(.motion-reduced) .site-header {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

html.motion-loaded:not(.motion-reduced) .site-header.is-scrolled {
  transition:
    opacity 1s var(--ease-out-expo),
    transform 1.08s var(--ease-out-expo),
    box-shadow 0.42s cubic-bezier(0.2, 0.8, 0.2, 1);
}

html.motion-reduced .site-header {
  opacity: 1 !important;
  transform: none !important;
}

/* Footer ambience + links */
html.motion-ready:not(.motion-reduced) footer.footer::after {
  content: "";
  position: absolute;
  inset: -45% -10% auto -10%;
  height: min(560px, 120%);
  background:
    radial-gradient(ellipse 90% 60% at 50% -10%, rgba(255, 255, 255, 0.12), transparent 58%),
    radial-gradient(circle at 88% 100%, rgba(255, 255, 255, 0.04), transparent 50%);
  pointer-events: none;
  opacity: 0.72;
  mix-blend-mode: soft-light;
  animation: motion-chrome-footer-ambient 20s ease-in-out infinite alternate;
}

@keyframes motion-chrome-footer-ambient {
  0% {
    transform: translate3d(-1.5%, 0, 0) scale(1);
    opacity: 0.65;
  }
  50% {
    transform: translate3d(1.2%, -1.8%, 0) scale(1.02);
    opacity: 0.85;
  }
  100% {
    transform: translate3d(0.4%, -0.4%, 0) scale(1);
    opacity: 0.7;
  }
}

html.motion-ready:not(.motion-reduced) .footer-contact a {
  border-bottom: none !important;
}

html.motion-ready:not(.motion-reduced) .footer-contact a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.55s var(--ease-out-expo);
}

html.motion-ready:not(.motion-reduced) .footer-contact a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Hamburger morph */
.nav-toggle span {
  transition:
    transform 0.42s var(--ease-out-expo),
    opacity 0.28s ease;
}

.nav-toggle.is-open span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

.nav-toggle.is-open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.nav-toggle.is-open span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

@media (prefers-reduced-motion: reduce) {
  .motion-scroll-indicator,
  .motion-grain {
    display: none !important;
  }

  html.motion-ready .site-header .header-top::after {
    animation: none !important;
    opacity: 0 !important;
    display: none !important;
  }

  footer.footer::after {
    animation: none !important;
    display: none !important;
  }
}

html.motion-reduced .motion-grain,
html.motion-reduced .motion-scroll-indicator {
  display: none !important;
}

html.motion-reduced .site-header .header-top::after,
html.motion-reduced footer.footer::after {
  display: none !important;
}

html.motion-reduced .nav-toggle span {
  transition: none !important;
}

html.motion-reduced body {
  opacity: 1 !important;
}

/* Admin visual preview only (?admin_preview=1) — lighter effects, no change to normal visitors */
html.admin-preview .motion-grain,
html.admin-preview .motion-scroll-indicator {
  display: none !important;
}

html.admin-preview.motion-ready body {
  opacity: 1 !important;
  transition: none;
}

html.admin-preview .hero.motion-ambient::before {
  animation: none !important;
}

html.admin-preview .hero.motion-ambient::after {
  animation: none !important;
}
