/* ==============================================
   ANIMATIONS.CSS
   Scroll effects, transitions, micro-interactions
   ============================================== */

/* ===== SMOOTH SCROLLING ===== */
html {
  scroll-behavior: smooth;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== FADE-IN ON SCROLL ===== */
/* Add this class to sections you want to animate */
.fade-in-section {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.fade-in-section.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children for cascading effect */
.fade-in-section.stagger > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.fade-in-section.stagger.is-visible > *:nth-child(1) {
  transition-delay: 0.1s;
  opacity: 1;
  transform: translateY(0);
}

.fade-in-section.stagger.is-visible > *:nth-child(2) {
  transition-delay: 0.2s;
  opacity: 1;
  transform: translateY(0);
}

.fade-in-section.stagger.is-visible > *:nth-child(3) {
  transition-delay: 0.3s;
  opacity: 1;
  transform: translateY(0);
}

.fade-in-section.stagger.is-visible > *:nth-child(4) {
  transition-delay: 0.4s;
  opacity: 1;
  transform: translateY(0);
}

/* ===== PARALLAX BACKGROUNDS ===== */
/* Apply to decorative background elements */
.parallax-bg {
  background-attachment: fixed;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

/* For baby blue decorative blocks */
.parallax-block {
  position: absolute;
  background: var(--theme-palette-color-4); /* Baby blue */
  border-radius: 20px;
  opacity: 0.5;
  z-index: -1;
  will-change: transform;
}

/* ===== HOVER/TAP ANIMATIONS ===== */
/* Interactive elements scale feedback */
.interactive-scale {
  transition: transform 0.2s ease;
  will-change: transform;
}

@media (min-width: 768px) {
  .interactive-scale:hover {
    transform: scale(1.05);
  }
}

@media (max-width: 767px) {
  .interactive-scale:active {
    transform: scale(0.97);
  }
}

/* ===== LOADING STATES ===== */
/* For when content is loading */
.skeleton-loader {
  background: linear-gradient(
    90deg,
    var(--theme-palette-color-6) 25%,
    #e0e0e0 50%,
    var(--theme-palette-color-6) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ===== PULSE ANIMATION ===== */
/* For attention-grabbing elements (like CTA buttons) */
.pulse {
  animation: pulse-animation 2s ease-in-out infinite;
}

@keyframes pulse-animation {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
}

/* ===== BOUNCE ON LOAD ===== */
/* For elements that should bounce in */
.bounce-in {
  animation: bounce-in 0.6s ease-out;
}

@keyframes bounce-in {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }
  50% {
    transform: scale(1.05) translateY(-5px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ===== ROTATE ON HOVER ===== */
/* For icons or decorative elements */
.rotate-on-hover {
  transition: transform 0.3s ease;
}

.rotate-on-hover:hover {
  transform: rotate(5deg);
}

/* ===== UNDERLINE ANIMATION ===== */
/* For links or menu items */
.animated-underline {
  position: relative;
  text-decoration: none;
}

.animated-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--theme-palette-color-1); /* Sky blue */
  transition: width 0.3s ease;
}

.animated-underline:hover::after {
  width: 100%;
}

/* ===== SLIDE IN FROM SIDES ===== */
.slide-in-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-in-left.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.slide-in-right {
  opacity: 0;
  transform: translateX(50px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-in-right.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* ===== GLOWING EFFECT ===== */
/* For special buttons or featured elements */
.glow-effect {
  position: relative;
  overflow: hidden;
}

.glow-effect::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.glow-effect:hover::before {
  width: 300px;
  height: 300px;
}