/*
 * Motion effects — shared by invatechbd.com and mehedi.invatechbd.com (see js/motion.js).
 * Colours come from the site: --fx-c1 / --fx-c2 (falls back to Invatech blue and red).
 * Nothing here runs for visitors who ask for reduced motion.
 */

/* 1. Page transitions between pages of the same site (Chrome, Edge, Safari 18+; others just load normally) */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: fxPageOut .22s cubic-bezier(.4, 0, 1, 1) both; }
  ::view-transition-new(root) { animation: fxPageIn .38s cubic-bezier(.2, .7, .2, 1) both; }
}
@keyframes fxPageOut { to { opacity: 0; transform: translateY(-10px); } }
@keyframes fxPageIn { from { opacity: 0; transform: translateY(14px); } }

/* 2. Smooth scrolling is done by motion.js, so the browser's own smooth scroll is switched off to avoid double easing */
html.fx-smooth { scroll-behavior: auto !important; }

/* 3. Headings: each word rises out of a soft blur, one after another */
.fx-head .fx-w { display: inline; }
.fx-head .fx-w > span { display: inline-block; transition: opacity .7s cubic-bezier(.2, .7, .2, 1), transform .8s cubic-bezier(.2, .7, .2, 1), filter .7s ease;
  transition-delay: calc(var(--wi, 0) * 55ms + 80ms); }
.fx-head:not(.fx-in) .fx-w > span { opacity: 0; transform: translateY(.5em) rotate(2deg); filter: blur(8px); }
/* Gradient text and word rotators stay inline (they may wrap over two lines): fade + blur only */
.fx-head .fx-whole > span { display: inline; }
.fx-head:not(.fx-in) .fx-whole > span { transform: none; }

/* 4. Scroll-linked: visuals grow into place as they scroll in; a thin reading-progress bar at the top */
.fx-progress { position: fixed; top: 0; left: 0; right: 0; z-index: 2000; height: 3px; pointer-events: none; transform: scaleX(0); transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--fx-c1, #1677b8), var(--fx-c2, #e64746)); }
@supports (animation-timeline: scroll()) {
  .fx-progress { animation: fxProgress linear both; animation-timeline: scroll(root); }
  .fx .fx-scroll { animation: fxRise linear both; animation-timeline: view(); animation-range: entry 0% cover 30%; }
}
@keyframes fxProgress { to { transform: scaleX(1); } }
@keyframes fxRise { from { scale: .94; translate: 0 28px; } to { scale: 1; translate: 0 0; } }

/* 5. Cards: 3D tilt toward the mouse + a glowing border that follows it (desktop mouse only) */
.fx-card { position: relative; }
html.fx .fx-card.fx-hot { transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-4px); transition: transform .15s ease-out, box-shadow .4s, border-color .3s; }
.fx-glow { position: absolute; inset: 0; z-index: 3; padding: 1.5px; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .35s;
  background: radial-gradient(260px circle at var(--gx, 50%) var(--gy, 50%), var(--fx-c1, #1677b8), var(--fx-c2, #e64746) 45%, transparent 72%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude; }
.fx-card.fx-hot .fx-glow { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .fx-progress, .fx-glow { display: none; }
}
@media print {
  .fx-progress, .fx-glow { display: none; }
}
