/* =========================================
   VARIABLES CSS
   Definimos los colores corporativos aquí para
   poder cambiarlos fácilmente en todo el sitio.
   ========================================= */
:root {
  /* Azul profundo (Corporativo) */
  --primary-color: #0d47a1;

  /* Tono más oscuro para hovers */
  --primary-dark: #002171;

  /* Tono más claro */
  --primary-light: #5472d3;

  /* Rojo/Naranja de acento (para llamadas a la acción) */
  --accent-color: #d32f2f;

  /* Rojo oscuro para hover en botones de acento */
  --accent-hover: #9a0007;

  /* Color de texto principal */
  --text-dark: #333333;

  /* Color de texto secundario */
  --text-light: #666666;

  /* Fondos claros */
  --light-gray: #f8f9fa;

  /* Versión RGB para transparencias */
  --primary-rgb: 13, 71, 161;
}

/* Estilos Generales del Cuerpo */
body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  /* Fuente moderna y legible */
  color: var(--text-dark);
  line-height: 1.6;
  margin: 0;
  padding: 0;
}

/* =========================================
   TIPOGRAFÍA
   ========================================= */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
  /* Un poco más "apretado" para títulos modernos */
}


/* Clases de utilidad de color personalizadas */
.text-primary {
  color: var(--primary-color) !important;
}

.text-warning {
  color: var(--accent-color) !important;
  /* Usamos nuestro rojo de acento para la clase warning */
}

.bg-primary {
  background-color: var(--primary-color) !important;
}

/* Fondos semitransparentes para iconos */
.bg-primary-light {
  background-color: rgba(var(--primary-rgb), 0.1);
}

.bg-warning-light {
  background-color: rgba(211, 47, 47, 0.1);
}

.bg-secondary-light {
  background-color: rgba(108, 117, 125, 0.1);
}

/* =========================================
   BOTONES
   ========================================= */
.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  transition: all 0.3s ease;
  /* Transición suave */
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-2px);
  /* Efecto de elevación al pasar el mouse */
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}

.btn-outline-primary {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-outline-primary:hover {
  background-color: var(--primary-color);
  color: white;
}

.btn-warning {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
  color: white;
}

.btn-warning:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
  color: white;
  transform: translateY(-2px);
}

/* =========================================
   AYUDANTES DE DISEÑO (LAYOUT)
   ========================================= */
.section-padding {
  padding: 80px 0;
  /* Espaciado generoso entre secciones */
}

.ls-2 {
  letter-spacing: 2px;
}

/* =========================================
   COMPONENTES ESPECÍFICOS
   ========================================= */

/* Barra Superior */
.top-bar {
  background-color: var(--primary-dark);
  font-size: 0.85rem;
}

/* Navegación */
.navbar-brand img {
  max-width: 180px;
  height: auto;
}

/* Navbar Minimizado */
.navbar-minimized {
  padding: 0.3rem 0;
  transition: all 0.3s ease;
  min-height: auto;
  margin: 0;
  border: none;
}

.navbar-minimized .navbar-brand img {
  max-width: 200px;
  width: 100%;
  height: auto;
  display: block;
}

.navbar-minimized .copy {
  font-size: 0.65rem;
  margin: 0;
  padding: 0;
  line-height: 1;
}

.nav-link {
  font-weight: 500;
  color: var(--text-dark);
  padding: 0.5rem 1rem !important;
  transition: color 0.3s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary-color);
}

/* Hero Section - Nueva estructura con 2 servicios lado a lado */
#hero {
  background: #f8f9fa;
  margin: 0;
  padding: 0;
  display: block;
}

.hero-section {
  min-height: 600px;
  margin: 0;
  padding: 0;
  display: block;
}

.hero-service {
  position: relative;
  height: 524px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
}

.hero-images-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  /* Placeholder background prevents a white frame while images initialize */
  background: linear-gradient(180deg, rgba(15, 23, 30, 0.08) 0%, rgba(0, 0, 0, 0.06) 100%);
}

.hero-image,
.fade-image {
  position: absolute;
  display: block;
  /* Asegura comportamiento de bloque para picture */
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.5s ease-in-out;
  z-index: 0;
}

/* Las imágenes dentro de picture siempre deben ser visibles si el picture está activo */
picture.fade-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1 !important;
}

.hero-image.active,
.fade-image.active {
  opacity: 1;
  z-index: 1;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  color: white;
  text-align: left;
  max-width: 90%;
  padding: 15px;
}


.hero-security .hero-content {
  text-align: left;
  justify-self: flex-start;
}

.hero-digital .hero-content {
  text-align: right;
  margin-left: auto;
}

.hero-badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 1rem;
}

.hero-title {
  font-size: 3.2rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.hero-title span {
  font-weight: 800;
}

.hero-description {
  font-size: 1.1rem;
  margin-bottom: 2rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.95);
  max-width: 500px;
}

.hero-buttons {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero-buttons .btn {
  font-weight: 600;
  transition: all 0.3s ease;
}

.hero-buttons .btn-success {
  background-color: #28a745;
  border-color: #28a745;
}

.hero-buttons .btn-success:hover {
  background-color: #218838;
  transform: translateY(-2px);
}

.hero-buttons .btn-link {
  font-weight: 600;
  text-decoration: none !important;
  padding: 0;
}

.hero-buttons .btn-link:hover {
  opacity: 0.8;
}

/* Responsive */
@media (max-width: 992px) {
  .hero-service {
    height: 500px;
  }

  .hero-content {
    padding: 2rem;
  }

  .hero-security .hero-content,
  .hero-digital .hero-content {
    padding: 2rem;
  }

  .hero-title {
    font-size: 2.5rem;
  }

  .hero-description {
    font-size: 1rem;
  }
}

@media (max-width: 768px) {
  .hero-service {
    height: 450px;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-description {
    font-size: 0.95rem;
  }

  .hero-content {
    padding: 1.5rem;
  }

  .hero-buttons {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .hero-buttons .btn {
    width: 100%;
  }
}

/* Estilos de Galería Modal Removidos por Conflicto */

/* Limpieza de sintaxis */


/* Portrait-mode: aplica solo al slide activo (no interfiere con slides 'pareja') */
/* Estilos Retrato Antiguos Eliminados */


.vh-80 {
  height: 80vh;
}

.object-fit-cover {
  object-fit: cover;
  /* Asegura que la imagen cubra todo el espacio sin deformarse */
  height: 100%;
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  /* Capa oscura semitransparente sobre la imagen */
  z-index: 1;
}

.carousel-caption {
  z-index: 2;
  /* Texto sobre la capa oscura */
  bottom: 20%;
}

/* Hero: layout limpio y funcional */
header#hero {
  height: auto;
}

header#hero .carousel-item {
  height: auto;
}

.hero-slide {
  display: flex;
  height: 80vh;
  min-height: 500px;
  position: relative;
  overflow: hidden;
}

.hero-half {
  flex: 1;
  position: relative;
  overflow: hidden;
  height: 100%;
}

.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Diagonal en desktop/tablet */
@media (min-width: 768px) {
  .hero-half:first-child .hero-img {
    clip-path: polygon(0 0, 100% 0, 65% 100%, 0 100%);
    object-position: left center;
  }

  .hero-half:last-child .hero-img {
    clip-path: polygon(35% 0, 100% 0, 100% 100%, 0 100%);
    object-position: right center;
  }

  .hero-slide::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    width: 8%;
    height: 100%;
    transform: translateX(-50%) rotate(18deg);
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.05) 30%,
        rgba(0, 0, 0, 0.08) 50%,
        rgba(255, 255, 255, 0.05) 70%,
        rgba(255, 255, 255, 0) 100%);
    z-index: 3;
    pointer-events: none;
    filter: blur(1px);
  }
}

/* Mobile: apilado vertical */
@media (max-width: 767px) {
  .hero-slide {
    flex-direction: column;
    height: auto;
  }

  .hero-half {
    height: 40vh;
    min-height: 300px;
  }

  .hero-img {
    clip-path: none;
  }
}

/* CTAs */
.hero-cta {
  position: absolute;
  bottom: 1.5rem;
  left: 1.5rem;
  right: 1.5rem;
  z-index: 4;
  color: #ffffff;
}

.hero-cta h5 {
  font-size: 1.1rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  margin: 0 0 0.75rem 0;
}

.hero-cta .btn {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  font-size: 0.9rem;
}

.hero-half:last-child .hero-cta {
  text-align: right;
  left: auto;
}

/* Mobile CTAs */
@media (max-width: 767px) {
  .hero-cta {
    position: static;
    padding: 1rem;
    text-align: center;
    background: transparent;
  }

  .hero-cta h5 {
    color: #333;
    text-shadow: none;
  }

  .hero-half:last-child .hero-cta {
    text-align: center;
  }
}

/* Animaciones de entrada simples */
.animated-fade-up {
  opacity: 0;
  animation: fadeUp 1s ease forwards;
}

.animated-fade-down {
  opacity: 0;
  animation: fadeDown 1s ease forwards;
}

.delay-100 {
  animation-delay: 0.2s;
}

.delay-200 {
  animation-delay: 0.4s;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Tarjetas de Servicios */
.transition-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.shadow-hover:hover {
  transform: translateY(-10px);
  /* Flotar hacia arriba */
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1) !important;
}

.zoom-effect {
  transition: transform 0.5s ease;
  width: 100%;
  height: 250px;
  object-fit: cover;
}

.card:hover .zoom-effect {
  transform: scale(1.1);
  /* Efecto zoom en la imagen */
}

.icon-box {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Formulario de Contacto */
.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.25rem rgba(var(--primary-rgb), 0.25);
}

/* Footer */
.hover-white:hover {
  color: white !important;
}

.btn-icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.btn-icon:hover {
  background-color: white;
  color: var(--primary-color);
}

/* =========================================
   RESPONSIVE (MÓVIL)
   ========================================= */
@media (max-width: 768px) {
  header#hero .carousel-item {
    height: 60vh;
    /* Menor altura en móviles */
  }

  .display-3 {
    font-size: 2.5rem;
    /* Texto más pequeño */
  }
}

/* Estilos para las parejas de imágenes dentro del modal (dos por slide en desktop) */
.modal-pair-img {
  width: 100%;
  max-width: 520px;
  height: auto;
  object-fit: contain;
  display: block;
  min-width: 0;
  /* permitir que la imagen se reduzca dentro del flex container */
}

@media (min-width: 768px) {
  .modal-pair-img {
    flex: 0 0 48%;
    width: auto;
    max-width: 48%;
  }

  /* evitar wrap en desktop y mantener las imágenes estrictamente lado a lado */
  #galleryModal .carousel-item>.d-flex {
    flex-wrap: nowrap !important;
  }
}

@media (max-width: 576px) {
  .modal-pair-img {
    width: 100%;
    max-width: 100%;
  }
}

/* Placeholder visual para imágenes faltantes (se asigna por JS). Reemplaza la imagen src cuando tengas tu foto. */
.modal-pair-img.placeholder {
  background: linear-gradient(135deg, #f3f4f6 0%, #e9ecef 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #6c757d;
  font-size: 0.9rem;
  min-height: 220px;
  /* tamaño razonable para el modal */
  object-fit: contain;
}

/* Consolidación de estilos de Galería Modal */
#galleryModal .modal-dialog {
  max-width: 900px;
  margin: 1.75rem auto;
}

#galleryModal .modal-content {
  border-radius: 20px;
  overflow: visible;
  /* Corregido: permite que las fotos respiren */
  border: none;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

#galleryModal .modal-body {
  padding: 1.5rem;
  /* Aumentado para evitar recortes */
}

.gallery-carousel-row {
  margin-right: -10px;
  margin-left: -10px;
  display: flex;
  flex-wrap: wrap;
}

.gallery-item {
  padding: 10px;
  transition: transform 0.3s ease;
}

/* Consolidación de estilos de Galería Modal - FINAL FIX */
#galleryModal .modal-dialog {
  max-width: 820px;
  margin: 1.5rem auto;
}

#galleryModal .modal-content {
  border-radius: 20px;
  overflow: hidden;
  border: none;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

#galleryModal .modal-body {
  padding: 1rem;
}

.gallery-carousel-row {
  margin: 0 -5px;
  display: flex;
  flex-wrap: wrap;
}

.gallery-item {
  padding: 5px;
}

.gallery-img-container {
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  aspect-ratio: 16/9;
  background: #f8f9fa;
  width: 100%;
}

.gallery-img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Flechas dentro del modal */
#galleryModal .carousel-control-prev,
#galleryModal .carousel-control-next {
  width: 46px;
  height: 46px;
  background-color: var(--primary-color);
  border-radius: 50%;
  top: 50%;
  transform: translateY(-50%);
  opacity: 1;
  border: 3px solid white;
  z-index: 10;
}

#galleryModal .carousel-control-prev {
  left: 15px;
}

#galleryModal .carousel-control-next {
  right: 15px;
}

@media (max-width: 767px) {
  #galleryModal .modal-dialog {
    max-width: 94%;
    margin: 1rem auto;
  }

  .gallery-item {
    padding: 6px;
    /* Espaciado más fino para el grid 2x2 */
  }
}

/* =========================================
   SECCIÓN CLIENTES (LOGOS)
   ========================================= */
.clients-section {
  padding: 80px 0;
  background-color: #ffffff;
  position: relative;
}

.clients-cloud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1rem 1rem;
  max-width: 1100px;
  margin: 0 auto;
}

.client-item {
  flex: 0 0 auto;
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  padding: 15px;
}

.client-logo {
  max-width: 180px;
  height: auto;
  max-height: 70px;
  filter: grayscale(100%) contrast(0.8);
  opacity: 0.5;
  transition: all 0.4s ease;
  object-fit: contain;
}

.client-item:hover {
  transform: translateY(-5px) scale(1.05);
}

.client-item:hover .client-logo {
  filter: grayscale(0%) contrast(1);
  opacity: 1;
}

/* Variaciones para el efecto "desordenado" */
.client-item:nth-child(odd) {
  margin-top: 20px;
}

.client-item:nth-child(3n) {
  margin-top: -10px;
}

.client-item:nth-child(4n) {
  transform: rotate(1deg);
}

@media (max-width: 768px) {
  .clients-cloud {
    gap: 1.5rem 2.5rem;
  }

  .client-logo {
    max-width: 130px;
    max-height: 55px;
  }

  .client-item:nth-child(odd),
  .client-item:nth-child(3n) {
    margin-top: 0;
  }
}