/* ============================================================
   Clearwork Guides - Animations & Motion
   Scroll-reveal, hero transitions, hover effects, and more.
   Requires tokens.css for custom property definitions.
   ============================================================ */


/* ----------------------------------------------------------
   1. Scroll-Reveal Base
   Elements with [data-reveal] start hidden and animate in
   when the .is-visible class is added via IntersectionObserver.
   ---------------------------------------------------------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

[data-reveal="left"] {
  transform: translateX(-24px);
}

[data-reveal="left"].is-visible {
  transform: translateX(0);
}

[data-reveal="right"] {
  transform: translateX(24px);
}

[data-reveal="right"].is-visible {
  transform: translateX(0);
}

[data-reveal="scale"] {
  transform: scale(0.95);
}

[data-reveal="scale"].is-visible {
  transform: scale(1);
}


/* ----------------------------------------------------------
   2. Reduced Motion
   Respect user preference for reduced motion.
   ---------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}


/* ----------------------------------------------------------
   3. Hero Animations
   Staggered entrance for hero content elements.
   ---------------------------------------------------------- */

.hero__badge {
  animation: hero-in 0.8s ease both;
  animation-delay: 0s;
}

.hero__title {
  animation: hero-in 0.8s ease both;
  animation-delay: 0.1s;
}

.hero__subtitle {
  animation: hero-in 0.8s ease both;
  animation-delay: 0.3s;
}

.hero__actions {
  animation: hero-in 0.8s ease both;
  animation-delay: 0.5s;
}

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


/* ----------------------------------------------------------
   4. Gradient Mesh Background
   Slow-moving ambient background for hero / full-width sections.
   ---------------------------------------------------------- */

.gradient-mesh {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(
      135deg,
      #0f0f1a 0%,
      #1a1a2e 25%,
      #252540 50%,
      rgba(212, 145, 94, 0.05) 75%,
      #1a1a2e 100%
    );
  background-size: 200% 200%;
  animation: mesh-shift 15s ease infinite;
}

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


/* ----------------------------------------------------------
   5. Hover Effects
   Reusable lift and shadow transitions for interactive cards.
   ---------------------------------------------------------- */

.card-hover {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.lift-on-hover {
  transition: transform var(--transition-base);
}

.lift-on-hover:hover {
  transform: translateY(-2px);
}


/* ----------------------------------------------------------
   6. Loading Spinner
   Lightweight accent-colored spinner for async actions.
   ---------------------------------------------------------- */

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 50%;
  border-top-color: var(--accent);
  animation: spin 0.6s linear infinite;
}

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


/* ----------------------------------------------------------
   7. Pulse Animation
   Subtle breathing effect for live indicators / badges.
   ---------------------------------------------------------- */

.pulse {
  animation: pulse 2s ease infinite;
}

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


/* ----------------------------------------------------------
   8. Focus Styles
   Keyboard-accessible focus rings across all interactive
   elements, using the accent color for consistency.
   ---------------------------------------------------------- */

*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
