/**
 * Hostxolo - 3D Animations & Modern Effects
 * Premium animations, 3D transforms, glassmorphism, particles
 */

/* ======== CSS CUSTOM PROPERTIES ======== */
:root {
  --anim-duration: 0.8s;
  --anim-delay: 0.15s;
  --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --tilt-max: 8deg;
  --glow-orange: rgba(249, 115, 22, 0.3);
  --glow-blue: rgba(59, 130, 246, 0.2);
}

/* ======== SCROLL-TRIGGERED ANIMATIONS ======== */
[data-aos] {
  opacity: 0;
  transform: translateY(40px) scale(0.98);
  transition: opacity 0.7s var(--ease-out-expo),
              transform 0.7s var(--ease-out-expo);
  will-change: transform, opacity;
}
[data-aos].aos-animate {
  opacity: 1;
  transform: translateY(0) scale(1);
}

[data-aos="fade-up"] { transform: translateY(50px); }
[data-aos="fade-down"] { transform: translateY(-50px); }
[data-aos="fade-left"] { transform: translateX(-50px); }
[data-aos="fade-right"] { transform: translateX(50px); }
[data-aos="zoom-in"] { transform: scale(0.85); }
[data-aos="zoom-out"] { transform: scale(1.15); }
[data-aos="flip-up"] {
  transform: perspective(600px) rotateX(15deg) translateY(30px);
}
[data-aos="flip-down"] {
  transform: perspective(600px) rotateX(-15deg) translateY(-30px);
}
[data-aos="flip-left"] {
  transform: perspective(600px) rotateY(15deg) translateX(30px);
}

[data-aos].aos-animate {
  transform: translateY(0) translateX(0) scale(1) rotateX(0) rotateY(0);
}

/* Stagger delays */
[data-aos-delay="100"] { transition-delay: 0.1s; }
[data-aos-delay="200"] { transition-delay: 0.2s; }
[data-aos-delay="300"] { transition-delay: 0.3s; }
[data-aos-delay="400"] { transition-delay: 0.4s; }
[data-aos-delay="500"] { transition-delay: 0.5s; }
[data-aos-delay="600"] { transition-delay: 0.6s; }

/* ======== 3D TILT CARDS ======== */
.tilt-card {
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.15s ease;
}
.tilt-card .tilt-content {
  transform: translateZ(30px);
  transition: transform 0.3s var(--ease-spring);
}
.tilt-card:hover .tilt-content {
  transform: translateZ(50px);
}
.tilt-card .tilt-glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), 
              rgba(249, 115, 22, 0.12) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.tilt-card:hover .tilt-glow {
  opacity: 1;
}

/* ======== FLOATING ELEMENTS ======== */
.float-anim {
  animation: float 4s var(--ease-out-expo) infinite;
}
.float-anim-delay-1 { animation-delay: -1s; }
.float-anim-delay-2 { animation-delay: -2s; }
.float-anim-delay-3 { animation-delay: -3s; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  33% { transform: translateY(-12px) rotate(0.5deg); }
  66% { transform: translateY(6px) rotate(-0.5deg); }
}

/* ======== PARTICLE BACKGROUND ======== */
.particle-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  animation: particleFloat linear infinite;
}
@keyframes particleFloat {
  0% { transform: translateY(100vh) scale(0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* ======== GRADIENT TEXT ANIMATION ======== */
.gradient-text-anim {
  background: linear-gradient(135deg, #f97316, #fb923c, #6366f1, #f97316);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 4s ease infinite;
}
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ======== GLOW PULSE ======== */
.glow-pulse {
  animation: glowPulse 2s ease-in-out infinite;
}
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(249,115,22,0.2); }
  50% { box-shadow: 0 0 40px rgba(249,115,22,0.4); }
}

/* ======== GLASSMORPHISM ======== */
.glass {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.glass-dark {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* ======== TYPEWRITER EFFECT ======== */
.typewriter-cursor {
  display: inline-block;
  width: 3px;
  height: 1em;
  background: #f97316;
  margin-left: 4px;
  animation: blink 0.8s step-end infinite;
  vertical-align: text-bottom;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ======== COUNTER ANIMATION ======== */
.counter-value {
  display: inline-block;
}
.counter-value.animate {
  animation: countPop 0.4s var(--ease-spring);
}
@keyframes countPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ======== SMOOTH SECTION REVEAL ======== */
.section-reveal {
  position: relative;
  overflow: hidden;
}
.section-reveal::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--light);
  z-index: 2;
  transform: translateY(0);
  transition: transform 1s var(--ease-out-expo);
  pointer-events: none;
}
.section-reveal.revealed::after {
  transform: translateY(100%);
}

/* ======== SHIMMER LOADING ======== */
.shimmer {
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255,255,255,0.05) 50%, 
    transparent 100%);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ======== MORPHING BACKGROUND ======== */
.morph-bg {
  position: relative;
  overflow: hidden;
}
.morph-bg::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(249,115,22,0.1) 0%, transparent 60%);
  border-radius: 50%;
  animation: morphGlow 8s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes morphGlow {
  0% { transform: translate(-20%, -20%) scale(1); opacity: 0.5; }
  50% { transform: translate(50%, 50%) scale(1.5); opacity: 0.8; }
  100% { transform: translate(-10%, 80%) scale(1.2); opacity: 0.5; }
}

/* ======== 3D PERSPECTIVE SECTIONS ======== */
.perspective-section {
  perspective: 1200px;
}
.perspective-content {
  transform: rotateX(var(--rotate-x, 0deg)) rotateY(var(--rotate-y, 0deg));
  transition: transform 0.3s ease;
  transform-style: preserve-3d;
}

/* ======== CARD HOVER 3D ======== */
.card-3d {
  transition: transform 0.4s var(--ease-spring), box-shadow 0.4s ease;
  transform-style: preserve-3d;
}
.card-3d:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 30px 60px rgba(0,0,0,0.15);
}

/* ======== SPLIT TEXT REVEAL ======== */
.split-text span {
  display: inline-block;
  opacity: 0;
  transform: translateY(20px) rotateX(-40deg);
  animation: splitReveal 0.5s var(--ease-out-expo) forwards;
}
@keyframes splitReveal {
  to { opacity: 1; transform: translateY(0) rotateX(0); }
}

/* ======== HERO PARTICLE OVERLAY ======== */
.hero-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.hero-particle {
  position: absolute;
  border-radius: 50%;
  animation: heroParticleFloat linear infinite;
  pointer-events: none;
}
@keyframes heroParticleFloat {
  0% { transform: translateY(0) scale(0); opacity: 0; }
  20% { opacity: 0.8; transform: scale(1); }
  80% { opacity: 0.6; }
  100% { transform: translateY(-100vh) scale(0.5); opacity: 0; }
}

/* ======== ORBITAL RING ======== */
.orbit-ring {
  position: absolute;
  border: 1px solid rgba(249,115,22,0.08);
  border-radius: 50%;
  animation: orbitSpin 20s linear infinite;
  pointer-events: none;
}
.orbit-ring:nth-child(1) { width: 200%; height: 200%; top: -50%; left: -50%; }
.orbit-ring:nth-child(2) { width: 150%; height: 150%; top: -25%; left: -25%; animation-duration: 15s; animation-direction: reverse; }
.orbit-ring:nth-child(3) { width: 120%; height: 120%; top: -10%; left: -10%; animation-duration: 25s; }
@keyframes orbitSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ======== SCROLL INDICATOR ======== */
.scroll-indicator {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,0.5);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: scrollBounce 2s ease-in-out infinite;
}
.scroll-indicator .mouse {
  width: 24px;
  height: 38px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 12px;
  position: relative;
}
.scroll-indicator .mouse::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 8px;
  background: rgba(255,255,255,0.5);
  border-radius: 2px;
  animation: scrollMouse 1.5s ease-in-out infinite;
}
@keyframes scrollBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}
@keyframes scrollMouse {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: 1; }
  50% { transform: translateX(-50%) translateY(12px); opacity: 0; }
}

/* ======== MAGNETIC BUTTONS ======== */
.magnetic-btn {
  position: relative;
  transition: transform 0.3s var(--ease-spring);
}

/* ======== IMAGE REVEAL ======== */
.img-reveal {
  position: relative;
  overflow: hidden;
}
.img-reveal::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--primary);
  transform: translateX(0);
  transition: transform 0.8s var(--ease-out-expo);
}
.img-reveal.revealed::after {
  transform: translateX(100%);
}

/* ======== NAVBAR SCROLL ENHANCEMENTS ======== */
.navbar.navbar-scrolled {
  background: rgba(255,255,255,0.92) !important;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(226,232,240,0.3);
  box-shadow: 0 4px 30px rgba(0,0,0,0.06) !important;
}

/* ======== SECTION TRANSITIONS ======== */
.section-transition {
  position: relative;
}
.section-transition::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 60px;
  background: inherit;
  clip-path: ellipse(50% 100% at 50% 100%);
  pointer-events: none;
}

/* ======== LOADING SPINNER ======== */
.loading-dots {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}
.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: dotBounce 1.4s ease-in-out infinite both;
}
.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }
@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* ======== RESPONSIVE ANIMATIONS ======== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  [data-aos],
  .float-anim,
  .particle,
  .hero-particle,
  .orbit-ring,
  .scroll-indicator {
    animation: none !important;
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}

/* Mobile: reduce animations, disable overflow-causing effects */
@media (max-width: 991px) {
  [data-aos] {
    transition-duration: 0.4s !important;
  }
}

@media (max-width: 768px) {
  [data-aos] {
    transform: translateY(15px) !important;
    transition-duration: 0.35s !important;
  }
  [data-aos].aos-animate {
    transform: translateY(0) !important;
  }
  .scroll-indicator { display: none !important; }
  .orbit-ring { display: none !important; }
  .hero-particles { opacity: 0.4; }
  
  /* Hero section fix: prevent overflow from pseudo-elements */
  .hero-section::before,
  .hero-section::after {
    background-size: 200% 200% !important;
  }
}

@media (max-width: 480px) {
  [data-aos] {
    transform: translateY(10px) !important;
  }
}

/* Fix for hero overflow on all screen sizes */
.hero-section {
  overflow: hidden;
  position: relative;
}
.hero-section .hero-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.hero-section .hero-particle {
  pointer-events: none;
}
