/* ================================================
   assets/css/animations.css — Semua keyframes dan kelas utilitas animasi
   ================================================ */

/* ----------------------------------------------
   Keyframes
   ---------------------------------------------- */

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

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

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

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

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

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

@keyframes rotateSlow {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

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

/* ----------------------------------------------
   Base animation classes (umumnya dikombinasikan dengan Intersection Observer)
   ---------------------------------------------- */

/* Animasi default: fade in up */
.animate {
  animation-duration: 0.8s;
  animation-fill-mode: both;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Variasi durasi */
.animate--fast {
  animation-duration: 0.4s;
}

.animate--slow {
  animation-duration: 1.2s;
}

/* Variasi delay */
.animate--delay-1 {
  animation-delay: 0.2s;
}

.animate--delay-2 {
  animation-delay: 0.4s;
}

.animate--delay-3 {
  animation-delay: 0.6s;
}

.animate--delay-4 {
  animation-delay: 0.8s;
}

.animate--delay-5 {
  animation-delay: 1s;
}

/* Kelas animasi spesifik */
.animate--fade-in {
  animation-name: fadeIn;
}

.animate--fade-in-up {
  animation-name: fadeInUp;
}

.animate--fade-in-down {
  animation-name: fadeInDown;
}

.animate--fade-in-left {
  animation-name: fadeInLeft;
}

.animate--fade-in-right {
  animation-name: fadeInRight;
}

.animate--scale-in {
  animation-name: scaleIn;
}

.animate--pulse {
  animation-iteration-count: infinite;
  animation-name: pulse;
}

/* Untuk elemen yang akan dianimasikan saat muncul di viewport */
[data-animate] {
  opacity: 0; /* Mulai tidak terlihat */
}

[data-animate].animated {
  opacity: 1; /* Menjadi terlihat setelah animasi dijalankan */
}

/* Contoh penggunaan:
   <div data-animate="fadeInUp" class="animate"></div>
   (Di JavaScript nanti kita akan menambahkan class "animated" saat elemen masuk viewport)
*/

/* ----------------------------------------------
   Loading spinner
   ---------------------------------------------- */
.spinner {
  animation: rotateSlow 1s linear infinite;
  border: 3px solid var(--color-secondary);
  border-radius: 50%;
  border-top-color: var(--color-primary);
  height: 40px;
  width: 40px;
}

.spinner--sm {
  height: 24px;
  width: 24px;
}

.spinner--lg {
  border-width: 4px;
  height: 60px;
  width: 60px;
}