/* ==========================================================================
   WayUgo — Animations & Transitions

   1. Keyframes
   2. Scroll-reveal (data-wu-reveal, driven by IntersectionObserver in main.js)
   3. Hover effects
   4. Loaders
   5. Reduced motion
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. KEYFRAMES
   -------------------------------------------------------------------------- */
@keyframes wu-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes wu-fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes wu-fade-down {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes wu-slide-down {
  from { transform: translateY(-100%); }
  to   { transform: translateY(0); }
}

@keyframes wu-zoom-in {
  from { opacity: 0; transform: scale(.94); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes wu-shimmer {
  from { background-position: 100% 50%; }
  to   { background-position: 0 50%; }
}

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

@keyframes wu-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .45; }
}

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

/* --------------------------------------------------------------------------
   2. SCROLL REVEAL
   Add data-wu-reveal to any element. main.js adds .is-revealed when it
   enters the viewport. data-wu-delay="150" staggers in milliseconds.
   -------------------------------------------------------------------------- */
[data-wu-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--wu-duration-lg) var(--wu-ease-out),
              transform var(--wu-duration-lg) var(--wu-ease-out);
  transition-delay: var(--wu-reveal-delay, 0ms);
  will-change: opacity, transform;
}
[data-wu-reveal="left"]  { transform: translateX(-28px); }
[data-wu-reveal="right"] { transform: translateX(28px); }
[data-wu-reveal="zoom"]  { transform: scale(.94); }
[data-wu-reveal="fade"]  { transform: none; }

[data-wu-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   3. HOVER EFFECTS
   -------------------------------------------------------------------------- */
.wu-hover-lift { transition: transform var(--wu-duration) var(--wu-ease), box-shadow var(--wu-duration) var(--wu-ease); }
.wu-hover-lift:hover { transform: translateY(-5px); box-shadow: var(--wu-shadow); }

.wu-hover-zoom { overflow: hidden; }
.wu-hover-zoom img { transition: transform var(--wu-duration-lg) var(--wu-ease-out); }
.wu-hover-zoom:hover img { transform: scale(1.08); }

/* Underline that grows from the left */
.wu-hover-underline { position: relative; }
.wu-hover-underline::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--wu-duration) var(--wu-ease);
}
.wu-hover-underline:hover::after { transform: scaleX(1); }

.wu-float { animation: wu-float 4s ease-in-out infinite; }

/* --------------------------------------------------------------------------
   4. LOADERS
   -------------------------------------------------------------------------- */
.wu-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  border-inline-end-color: transparent;
  border-radius: 50%;
  animation: wu-spin .7s linear infinite;
  vertical-align: -0.2em;
}
.wu-spinner-lg { width: 38px; height: 38px; border-width: 3px; }

/* Button in a pending state — hides the label, shows a spinner */
.wu-btn.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.wu-btn.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255, 255, 255, .5);
  border-inline-end-color: #fff;
  border-radius: 50%;
  animation: wu-spin .7s linear infinite;
}
.wu-btn-outline.is-loading::after,
.wu-btn-ghost.is-loading::after {
  border-color: rgba(var(--wu-primary-rgb), .35);
  border-inline-end-color: var(--wu-primary);
}

/* Full-page loader shown until main.js boots */
.wu-page-loader {
  position: fixed;
  inset: 0;
  z-index: var(--wu-z-toast);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--wu-body-bg);
  transition: opacity var(--wu-duration-lg) var(--wu-ease), visibility var(--wu-duration-lg);
}
.wu-page-loader.is-hidden { opacity: 0; visibility: hidden; }

/* --------------------------------------------------------------------------
   5. REDUCED MOTION
   Respect the OS setting — required for WCAG 2.1 AA (2.3.3).
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }

  [data-wu-reveal] {
    opacity: 1;
    transform: none;
  }
}
