/* ========================================
   Advanced Interactions & Animations
   ======================================== */

/* Scroll Progress Bar */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
  z-index: 9999;
  transition: width 0.1s ease;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

/* Scroll Reveal Animations */
.section,
.card,
.insight,
.stat-card,
.highlight-panel__item,
.department-card,
.hero__content,
.hero__visual {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.8s ease, transform 0.8s ease;
  transition-delay: calc(var(--animation-order, 0) * 0.1s);
}

/* Optional: Add animation class for scroll reveal if needed */
.scroll-reveal:not(.is-visible) {
  opacity: 0;
  transform: translateY(40px);
}

.scroll-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Enhanced Card Hover Effects with 3D Transform */
.card,
.stat-card,
.department-card {
  position: relative;
  transform-style: preserve-3d;
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  --rotate-x: 0deg;
  --rotate-y: 0deg;
  --mouse-x: 50%;
  --mouse-y: 50%;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(99, 102, 241, 0.08);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.card:hover::before {
  opacity: 1;
}

.card:hover {
  transform: perspective(1000px) rotateX(var(--rotate-x)) rotateY(var(--rotate-y)) translateY(-8px) scale(1.02);
  box-shadow: 0 30px 60px rgba(99, 102, 241, 0.3), 0 0 0 1px rgba(56, 189, 248, 0.5);
}

/* Magnetic Button Effect */
.btn--primary,
.nav__cta {
  transition: transform 0.2s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
}

/* Ripple Effect */
.ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  transform: scale(0);
  animation: ripple-animation 0.6s ease-out;
  pointer-events: none;
}

@keyframes ripple-animation {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

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

[data-float] {
  animation: float 3s ease-in-out infinite;
}

/* Typing Cursor Effect */
[data-typing] {
  border-right: 2px solid var(--accent);
  padding-right: 5px;
  animation: blink 0.7s step-end infinite;
}

@keyframes blink {
  from,
  to {
    border-color: transparent;
  }
  50% {
    border-color: var(--accent);
  }
}

/* Lazy Load Image Blur Effect */
img[loading="lazy"] {
  filter: blur(10px);
  transition: filter 0.5s ease;
}

img[loading="lazy"].loaded {
  filter: blur(0);
}

/* Enhanced Button Glow Effect */
.btn--primary {
  position: relative;
  overflow: hidden;
}

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

.btn--primary:hover::after {
  width: 300px;
  height: 300px;
}

/* Accent Text */
.gradient-text {
  color: var(--accent);
  font-weight: 600;
}

/* Smooth Card Grid Stagger Animation */
.card-grid > * {
  animation: card-entry 0.6s ease backwards;
  animation-delay: calc(var(--animation-order, 0) * 0.1s);
}

@keyframes card-entry {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Glowing Border Animation */
.glow-border {
  position: relative;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.glow-border::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: var(--accent);
  z-index: -1;
  opacity: 0.5;
}

/* Text Reveal Animation */
.text-reveal {
  opacity: 0;
  animation: text-reveal-animation 0.8s ease forwards;
}

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

/* Pulse Animation for Important Elements */
@keyframes pulse-glow {
  0%,
  100% {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
  }
  50% {
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.8);
  }
}

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

/* Stagger Fade-in for Lists */
.list li,
.team-list li {
  opacity: 1;
  /* Removed initial opacity: 0 to prevent invisible content */
  /* animation: fade-in-up 0.5s ease forwards; */
  /* animation-delay: calc(var(--list-index, 0) * 0.1s); */
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Smooth Hover Transitions for All Interactive Elements */
a,
button,
.nav__link,
.lang-switch__btn {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced Focus States for Accessibility */
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

/* Shimmer Loading Effect */
.shimmer {
  background: rgba(255, 255, 255, 0.05);
  animation: shimmer-animation 2s infinite;
}

@keyframes shimmer-animation {
  0% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.6;
  }
  100% {
    opacity: 0.3;
  }
}

/* Parallax Container */
[data-parallax] {
  will-change: transform;
}

/* Badge Animations */
.badge {
  animation: badge-bounce 2s ease-in-out infinite;
}

@keyframes badge-bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

/* Smooth Page Transitions */
body {
  animation: page-fade-in 0.5s ease-in;
}

@keyframes page-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Enhanced Avatar Hover Effects */
.avatar {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.avatar:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 20px 40px rgba(99, 102, 241, 0.5);
}

/* Insight Card Hover Effects */
.insight {
  transition: all 0.3s ease;
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.insight:hover {
  background: rgba(99, 102, 241, 0.05);
  transform: translateX(8px);
}

/* Hero Visual Floating Animation */
.hero__visual {
  animation: hero-float 6s ease-in-out infinite;
}

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

/* Stat Card Number Count Animation */
.stat-card h4 {
  font-variant-numeric: tabular-nums;
}

/* Brand Mark Rotation on Hover */
.brand__mark {
  transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.brand:hover .brand__mark {
  transform: rotate(360deg) scale(1.1);
}

/* Footer Link Underline Animation */
.site-footer__links a {
  position: relative;
}

.site-footer__links a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.site-footer__links a:hover::after {
  width: 100%;
}

/* Highlight Panel Gradient Border Animation */
.highlight-panel {
  position: relative;
  overflow: hidden;
}

.highlight-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.highlight-panel:hover::before {
  opacity: 0.5;
}

/* Contact Block Pulse Animation */
.contact-block {
  animation: contact-pulse 3s ease-in-out infinite;
}

@keyframes contact-pulse {
  0%,
  100% {
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.45);
  }
  50% {
    box-shadow: 0 20px 45px rgba(99, 102, 241, 0.35);
  }
}

/* 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;
  }

  .scroll-progress {
    display: none;
  }
}
