/* ==========================================================================
   motion.css — shared Apple-level motion system for ststudiosng
   Pairs with assets/motion.js. All hidden states are gated behind
   html.js-motion (added by JS), so content is fully visible with no-JS.
   ========================================================================== */

:root {
  --ease-apple: cubic-bezier(.22, 1, .36, 1);
  --m-duration: .9s;
}

/* ---------- Clean full-width white navbar ---------------------------------------
   Clear white bar, edge to edge. Soft shadow settles in once you scroll. */
header #siteNav.light-purple-glass {
  background: #ffffff;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border: none;
  border-bottom: 1px solid rgba(147, 51, 234, .14);
  border-radius: 0;
  box-shadow: none;
  transition: box-shadow .3s ease;
}
header #siteNav.light-purple-glass.nav-scrolled {
  background: #ffffff;
  box-shadow: 0 12px 32px -14px rgba(76, 29, 149, .22);
}

/* ---------- Scroll reveals ------------------------------------------------ */
html.js-motion [data-motion] {
  opacity: 0;
  will-change: opacity, transform, filter;
}
html.js-motion [data-motion="rise"]  { transform: translateY(28px); }
html.js-motion [data-motion="blur"]  { transform: translateY(18px); filter: blur(10px); }
html.js-motion [data-motion="scale"] { transform: translateY(16px) scale(.94); }
html.js-motion [data-motion="left"]  { transform: translateX(-36px); }
html.js-motion [data-motion="right"] { transform: translateX(36px); }
html.js-motion [data-motion="zoom"]  { transform: scale(1.10); }
/* Pure fade — no travel, just materialises */
html.js-motion [data-motion="fade"]  { transform: none; }
/* Drop from above */
html.js-motion [data-motion="down"]  { transform: translateY(-30px); }
/* Springy jump — overshoots like a physical object */
html.js-motion [data-motion="jump"]  { transform: translateY(44px) scale(.95); }
/* Bouncy pop straight at the viewer */
html.js-motion [data-motion="pop"]   { transform: scale(.55); }
/* 3D flip up from the floor */
html.js-motion [data-motion="flip"]  { transform: perspective(700px) rotateX(58deg); transform-origin: 50% 100%; }
/* Spinning badge entrance */
html.js-motion [data-motion="spin"]  { transform: scale(.4) rotate(-40deg); }
/* Playful swing settle */
html.js-motion [data-motion="swing"] { transform: translateY(18px) rotate(2.5deg); }
/* Cinematic clip-wipe reveals (transform-free, safe on parallaxed images) */
html.js-motion [data-motion="wipe"]   { transform: none; clip-path: inset(0 0 100% 0); }
html.js-motion [data-motion="wipe-x"] { transform: none; clip-path: inset(0 100% 0 0); }

html.js-motion [data-motion].is-in {
  opacity: 1;
  transform: none;
  filter: none;
  clip-path: none;
  transition:
    opacity .45s var(--ease-apple),
    transform .65s var(--ease-apple),
    filter .45s var(--ease-apple),
    clip-path .65s var(--ease-apple);
  transition-delay: var(--m-delay, 0ms);
}
/* Wipe reveals are the only variants animated with clip-path — keep their
   final inset so the wipe transition never snaps to a non-interpolable value.
   (A generic inset(0) on every .is-in clipped absolutely-positioned children
   that overflow their card, e.g. the "Most Popular" pricing badge.) */
html.js-motion [data-motion="wipe"].is-in,
html.js-motion [data-motion="wipe-x"].is-in {
  clip-path: inset(0 0 0 0);
}
/* Spring physics for the bouncy family */
html.js-motion [data-motion="jump"].is-in,
html.js-motion [data-motion="pop"].is-in,
html.js-motion [data-motion="spin"].is-in {
  transition:
    opacity .4s var(--ease-apple),
    transform .75s cubic-bezier(.34, 1.3, .4, 1),
    filter .4s var(--ease-apple),
    clip-path .65s var(--ease-apple);
  transition-delay: var(--m-delay, 0ms);
}

/* ---------- Split headlines (word-mask cascade) ---------------------------- */
html.js-motion [data-split] .m-w {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  padding-bottom: .12em;
  margin-bottom: -.12em;
}
html.js-motion [data-split] .m-wi {
  display: inline-block;
  transform: translateY(112%);
  will-change: transform;
}
html.js-motion [data-split].is-in .m-wi {
  transform: translateY(0);
  transition: transform .65s var(--ease-apple);
  transition-delay: var(--m-delay, 0ms);
}

/* ---------- Hero entrance -------------------------------------------------- */
html.js-motion [data-hero-item] {
  opacity: 0;
  transform: translateY(22px);
  filter: blur(6px);
}
html.js-motion [data-hero-item].is-in {
  opacity: 1;
  transform: none;
  filter: none;
  transition:
    opacity .5s var(--ease-apple),
    transform .7s var(--ease-apple),
    filter .5s var(--ease-apple);
  transition-delay: var(--m-delay, 0ms);
}

/* Slow Ken Burns drift for hero media (subtle, luxurious) */
@keyframes m-kb {
  from { transform: scale(1); }
  to   { transform: scale(1.09); }
}
.m-kenburns {
  animation: m-kb 18s ease-in-out infinite alternate;
  will-change: transform;
}

/* ---------- Magnetic buttons ------------------------------------------------ */
.m-magnetic {
  transition: transform .22s var(--ease-apple), box-shadow .25s var(--ease-apple), background-color .2s var(--ease-apple);
  will-change: transform;
}

/* ---------- Shine sweep on cards / buttons ---------------------------------- */
.m-shine {
  position: relative;
  overflow: hidden;
}
.m-shine::after {
  content: "";
  position: absolute;
  inset: -20%;
  background: linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, .35) 50%, transparent 58%);
  transform: translateX(-130%);
  pointer-events: none;
}
.m-shine:hover::after {
  transform: translateX(130%);
  transition: transform .5s var(--ease-apple);
}

/* ---------- Tilt cards ------------------------------------------------------- */
[data-tilt] {
  transform-style: preserve-3d;
  will-change: transform;
}

/* ---------- Scroll progress hairline ----------------------------------------- */
#mProgress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 100%;
  z-index: 70;
  background: linear-gradient(90deg, #9333ea, #d946ef);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

/* ---------- Back-to-top ------------------------------------------------------- */
#mTop {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 60;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .85);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(147, 51, 234, .25);
  color: #7e22ce;
  box-shadow: 0 12px 30px -10px rgba(147, 51, 234, .45);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity .25s var(--ease-apple), transform .35s var(--ease-apple);
}
#mTop.show {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
#mTop:hover { transform: translateY(-3px); }

/* ---------- Marquee edge fade -------------------------------------------------- */
.m-edges {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

/* ---------- FAQ open animation -------------------------------------------------- */
details summary { cursor: pointer; }
details[open] summary ~ * {
  animation: m-faq .3s var(--ease-apple);
}
@keyframes m-faq {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Modal entrance (replaces no-op Tailwind animate classes) -------------- */
@keyframes m-pop {
  from { opacity: 0; transform: translateY(26px) scale(.96); }
  to   { opacity: 1; transform: none; }
}
.m-pop { animation: m-pop .4s var(--ease-apple); }
@keyframes m-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.m-fade { animation: m-fade .2s var(--ease-apple); }

/* ---------- Gentle page intro ---------------------------------------------------- */
@keyframes m-page { from { opacity: 0; } to { opacity: 1; } }
body { animation: m-page .3s var(--ease-apple); }

/* Slow left-to-right reveal sweep for wide hero imagery on phones.
   Scale buffer keeps edges covered while panning. */
@keyframes m-panx {
  from { transform: scale(1.18) translateX(4%); }
  to   { transform: scale(1.18) translateX(-4%); }
}
@media (max-width: 639.98px) {
  .m-pan-x {
    animation: m-panx 12s ease-in-out infinite alternate;
    will-change: transform;
  }
}

/* ---------- Mobile perf: flatten glass, kill skew --------------------------------------
   backdrop-blur over dozens of moving marquee cards janks phones.
   Solid panels on small/coarse screens; skew lean removed entirely so
   cards always sit upright. */
@media (max-width: 768px), (pointer: coarse) {
  .light-purple-glass {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: rgba(255, 255, 255, .96);
  }
}

/* ---------- Animated service icons (self-contained inline SVG) --------------------- */
@keyframes ai-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
@keyframes ai-wiggle {
  0%, 100% { transform: rotate(-9deg); }
  50% { transform: rotate(9deg); }
}
@keyframes ai-pop {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}
@keyframes ai-spin {
  to { transform: rotate(360deg); }
}
.ai-bob { animation: ai-bob 2.4s ease-in-out infinite; }
.ai-wiggle { animation: ai-wiggle 2s ease-in-out infinite; transform-origin: 70% 30%; }
.ai-pop { animation: ai-pop 2.2s ease-in-out infinite; }
.ai-spin { animation: ai-spin 10s linear infinite; }

/* ---------- Modal gallery cascade ------------------------------------------------ */
#modalGallery > div {
  animation: m-cardin .45s var(--ease-apple) backwards;
}
#modalGallery > div:nth-child(2) { animation-delay: .04s; }
#modalGallery > div:nth-child(3) { animation-delay: .08s; }
#modalGallery > div:nth-child(4) { animation-delay: .12s; }
#modalGallery > div:nth-child(5) { animation-delay: .16s; }
#modalGallery > div:nth-child(6) { animation-delay: .2s; }
#modalGallery > div:nth-child(7) { animation-delay: .24s; }
#modalGallery > div:nth-child(n+8) { animation-delay: .28s; }
@keyframes m-cardin {
  from { opacity: 0; transform: translateY(26px) scale(.95); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Reduced motion: everything visible, nothing moves --------------------- */
@media (prefers-reduced-motion: reduce) {
  html.js-motion [data-motion],
  html.js-motion [data-hero-item] {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    clip-path: none !important;
    transition: none !important;
  }
  html.js-motion [data-split] .m-wi { transform: none !important; transition: none !important; }
  .m-kenburns, body, .m-pop, .m-fade { animation: none !important; }
  .m-magnetic { transition: none !important; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
