:root {
  --animation-duration: 0.8s;
  --easing: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --green-gradient: linear-gradient(to bottom, #8bc34a 50%, #ffffff 100%);
}

/* Banner Principal */
.banner-epss {
  position: relative;
  width: 100%;
  max-width: 1440px;
  height: 700px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  padding: 2rem;
  background-color: #fff;
  will-change: transform;
}

.ciudad-fondo {
  position: absolute;
  inset: 0;
  background: url("/assets/images/ciudad.webp") center bottom no-repeat;
  background-size: cover;
  opacity: 0.8;
  z-index: 1;
  will-change: opacity;
}

.edificio-principal {
  position: absolute;
  bottom: 25%;
  left: 57.5%;
  transform: translateX(-50%);
  max-height: 50%;
  z-index: 2;
  pointer-events: none;
  user-select: none;
  will-change: transform;
}

.contenido-epss {
  max-width: 90%;
  position: relative;
  display: flex;
  justify-content: center;
}

.titulo-epss {
  font-size: 7rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  margin: 0;
  display: flex;
  z-index: 3;
  will-change: transform, opacity;
}

.titulo-epss span {
  background: var(--green-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.texto-detras {
  position: relative;
  z-index: 2;
}

.texto-encima {
  position: relative;
  z-index: 5;
}

/* Animación de nubes optimizada */
.nube-movimiento {
  position: absolute;
  top: 0;
  left: 0;
  width: 300%;
  height: 100%;
  background: url("/assets/images/nube.webp") repeat-x;
  background-size: contain;
  filter: blur(10px);
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 4;
  will-change: transform;
  backface-visibility: hidden;
}

.capa1 {
  animation: moverNube 60s linear infinite;
  opacity: 0.7;
}

.capa2 {
  animation: moverNube-reverse 90s linear infinite;
  opacity: 0.6;
  transform: scale(1.2);
}

@keyframes moverNube {
  0% { transform: translateX(0); }
  100% { transform: translateX(-66.6%); }
}

@keyframes moverNube-reverse {
  0% { transform: translateX(-66.6%); }
  100% { transform: translateX(0); }
}

@media (max-width: 768px) {
  .titulo-epss {
    font-size: 4.5rem;
  }
}

/* Animaciones Scroll optimizadas */
.scroll-animation {
  opacity: 0;
  transform: translate3d(0, 30px, 0);
  transition: all var(--animation-duration) var(--easing);
  will-change: transform, opacity;
}

.scroll-animation.active {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* Sección Casos - Animaciones mejoradas */
.seccion-casos {
  padding: 60px 20px;
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.titulo-casos {
  color: #4caf50;
  font-size: 1.5rem;
  border-bottom: 2px solid #4caf50;
  display: inline-block;
  margin-bottom: 40px;
}

.galeria-casos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
}

.item-caso {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transform: translateX(60px);
  opacity: 0;
  transition: transform 0.6s var(--easing), opacity 0.6s var(--easing);
  will-change: transform, opacity;
}

.item-caso.visible {
  transform: translateX(0);
  opacity: 1;
}

.item-caso img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.4s var(--easing);
  will-change: transform;
}

.texto-caso {
  margin-top: 10px;
  font-size: 1rem;
  color: #333;
  z-index: 2;
  transition: all 0.4s var(--easing);
}

.etiqueta-caso {
  margin-top: 6px;
  font-size: 0.9rem;
  color: #4caf50;
  border-top: 1px dashed #ccc;
  padding-top: 6px;
  z-index: 2;
  transition: all 0.4s var(--easing);
}

.descripcion-hover {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 1) 100%);
  color: #fff;
  font-size: 0.9rem;
  padding: 20px;
  transform: translateY(100%);
  transition: all 0.4s var(--easing);
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  text-align: justify;
  line-height: 1.6;
  opacity: 0;
  backdrop-filter: blur(2px);
  box-shadow: 0 -10px 20px rgba(0, 0, 0, 0.15);
  will-change: transform, opacity;
}

/* Efectos Hover optimizados */
.item-caso:hover {
  transform: scale(1.03);
  z-index: 10;
}

.item-caso:hover img {
  transform: scale(1.05);
}

.item-caso:hover .descripcion-hover {
  transform: translateY(0);
  opacity: 1;
}

.item-caso:hover .texto-caso,
.item-caso:hover .etiqueta-caso {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

/* Animaciones escalables */
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slide-up {
  from {
    transform: translate3d(0, 40px, 0);
    opacity: 0;
  }
  to {
    transform: translate3d(0, 0, 0);
    opacity: 1;
  }
}

@keyframes zoom-in {
  from {
    transform: scale3d(0.8, 0.8, 0.8);
    opacity: 0;
  }
  to {
    transform: scale3d(1, 1, 1);
    opacity: 1;
  }
}

.anim-fade-in {
  animation: fade-in 1s var(--easing) forwards;
}

.anim-slide-up {
  animation: slide-up 1s var(--easing) forwards;
}

.anim-zoom-in {
  animation: zoom-in 1s var(--easing) forwards;
}

/* Optimización para movimiento reducido */
@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;
  }
}

/* Mejoras de rendimiento generales */
* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  backface-visibility: hidden;
}