/* Keyframes */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-24px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74,158,255,0.4); }
  50%       { box-shadow: 0 0 0 8px rgba(74,158,255,0); }
}
@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-12px); }
}
@keyframes gradient-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-left {
  opacity: 0;
  transform: translateX(-28px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal-left.visible { opacity: 1; transform: translateX(0); }

/* Stagger delays for grid children */
.stagger > *:nth-child(1) { transition-delay: 0ms; }
.stagger > *:nth-child(2) { transition-delay: 80ms; }
.stagger > *:nth-child(3) { transition-delay: 160ms; }
.stagger > *:nth-child(4) { transition-delay: 240ms; }
.stagger > *:nth-child(5) { transition-delay: 320ms; }
.stagger > *:nth-child(6) { transition-delay: 400ms; }

/* Hero entrance */
.hero-animate { animation: fadeInUp 0.8s ease both; }
.hero-animate--1 { animation-delay: 0.1s; }
.hero-animate--2 { animation-delay: 0.25s; }
.hero-animate--3 { animation-delay: 0.4s; }
.hero-animate--4 { animation-delay: 0.55s; }
.hero-animate--5 { animation-delay: 0.7s; }

/* Circuit / dot grid background for hero */
.bg-grid {
  background-image:
    radial-gradient(circle at 1px 1px, rgba(74,158,255,0.15) 1px, transparent 0);
  background-size: 32px 32px;
}
.bg-circuit {
  background-image:
    linear-gradient(rgba(74,158,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74,158,255,0.04) 1px, transparent 1px);
  background-size: 64px 64px;
}

/* Glow orbs */
.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}
.glow-orb--blue {
  background: rgba(74,158,255,0.18);
  width: 600px; height: 600px;
}
.glow-orb--primary {
  background: rgba(27,58,107,0.4);
  width: 800px; height: 800px;
}

/* Rotating gear / float */
.icon-spin { animation: spin-slow 20s linear infinite; }
.icon-float { animation: float 4s ease-in-out infinite; }

/* Accent gradient text */
.gradient-text {
  color: var(--color-accent); /* fallback */
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Pulse indicator */
.pulse { animation: pulse-dot 2s ease-in-out infinite; }

/* Animated border */
.border-animate {
  position: relative;
}
.border-animate::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--color-accent), transparent, var(--color-accent));
  opacity: 0;
  transition: opacity var(--transition-base);
  z-index: -1;
}
.border-animate:hover::before { opacity: 1; }

/* Marquee / infinite scroll */
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee 28s linear infinite;
}
.marquee-track:hover { animation-play-state: paused; }
.marquee-wrapper {
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
}

/* Shimmer loading / highlight */
@keyframes shimmer {
  from { background-position: -200% center; }
  to   { background-position: 200% center; }
}
.shimmer-text {
  background: linear-gradient(90deg, var(--color-white) 0%, var(--color-accent) 45%, var(--color-purple) 55%, var(--color-white) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 4s linear infinite;
}

/* Email card tilt on hover */
@keyframes tiltIn {
  from { transform: perspective(800px) rotateY(-8deg) rotateX(4deg); opacity: 0; }
  to   { transform: perspective(800px) rotateY(0deg) rotateX(0deg); opacity: 1; }
}
.email-card-enter { animation: tiltIn 0.7s ease both; }

/* Typewriter cursor blink */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
.cursor-blink::after {
  content: '|';
  animation: blink 1s step-end infinite;
  color: var(--color-accent);
  margin-left: 2px;
}

/* Counter up (already handled in JS, but this adds a glow on visible) */
.stat.visible { text-shadow: 0 0 20px rgba(74,158,255,0.4); }

/* Reveal from right */
.reveal-right {
  opacity: 0;
  transform: translateX(28px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal-right.visible { opacity: 1; transform: translateX(0); }

/* Scale up reveal */
.reveal-scale {
  opacity: 0;
  transform: scale(0.94);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal-scale.visible { opacity: 1; transform: scale(1); }

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal-left, .reveal-right, .reveal-scale { transition: none; opacity: 1; transform: none; }
  .hero-animate { animation: none; opacity: 1; }
  .pulse { animation: none; }
  html { scroll-behavior: auto; }
  .icon-spin, .icon-float { animation: none; }
  .marquee-track { animation: none; }
  .shimmer-text { animation: none; -webkit-text-fill-color: var(--color-white); }
  .email-card-enter { animation: none; opacity: 1; transform: none; }
  .cursor-blink::after { animation: none; }
}
