/* ─────────────────────────────────────────────────────────────
   Motion system — shared by every page.
   Scroll reveal, hero entrance, animated counters, scroll progress.
   Only transform/opacity are animated (GPU friendly), and the whole
   thing is disabled when the user prefers reduced motion.
   ───────────────────────────────────────────────────────────── */

/* Elements are only hidden once JS is confirmed working, so a script
   failure never leaves the page blank. */
html.js .reveal {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity 0.7s cubic-bezier(0.22, 0.61, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: opacity, transform;
}
html.js .reveal.in {
  opacity: 1;
  transform: none;
}
html.js .reveal[data-delay="1"] { transition-delay: 0.08s; }
html.js .reveal[data-delay="2"] { transition-delay: 0.16s; }
html.js .reveal[data-delay="3"] { transition-delay: 0.24s; }
html.js .reveal[data-delay="4"] { transition-delay: 0.32s; }

/* Hero entrance — slightly longer, from further down. */
html.js .hero-in {
  opacity: 0;
  transform: translateY(18px);
  animation: heroIn 0.9s cubic-bezier(0.22, 0.61, 0.36, 1) 0.05s forwards;
}
html.js .hero-in[data-delay="1"] { animation-delay: 0.15s; }
html.js .hero-in[data-delay="2"] { animation-delay: 0.28s; }
html.js .hero-in[data-delay="3"] { animation-delay: 0.41s; }
@keyframes heroIn {
  to { opacity: 1; transform: none; }
}

/* Animated stat counters: the number pops in with the card. */
html.js .stat-value[data-count] {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
html.js .stat-value[data-count].counted {
  opacity: 1;
  transform: none;
}

/* Scroll progress bar (injected by motion.js). */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--primary), var(--tech));
  z-index: 9999;
  transition: width 0.1s linear;
  pointer-events: none;
}

/* Nav: subtle underline that grows on hover / for the current page. */
.nav-links a {
  position: relative;
}
.nav-links a::after {
  content: '';
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 6px;
  height: 2px;
  border-radius: 2px;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.nav-links a:hover::after,
.nav-links a.active::after {
  transform: scaleX(1);
}

/* Card lift already exists on most pages; add a soft glow on hover. */
.card:hover,
.app-card:hover,
.service-card:hover,
.stat-card:hover {
  border-color: var(--primary);
}

/* Respect the user's motion setting — everything visible, no animation. */
@media (prefers-reduced-motion: reduce) {
  html.js .reveal,
  html.js .hero-in,
  html.js .stat-value[data-count] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
  }
  html { scroll-behavior: auto; }
}
