/* Animations and micro-interactions */
:root {
  --brand: #4CAF50;
  --brand-dark: #388E3C;
  --ease: cubic-bezier(.2,.7,.2,1);
}

/* Hero animated gradient overlay */
.hero-animated-gradient {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 80% at 0% 0%, rgba(76,175,80,0.18) 0%, transparent 60%),
              radial-gradient(120% 80% at 100% 100%, rgba(56,142,60,0.18) 0%, transparent 60%);
  animation: hueShift 12s linear infinite alternate;
  mix-blend-mode: screen;
}

@keyframes hueShift {
  0% { filter: hue-rotate(0deg) saturate(1); opacity: .8; }
  50%{ filter: hue-rotate(10deg) saturate(1.1); opacity: .9; }
  100%{ filter: hue-rotate(20deg) saturate(1.2); opacity: 1; }
}

/* Reveal base */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* Direction variants */
.fade-in { transform: none; }
.fade-right { transform: translateX(-16px); }
.fade-left { transform: translateX(16px); }

/* Staggering */
.stagger-parent { --stagger-step: 90ms; }
.stagger-parent .stagger-child { opacity: 0; transform: translateY(14px); transition: opacity .55s var(--ease), transform .55s var(--ease); }
.stagger-parent.is-visible .stagger-child { opacity: 1; transform: translateY(0); }
.stagger-parent.is-visible .stagger-child:nth-child(1) { transition-delay: calc(var(--stagger-step) * 0); }
.stagger-parent.is-visible .stagger-child:nth-child(2) { transition-delay: calc(var(--stagger-step) * 1); }
.stagger-parent.is-visible .stagger-child:nth-child(3) { transition-delay: calc(var(--stagger-step) * 2); }
.stagger-parent.is-visible .stagger-child:nth-child(4) { transition-delay: calc(var(--stagger-step) * 3); }

/* Buttons micro-interactions */
.btn { transition: transform .18s var(--ease), box-shadow .18s var(--ease); will-change: transform; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(0,0,0,.14); }
.btn:active { transform: translateY(0) scale(.98); box-shadow: 0 6px 14px rgba(0,0,0,.16); }

/* Image card hover effects */
.img-card { position: relative; transition: transform .35s var(--ease), box-shadow .35s var(--ease); box-shadow: 0 8px 22px rgba(0,0,0,.08); }
.img-card:hover { transform: translateY(-6px); box-shadow: 0 16px 40px rgba(0,0,0,.16); }
.hover-zoom img { transition: transform .5s var(--ease); will-change: transform; }
.hover-zoom:hover img { transform: scale(1.05); }

/* Feature mini-cards */
.card-hover { transition: transform .28s var(--ease), box-shadow .28s var(--ease), background .28s var(--ease); }
.card-hover:hover { transform: translateY(-6px); box-shadow: 0 18px 36px rgba(0,0,0,.14); background: #ffffff; }

/* Animated gradient border utility */
.gradient-border { position: relative; border-radius: inherit; }
.gradient-border::before {
  content: "";
  position: absolute; inset: -1px; border-radius: inherit; padding: 2px;
  background: linear-gradient(135deg, #4CAF50, #7B1FA2, #388E3C, #4CAF50);
  background-size: 300% 300%;
  animation: borderFlow 8s linear infinite;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; 
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

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

/* Slightly intensify on hover when element is hoverable */
.gradient-border:hover::before { filter: brightness(1.08); }

/* Header scroll state */
.header.scrolled { backdrop-filter: saturate(1.2) blur(10px); background: rgba(255,255,255,0.72); box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.header.scrolled .nav-link { color: #2c3e50; }

/* Back to top button removed */

/* Smooth scroll for in-page anchors */
html { scroll-behavior: smooth; }

/* ========== ADVANCED ANIMATIONS ========== */

/* Parallax scroll effects */
.parallax-element {
  will-change: transform;
  transition: transform 0.1s linear;
}

/* Floating animation */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

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

/* Pulse effect */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.pulse-animation {
  animation: pulse 2s ease-in-out infinite;
}

/* Simplified morphing shapes - desktop only */
@media (min-width: 769px) {
  @keyframes morph {
    0%, 100% { border-radius: 50%; }
    50% { border-radius: 30% 70% 70% 30%; }
  }

  .morphing-shape {
    animation: morph 12s ease-in-out infinite;
    will-change: border-radius;
  }
}

/* Mobile fallback - static shapes */
@media (max-width: 768px) {
  .morphing-shape {
    border-radius: 50%;
  }
}

/* Glowing effect */
@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px rgba(76, 175, 80, 0.3); }
  50% { box-shadow: 0 0 40px rgba(76, 175, 80, 0.6); }
}

.glow-effect {
  animation: glow 2s ease-in-out infinite;
}

/* Text typing effect */
@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink {
  50% { border-color: transparent; }
}

.typewriter {
  overflow: hidden;
  border-right: 2px solid #4CAF50;
  white-space: nowrap;
  margin: 0 auto;
  animation: typing 3s steps(40, end) forwards, blink 0.75s step-end infinite;
  width: 100%;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .typewriter {
    animation: typing 2s steps(25, end) forwards, blink 0.75s step-end infinite;
    font-size: 2rem !important;
  }
}

/* Slide in animations */
.slide-in-left {
  opacity: 0;
  transform: translateX(-100px);
  transition: all 0.8s var(--ease);
}

.slide-in-right {
  opacity: 0;
  transform: translateX(100px);
  transition: all 0.8s var(--ease);
}

.slide-in-up {
  opacity: 0;
  transform: translateY(100px);
  transition: all 0.8s var(--ease);
}

.slide-in-down {
  opacity: 0;
  transform: translateY(-100px);
  transition: all 0.8s var(--ease);
}

.slide-in-left.is-visible,
.slide-in-right.is-visible,
.slide-in-up.is-visible,
.slide-in-down.is-visible {
  opacity: 1;
  transform: translate(0);
}

/* Zoom animations */
.zoom-in {
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.6s var(--ease);
}

.zoom-in.is-visible {
  opacity: 1;
  transform: scale(1);
}

/* Rotate animations */
.rotate-in {
  opacity: 0;
  transform: rotate(-180deg) scale(0.8);
  transition: all 0.8s var(--ease);
}

.rotate-in.is-visible {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Interactive hover effects */
.hover-lift {
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.hover-lift:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.hover-tilt {
  transition: transform 0.3s var(--ease);
}

.hover-tilt:hover {
  transform: perspective(1000px) rotateX(10deg) rotateY(10deg);
}

/* Loading animations */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #4CAF50;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Optimized particle effect background */
.particles-bg {
  position: relative;
  overflow: hidden;
}

/* Only show particles on desktop */
@media (min-width: 769px) {
  .particles-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
      radial-gradient(circle at 20% 80%, rgba(76, 175, 80, 0.05) 0%, transparent 50%),
      radial-gradient(circle at 80% 20%, rgba(56, 142, 60, 0.05) 0%, transparent 50%);
    animation: particleFloat 30s ease-in-out infinite;
    pointer-events: none;
    will-change: transform;
  }
}

@keyframes particleFloat {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(20px, -20px); }
}

/* Advanced button effects */
.btn-magnetic {
  position: relative;
  transition: all 0.3s var(--ease);
  overflow: hidden;
}

.btn-magnetic::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn-magnetic:hover::before {
  left: 100%;
}

/* Scroll progress indicator */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, #4CAF50, #388E3C);
  z-index: 9999;
  transition: width 0.1s linear;
}

/* Page transition overlay */
.page-transition {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, #4CAF50, #388E3C);
  z-index: 10000;
  transform: translateX(-100%);
  transition: transform 0.5s var(--ease);
}

.page-transition.active {
  transform: translateX(0);
}

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

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

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

/* prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal, .stagger-parent .stagger-child { opacity: 1 !important; transform: none !important; }
}
