/* ==========================================================================
   NEXT-LEVEL ANIMATIONS ENGINE - MOHD IRSHAD PORTFOLIO
   Cinematic Preloader, Staggered Hero Entrance, Scroll Reveals & Micro-Interactions
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. TOP SCROLL PROGRESS BAR
   -------------------------------------------------------------------------- */
.scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3.5px;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #9333ea, #ec4899, #f97316);
  z-index: 99999;
  box-shadow: 0 0 12px rgba(236, 72, 153, 0.6);
  transition: width 0.1s cubic-bezier(0.2, 0, 0, 1);
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   2. LUXURY CINEMATIC PRELOADER
   -------------------------------------------------------------------------- */
.luxury-preloader {
  position: fixed;
  inset: 0;
  background: #090d16;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity 0.8s cubic-bezier(0.77, 0, 0.175, 1), visibility 0.8s ease, transform 0.8s cubic-bezier(0.77, 0, 0.175, 1);
}

.luxury-preloader.fade-out {
  opacity: 0;
  visibility: hidden;
  transform: scale(1.06);
  pointer-events: none;
}

/* Preloader Ambient Pulsing Orbs */
.preloader-glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
}
.preloader-glow-1 {
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.35), transparent 70%);
  animation: orbPulse 4s ease-in-out infinite alternate;
}
.preloader-glow-2 {
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.3), transparent 70%);
  animation: orbPulse 4s ease-in-out 1.5s infinite alternate-reverse;
}

@keyframes orbPulse {
  0% { transform: scale(0.85) translate(-20px, -20px); opacity: 0.6; }
  100% { transform: scale(1.25) translate(20px, 20px); opacity: 0.9; }
}

/* Preloader Center Content */
.preloader-center-box {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Glowing Monogram Logo */
.preloader-logo-wrap {
  width: 86px;
  height: 60px;
  margin-bottom: 1.5rem;
  position: relative;
  filter: drop-shadow(0 0 20px rgba(249, 115, 22, 0.45));
}
.preloader-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.preloader-svg path {
  stroke-dasharray: 180;
  stroke-dashoffset: 180;
  animation: dashDraw 1.4s cubic-bezier(0.65, 0, 0.35, 1) forwards infinite alternate;
}

@keyframes dashDraw {
  0% { stroke-dashoffset: 180; }
  100% { stroke-dashoffset: 0; }
}

/* Preloader Percentage & Text */
.preloader-title {
  font-family: var(--font-sans);
  font-size: 1.6rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.5px;
  margin-bottom: 0.3rem;
}
.preloader-title span {
  background: linear-gradient(135deg, #a855f7, #ec4899, #f97316);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.preloader-subtitle {
  font-size: 0.84rem;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

/* Preloader Progress Bar Line */
.preloader-progress-track {
  width: 220px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  margin-bottom: 0.8rem;
}
.preloader-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899, #f97316);
  border-radius: 9999px;
  transition: width 0.15s ease;
  box-shadow: 0 0 12px #ec4899;
}

.preloader-percent-number {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  color: #e2e8f0;
  letter-spacing: 1px;
}

/* --------------------------------------------------------------------------
   3. HERO ENTRANCE CASCADE ANIMATIONS (TRIGGERED ON PAGE LOAD)
   -------------------------------------------------------------------------- */
body:not(.page-loaded) .navbar {
  transform: translateY(-40px);
  opacity: 0;
}
body.page-loaded .navbar {
  transform: translateY(0);
  opacity: 1;
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.8s ease;
}

body:not(.page-loaded) .hero-left > * {
  opacity: 0;
  transform: translateY(30px);
}

body.page-loaded .welcome-badge {
  animation: heroFadeDown 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.15s forwards;
}
body.page-loaded .hero-hi {
  animation: heroFadeDown 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.25s forwards;
}
body.page-loaded .hero-name-gradient {
  animation: heroFadeDown 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.35s forwards;
}
body.page-loaded .typewriter-box {
  animation: heroFadeDown 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.45s forwards;
}
body.page-loaded .hero-subtext {
  animation: heroFadeDown 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.55s forwards;
}
body.page-loaded .hero-cta-row {
  animation: heroFadeDown 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.65s forwards;
}

/* Staggered Entrance for Hero 4 Stats Cards */
body.page-loaded .hero-stats-grid .stat-item-card:nth-child(1) {
  animation: heroStatPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.75s forwards;
}
body.page-loaded .hero-stats-grid .stat-item-card:nth-child(2) {
  animation: heroStatPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.85s forwards;
}
body.page-loaded .hero-stats-grid .stat-item-card:nth-child(3) {
  animation: heroStatPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.95s forwards;
}
body.page-loaded .hero-stats-grid .stat-item-card:nth-child(4) {
  animation: heroStatPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 1.05s forwards;
}

/* Staggered Entrance for Hero Right Cutout & Aura */
body:not(.page-loaded) .hero-composition-box {
  opacity: 0;
  transform: scale(0.9) translateY(40px);
}
body.page-loaded .hero-composition-box {
  animation: heroImageEnter 1s cubic-bezier(0.16, 1, 0.3, 1) 0.4s forwards;
}

@keyframes heroFadeDown {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes heroStatPop {
  0% {
    opacity: 0;
    transform: translateY(25px) scale(0.85);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes heroImageEnter {
  0% {
    opacity: 0;
    transform: scale(0.88) translateY(40px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* --------------------------------------------------------------------------
   4. INTERACTIVE GRADIENT TEXT SHIMMER ON NAME
   -------------------------------------------------------------------------- */
.hero-name-gradient {
  background-size: 200% auto !important;
  animation: shimmerGradient 6s linear infinite alternate !important;
}

@keyframes shimmerGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* --------------------------------------------------------------------------
   5. DYNAMIC SCROLL REVEAL ANIMATION ENGINE
   -------------------------------------------------------------------------- */
.reveal-on-scroll {
  opacity: 0 !important;
  transform: translateY(45px) scale(0.97) !important;
  transition: opacity 0.85s cubic-bezier(0.16, 1, 0.3, 1), transform 0.85s cubic-bezier(0.16, 1, 0.3, 1) !important;
  will-change: opacity, transform;
}

.reveal-on-scroll.revealed {
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
}

/* Staggered animation delays for child cards inside revealed grids */
.reveal-on-scroll.revealed .expertise-skill-card:nth-child(1),
.reveal-on-scroll.revealed .project-item-card:nth-child(1),
.reveal-on-scroll.revealed .service-premium-card:nth-child(1),
.reveal-on-scroll.revealed .testimonial-exact-card:nth-child(1),
.reveal-on-scroll.revealed .process-step-card:nth-child(1) {
  animation: cardFadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
}

.reveal-on-scroll.revealed .expertise-skill-card:nth-child(2),
.reveal-on-scroll.revealed .project-item-card:nth-child(2),
.reveal-on-scroll.revealed .service-premium-card:nth-child(2),
.reveal-on-scroll.revealed .testimonial-exact-card:nth-child(2),
.reveal-on-scroll.revealed .process-step-card:nth-child(2) {
  animation: cardFadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.18s both;
}

.reveal-on-scroll.revealed .expertise-skill-card:nth-child(3),
.reveal-on-scroll.revealed .project-item-card:nth-child(3),
.reveal-on-scroll.revealed .service-premium-card:nth-child(3),
.reveal-on-scroll.revealed .testimonial-exact-card:nth-child(3),
.reveal-on-scroll.revealed .process-step-card:nth-child(3) {
  animation: cardFadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.30s both;
}

.reveal-on-scroll.revealed .expertise-skill-card:nth-child(4),
.reveal-on-scroll.revealed .project-item-card:nth-child(4),
.reveal-on-scroll.revealed .process-step-card:nth-child(4) {
  animation: cardFadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.42s both;
}

.reveal-on-scroll.revealed .expertise-skill-card:nth-child(5),
.reveal-on-scroll.revealed .project-item-card:nth-child(5) {
  animation: cardFadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.54s both;
}

.reveal-on-scroll.revealed .expertise-skill-card:nth-child(6),
.reveal-on-scroll.revealed .project-item-card:nth-child(6) {
  animation: cardFadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.66s both;
}

@keyframes cardFadeUp {
  0% {
    opacity: 0;
    transform: translateY(35px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* --------------------------------------------------------------------------
   6. FLOATING PULSE & GLOW MICRO-INTERACTIONS
   -------------------------------------------------------------------------- */
.hero-floating-quote, .hero-floating-freelance, .about-float-badge {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.hero-floating-quote:hover, .hero-floating-freelance:hover, .about-float-badge:hover {
  transform: scale(1.08) translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

/* Magnetic Pulse for CTA Buttons */
.btn-cv, .btn-touch, .btn-hire-nav {
  position: relative;
  overflow: hidden;
}

.btn-cv::after, .btn-touch::after, .btn-hire-nav::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    60deg,
    transparent 20%,
    rgba(255, 255, 255, 0.35) 50%,
    transparent 80%
  );
  transform: rotate(30deg) translateX(-100%);
  transition: transform 0.6s ease;
}

.btn-cv:hover::after, .btn-touch:hover::after, .btn-hire-nav:hover::after {
  transform: rotate(30deg) translateX(100%);
}
