/* ============================================
   HIGH RIDGE ADVISORY - Animations
   ============================================ */

/* ----------------------------------------
   Scroll Animation Base States
   ---------------------------------------- */
[data-animate] {
  opacity: 0;
  transition: opacity var(--duration-slower) var(--ease-out-expo),
              transform var(--duration-slower) var(--ease-out-expo);
}

[data-animate="fade-in"] {
  opacity: 0;
}

[data-animate="fade-in-up"] {
  opacity: 0;
  transform: translateY(30px);
}

[data-animate="fade-in-left"] {
  opacity: 0;
  transform: translateX(-30px);
}

[data-animate="fade-in-right"] {
  opacity: 0;
  transform: translateX(30px);
}

[data-animate="scale-in"] {
  opacity: 0;
  transform: scale(0.95);
}

/* ----------------------------------------
   Visible States (triggered by JS)
   ---------------------------------------- */
[data-animate].is-visible {
  opacity: 1;
  transform: translateY(0) translateX(0) scale(1);
}

/* ----------------------------------------
   Stagger Children Animation
   ---------------------------------------- */
[data-animate="stagger-children"] > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--duration-slow) var(--ease-out-expo),
              transform var(--duration-slow) var(--ease-out-expo);
}

[data-animate="stagger-children"].is-visible > *:nth-child(1) {
  transition-delay: 0ms;
  opacity: 1;
  transform: translateY(0);
}

[data-animate="stagger-children"].is-visible > *:nth-child(2) {
  transition-delay: 100ms;
  opacity: 1;
  transform: translateY(0);
}

[data-animate="stagger-children"].is-visible > *:nth-child(3) {
  transition-delay: 200ms;
  opacity: 1;
  transform: translateY(0);
}

[data-animate="stagger-children"].is-visible > *:nth-child(4) {
  transition-delay: 300ms;
  opacity: 1;
  transform: translateY(0);
}

[data-animate="stagger-children"].is-visible > *:nth-child(5) {
  transition-delay: 400ms;
  opacity: 1;
  transform: translateY(0);
}

[data-animate="stagger-children"].is-visible > *:nth-child(6) {
  transition-delay: 500ms;
  opacity: 1;
  transform: translateY(0);
}

[data-animate="stagger-children"].is-visible > *:nth-child(7) {
  transition-delay: 600ms;
  opacity: 1;
  transform: translateY(0);
}

[data-animate="stagger-children"].is-visible > *:nth-child(8) {
  transition-delay: 700ms;
  opacity: 1;
  transform: translateY(0);
}

[data-animate="stagger-children"].is-visible > *:nth-child(n+9) {
  transition-delay: 800ms;
  opacity: 1;
  transform: translateY(0);
}

/* ----------------------------------------
   Hero Animations
   ---------------------------------------- */
.hero-content {
  opacity: 0;
  animation: heroFadeIn 800ms var(--ease-out-expo) forwards;
  animation-delay: 200ms;
}

.hero-content h1 {
  opacity: 0;
  transform: translateY(20px);
  animation: heroElementIn 700ms var(--ease-out-expo) forwards;
  animation-delay: 300ms;
}

.hero-content .hero-subtitle {
  opacity: 0;
  transform: translateY(20px);
  animation: heroElementIn 700ms var(--ease-out-expo) forwards;
  animation-delay: 450ms;
}

.hero-content .hero-cta {
  opacity: 0;
  transform: translateY(20px);
  animation: heroElementIn 700ms var(--ease-out-expo) forwards;
  animation-delay: 600ms;
}

.scroll-indicator {
  opacity: 0;
  animation: fadeIn 500ms var(--ease-out-cubic) forwards;
  animation-delay: 1500ms;
}

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

@keyframes heroElementIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* ----------------------------------------
   Image Reveal Animation
   ---------------------------------------- */
.image-reveal {
  overflow: hidden;
}

.image-reveal img {
  transform: scale(1.1);
  transition: transform var(--duration-slower) var(--ease-out-expo);
}

.image-reveal.is-visible img {
  transform: scale(1);
}

/* ----------------------------------------
   Button Hover Animations
   ---------------------------------------- */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.btn:active::after {
  width: 300px;
  height: 300px;
}

/* ----------------------------------------
   Link Underline Animation
   ---------------------------------------- */
.link-animated {
  position: relative;
  display: inline-block;
}

.link-animated::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--gold-500);
  transition: width var(--duration-normal) var(--ease-out-cubic);
}

.link-animated:hover::after {
  width: 100%;
}

/* ----------------------------------------
   Card Animations
   ---------------------------------------- */
.card {
  transition: transform var(--duration-normal) var(--ease-out-cubic),
              box-shadow var(--duration-normal) var(--ease-out-cubic),
              border-color var(--duration-normal) var(--ease-out-cubic);
}

/* ----------------------------------------
   Navigation Animations
   ---------------------------------------- */
.navbar {
  transition: background-color var(--duration-normal) var(--ease-out-cubic),
              box-shadow var(--duration-normal) var(--ease-out-cubic);
}

/* Mobile menu slide animation handled in styles.css */

/* ----------------------------------------
   Accordion Animations
   ---------------------------------------- */
.card-team-bio {
  transition: max-height var(--duration-slow) var(--ease-out-cubic),
              padding var(--duration-slow) var(--ease-out-cubic);
}

/* ----------------------------------------
   Reduced Motion Support
   ---------------------------------------- */
@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;
  }

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

  [data-animate="stagger-children"] > * {
    opacity: 1;
    transform: none;
  }

  .hero-content,
  .hero-content h1,
  .hero-content .hero-subtitle,
  .hero-content .hero-cta,
  .scroll-indicator {
    opacity: 1;
    transform: none;
    animation: none;
  }
}

/* Also support class-based reduced motion */
.reduce-motion *,
.reduce-motion *::before,
.reduce-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

.reduce-motion [data-animate] {
  opacity: 1;
  transform: none;
}

.reduce-motion [data-animate="stagger-children"] > * {
  opacity: 1;
  transform: none;
}

/* ----------------------------------------
   Loading Animation (optional)
   ---------------------------------------- */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--navy-600);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ----------------------------------------
   Pulse Animation (for CTAs)
   ---------------------------------------- */
@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(26, 54, 93, 0.4);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(26, 54, 93, 0);
  }
}

.btn-pulse {
  animation: pulse 2s infinite;
}
