/* ============================================================
   MRАГРИ — ANIMATIONS CSS
   All keyframes, scroll-reveal classes, transitions, effects
   ============================================================ */

/* ============================================================
   REVEAL ON SCROLL (JS-triggered classes)
   ============================================================ */

/* Base hidden state for elements before reveal */
[data-reveal] {
  will-change: transform, opacity;
}

[data-reveal="fade"] {
  opacity: 0;
  transition: opacity 0.8s var(--ease-out);
}

[data-reveal="up"] {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

[data-reveal="down"] {
  opacity: 0;
  transform: translateY(-50px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

[data-reveal="left"] {
  opacity: 0;
  transform: translateX(-60px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

[data-reveal="right"] {
  opacity: 0;
  transform: translateX(60px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

[data-reveal="scale"] {
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-spring);
}

[data-reveal="blur"] {
  opacity: 0;
  filter: blur(10px);
  transform: translateY(20px);
  transition: opacity 0.9s var(--ease-out), filter 0.9s var(--ease-out), transform 0.9s var(--ease-out);
}

[data-reveal="flip-x"] {
  opacity: 0;
  transform: perspective(800px) rotateX(30deg);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

/* Revealed state */
[data-reveal].revealed {
  opacity: 1;
  transform: none;
  filter: none;
}

/* Stagger delays for grid children */
[data-reveal-stagger] > * {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

[data-reveal-stagger] > *:nth-child(1)  { transition-delay: 0.05s; }
[data-reveal-stagger] > *:nth-child(2)  { transition-delay: 0.12s; }
[data-reveal-stagger] > *:nth-child(3)  { transition-delay: 0.19s; }
[data-reveal-stagger] > *:nth-child(4)  { transition-delay: 0.26s; }
[data-reveal-stagger] > *:nth-child(5)  { transition-delay: 0.33s; }
[data-reveal-stagger] > *:nth-child(6)  { transition-delay: 0.40s; }
[data-reveal-stagger] > *:nth-child(7)  { transition-delay: 0.47s; }
[data-reveal-stagger] > *:nth-child(8)  { transition-delay: 0.54s; }

[data-reveal-stagger].revealed > * {
  opacity: 1;
  transform: none;
}

/* ============================================================
   GLOBAL KEYFRAMES
   ============================================================ */

/* Floating / breathing */
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.04); }
}

/* Organic leaf sway */
@keyframes leafSway {
  0%, 100% { transform: rotate(-5deg) translateY(0); }
  25%       { transform: rotate(5deg)  translateY(-8px); }
  50%       { transform: rotate(-3deg) translateY(-15px); }
  75%       { transform: rotate(4deg)  translateY(-5px); }
}

/* Water ripple */
@keyframes ripple {
  0%   { transform: scale(0); opacity: 0.8; }
  100% { transform: scale(4); opacity: 0; }
}

/* Shine sweep */
@keyframes shine {
  0%   { left: -100%; }
  60%  { left: 130%; }
  100% { left: 130%; }
}

/* Gradient shift */
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50%       { background-position: 100% 50%; }
}

/* Bounce in */
@keyframes bounceIn {
  0%   { transform: scale(0.3); opacity: 0; }
  50%  { transform: scale(1.05); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}

/* Slide in from left */
@keyframes slideInLeft {
  from { transform: translateX(-100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* Slide in from right */
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* Slide up */
@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* Fade in */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Zoom in */
@keyframes zoomIn {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* Spin */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Typing cursor blink */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* Progress bar fill */
@keyframes fillBar {
  from { width: 0%; }
  to   { width: var(--target-width, 80%); }
}

/* Twinkle star */
@keyframes twinkle {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.3; transform: scale(0.5); }
}

/* Grow from center */
@keyframes growCenter {
  from { transform: scaleX(0); transform-origin: center; }
  to   { transform: scaleX(1); }
}

/* ============================================================
   HERO SPECIFIC ANIMATIONS
   ============================================================ */

/* Hero title word-by-word animation */
.hero__title .word {
  display: inline-block;
  overflow: hidden;
}

.hero__title .word-inner {
  display: inline-block;
  transform: translateY(110%);
  animation: wordReveal 0.8s var(--ease-spring) forwards;
  animation-delay: var(--delay, 0s);
}

@keyframes wordReveal {
  to { transform: translateY(0); }
}

/* Particle system */
.hero__particle {
  animation: particleRise var(--d, 8s) ease-in-out infinite;
  animation-delay: var(--del, 0s);
}

@keyframes particleRise {
  0%   { transform: translateY(0) translateX(0) scale(1); opacity: 0.15; }
  50%  { opacity: 0.08; }
  100% { transform: translateY(-200px) translateX(var(--x, 30px)) scale(0); opacity: 0; }
}

/* Organic blob morphing */
.hero__blob {
  animation: blobMorph 12s ease-in-out infinite alternate;
}

@keyframes blobMorph {
  0%   { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
  25%  { border-radius: 40% 60% 70% 30% / 40% 60% 30% 70%; }
  50%  { border-radius: 70% 30% 50% 50% / 30% 70% 50% 50%; }
  75%  { border-radius: 30% 70% 60% 40% / 70% 30% 40% 60%; }
  100% { border-radius: 50% 50% 40% 60% / 50% 50% 60% 40%; }
}

/* ============================================================
   BUTTON ANIMATIONS
   ============================================================ */

/* Magnetic button effect (JS enhanced) */
.btn--magnetic {
  transition: transform 0.3s var(--ease-out) !important;
}

/* Pulse ring */
.btn--pulse {
  position: relative;
}

.btn--pulse::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  background: inherit;
  opacity: 0.4;
  animation: pulseRing 2s ease-out infinite;
  z-index: -1;
}

@keyframes pulseRing {
  0%   { transform: scale(1);   opacity: 0.4; }
  70%  { transform: scale(1.3); opacity: 0; }
  100% { transform: scale(1.3); opacity: 0; }
}

/* Shimmer loading state */
.btn--loading {
  pointer-events: none;
  opacity: 0.8;
  position: relative;
  overflow: hidden;
}

.btn--loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
  animation: shimmer 1.2s linear infinite;
  transform: none !important;
  left: -100% !important;
}

@keyframes shimmer {
  0%   { left: -100%; }
  100% { left: 100%; }
}

/* ============================================================
   CARD HOVER EFFECTS
   ============================================================ */

/* 3D tilt effect container */
.tilt-card {
  transform-style: preserve-3d;
  perspective: 1000px;
  transition: transform 0.1s linear;
}

.tilt-card__inner {
  transform-style: preserve-3d;
  transition: transform 0.1s linear;
}

.tilt-card__shine {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,255,255,0) 40%, rgba(255,255,255,0.25) 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.tilt-card:hover .tilt-card__shine { opacity: 1; }

/* Hover glow effect */
.hover-glow {
  position: relative;
}

.hover-glow::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: var(--grad-primary);
  opacity: 0;
  z-index: -1;
  filter: blur(15px);
  transition: opacity 0.4s;
}

.hover-glow:hover::before { opacity: 0.6; }

/* Ripple click effect */
.ripple-container {
  position: relative;
  overflow: hidden;
}

.ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  transform: scale(0);
  animation: rippleEffect 0.6s linear;
  pointer-events: none;
}

@keyframes rippleEffect {
  to { transform: scale(4); opacity: 0; }
}

/* ============================================================
   TEXT ANIMATIONS
   ============================================================ */

/* Split text — each char animates */
.split-text .char {
  display: inline-block;
  transform: translateY(100%);
  opacity: 0;
  animation: charReveal 0.5s var(--ease-spring) forwards;
  animation-delay: calc(var(--char-index, 0) * 0.03s);
}

@keyframes charReveal {
  to { transform: translateY(0); opacity: 1; }
}

/* Gradient text cycling */
.text-gradient {
  background: linear-gradient(90deg, var(--clr-primary), var(--clr-wheat), var(--clr-primary));
  background-size: 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 4s linear infinite;
}

/* Typewriter cursor */
.typewriter::after {
  content: '|';
  animation: blink 0.75s step-end infinite;
  color: var(--clr-primary);
  margin-left: 2px;
}

/* ============================================================
   COUNTER ANIMATION
   ============================================================ */
.counter {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.progress-bar {
  background: var(--clr-primary-pale);
  border-radius: var(--radius-full);
  height: 8px;
  overflow: hidden;
  margin-bottom: var(--space-2);
}

.progress-bar__fill {
  height: 100%;
  background: var(--grad-primary);
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 1.2s var(--ease-out);
}

.progress-bar__fill.animate { width: var(--target-width, 75%); }

/* ============================================================
   SCROLL PROGRESS LINE (top of page)
   ============================================================ */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--grad-primary);
  z-index: calc(var(--z-cursor) - 1);
  width: 0%;
  transition: width 0.1s linear;
  border-radius: 0 2px 2px 0;
}

/* ============================================================
   SWIPER CAROUSEL CUSTOM STYLES
   ============================================================ */
.mrAgri-swiper {
  overflow: visible !important;
  padding-bottom: var(--space-10) !important;
}

.mrAgri-swiper .swiper-slide {
  height: auto;
}

/* Custom pagination */
.mrAgri-swiper .swiper-pagination {
  bottom: 0 !important;
}

.mrAgri-swiper .swiper-pagination-bullet {
  width: 8px;
  height: 8px;
  background: var(--clr-border-dark);
  opacity: 1;
  transition: var(--transition-fast);
}

.mrAgri-swiper .swiper-pagination-bullet-active {
  background: var(--clr-primary);
  width: 24px;
  border-radius: var(--radius-full);
}

/* Custom arrows */
.swiper-btn-wrap {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.swiper-custom-btn {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-full);
  border: 2px solid var(--clr-border);
  background: var(--clr-surface);
  color: var(--clr-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.swiper-custom-btn:hover {
  background: var(--clr-primary);
  border-color: var(--clr-primary);
  color: white;
  transform: scale(1.1);
}

.swiper-custom-btn.swiper-button-disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ============================================================
   FLOATING ELEMENTS (decorative)
   ============================================================ */

.decor-leaf {
  position: absolute;
  pointer-events: none;
  animation: leafDrift var(--d, 15s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  opacity: 0.07;
}

@keyframes leafDrift {
  0%, 100% { transform: translateY(0) rotate(var(--r, 0deg)); }
  33%       { transform: translateY(-25px) rotate(calc(var(--r, 0deg) + 15deg)); }
  66%       { transform: translateY(15px)  rotate(calc(var(--r, 0deg) - 10deg)); }
}

.decor-circle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.06;
  animation: breathe var(--d, 8s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

/* ============================================================
   PAGE TRANSITIONS
   ============================================================ */
.page-transition-overlay {
  position: fixed;
  inset: 0;
  background: var(--clr-primary);
  z-index: 99998;
  transform: scaleY(0);
  transform-origin: bottom;
  pointer-events: none;
}

.page-transition-overlay.enter {
  animation: pageEnter 0.5s var(--ease-in-out) forwards;
}

.page-transition-overlay.exit {
  animation: pageExit 0.5s var(--ease-in-out) forwards;
  transform-origin: top;
}

@keyframes pageEnter {
  from { transform: scaleY(0); transform-origin: bottom; }
  to   { transform: scaleY(1); transform-origin: bottom; }
}

@keyframes pageExit {
  from { transform: scaleY(1); transform-origin: top; }
  to   { transform: scaleY(0); transform-origin: top; }
}

/* ============================================================
   WISHLIST / HEART ANIMATION
   ============================================================ */
.wishlist-btn svg {
  transition: fill var(--duration-fast), transform var(--duration-fast) var(--ease-spring);
}

.wishlist-btn.active svg {
  fill: #e53e3e;
  stroke: #e53e3e;
  animation: heartPop 0.4s var(--ease-spring);
}

@keyframes heartPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.4); }
  100% { transform: scale(1); }
}

/* ============================================================
   ADD TO CART ANIMATION
   ============================================================ */

/* Fly-to-cart animation */
.fly-item {
  position: fixed;
  width: 50px;
  height: 50px;
  border-radius: var(--radius-full);
  background: var(--clr-primary);
  z-index: 9999;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: var(--shadow-md);
}

/* ============================================================
   PARALLAX
   ============================================================ */
.parallax-section {
  will-change: transform;
  transform: translateZ(0);
}

.parallax-bg {
  will-change: transform;
  backface-visibility: hidden;
}

/* ============================================================
   ORGANIC SECTION DIVIDERS
   ============================================================ */
.divider-wave {
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  overflow: hidden;
  line-height: 0;
}

.divider-wave svg { display: block; width: 100%; }

.divider-wave--top {
  bottom: auto;
  top: -1px;
  transform: rotate(180deg);
}

.divider-wave--white path { fill: #FFFFFF; }
.divider-wave--bg path    { fill: var(--clr-bg); }
.divider-wave--cream path { fill: var(--clr-wood-pale); }
.divider-wave--green path { fill: var(--clr-primary); }

/* ============================================================
   GRID FILTER ANIMATIONS (Isotope)
   ============================================================ */
.isotope-item {
  transition: transform 0.4s var(--ease-out), opacity 0.4s var(--ease-out) !important;
}

/* ============================================================
   HOVER UNDERLINE LINK
   ============================================================ */
.hover-underline {
  position: relative;
  display: inline-block;
}

.hover-underline::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: right 0.3s var(--ease-out);
}

.hover-underline:hover::after { right: 0; }

/* ============================================================
   GLOW EFFECTS
   ============================================================ */
.glow-primary {
  box-shadow: 0 0 20px rgba(45,106,46,0.5);
  animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(45,106,46,0.4); }
  50%       { box-shadow: 0 0 40px rgba(45,106,46,0.7); }
}

/* ============================================================
   MORPHING BACKGROUND
   ============================================================ */
.morph-bg {
  background-size: 400% 400%;
  animation: gradientShift 8s ease infinite;
}

/* ============================================================
   ACCORDION / COLLAPSE
   ============================================================ */
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s var(--ease-out);
}

.accordion-content.open {
  max-height: 1000px;
}

/* ============================================================
   PREFERS REDUCED MOTION
   ============================================================ */
@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-reveal],
  [data-reveal-stagger] > * {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    transition: none !important;
  }
}
