/* ============================================
   SEDES - Animations & Transitions
   Smooth 60fps animations using transform/opacity
   ============================================ */

/* --- Keyframe Animations --- */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes fadeLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

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

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

@keyframes particleFloat {
  0% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx, 100px), var(--ty, -200px)) rotate(360deg);
    opacity: 0;
  }
}

@keyframes particlePulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.3;
  }
}

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

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

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

/* --- Animation Classes --- */
.animate-fade-in {
  animation: fadeIn 0.6s ease forwards;
}

.animate-fade-up {
  animation: fadeUp 0.6s ease forwards;
}

.animate-fade-left {
  animation: fadeLeft 0.6s ease forwards;
}

.animate-fade-right {
  animation: fadeRight 0.6s ease forwards;
}

/* --- Animation Delays --- */
.delay-1 {
  animation-delay: 200ms;
}

.delay-2 {
  animation-delay: 400ms;
}

.delay-3 {
  animation-delay: 600ms;
}

.delay-4 {
  animation-delay: 800ms;
}

.delay-5 {
  animation-delay: 1000ms;
}

/* --- Scroll Reveal Classes --- */
.reveal-up {
  opacity: 0;
  transform: translateY(40px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-right {
  opacity: 0;
  transform: translateX(40px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

/* Revealed state */
.reveal-up.revealed,
.reveal-left.revealed,
.reveal-right.revealed,
.reveal-scale.revealed {
  opacity: 1;
  transform: translate(0);
}

/* Staggered reveal delays */
.reveal-up:nth-child(1),
.reveal-left:nth-child(1),
.reveal-right:nth-child(1) {
  transition-delay: 0ms;
}

.reveal-up:nth-child(2),
.reveal-left:nth-child(2),
.reveal-right:nth-child(2) {
  transition-delay: 150ms;
}

.reveal-up:nth-child(3),
.reveal-left:nth-child(3),
.reveal-right:nth-child(3) {
  transition-delay: 300ms;
}

.reveal-up:nth-child(4),
.reveal-left:nth-child(4),
.reveal-right:nth-child(4) {
  transition-delay: 450ms;
}

/* --- Hover Animations for Cards --- */
.info-card,
.service-card,
.program-card,
.unit-card {
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              box-shadow 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.info-card:hover,
.service-card:hover,
.program-card:hover,
.unit-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

/* --- Particle Animations --- */
.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: rgba(59, 130, 246, 0.4);
  border-radius: 50%;
  animation: particleFloat linear infinite;
  pointer-events: none;
}

.particle:nth-child(odd) {
  background: rgba(124, 58, 237, 0.3);
}

.particle:nth-child(1) {
  --tx: 120px;
  --ty: -250px;
  left: 10%;
  top: 80%;
  animation-duration: 8s;
  animation-delay: 0s;
}

.particle:nth-child(2) {
  --tx: -80px;
  --ty: -300px;
  left: 25%;
  top: 90%;
  animation-duration: 10s;
  animation-delay: 1s;
}

.particle:nth-child(3) {
  --tx: 60px;
  --ty: -200px;
  left: 50%;
  top: 85%;
  animation-duration: 7s;
  animation-delay: 2s;
}

.particle:nth-child(4) {
  --tx: -100px;
  --ty: -280px;
  left: 70%;
  top: 75%;
  animation-duration: 9s;
  animation-delay: 0.5s;
}

.particle:nth-child(5) {
  --tx: 90px;
  --ty: -220px;
  left: 85%;
  top: 88%;
  animation-duration: 11s;
  animation-delay: 3s;
}

.particle:nth-child(6) {
  --tx: -50px;
  --ty: -260px;
  left: 40%;
  top: 70%;
  animation-duration: 8.5s;
  animation-delay: 1.5s;
}

.particle-lg {
  width: 10px;
  height: 10px;
  animation: particlePulse 4s ease-in-out infinite;
}

/* --- Smooth Transitions for Interactive Elements --- */
a,
button,
input,
textarea,
select {
  transition: all 0.3s ease;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

/* --- Navbar Slide-Down Animation --- */
.navbar {
  animation: slideDown 0.5s ease;
}

.navbar.scrolled {
  background: #ffffff;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  animation: none;
  transition: background 0.3s ease,
              padding 0.3s ease,
              box-shadow 0.3s ease;
}

.navbar.scrolled .nav-link {
  color: #374151;
}

.navbar.scrolled .nav-link:hover {
  color: #1e40af;
}

.navbar.scrolled .nav-link-cta {
  color: #ffffff;
}

.navbar.scrolled .nav-logo-title {
  color: #1e40af;
}

.navbar.scrolled .nav-logo-sub {
  color: #6b7280;
}

.navbar.scrolled #navToggle span {
  background: #374151;
}

/* --- Back-to-Top Button Fade --- */
.back-to-top {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease,
              visibility 0.4s ease,
              transform 0.3s ease,
              box-shadow 0.3s ease;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  animation: fadeUp 0.4s ease;
}

/* --- Service Card Icon Pulse on Hover --- */
.service-card:hover .service-card-icon {
  animation: pulse 0.6s ease;
}

.program-card:hover .program-card-icon {
  animation: pulse 0.6s ease;
}

/* --- Gradient Animation for Hero --- */
.hero-bg-gradient {
  background-size: 200% 200%;
  animation: gradientShift 15s ease infinite;
}

/* --- Counter Animation Support --- */
.counter-animate {
  animation: countUp 0.6s ease forwards;
}

.counter-number {
  display: inline-block;
  transition: transform 0.3s ease;
}

.counter-number.counting {
  transform: scale(1.1);
}

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

.animated-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: currentColor;
  transition: width 0.3s ease;
}

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

/* --- Loading Shimmer --- */
.shimmer {
  position: relative;
  overflow: hidden;
}

.shimmer::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(241, 245, 249, 0) 0%,
    rgba(241, 245, 249, 0.8) 50%,
    rgba(241, 245, 249, 0) 100%
  );
  animation: shimmer 1.5s infinite;
}

/* --- Image Zoom on Hover --- */
.img-zoom {
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.img-zoom img {
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.img-zoom:hover img {
  transform: scale(1.08);
}

/* --- Button Ripple Effect --- */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

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

.btn-ripple:active::before {
  width: 300px;
  height: 300px;
}

/* --- Gradient Text --- */
.gradient-text {
  background: linear-gradient(135deg, #3b82f6, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
}

/* --- Hero Particles --- */
.hero-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.hero-particles .particle {
  position: absolute;
  border-radius: 50%;
  background: white;
  opacity: 0.2;
  animation: particleFloat linear infinite;
}

/* --- Hero Overlay --- */
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.9) 0%,
    rgba(124, 58, 237, 0.85) 100%
  );
}

/* --- Hero Scroll Indicator --- */
.hero-scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  animation: float 2s ease-in-out infinite;
}

/* --- Nav Toggle (Hamburger) --- */
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: currentColor;
  margin: 5px 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* --- Mobile Nav Menu --- */
.nav-menu.active {
  display: flex;
}

/* --- Filter Buttons --- */
.filter-btn.active {
  background: #3b82f6;
  color: #ffffff;
}

/* --- Instagram Grid Items --- */
.instagram-item {
  aspect-ratio: 1;
  overflow: hidden;
  position: relative;
}

.instagram-item .overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.instagram-item:hover .overlay {
  opacity: 1;
}

/* --- Page Hero (Inner Pages) --- */
.page-hero {
  min-height: 40vh;
  background: linear-gradient(135deg, #3b82f6, #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

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

  .reveal-up,
  .reveal-left,
  .reveal-right,
  .reveal-scale {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .particle {
    display: none;
  }
}
