/* ============================================================
   Grand Star Electric Inc. — Premium Animations
   Apple-inspired: smooth, purposeful, elegant motion
   ============================================================ */

/* ── Circuit Pattern Background (subtle) ── */
.circuit-bg {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(0,0,0,0.015) 1px, transparent 0);
  background-size: 40px 40px;
  pointer-events: none;
}

/* ── Glow Pulse (refined) ── */
.glow-pulse {
  animation: glowPulse 4s ease-in-out infinite;
}
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 40px 80px rgba(0,0,0,0.12); }
  50% { box-shadow: 0 40px 80px rgba(0,0,0,0.18), 0 0 80px rgba(0,113,227,0.04); }
}

/* ── Staggered Fade In ── */
.stagger-in > * {
  opacity: 0;
  transform: translateY(24px);
}
.stagger-in.animate > * {
  animation: staggerReveal 0.8s var(--ease-out) forwards;
}
.stagger-in.animate > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-in.animate > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-in.animate > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-in.animate > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-in.animate > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-in.animate > *:nth-child(6) { animation-delay: 0.3s; }
@keyframes staggerReveal {
  to { opacity: 1; transform: translateY(0); }
}

/* ── Slide In Variants ── */
.slide-left {
  opacity: 0; transform: translateX(-40px);
  transition: all 1s var(--ease-out);
}
.slide-right {
  opacity: 0; transform: translateX(40px);
  transition: all 1s var(--ease-out);
}
.slide-up {
  opacity: 0; transform: translateY(40px);
  transition: all 1s var(--ease-out);
}
.slide-left.visible, .slide-right.visible, .slide-up.visible {
  opacity: 1; transform: translate(0);
}

/* ── Scale Reveal ── */
.scale-in {
  opacity: 0;
  transform: scale(0.95);
  transition: all 0.8s var(--ease-out);
}
.scale-in.visible {
  opacity: 1;
  transform: scale(1);
}

/* ── Gradient Text Shimmer ── */
.shimmer-text {
  background: linear-gradient(
    90deg,
    var(--navy) 0%,
    var(--blue) 50%,
    var(--navy) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 6s linear infinite;
}
@keyframes shimmer {
  to { background-position: 200% center; }
}

/* ── Hover Lift ── */
.hover-lift {
  transition: transform 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out);
}
.hover-lift:hover {
  transform: translateY(-4px);
}

/* ── Smooth Parallax ── */
.parallax-container {
  position: relative;
  overflow: hidden;
}
.parallax-bg {
  position: absolute;
  inset: -15%;
  will-change: transform;
  transition: transform 0.1s linear;
}

/* ── Morphing Shape (ambient) ── */
.morph-shape {
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(0,113,227,0.03), transparent 70%);
  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  animation: morph 12s ease-in-out infinite;
  pointer-events: none;
}
@keyframes morph {
  0%, 100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; transform: rotate(0deg); }
  33% { border-radius: 58% 42% 75% 25% / 76% 46% 54% 24%; transform: rotate(120deg); }
  66% { border-radius: 50% 50% 33% 67% / 55% 27% 73% 45%; transform: rotate(240deg); }
}

/* ── Smooth counter transition ── */
.counter-animate {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

/* ── Link hover underline animation ── */
.animated-link {
  position: relative;
  display: inline-block;
}
.animated-link::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 100%; height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s var(--ease-out);
}
.animated-link:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* ── Card shine effect on hover ── */
.card-shine {
  position: relative;
  overflow: hidden;
}
.card-shine::after {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: linear-gradient(
    to bottom right,
    transparent 40%,
    rgba(255,255,255,0.03) 50%,
    transparent 60%
  );
  transform: rotate(45deg) translateY(-100%);
  transition: transform 0.8s var(--ease-out);
  pointer-events: none;
}
.card-shine:hover::after {
  transform: rotate(45deg) translateY(0);
}

/* ── Smooth scroll progress bar ── */
.scroll-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--blue);
  transform-origin: left;
  transform: scaleX(0);
  z-index: 999;
  transition: none;
}

/* ── Button press effect ── */
.btn:active {
  transform: scale(0.97);
  transition-duration: 0.1s;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal, .slide-left, .slide-right, .slide-up, .scale-in {
    opacity: 1 !important;
    transform: none !important;
  }
  .stagger-in > * {
    opacity: 1 !important;
    transform: none !important;
  }
}
