/* ============================================================
   PORTFOLIO - Walid Amaglio | BTS SIO SISR
   Animations Stylesheet
   ============================================================ */

/* ============================================================
   1. FADE IN ANIMATIONS
   ============================================================ */
@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(-40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

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

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

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes zoomOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.8);
  }
}

/* ============================================================
   2. PULSE
   ============================================================ */
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes pulseSlow {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.08);
    opacity: 0.85;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.08); }
  28% { transform: scale(1); }
  42% { transform: scale(1.04); }
  70% { transform: scale(1); }
}

/* ============================================================
   3. GLOW
   ============================================================ */
@keyframes glow {
  0% {
    box-shadow: 0 0 5px rgba(0, 212, 255, 0.2),
                0 0 10px rgba(0, 212, 255, 0.1);
  }
  50% {
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.5),
                0 0 40px rgba(0, 212, 255, 0.25),
                0 0 60px rgba(0, 212, 255, 0.1);
  }
  100% {
    box-shadow: 0 0 5px rgba(0, 212, 255, 0.2),
                0 0 10px rgba(0, 212, 255, 0.1);
  }
}

@keyframes glowText {
  0% {
    text-shadow: 0 0 4px rgba(0, 212, 255, 0.3);
  }
  50% {
    text-shadow: 0 0 12px rgba(0, 212, 255, 0.8),
                 0 0 24px rgba(0, 212, 255, 0.4);
  }
  100% {
    text-shadow: 0 0 4px rgba(0, 212, 255, 0.3);
  }
}

@keyframes glowBorder {
  0% {
    border-color: rgba(0, 212, 255, 0.2);
  }
  50% {
    border-color: rgba(0, 212, 255, 0.8);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
  }
  100% {
    border-color: rgba(0, 212, 255, 0.2);
  }
}

/* ============================================================
   4. TYPING EFFECT
   ============================================================ */
@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes typeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

/* ============================================================
   5. CURSOR BLINK
   ============================================================ */
@keyframes blink {
  0%, 100% {
    border-color: var(--accent-cyan, #00d4ff);
    opacity: 1;
  }
  50% {
    border-color: transparent;
    opacity: 0;
  }
}

@keyframes blinkCursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ============================================================
   6. FLOAT
   ============================================================ */
@keyframes float {
  0% {
    transform: translate(-50%, -50%) translateY(0px);
  }
  50% {
    transform: translate(-50%, -50%) translateY(-12px);
  }
  100% {
    transform: translate(-50%, -50%) translateY(0px);
  }
}

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

@keyframes floatRotate {
  0% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-10px) rotate(3deg);
  }
  100% {
    transform: translateY(0px) rotate(0deg);
  }
}

/* ============================================================
   7. COUNTER (class setup — actual counting done in JS)
   ============================================================ */
@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.counter-number {
  animation: countUp 0.5s ease forwards;
  display: inline-block;
}

.counter-wrapper {
  overflow: hidden;
}

/* ============================================================
   8. SHIMMER (skeleton loading)
   ============================================================ */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03) 25%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.03) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s infinite;
  border-radius: 6px;
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-title {
  height: 22px;
  width: 60%;
  margin-bottom: 12px;
  border-radius: 4px;
}

.skeleton-circle {
  border-radius: 50%;
}

.skeleton-image {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 8px;
  margin-bottom: 12px;
}

/* ============================================================
   9. SPIN
   ============================================================ */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

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

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

/* ============================================================
   10. SLIDE IN NAV
   ============================================================ */
@keyframes slideInNav {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInNavItem {
  0% {
    opacity: 0;
    transform: translateX(-15px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

.navbar-links.open a {
  animation: slideInNav 0.3s ease forwards;
}

.navbar-links.open a:nth-child(1) { animation-delay: 0.05s; }
.navbar-links.open a:nth-child(2) { animation-delay: 0.10s; }
.navbar-links.open a:nth-child(3) { animation-delay: 0.15s; }
.navbar-links.open a:nth-child(4) { animation-delay: 0.20s; }
.navbar-links.open a:nth-child(5) { animation-delay: 0.25s; }
.navbar-links.open a:nth-child(6) { animation-delay: 0.30s; }
.navbar-links.open a:nth-child(7) { animation-delay: 0.35s; }
.navbar-links.open a:nth-child(8) { animation-delay: 0.40s; }

/* ============================================================
   11. MISC KEYFRAMES
   ============================================================ */
@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
  70% {
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInBottom {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideOutBottom {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(100%);
    opacity: 0;
  }
}

@keyframes slideInTop {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes wobble {
  0% { transform: translateX(0); }
  20% { transform: translateX(-6px) rotate(-2deg); }
  40% { transform: translateX(6px) rotate(2deg); }
  60% { transform: translateX(-4px) rotate(-1deg); }
  80% { transform: translateX(4px) rotate(1deg); }
  100% { transform: translateX(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes borderPulse {
  0%, 100% {
    border-color: rgba(0, 212, 255, 0.2);
  }
  50% {
    border-color: rgba(0, 212, 255, 0.6);
  }
}

/* ============================================================
   12. UTILITY ANIMATION CLASSES
   ============================================================ */

/* Base: hidden before animation triggers */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.animated {
  opacity: 1;
  transform: translateY(0);
}

/* Fade In */
.fade-in {
  animation: fadeIn 0.6s ease forwards;
}

.fade-in-up {
  animation: fadeInUp 0.7s ease forwards;
}

.fade-in-down {
  animation: fadeInDown 0.7s ease forwards;
}

/* Slide In */
.slide-in-left {
  animation: fadeInLeft 0.7s ease forwards;
}

.slide-in-right {
  animation: fadeInRight 0.7s ease forwards;
}

.slide-in-bottom {
  animation: slideInBottom 0.6s ease forwards;
}

.slide-in-top {
  animation: slideInTop 0.6s ease forwards;
}

/* Zoom */
.zoom-in {
  animation: zoomIn 0.5s ease forwards;
}

/* Bounce */
.bounce-in {
  animation: bounceIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Pulse loop */
.pulse {
  animation: pulse 2s ease-in-out infinite;
}

.pulse-slow {
  animation: pulseSlow 3s ease-in-out infinite;
}

/* Glow loop */
.glow {
  animation: glow 2.5s ease-in-out infinite;
}

.glow-text {
  animation: glowText 2.5s ease-in-out infinite;
}

/* Float loop */
.float {
  animation: floatSimple 3s ease-in-out infinite;
}

/* Spin loop */
.spin {
  animation: spin 1s linear infinite;
}

.spin-slow {
  animation: spinSlow 8s linear infinite;
}

/* Shimmer */
.shimmer-anim {
  animation: shimmer 1.5s infinite;
}

/* Shake (one-shot error) */
.shake {
  animation: shake 0.5s ease;
}

/* Wobble */
.wobble {
  animation: wobble 0.6s ease;
}

/* Gradient background animation */
.gradient-animated {
  background-size: 200% 200%;
  animation: gradientShift 4s ease infinite;
}

/* Border pulse */
.border-pulse {
  animation: borderPulse 2s ease-in-out infinite;
}

/* ============================================================
   13. DELAY HELPERS
   ============================================================ */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }
.delay-1000 { animation-delay: 1s; }
.delay-1200 { animation-delay: 1.2s; }

/* Duration helpers */
.duration-300 { animation-duration: 0.3s; }
.duration-500 { animation-duration: 0.5s; }
.duration-700 { animation-duration: 0.7s; }
.duration-1000 { animation-duration: 1s; }
.duration-1500 { animation-duration: 1.5s; }
.duration-2000 { animation-duration: 2s; }

/* Fill modes */
.fill-both { animation-fill-mode: both; }
.fill-forwards { animation-fill-mode: forwards; }
.fill-backwards { animation-fill-mode: backwards; }

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

  .animate-on-scroll {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .skeleton {
    animation: none;
    background: rgba(255, 255, 255, 0.05);
  }

  .float,
  .pulse,
  .pulse-slow,
  .glow,
  .glow-text,
  .spin,
  .spin-slow,
  .shimmer-anim,
  .gradient-animated,
  .border-pulse {
    animation: none;
  }

  .navbar-links.open a {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
