/* ---------------------------------------------------
   ANIMATIONS & TRANSITIONS
--------------------------------------------------- */

/* Base state for animated elements */
.animate-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
  transition-delay: var(--delay, 0s);
  will-change: opacity, transform;
}

/* Active state for animated elements */
.animate-in.active {
  opacity: 1;
  transform: translateY(0);
}

/* Typing animation for headings */
.typing-animation {
  display: inline-block;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid var(--odo-red);
  animation: typing 1.2s steps(20, end) forwards,
             blink-caret 0.75s step-end infinite;
  opacity: 1 !important;
  transform: none !important;
}

/* Japanese typing animation */
.typing-animation.japanese {
  animation: typing 1.2s steps(10, end) forwards,
             blink-caret 0.75s step-end infinite;
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
}

/* English typing animation after Japanese */
.typing-animation.english {
  animation: typing 1.2s steps(20, end) forwards,
             blink-caret 0.75s step-end infinite;
  width: 0; /* Reset width for new animation */
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
}

/* Typing animation keyframes */
@keyframes typing {
  from { width: 0 }
  to { width: 100% }
}

/* Cursor blink animation */
@keyframes blink-caret {
  from, to { border-color: transparent }
  50% { border-color: var(--odo-red) }
}

/* Standardized delay system using CSS variables */
.delay-1 {
  --delay: 0.1s;
}

.delay-2 {
  --delay: 0.2s;
}

.delay-3 {
  --delay: 0.3s;
}

.delay-4 {
  --delay: 0.4s;
}

.delay-5 {
  --delay: 0.5s;
}

/* Standardized animation for all elements including center-gif */
.center-gif.animate-in {
  /* Using the same animation properties as other elements for consistency */
  transform: translateY(0); /* No vertical movement for the center image */
}

/* Respect user's preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
  .animate-in {
    transition: opacity 0.3s ease-out !important;
    transform: none !important;
  }
  
  .typing-animation {
    width: 100% !important;
    animation: none !important;
    border-right: none !important;
  }
}

/* Optimize animations for mobile devices */
@media (max-width: 768px), (orientation: landscape) and (max-width: 932px) {
  .animate-in {
    transform: translateY(10px); /* Smaller movement on mobile */
  }
}
