:root {
  --verde-profesional: #045C4B;  
  --verde-agua: #07B09B;
  --verde-claro: #75B214;
  --amarillo-verde: #33b14c;
  --tierra: #A67C52;
  --blanco: #ffffff;
  --gris-fondo: #f5f9f6;
  --negro: #333333;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Roboto', sans-serif;
  line-height: 1.6;
  background-color: var(--blanco);
  color: var(--negro);
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Keyframes para animaciones generales */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInLeft { from { opacity: 0; transform: translateX(-30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeInRight { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes zoomIn { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }

/* Carrusel Principal */
.carousel {
  position: relative;
  overflow: hidden;
  height: 100vh;
  max-height: 800px;
  background-color: var(--gris-fondo);
}

.carousel-container {
  position: relative;
  width: 100%;
  height: 100%;
}

.carousel-slide {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.5s ease-in-out, transform 1.5s ease-in-out;
  z-index: 0;
  overflow: hidden;
}

.carousel-slide.active {
  opacity: 1;
  z-index: 1;
}

.slide-bg {
  position: absolute;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  transition: transform 10s ease-out;
  transform: scale(1.1);
}

.carousel-slide.active .slide-bg {
  transform: scale(1);
}

.slide-content {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 20px;
  z-index: 2;
}

.centered-logo {
  max-width: 900px;
  width: 100%;
  height: auto;
  filter: 
    drop-shadow(0 5px 15px rgba(0,0,0,0.3))
    brightness(1.1)
    contrast(1.1);
  position: relative;
  z-index: 2;
  transition: transform 0.3s ease;
}

.centered-logo:hover {
  transform: scale(1.05);
}

.carousel-caption {
  max-width: 800px;
  padding: 40px;
  border-radius: 8px;
  background: rgba(4, 92, 75, 0.85);
  backdrop-filter: blur(5px);
  color: white;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.carousel-caption h2, 
.carousel-caption h3 {
  font-size: 2.5rem;
  margin-bottom: 20px;
  color: var(--amarillo-verde);
  opacity: 0; /* Controlado por JS */
  animation-fill-mode: forwards;
}

.carousel-caption p {
  font-size: 1.3rem;
  margin-bottom: 30px;
  opacity: 0; /* Controlado por JS */
  animation-fill-mode: forwards;
}

.carousel-caption .cta-btn {
  display: inline-block;
  padding: 12px 30px;
  background: var(--amarillo-verde);
  color: var(--verde-profesional);
  text-decoration: none;
  border-radius: 50px;
  font-weight: bold;
  transition: all 0.3s;
  opacity: 0; /* Controlado por JS */
  animation-fill-mode: forwards;
}

.carousel-caption .cta-btn:hover {
  background: white;
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 60px;
  height: 60px;
  background-color: rgba(255,255,255,0.2);
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  z-index: 10;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  backdrop-filter: blur(5px);
  opacity: 0.7;
}
.carousel-btn svg { width: 30px; height: 30px; fill: currentColor; }
.carousel-btn.prev { left: 30px; }
.carousel-btn.next { right: 30px; }
.carousel-btn:hover { opacity: 1; background-color: var(--amarillo-verde); color: var(--verde-profesional); transform: translateY(-50%) scale(1.1); }

.carousel-progress { position: absolute; bottom: 0; left: 0; width: 100%; height: 5px; background: rgba(255,255,255,0.2); z-index: 10; }
.progress-bar { height: 100%; width: 0; background: var(--amarillo-verde); transition: width linear; }

.stats-container { display: flex; justify-content: center; gap: 30px; margin-top: 30px; }
.stat-item { text-align: center; }
.stat-number { font-size: 2.5rem; font-weight: bold; color: var(--amarillo-verde); }
.stat-label { font-size: 1rem; text-transform: uppercase; letter-spacing: 1px; }

#particles-js { position: absolute; width: 100%; height: 100%; top: 0; left: 0; z-index: 1; }

/* Sección de Servicios */
.our-services {
  padding: 100px 0;
  background: linear-gradient(135deg, var(--gris-fondo) 0%, #e8f4f1 100%);
  position: relative;
  overflow: hidden; 
}

.our-services::before { 
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('/assets/images/pattern-leaf.png') repeat;
  opacity: 0.03;
  pointer-events: none;
}

.section-title {
  text-align: center;
  font-size: 2.8rem;
  color: var(--verde-profesional);
  margin-bottom: 60px;
  position: relative;
  display: inline-block; 
  left: 50%;
  transform: translateX(-50%);
}

.section-title::after { 
  content: '';
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: var(--amarillo-verde);
  border-radius: 2px;
}

.services-carousel-container {
  position: relative;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 0; 
}

.services-carousel { 
  display: flex; 
  position: relative;
  width: 100%;
  height: 500px; 
  perspective: 1200px;
  transform-style: preserve-3d;
}

.service-card { 
  position: absolute;
  width: 320px; 
  height: 420px; 
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotateY(calc(var(--i) * 120deg)) translateZ(380px); 
  transition: transform 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55), opacity 0.5s ease;
  will-change: transform, opacity;
  cursor: pointer;
  z-index: 1;
  transform-style: preserve-3d; 
}

.service-card:hover { z-index: 2; } 
.service-card.active { z-index: 3; } 

.service-content { 
  width: 100%;
  height: 100%;
  background: white;
  border-radius: 20px;
  box-shadow: 0 15px 40px rgba(4, 92, 75, 0.1);
  padding: 40px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform 0.5s ease, box-shadow 0.5s ease;
  border-top: 5px solid var(--amarillo-verde);
  overflow: hidden; 
  position: relative;
  transform: rotateY(0deg); 
}

.service-card.left .service-content,
.service-card.right .service-content {
  transform: rotateY(180deg); 
}

.service-card.active .service-content {
  transform: scale(1.08) rotateY(0deg); 
  box-shadow: 0 20px 50px rgba(4, 92, 75, 0.25);
  overflow: visible; 
}

.service-icon { font-size: 3rem; color: var(--amarillo-verde); margin-bottom: 25px; transition: transform 0.5s ease, background-color 0.3s ease; position: relative; width: 80px; height: 80px; display: flex; align-items: center; justify-content: center; background: rgba(7, 176, 155, 0.1); border-radius: 50%; }
.service-card h3 { color: var(--verde-profesional); font-size: 1.6rem; margin-bottom: 20px; transition: color 0.3s ease; position: relative; }
.service-card h3::after { content: ''; position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); width: 40px; height: 3px; background: var(--amarillo-verde); border-radius: 3px; transition: width 0.3s ease; }
.service-card.active h3::after { width: 60px; }

.service-details { 
  height: 0;
  opacity: 0;
  overflow: hidden; 
  transition: opacity 0.6s ease, height 0.6s ease; 
  width: 100%;
}

.service-card.active .service-details {
  height: auto; 
  opacity: 1;
  margin-top: 20px;
  overflow-y: auto; 
  max-height: 160px; 
  scrollbar-width: thin; 
  scrollbar-color: var(--amarillo-verde) rgba(4, 92, 75, 0.08); 
  padding-right: 8px; 
  touch-action: pan-y; /* Permite scroll vertical en táctiles */
  -webkit-overflow-scrolling: touch; /* Scroll suave en iOS */
}

.service-card.active .service-details::-webkit-scrollbar { width: 8px; }
.service-card.active .service-details::-webkit-scrollbar-track { background: rgba(4, 92, 75, 0.08); border-radius: 4px; margin-block: 2px; }
.service-card.active .service-details::-webkit-scrollbar-thumb { background: var(--amarillo-verde); border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
.service-card.active .service-details::-webkit-scrollbar-thumb:hover { background: var(--verde-profesional); }

.service-features { list-style: none; padding: 0; margin: 20px 0 0; text-align: left; width: 100%; }
.service-features li { margin-bottom: 12px; display: flex; align-items: flex-start; font-size: 0.95rem; line-height: 1.5; color: var(--negro); position: relative; padding-left: 25px; }
.service-features li::before { content: ''; position: absolute; left: 0; top: 7px; width: 12px; height: 12px; background-color: var(--amarillo-verde); border-radius: 50%; }
.service-features i { display: none; } 

.service-card.left:not(.active):hover .service-content,
.service-card.right:not(.active):hover .service-content {
  transform: rotateY(180deg) scale(1.05) translateY(-10px);
}
.service-card:not(.active):not(.left):not(.right):hover .service-content {
   transform: scale(1.05) translateY(-10px) rotateY(0deg);
}
.service-card:not(.active):hover .service-icon { transform: translateY(-5px) rotate(10deg); background: rgba(7, 176, 155, 0.15); }

/* Responsive para Sección de Servicios */
@media (max-width: 992px) {
  .services-carousel { height: 420px; perspective: 1000px; }
  .service-card { width: 280px; height: 380px; transform: translate(-50%, -50%) rotateY(calc(var(--i) * 120deg)) translateZ(320px); }
  .service-content { padding: 30px 20px; }
  .service-card.active .service-details { max-height: 130px; } 
}
@media (max-width: 768px) {
  .our-services { padding: 80px 0; }
  .services-carousel { height: 350px; perspective: 800px; }
  .service-card { width: 240px; height: 320px; transform: translate(-50%, -50%) rotateY(calc(var(--i) * 120deg)) translateZ(250px); }
  .service-icon { font-size: 2.2rem; width: 70px; height: 70px; margin-bottom: 15px; }
  .service-card h3 { font-size: 1.3rem; margin-bottom: 15px; }
  .service-features li { font-size: 0.85rem; margin-bottom: 8px; }
  .service-card.active .service-details { max-height: 100px; padding-right: 5px; } 
  .service-card.active .service-details::-webkit-scrollbar { width: 6px; }
}
@media (max-width: 576px) {
  .services-carousel { height: 300px; perspective: 600px; }
  .service-card { width: 200px; height: 280px; transform: translate(-50%, -50%) rotateY(calc(var(--i) * 120deg)) translateZ(180px); }
  .service-content { padding: 20px 15px; }
  .service-icon { font-size: 2rem; width: 60px; height: 60px; margin-bottom: 10px; }
  .service-features li { font-size: 0.8rem; padding-left: 20px; }
  .service-features li::before { width: 10px; height: 10px; top: 6px; }
  .service-card.active .service-details { max-height: 70px; } 
}

/* Sección Nuestro Enfoque */
.about-approach { padding: 80px 0; background-color: var(--gris-fondo); }
.approach-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; margin-top: 40px; }
.approach-card { background: var(--blanco); border-radius: 8px; overflow: hidden; box-shadow: 0 5px 15px rgba(0,0,0,0.05); transition: all 0.3s ease; display: flex; flex-direction: column; height: 100%; }
.approach-card:hover { transform: translateY(-5px); box-shadow: 0 15px 30px rgba(7, 176, 155, 0.15); }
.approach-icon { background: var(--verde-profesional); color: white; font-size: 2rem; padding: 20px; text-align: center; }
.approach-icon i { transition: transform 0.3s ease; }
.approach-card:hover .approach-icon i { transform: scale(1.2); }
.approach-card h3 { color: var(--verde-profesional); padding: 20px 20px 10px; margin: 0; font-size: 1.4rem; text-align: center; }
.approach-content { padding: 0 20px 20px; flex-grow: 1; display: flex; flex-direction: column; justify-content: space-between; }
.approach-content p { margin-bottom: 15px; line-height: 1.6; color: var(--negro); }
.approach-content p:last-child { margin-bottom: 0; }
@media (max-width: 768px) { .approach-grid { grid-template-columns: 1fr; } .approach-card { max-width: 500px; margin: 0 auto; } }

/* Footer */
.agro-footer { background-color: var(--verde-profesional); color: var(--blanco); padding: 60px 0 20px; }
.footer-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px; margin-bottom: 40px; }
.footer-logo { height: 60px; margin-bottom: 20px; }
.footer-about p { opacity: 0.8; line-height: 1.6; }
.footer-links h3, .footer-contact h3 { color: var(--amarillo-verde); margin-bottom: 20px; font-size: 1.3rem; }
.footer-links ul { list-style: none; padding: 0; } .footer-links li { margin-bottom: 10px; }
.footer-links a { color: var(--blanco); text-decoration: none; transition: color 0.3s; opacity: 0.8; }
.footer-links a:hover { color: var(--amarillo-verde); opacity: 1; }
.footer-contact p { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; opacity: 0.8; }
.footer-contact i { width: 20px; text-align: center; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 20px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.social-links { display: flex; gap: 15px; }
.social-links a { color: var(--blanco); background: rgba(255,255,255,0.1); width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all 0.3s; }
.social-links a:hover { background: var(--amarillo-verde); color: var(--verde-profesional); transform: translateY(-3px); }

/* Ajustes Responsive Generales del Carrusel Principal y otros */
@media (max-width: 768px) { /* Ajustes generales para tablets y móviles grandes */
  .carousel { height: 80vh; } .carousel-caption { padding: 25px; }
  .carousel-caption h2, .carousel-caption h3 { font-size: 1.8rem; } .carousel-caption p { font-size: 1rem; }
  /* Los botones del carrusel principal ya tienen un media query @480px, se podría unificar o ajustar */
}
@media (max-width: 480px) { /* Ajustes para móviles más pequeños */
  .carousel { height: 70vh; } 
  .carousel-caption h2, .carousel-caption h3 { font-size: 1.5rem; }
  .carousel-btn { width: 45px; height: 45px; } /* Reducción previa */
  .carousel-btn.prev { left: 15px; }
  .carousel-btn.next { right: 15px; }
  .section-title { font-size: 2.2rem; } 
  .service-card h3 { font-size: 1.2rem; }
}

/* NUEVO: Media Query para pantallas muy estrechas (soluciona solapamiento de botones del carrusel principal) */
@media (max-width: 360px) { /* Ajustar este breakpoint si es necesario, ej. 320px o 300px */
  .carousel-btn {
    width: 35px; /* Reducir aún más el tamaño */
    height: 35px;
  }
  .carousel-btn svg {
    width: 20px; /* Escalar el SVG interno */
    height: 20px;
  }
  .carousel-btn.prev {
    left: 10px; /* Reducir el offset */
  }
  .carousel-btn.next {
    right: 10px; /* Reducir el offset */
  }
}


/* Configuraciones HTML y de base */
html { font-size: 16px; scroll-behavior: smooth; }
@media (max-width: 1200px) { html { font-size: 15px; } }
@media (max-width: 992px) { html { font-size: 14px; } }
@media (max-width: 768px) { html { font-size: 13px; } .container { width: 95%; padding: 0 15px; } }
@media (max-width: 576px) { html { font-size: 12px; } }

button, a { -webkit-tap-highlight-color: rgba(0,0,0,0); touch-action: manipulation; }
img { max-width: 100%; height: auto; display: block; }

/* Clases de optimización */
.no-animations *, .no-animations *::before, .no-animations *::after,
.slow-connection *, .slow-connection *::before, .slow-connection *::after { animation: none !important; transition: none !important; }
.slow-connection img { filter: blur(1px); transition: filter 0.3s ease; }
.slow-connection img.loaded { filter: none; }

@media (max-width: 768px) { .carousel-slide:not(.active) { display: none; } } 
@media screen and (max-width: 480px) { input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="search"], textarea, select { font-size: 16px !important; } }
/* =================================== */
/* PRELOADER STYLES           */
/* =================================== */
#preloader {
  position: fixed; /* Cubre toda la pantalla y se queda fijo */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--verde-profesional); /* Fondo con tu color principal */
  z-index: 99999; /* Asegura que esté por encima de todo */
  display: flex;
  flex-direction: column; /* Centra el contenido verticalmente */
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.7s cubic-bezier(0.77, 0, 0.175, 1), visibility 0s linear 0.7s; /* Transición suave para desaparecer */
}

#preloader.preloader-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none; /* Importante para permitir clics en la página una vez oculto */
}

.preloader-content {
  text-align: center;
}

.preloader-logo {
  display: block;
  max-width: 180px; /* Ajusta el tamaño del logo según necesites */
  height: auto;
  margin: 0 auto 30px auto; /* Centrado y con espacio inferior */
  animation: pulseLogo 1.8s ease-in-out infinite alternate; /* Animación sutil para el logo */
}

@keyframes pulseLogo {
  from {
    transform: scale(1);
    opacity: 0.9;
  }
  to {
    transform: scale(1.03);
    opacity: 1;
  }
}

.preloader-spinner {
  width: 45px; /* Tamaño del spinner */
  height: 45px;
  border: 4px solid rgba(255, 255, 255, 0.2); /* Color base del círculo del spinner */
  border-top-color: var(--amarillo-verde); /* Color del acento para la parte que gira */
  border-radius: 50%;
  animation: spin 0.8s linear infinite; /* Animación de rotación */
  margin: 0 auto; /* Centrado si el logo no estuviera o como animación principal */
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.preloader-text {
  color: var(--blanco); /* Color del texto de carga */
  font-size: 0.95rem;
  margin-top: 25px; /* Espacio sobre el texto */
  letter-spacing: 0.5px;
  font-weight: 300;
}
