/* ═══════════════════════════════════════════════════════════════
   AGRI GROWTH ENGINE X — ANIMATIONS & MICRO-INTERACTIONS
   ═══════════════════════════════════════════════════════════════ */

/* ── Page load: staggered reveal for initial viewport ────────── */
@keyframes agexFadeUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes agexFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes agexScaleIn {
  from { opacity: 0; transform: scale(.94); }
  to   { opacity: 1; transform: scale(1); }
}

/* Hero animates in on page load */
.agex-hero {
  animation: agexScaleIn .65s var(--agex-ease-out) both;
}
.agex-hero__badge {
  animation: agexFadeUp .5s var(--agex-ease-out) .1s both;
}
.agex-hero__title {
  animation: agexFadeUp .6s var(--agex-ease-out) .18s both;
}
.agex-hero__meta {
  animation: agexFadeUp .5s var(--agex-ease-out) .28s both;
}
.agex-hero__ctas {
  animation: agexFadeUp .5s var(--agex-ease-out) .36s both;
}

/* Cards stagger */
.agex-card:nth-child(1) { animation: agexFadeUp .5s var(--agex-ease-out) .1s both; }
.agex-card:nth-child(2) { animation: agexFadeUp .5s var(--agex-ease-out) .18s both; }
.agex-card:nth-child(3) { animation: agexFadeUp .5s var(--agex-ease-out) .26s both; }
.agex-card:nth-child(4) { animation: agexFadeUp .5s var(--agex-ease-out) .34s both; }
.agex-card:nth-child(5) { animation: agexFadeUp .5s var(--agex-ease-out) .40s both; }
.agex-card:nth-child(6) { animation: agexFadeUp .5s var(--agex-ease-out) .46s both; }

/* ── Button hover lift (override theme) ─────────────────────── */
body.agex-active .wp-block-button__link,
body.agex-active button:not(.agex-assistant-close):not(.agex-chip):not(.agex-send-btn):not(.agex-fab):not(#agex-msb-submit):not(.agex-assistant-close) {
  transition: transform .2s var(--agex-ease), box-shadow .2s ease !important;
}
body.agex-active .wp-block-button__link:hover {
  transform: translateY(-2px) !important;
}

/* ── Link underline slide ────────────────────────────────────── */
body.agex-active .entry-content a:not(.agex-btn):not(.agex-card):not(.agex-product-card) {
  position: relative;
  text-decoration: none;
}
body.agex-active .entry-content a:not(.agex-btn):not(.agex-card):not(.agex-product-card)::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0;
  width: 0; height: 1.5px;
  background: var(--agex-green-lite);
  transition: width .25s var(--agex-ease-out);
  border-radius: 2px;
}
body.agex-active .entry-content a:not(.agex-btn):not(.agex-card):not(.agex-product-card):hover::after {
  width: 100%;
}

/* ── Image hover zoom ────────────────────────────────────────── */
body.agex-active .entry-content img,
body.agex-active .wp-block-image img {
  transition: transform .45s var(--agex-ease-out), box-shadow .3s ease;
  will-change: transform;
}
body.agex-active .entry-content img:hover,
body.agex-active .wp-block-image img:hover {
  transform: scale(1.025);
  box-shadow: 0 14px 40px rgba(0,40,20,.20);
}

/* ── Chip hover bounce ───────────────────────────────────────── */
.agex-chip {
  transition:
    transform .22s var(--agex-ease),
    background .18s ease,
    box-shadow .18s ease !important;
}

/* ── CTA block pulse ─────────────────────────────────────────── */
@keyframes agexCTAPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(0,196,106,.28); }
  50%      { box-shadow: 0 0 0 8px rgba(0,196,106,0); }
}
.agex-cta-block {
  animation: agexCTAPulse 3.5s ease-out infinite;
}

/* ── Progress bar shimmer ────────────────────────────────────── */
@keyframes agexShimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
#agex-progress-bar {
  background-size: 400px 3px;
  background-image: linear-gradient(
    90deg,
    var(--agex-green) 0%,
    var(--agex-green-lite) 50%,
    var(--agex-gold) 70%,
    var(--agex-green) 100%
  );
  animation: agexShimmer 2s linear infinite;
}

/* ── Card skeleton loading ───────────────────────────────────── */
@keyframes agexSkeleton {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.agex-skeleton {
  background: linear-gradient(90deg, #e8f5ee 25%, #d4eedd 50%, #e8f5ee 75%);
  background-size: 400px 100%;
  animation: agexSkeleton 1.4s ease infinite;
  border-radius: var(--agex-r-sm);
}

/* ── Smooth page-level fade ──────────────────────────────────── */
body.agex-active .site-content {
  animation: agexFadeIn .35s ease both;
}

/* ── Reduced motion preference ───────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  #agex-progress-bar { animation: none; }
}
