/* ============================================================
   animations.css — keyframes, scroll-reveal, reduced motion
   ============================================================ */

/* ---------- Keyframes ---------- */
@keyframes caret-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes scroll-pulse {
  0%, 100% { opacity: 0.3; transform: scaleY(0.6); transform-origin: top; }
  50% { opacity: 1; transform: scaleY(1); }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes page-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Page entrance after the loader finishes */
body.is-loaded main,
body.is-loaded .nav,
body.is-loaded .footer {
  animation: page-in 700ms ease both;
}

/* ---------- Scroll reveal (Intersection Observer adds .visible) ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  filter: blur(6px);
  transition:
    opacity 700ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 700ms cubic-bezier(0.22, 1, 0.36, 1),
    filter 700ms cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

/* Staggered children: JS assigns --reveal-delay per sibling group */

/* ---------- 3D tilt (JS drives the custom properties) ---------- */
[data-tilt] {
  transform: perspective(800px)
             rotateX(var(--tilt-x, 0deg))
             rotateY(var(--tilt-y, 0deg));
  transition: transform 250ms ease;
}

/* ---------- Process line ---------- */
.process__line-fill { transition: width 300ms linear; }

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
    filter: none;
  }

  .hero__caret,
  .hero__scroll-line,
  .about__ring { animation: none; }

  .cursor-dot,
  .cursor-ring,
  .grain { display: none; }

  .skill.is-animated .skill__fill { transition: none; }
}
