/* ============================================================
   Motion layer — shared across portfolio pages
   Based on ui-ux-pro-max motion presets (motion.csv):
   - reveal 300–600ms, power-like easing, 8–24px offset
   - stagger ≤ 8 children, 60–80ms each
   - hover/ambient only transform + opacity
   - parallax on decorative layers only, 5–15%
   - always respect prefers-reduced-motion
   ============================================================ */

:root {
  --motion-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --motion-ease-in: cubic-bezier(0.55, 0, 1, 0.45);
  --motion-fast: 180ms;
  --motion-base: 420ms;
  --motion-slow: 640ms;
}

/* Page enter */
@keyframes motionPageIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
html.js-motion body {
  animation: motionPageIn 420ms var(--motion-ease) both;
}

/* Scroll reveal is done with WAAPI; this class only marks that JS is alive.
   Elements stay visible by default if JS fails. */

/* Ambient breathing glow (decorative only) */
@keyframes motionBreath {
  0%, 100% { transform: scale(1); opacity: .72; }
  50% { transform: scale(1.06); opacity: .95; }
}
[data-ambient] {
  animation: motionBreath 6s ease-in-out infinite;
  will-change: transform;
}

/* Magnetic / lift targets */
[data-magnetic] {
  transition: transform var(--motion-base) var(--motion-ease);
  will-change: transform;
}

/* Press feedback for every button-like element */
button,
.cta-button,
.hero-cta,
.checkout-btn,
.add-to-cart,
.send-btn,
.control-btn,
.filter,
.card-link,
.mail {
  transition: transform var(--motion-fast) var(--motion-ease),
              background-color var(--motion-fast) ease,
              color var(--motion-fast) ease,
              border-color var(--motion-fast) ease,
              box-shadow var(--motion-base) ease;
}
button:active,
.cta-button:active,
.hero-cta:active,
.checkout-btn:active,
.add-to-cart:active,
.send-btn:active,
.control-btn:active {
  transform: scale(0.97);
}

/* Nav shrinks on scroll */
nav.is-scrolled {
  padding-top: 14px !important;
  padding-bottom: 14px !important;
  background-color: rgba(10, 10, 10, 0.92) !important;
  backdrop-filter: blur(14px);
}

/* Link underline sweep */
.motion-link {
  position: relative;
  text-decoration: none;
}
.motion-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 1.5px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--motion-base) var(--motion-ease);
}
.motion-link:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Image zoom on hover (transform only) */
.motion-zoom img,
img.motion-zoom {
  transition: transform 900ms var(--motion-ease);
}
.motion-zoom:hover img,
img.motion-zoom:hover {
  transform: scale(1.06);
}

/* Reduced motion: everything resolves instantly */
@media (prefers-reduced-motion: reduce) {
  html.js-motion body { animation: none; }
  [data-ambient] { animation: none; }
  [data-magnetic] { transition: none; }
  button:active,
  .cta-button:active,
  .hero-cta:active,
  .checkout-btn:active,
  .add-to-cart:active,
  .send-btn:active,
  .control-btn:active { transform: none; }
  .motion-link::after { transition: none; }
  .motion-zoom img,
  img.motion-zoom { transition: none; }
  * { scroll-behavior: auto !important; }
}
