/* ============================================
   Animations & Scroll Reveal
   ============================================ */

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

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

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Scroll reveal — visible by default; hidden only after JS init */
.reveal,
.reveal-left,
.reveal-right,
.reveal-scale {
  opacity: 1;
  transform: none;
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.stagger-children > * {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

html.js-ready .reveal:not(.active) {
  opacity: 0;
  transform: translateY(40px);
}

html.js-ready .reveal.active {
  opacity: 1;
  transform: translateY(0);
}

html.js-ready .reveal-left:not(.active) {
  opacity: 0;
  transform: translateX(-40px);
}

html.js-ready .reveal-left.active {
  opacity: 1;
  transform: translateX(0);
}

html.js-ready .reveal-right:not(.active) {
  opacity: 0;
  transform: translateX(40px);
}

html.js-ready .reveal-right.active {
  opacity: 1;
  transform: translateX(0);
}

html.js-ready .reveal-scale:not(.active) {
  opacity: 0;
  transform: scale(0.85);
}

html.js-ready .reveal-scale.active {
  opacity: 1;
  transform: scale(1);
}

html.js-ready .stagger-children:not(.active) > * {
  opacity: 0;
  transform: translateY(30px);
}

.stagger-children.active > *:nth-child(1) { transition-delay: 0.1s; }
.stagger-children.active > *:nth-child(2) { transition-delay: 0.2s; }
.stagger-children.active > *:nth-child(3) { transition-delay: 0.3s; }
.stagger-children.active > *:nth-child(4) { transition-delay: 0.4s; }
.stagger-children.active > *:nth-child(5) { transition-delay: 0.5s; }
.stagger-children.active > *:nth-child(6) { transition-delay: 0.6s; }
.stagger-children.active > *:nth-child(7) { transition-delay: 0.7s; }
.stagger-children.active > *:nth-child(8) { transition-delay: 0.8s; }
.stagger-children.active > *:nth-child(9) { transition-delay: 0.9s; }
.stagger-children.active > *:nth-child(10) { transition-delay: 1s; }
.stagger-children.active > *:nth-child(11) { transition-delay: 1.1s; }
.stagger-children.active > *:nth-child(12) { transition-delay: 1.2s; }
.stagger-children.active > *:nth-child(13) { transition-delay: 1.3s; }
.stagger-children.active > *:nth-child(14) { transition-delay: 1.4s; }
.stagger-children.active > *:nth-child(15) { transition-delay: 1.5s; }
.stagger-children.active > *:nth-child(16) { transition-delay: 1.6s; }
.stagger-children.active > *:nth-child(17) { transition-delay: 1.7s; }
.stagger-children.active > *:nth-child(18) { transition-delay: 1.8s; }
.stagger-children.active > *:nth-child(19) { transition-delay: 1.9s; }

.stagger-children.active > * {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 768px) {
  .reveal,
  .reveal-left,
  .reveal-right,
  .reveal-scale {
    transition-duration: 0.35s;
  }

  .stagger-children > * {
    transition-duration: 0.25s;
  }

  html.js-ready .reveal:not(.active),
  html.js-ready .reveal-left:not(.active),
  html.js-ready .reveal-right:not(.active),
  html.js-ready .reveal-scale:not(.active),
  html.js-ready .stagger-children:not(.active) > * {
    transform: translateY(16px);
  }

  .stagger-children.active > *:nth-child(1) { transition-delay: 0s; }
  .stagger-children.active > *:nth-child(2) { transition-delay: 0.03s; }
  .stagger-children.active > *:nth-child(3) { transition-delay: 0.06s; }
  .stagger-children.active > *:nth-child(4) { transition-delay: 0.09s; }
  .stagger-children.active > *:nth-child(5) { transition-delay: 0.12s; }
  .stagger-children.active > *:nth-child(6) { transition-delay: 0.15s; }
  .stagger-children.active > *:nth-child(n + 7) { transition-delay: 0.15s; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal-left,
  .reveal-right,
  .reveal-scale,
  .stagger-children > * {
    transition: none !important;
  }

  html.js-ready .reveal:not(.active),
  html.js-ready .reveal-left:not(.active),
  html.js-ready .reveal-right:not(.active),
  html.js-ready .reveal-scale:not(.active),
  html.js-ready .stagger-children:not(.active) > * {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* Loading overlay */
.page-loader {
  position: fixed;
  inset: 0;
  background: var(--primary);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-content {
  text-align: center;
}

.loader-logo {
  font-family: var(--font-heading);
  color: var(--white);
  font-size: 1.5rem;
  margin-bottom: 24px;
}

.loader-bar {
  width: 200px;
  height: 3px;
  background: rgba(255,255,255,0.1);
  overflow: hidden;
  margin: 0 auto;
}

.loader-bar::after {
  content: '';
  display: block;
  width: 40%;
  height: 100%;
  background: var(--accent);
  animation: shimmer 1.5s infinite;
  background-size: 200% 100%;
}

/* Hover line animation */
.hover-line {
  position: relative;
  display: inline-block;
}

.hover-line::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.4s ease;
}

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

/* Counter animation */
.stat-number.counting {
  animation: countUp 0.6s ease forwards;
}

/* Mobile nav overlay */
.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 19, 30, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.nav-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
