/* ==========================================================================
   HOJA DE ESTILOS: SERVICIOS (PÁGINA PRINCIPAL)
   ==========================================================================
   Controla el diseño de la portada, el título con fondo difuminado y
   la grilla interactiva de servicios.
   ========================================================================== */

/* 1. SECCIÓN DE TÍTULO (BANNER PRINCIPAL) */
.page-title {
  position: relative;
  text-align: center;
  /* Ajuste de posición: Header (80px) + Espacio visual (60px) = 140px */
  margin-top: 140px;
  margin-bottom: 60px;
  padding: 80px 20px; /* Espacio interno para que el texto respire */
  border-radius: 20px; /* Bordes redondeados modernos */
  overflow: hidden; /* Recorta la imagen de fondo */
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3); /* Sombra de profundidad */
  border: 1px solid rgba(255, 255, 255, 0.1); /* Borde sutil */
}

/* Pseudo-elemento para la imagen de fondo con efecto BLUR */
.page-title::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;

  /* [EDITABLE]: Cambiar aquí la imagen de fondo del título */
  background-image: url("../assets/img/fondoenservicio.png");
  background-size: cover;
  background-position: center;

  /* Filtros visuales: 
       - blur(4px): Desenfoca la imagen para que el texto sea legible.
       - brightness(0.4): Oscurece la imagen un 60%. */
  filter: blur(4px) brightness(0.4);
  transform: scale(1.1); /* Escala para evitar bordes blancos por el blur */
  z-index: -1; /* Se coloca DETRÁS del texto */
}

.page-title h1 {
  font-size: 3rem;
  color: var(--white);
  margin-bottom: 20px;
  position: relative;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); /* Sombra para mejorar lectura */
}

.page-title p {
  font-size: 1.2rem;
  color: #e2e8f0;
  position: relative;
  max-width: 700px;
  margin: 0 auto;
}

/* 2. CONTENEDOR DE LA GRILLA DE SERVICIOS */
.services-container-wrapper {
  max-width: 1100px;
  margin: 0 auto 100px;
}

.group-title {
  font-size: 1.5rem;
  color: var(--accent-cyan);
  margin: 60px 0 30px;
  padding-left: 20px;
  border-left: 4px solid var(--accent-cyan); /* Línea decorativa izquierda */
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Grilla Principal: Forzamos 2 columnas para simetría */
.services-expand-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px;
}

/* 3. TARJETA DE SERVICIO (ESTADO CERRADO) */
.service-square-item {
  background: rgba(15, 23, 42, 0.6); /* Fondo semitransparente */
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  cursor: pointer; /* Indica que es clicable */
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1); /* Animación suave */
  min-height: 250px; /* Altura mínima para uniformidad */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.service-square-item:hover {
  transform: translateY(-5px); /* Efecto de levitación */
  border-color: var(--accent-cyan);
  background: rgba(30, 41, 59, 0.8);
  box-shadow: 0 10px 25px rgba(56, 189, 248, 0.15); /* Glow cyan al hover */
}

/* Vista Previa (Icono + Título) */
.square-preview {
  padding: 40px;
}
.service-icon-lg {
  font-size: 4rem;
  color: var(--accent-cyan);
  margin-bottom: 20px;
  display: block;
}
.square-preview h3 {
  color: var(--white);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 10px;
}
.tap-hint {
  font-size: 0.9rem;
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* 4. CONTENIDO EXPANDIDO (ESTADO ABIERTO) */
.square-content {
  display: none;
  opacity: 0;
} /* Oculto por defecto */

/* Estilos cuando se agrega la clase .expanded via JS */
.service-square-item.expanded {
  grid-column: 1 / -1; /* Ocupa todo el ancho (las 2 columnas) */
  aspect-ratio: auto;
  display: block;
  text-align: left;
  padding: 0;
  cursor: default; /* Ya no es un botón */
  border-color: var(--accent-cyan);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
  background: rgba(15, 23, 42, 0.95); /* Fondo más sólido para lectura */
}

.service-square-item.expanded:hover {
  transform: none;
}
.service-square-item.expanded .square-preview {
  display: none;
} /* Oculta el preview */

.service-square-item.expanded .square-content {
  display: block;
  opacity: 1;
  animation: fadeIn 0.5s ease forwards; /* Animación de aparición */
  padding: 50px;
}

/* Layout Interno (Texto Izquierda - Imagen Derecha) */
.service-expanded-wrapper {
  display: flex;
  gap: 50px;
  align-items: flex-start;
}
.service-text {
  flex: 1;
}
.service-image {
  flex: 0 0 400px;
} /* Ancho fijo para la imagen */

.service-image img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.content-text h3,
.service-text h3 {
  font-size: 2rem;
  color: var(--white);
  margin-bottom: 20px;
}
.content-text p,
.service-text p {
  color: #cbd5e1;
  margin-bottom: 25px;
  line-height: 1.7;
  font-size: 1.1rem;
}

/* Lista de características (Checkmarks) */
.feature-list {
  list-style: none;
  padding: 0;
  margin-bottom: 30px;
}
.feature-list li {
  padding-left: 30px;
  position: relative;
  color: #cbd5e1;
  margin-bottom: 12px;
  font-weight: 500;
  font-size: 1rem;
}
/* Pseudo-elemento para el check ✓ */
.feature-list li::before {
  content: "✓";
  color: var(--accent-cyan);
  font-weight: 900;
  position: absolute;
  left: 0;
  font-size: 1.2rem;
}

/* 5. BOTONES DE ACCIÓN (COTIZAR / MINIMIZAR) */
.service-actions {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-service-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--accent-cyan);
  color: #020617;
  padding: 14px 35px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 800;
  transition: 0.3s;
  font-size: 1.1rem;
}
.btn-service-cta:hover {
  background: white;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.6);
  transform: translateY(-2px);
}

.btn-minimize {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-dim);
  padding: 14px 25px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: 0.3s;
  font-family: inherit;
}
.btn-minimize:hover {
  border-color: var(--white);
  color: var(--white);
  background: rgba(255, 255, 255, 0.05);
}

/* Animación simple de opacidad */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* 6. RESPONSIVE DESIGN (Móvil) */
@media (max-width: 900px) {
  /* Pasa a 1 columna */
  .services-expand-grid {
    grid-template-columns: 1fr;
  }

  /* Invierte el orden: Imagen arriba, Texto abajo */
  .service-expanded-wrapper {
    flex-direction: column-reverse;
    gap: 30px;
  }
  .service-image {
    flex: auto;
    width: 100%;
  }
  .service-image img {
    height: 200px;
  }

  /* Botones ocupan todo el ancho para facilitar el toque */
  .btn-service-cta,
  .btn-minimize {
    width: 100%;
    justify-content: center;
  }

  .service-square-item.expanded .square-content {
    padding: 30px;
  }
}
