/* =============================================
   NERHOR - ĐÈN SÂN KHẤU HCM
   Animations & Effects v1.0
   Premium micro-interactions & visual effects
   ============================================= */

/* ===========================================
   SECTION 1: KEYFRAME ANIMATIONS
   =========================================== */

/* --- Phone Icon Pulse --- */
@keyframes pulse-phone {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
}

/* --- Phone Button Ring Pulse --- */
@keyframes pulse-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.5);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(0, 230, 118, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 230, 118, 0);
  }
}

/* --- Neon Glow Pulse (uses --accent-rgb) --- */
@keyframes glow-pulse {
  0%, 100% {
    box-shadow:
      0 0 10px rgba(var(--accent-rgb), 0.15),
      0 0 30px rgba(var(--accent-rgb), 0.1),
      0 0 60px rgba(var(--accent-rgb), 0.05);
  }
  50% {
    box-shadow:
      0 0 15px rgba(var(--accent-rgb), 0.3),
      0 0 40px rgba(var(--accent-rgb), 0.2),
      0 0 80px rgba(var(--accent-rgb), 0.1);
  }
}

/* --- Gentle Floating --- */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* --- Shimmer / Skeleton Loading --- */
@keyframes shimmer {
  0% {
    background-position: -400px 0;
  }
  100% {
    background-position: 400px 0;
  }
}

/* --- Fade In + Translate Up (Scroll Reveal) --- */
@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Simple Fade In --- */
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* --- Slide In From Right --- */
@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(60px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* --- Neon Flicker --- */
@keyframes neon-flicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
    opacity: 1;
    text-shadow:
      0 0 7px rgba(var(--accent-rgb), 0.6),
      0 0 20px rgba(var(--accent-rgb), 0.4),
      0 0 40px rgba(var(--accent-rgb), 0.2);
  }
  20%, 24%, 55% {
    opacity: 0.85;
    text-shadow:
      0 0 4px rgba(var(--accent-rgb), 0.3),
      0 0 12px rgba(var(--accent-rgb), 0.15);
  }
}

/* --- Slow Continuous Rotation --- */
@keyframes rotate-slow {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* --- Scale In (for modals, popups) --- */
@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* --- Checkmark Draw (SVG stroke animation) --- */
@keyframes checkmark-draw {
  0% {
    stroke-dashoffset: 80;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

/* --- Bounce Subtle --- */
@keyframes bounce-subtle {
  0%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-6px);
  }
  50% {
    transform: translateY(-3px);
  }
}

/* --- Gradient Shift (for animated backgrounds) --- */
@keyframes gradient-shift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* --- Ripple (for button click effect) --- */
@keyframes ripple {
  from {
    transform: scale(0);
    opacity: 0.5;
  }
  to {
    transform: scale(4);
    opacity: 0;
  }
}


/* ===========================================
   SECTION 2: SCROLL REVEAL ANIMATIONS
   =========================================== */

/* --- Animate on Scroll (base class) --- */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.animate-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Scroll reveal variant: fade only --- */
.animate-on-scroll.fade-only {
  transform: none;
}

/* --- Scroll reveal variant: from left --- */
.animate-on-scroll.from-left {
  transform: translateX(-40px);
}

.animate-on-scroll.from-left.is-visible {
  transform: translateX(0);
}

/* --- Scroll reveal variant: from right --- */
.animate-on-scroll.from-right {
  transform: translateX(40px);
}

.animate-on-scroll.from-right.is-visible {
  transform: translateX(0);
}

/* --- Scroll reveal variant: scale up --- */
.animate-on-scroll.scale-up {
  transform: scale(0.9);
}

.animate-on-scroll.scale-up.is-visible {
  transform: scale(1);
}

/* --- Stagger Animation Delays --- */
.stagger-1 { transition-delay: 100ms; }
.stagger-2 { transition-delay: 200ms; }
.stagger-3 { transition-delay: 300ms; }
.stagger-4 { transition-delay: 400ms; }
.stagger-5 { transition-delay: 500ms; }
.stagger-6 { transition-delay: 600ms; }


/* ===========================================
   SECTION 3: PARALLAX & BACKGROUND EFFECTS
   =========================================== */

/* --- Parallax Background Wrapper --- */
.parallax-bg {
  position: relative;
  overflow: hidden;
}

.parallax-bg::before {
  content: '';
  position: absolute;
  inset: -20% 0;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  z-index: 0;
  will-change: transform;
}

/* Parallax speed variants */
.parallax-slow::before {
  animation: none;
  /* JS controlled via transform: translateY() */
}

.parallax-overlay {
  position: relative;
  z-index: 1;
}

/* --- Particle / Dot Background Effect --- */
.particle-bg {
  position: relative;
}

.particle-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 10% 20%, rgba(var(--accent-rgb), 0.3) 50%, transparent 50%),
    radial-gradient(1px 1px at 30% 65%, rgba(var(--accent-rgb), 0.2) 50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 55% 15%, rgba(255,255,255,0.15) 50%, transparent 50%),
    radial-gradient(1px 1px at 70% 75%, rgba(var(--accent-rgb), 0.25) 50%, transparent 50%),
    radial-gradient(2px 2px at 85% 35%, rgba(var(--accent-rgb), 0.15) 50%, transparent 50%),
    radial-gradient(1px 1px at 15% 80%, rgba(255,255,255,0.1) 50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 45% 45%, rgba(var(--accent-rgb), 0.2) 50%, transparent 50%),
    radial-gradient(1px 1px at 90% 60%, rgba(255,255,255,0.12) 50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 25% 40%, rgba(var(--accent-rgb), 0.18) 50%, transparent 50%),
    radial-gradient(1px 1px at 60% 90%, rgba(255,255,255,0.1) 50%, transparent 50%);
  pointer-events: none;
  z-index: 0;
  animation: float 8s ease-in-out infinite;
}

.particle-bg > * {
  position: relative;
  z-index: 1;
}

/* Dense particle variant */
.particle-bg-dense::before {
  background-image:
    radial-gradient(1px 1px at 5% 10%, rgba(var(--accent-rgb), 0.3) 50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 12% 30%, rgba(255,255,255,0.12) 50%, transparent 50%),
    radial-gradient(1px 1px at 20% 55%, rgba(var(--accent-rgb), 0.25) 50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 28% 80%, rgba(var(--accent-rgb), 0.2) 50%, transparent 50%),
    radial-gradient(1px 1px at 35% 20%, rgba(255,255,255,0.1) 50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 42% 65%, rgba(var(--accent-rgb), 0.22) 50%, transparent 50%),
    radial-gradient(1px 1px at 50% 40%, rgba(255,255,255,0.15) 50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 58% 85%, rgba(var(--accent-rgb), 0.18) 50%, transparent 50%),
    radial-gradient(1px 1px at 65% 15%, rgba(var(--accent-rgb), 0.28) 50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 72% 50%, rgba(255,255,255,0.1) 50%, transparent 50%),
    radial-gradient(1px 1px at 80% 70%, rgba(var(--accent-rgb), 0.2) 50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 88% 25%, rgba(255,255,255,0.12) 50%, transparent 50%),
    radial-gradient(1px 1px at 95% 60%, rgba(var(--accent-rgb), 0.24) 50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 50% 95%, rgba(255,255,255,0.08) 50%, transparent 50%);
}


/* ===========================================
   SECTION 4: NEON & GLOW EFFECTS
   =========================================== */

/* --- Neon Text Glow --- */
.neon-text {
  color: var(--accent);
  text-shadow:
    0 0 7px rgba(var(--accent-rgb), 0.6),
    0 0 20px rgba(var(--accent-rgb), 0.4),
    0 0 42px rgba(var(--accent-rgb), 0.2),
    0 0 80px rgba(var(--accent-rgb), 0.1);
}

/* Subtle neon text (less intense) */
.neon-text-subtle {
  color: var(--accent);
  text-shadow:
    0 0 5px rgba(var(--accent-rgb), 0.4),
    0 0 15px rgba(var(--accent-rgb), 0.2);
}

/* Animated neon text with flicker */
.neon-text-flicker {
  color: var(--accent);
  animation: neon-flicker 4s ease-in-out infinite;
}

/* --- Neon Border Glow --- */
.neon-border {
  border: 1px solid rgba(var(--accent-rgb), 0.4);
  box-shadow:
    0 0 8px rgba(var(--accent-rgb), 0.15),
    0 0 20px rgba(var(--accent-rgb), 0.1),
    inset 0 0 8px rgba(var(--accent-rgb), 0.05);
  transition: all var(--transition-base);
}

.neon-border:hover {
  border-color: rgba(var(--accent-rgb), 0.6);
  box-shadow:
    0 0 12px rgba(var(--accent-rgb), 0.25),
    0 0 30px rgba(var(--accent-rgb), 0.15),
    0 0 60px rgba(var(--accent-rgb), 0.08),
    inset 0 0 12px rgba(var(--accent-rgb), 0.08);
}

/* Pulsing neon border */
.neon-border-pulse {
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  animation: glow-pulse 3s ease-in-out infinite;
}

/* --- Neon Line Divider --- */
.neon-line {
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(var(--accent-rgb), 0.5),
    var(--accent),
    rgba(var(--accent-rgb), 0.5),
    transparent
  );
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.3);
  border: none;
}


/* ===========================================
   SECTION 5: HOVER / INTERACTION EFFECTS
   =========================================== */

/* --- Hover Lift --- */
.hover-lift {
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base);
  will-change: transform;
}

.hover-lift:hover {
  transform: translateY(-6px);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(var(--accent-rgb), 0.1);
}

/* Gentle hover lift */
.hover-lift-sm {
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base);
}

.hover-lift-sm:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* --- Hover Scale --- */
.hover-scale {
  transition: transform var(--transition-base);
}

.hover-scale:hover {
  transform: scale(1.05);
}

/* --- Hover Glow (adds accent glow on hover) --- */
.hover-glow {
  transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
  box-shadow:
    0 0 20px rgba(var(--accent-rgb), 0.2),
    0 0 40px rgba(var(--accent-rgb), 0.1);
}

/* --- Image Hover Zoom --- */
.img-zoom-wrapper {
  overflow: hidden;
  border-radius: var(--border-radius);
}

.img-zoom-wrapper img {
  transition: transform var(--transition-slow);
  will-change: transform;
}

.img-zoom-wrapper:hover img {
  transform: scale(1.08);
}

/* --- Button Ripple Effect --- */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.3) 10%, transparent 10.01%);
  transform: scale(0);
  opacity: 0;
  transition: transform 0.5s, opacity 0.6s;
}

.btn-ripple:active::after {
  transform: scale(4);
  opacity: 0;
  transition: 0s;
}

/* --- Underline Hover (for links) --- */
.hover-underline {
  position: relative;
}

.hover-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 6px rgba(var(--accent-rgb), 0.4);
  transition: width var(--transition-base);
}

.hover-underline:hover::after {
  width: 100%;
}


/* ===========================================
   SECTION 6: UTILITY ANIMATION CLASSES
   =========================================== */

/* Apply animation utilities */
.anim-fade-in {
  animation: fade-in 0.5s ease forwards;
}

.anim-fade-in-up {
  animation: fade-in-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.anim-slide-in-right {
  animation: slide-in-right 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.anim-scale-in {
  animation: scale-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.anim-float {
  animation: float 3s ease-in-out infinite;
}

.anim-rotate-slow {
  animation: rotate-slow 12s linear infinite;
}

.anim-glow-pulse {
  animation: glow-pulse 3s ease-in-out infinite;
}

.anim-bounce {
  animation: bounce-subtle 2s ease-in-out infinite;
}

/* --- Gradient Animated Background --- */
.anim-gradient-bg {
  background-size: 200% 200%;
  animation: gradient-shift 6s ease infinite;
}


/* ===========================================
   SECTION 7: LOADING & TRANSITION STATES
   =========================================== */

/* Page transition overlay */
.page-transition {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.page-transition.loaded {
  opacity: 0;
}

/* Smooth content reveal */
.content-reveal {
  opacity: 0;
  animation: fade-in-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}


/* ===========================================
   SECTION 8: ACCESSIBILITY
   =========================================== */

/* --- Reduced Motion: Disable all animations --- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .animate-on-scroll {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .hover-lift:hover,
  .hover-lift-sm:hover {
    transform: none;
  }

  .hover-scale:hover {
    transform: none;
  }

  .parallax-bg::before {
    background-attachment: scroll;
  }

  .particle-bg::before {
    animation: none;
  }

  .neon-text-flicker {
    animation: none;
    text-shadow:
      0 0 7px rgba(var(--accent-rgb), 0.5),
      0 0 20px rgba(var(--accent-rgb), 0.3);
  }
}
