/* =====================================================
   Sriannai UPVC - Animation Stylesheet
   Scroll reveal, keyframes, micro-interactions
   ===================================================== */

/* ---------- Scroll Reveal Base ---------- */
[data-reveal] {
  opacity: 0;
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  will-change: opacity, transform;
}

/* Directional variants */
[data-reveal="up"] { transform: translateY(40px); }
[data-reveal="down"] { transform: translateY(-40px); }
[data-reveal="left"] { transform: translateX(-40px); }
[data-reveal="right"] { transform: translateX(40px); }
[data-reveal="scale"] { transform: scale(0.9); }
[data-reveal="fade"] { transform: none; }

/* Revealed state */
[data-reveal].revealed {
  opacity: 1;
  transform: translate(0, 0) scale(1);
}

/* Stagger delays */
[data-delay="1"] { transition-delay: 0.1s; }
[data-delay="2"] { transition-delay: 0.2s; }
[data-delay="3"] { transition-delay: 0.3s; }
[data-delay="4"] { transition-delay: 0.4s; }
[data-delay="5"] { transition-delay: 0.5s; }
[data-delay="6"] { transition-delay: 0.6s; }

/* ---------- Keyframe Animations ---------- */

/* Fade in */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Fade in up */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Fade in down */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Fade in left */
@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Fade in right */
@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Scale in */
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* Slide up */
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

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

/* Pulse glow */
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 162, 74, 0.4); }
  50% { box-shadow: 0 0 0 16px rgba(201, 162, 74, 0); }
}

/* Shimmer */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Bounce in */
@keyframes bounceIn {
  0% { opacity: 0; transform: scale(0.3); }
  50% { opacity: 1; transform: scale(1.05); }
  70% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/* Rotate */
@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Gradient shift */
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ---------- Animation Utility Classes ---------- */
.animate-fadeIn { animation: fadeIn 0.7s var(--ease) both; }
.animate-fadeInUp { animation: fadeInUp 0.7s var(--ease) both; }
.animate-fadeInDown { animation: fadeInDown 0.7s var(--ease) both; }
.animate-fadeInLeft { animation: fadeInLeft 0.7s var(--ease) both; }
.animate-fadeInRight { animation: fadeInRight 0.7s var(--ease) both; }
.animate-scaleIn { animation: scaleIn 0.5s var(--ease) both; }
.animate-bounceIn { animation: bounceIn 0.6s var(--ease-bounce) both; }
.animate-float { animation: float 3s ease-in-out infinite; }

/* Animation delays */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

/* ---------- Hero animations ---------- */
.hero-content > * {
  opacity: 0;
  animation: fadeInUp 0.8s var(--ease) forwards;
}
.hero-content > *:nth-child(1) { animation-delay: 0.2s; }
.hero-content > *:nth-child(2) { animation-delay: 0.35s; }
.hero-content > *:nth-child(3) { animation-delay: 0.5s; }
.hero-content > *:nth-child(4) { animation-delay: 0.65s; }
.hero-content > *:nth-child(5) { animation-delay: 0.8s; }

.hero-visual {
  opacity: 0;
  animation: fadeInRight 1s var(--ease) 0.5s forwards;
}

.page-banner-inner > * {
  opacity: 0;
  animation: fadeInUp 0.8s var(--ease) forwards;
}
.page-banner-inner > *:nth-child(1) { animation-delay: 0.2s; }
.page-banner-inner > *:nth-child(2) { animation-delay: 0.4s; }
.page-banner-inner > *:nth-child(3) { animation-delay: 0.6s; }

/* ---------- Micro-interactions ---------- */

/* Button shine effect */
.btn::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  transition: left 0.5s ease;
}
.btn:hover::before { left: 100%; }

/* Card hover lift */
.feature-card, .product-card, .service-card, .value-card, .advantage-item {
  will-change: transform;
}

/* Image zoom on hover */
.product-img img, .project-card img, .portfolio-item img {
  will-change: transform;
}

/* Underline animation for links */
.footer-links a {
  position: relative;
}

/* Icon bounce on hover */
.feature-card:hover .feature-icon,
.value-card:hover .value-icon {
  animation: bounceIn 0.5s var(--ease-bounce);
}

/* Stat counter pulse */
.stat-item:hover .stat-icon {
  animation: pulseGlow 1.5s ease infinite;
}

/* ---------- Parallax ---------- */
.parallax-bg {
  background-attachment: fixed;
  background-size: cover;
  background-position: center;
  position: relative;
}
@media (max-width: 992px) {
  .parallax-bg { background-attachment: scroll; }
}

/* ---------- Loading skeleton ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--light-gray) 25%, var(--gray-300) 50%, var(--light-gray) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease infinite;
}

/* ---------- Gradient text animation ---------- */
.gradient-text {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-300), var(--gold-500));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease infinite;
}

/* ---------- Respect reduced motion ---------- */
@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;
  }
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
}
