/* =========================================================
   Keyframes
   ========================================================= */

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

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

@keyframes slideDown {
  from { transform: translateY(-24px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

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

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =========================================================
   Utility animation classes
   ========================================================= */

.animate-fade-in {
  animation: fadeIn 0.6s ease-out forwards;
}

.animate-slide-up {
  animation: slideUp 0.6s cubic-bezier(0.35, 0, 0, 1) forwards;
}

.animate-slide-down {
  animation: slideDown 0.6s cubic-bezier(0.35, 0, 0, 1) forwards;
}

.animate-scale-in {
  animation: scaleIn 0.5s cubic-bezier(0.35, 0, 0, 1) forwards;
}

/* Staggered children */
.stagger-children > * {
  opacity: 0;
  animation: slideUp 0.6s cubic-bezier(0.35, 0, 0, 1) forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 80ms; }
.stagger-children > *:nth-child(3) { animation-delay: 160ms; }
.stagger-children > *:nth-child(4) { animation-delay: 240ms; }
.stagger-children > *:nth-child(5) { animation-delay: 320ms; }

/* =========================================================
   Scroll-reveal: elements start hidden, JS adds .is-visible
   ========================================================= */

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered reveal for grid items */
.reveal-grid .reveal:nth-child(1) { transition-delay: 0ms; }
.reveal-grid .reveal:nth-child(2) { transition-delay: 100ms; }
.reveal-grid .reveal:nth-child(3) { transition-delay: 200ms; }
.reveal-grid .reveal:nth-child(4) { transition-delay: 300ms; }

/* =========================================================
   Preloader — progress bar
   ========================================================= */

.preloader-bar {
  width: min(400px, 80vw);
  height: 32px;
  background-color: #000000;
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 2px;
}

.preloader-bar .progress {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--color-blue) 0%, var(--color-purple) 50%, var(--color-green) 100%);
  position: absolute;
  top: 0;
  left: 0;
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
  animation: preloader-fill 3s ease-in-out forwards;
}

.preloader-text {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  animation: preloader-pulse 2.4s ease-in-out infinite;
  will-change: opacity;
}

@keyframes preloader-pulse {
  0%, 100% { opacity: 0.15; }
  50%       { opacity: 0.7; }
}

@keyframes preloader-fill {
  0%   { transform: scaleX(0); }
  60%  { transform: scaleX(0.75); }
  85%  { transform: scaleX(0.92); }
  100% { transform: scaleX(1); }
}

/* =========================================================
   Prefers 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;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
