/* PERFORMANCE & ANIMATION OPTIMIZATIONS */

/* Hardware acceleration for animations */
.value-card,
.use-case-card,
.integration-card,
button,
a {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Smooth transitions */
* {
  transition-property: background-color, border-color, color, fill, stroke;
  transition-duration: 200ms;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Optimize animations */
@media (prefers-reduced-motion: no-preference) {
  .value-card:hover {
    animation: slideUp 0.3s ease-out forwards;
  }

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

  /* Fade in on scroll */
  .fade-in {
    opacity: 0;
    animation: fadeIn 0.6s ease-in-out forwards;
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }
}

/* Image optimization */
img {
  display: block;
  max-width: 100%;
  height: auto;
  loading: lazy;
}

/* Lazy load placeholder */
img[loading='lazy'] {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

img[loading='lazy']:not([src]) {
  opacity: 0.5;
}

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

/* Stop animations when image loads */
img[loading='lazy'][src] {
  animation: none;
}

/* Optimize font loading */
@font-face {
  font-display: swap;
}

/* Critical CSS - inline essential styles */
body {
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  line-height: 1.6;
  color: #0f172a;
  background-color: #ffffff;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Reduce bundle size */
.hidden {
  display: none !important;
}

/* Optimize hover states */
@media (hover: hover) {
  button:hover,
  a:hover {
    opacity: 0.9;
  }
}

@media (hover: none) {
  button:active,
  a:active {
    opacity: 0.85;
  }
}

/* Network-aware loading */
@media (prefers-reduced-data: reduce) {
  img {
    background-image: none !important;
  }

  * {
    animation: none !important;
    transition: none !important;
  }
}

/* Optimize colors for reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Battery saver mode */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #0f172a;
    color: #f1f5f9;
  }
}

/* Optimize for slow networks */
@media (max-width: 400px) {
  img {
    max-width: 100%;
  }

  .details-grid,
  .values-grid {
    gap: 12px;
  }
}

/* Cache busting - ensures fresh assets */
link[rel='stylesheet'],
script {
  integrity: '';
}
