/* ==================
   RESPONSIVE.CSS - SOLUCIÓN DEFINITIVA
   Media Queries para Prizma Ingeniería
   ================== */

/* ==========================================
   CONFIGURACIÓN BASE PARA DESKTOP (PC)
   ========================================== */

/* 1. Configuración básica de html y body */
html {
  overflow-x: hidden; /* Bloquea scroll horizontal */
  overflow-y: scroll; /* Siempre muestra scroll vertical */
  width: 100%;
}

body {
   /* Bloquea scroll horizontal */
  overflow-y: visible; /* Permite flujo natural vertical */
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

/* 2. Box-sizing para todos los elementos */
*, *::before, *::after {
  box-sizing: border-box;
}

/* 3. NO bloquear overflow en secciones en DESKTOP */
/* Las secciones deben fluir naturalmente en PC */
section,
.section,
main {
  overflow: visible;
  width: 100%;
  max-width: 100%;
}

/* 4. Containers de Bootstrap */
.container,
.container-fluid {
  overflow: visible;
  max-width: 100%;
}

/* 5. Rows de Bootstrap - Corrige margins negativos */
.row {
  margin-left: -15px;
  margin-right: -15px;
  overflow: visible;
}

/* 6. Previene que imágenes y medios causen overflow */
img,
video,
iframe {
  max-width: 100%;
  height: auto;
}

/* 7. Hero y secciones principales - Deben tener altura AUTO */
.hero-slider-container,
.section-services,
.section-about,
.section-projects,
.section-testimonials,
.section-contact,
.section-metrics-solmex {
  overflow: visible;
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: auto;
}

/* 8. Asegura que el hero tenga altura correcta */
.hero-slider-container {
  min-height: 600px;
  height: 100vh;
}

/* ==================
   CORRECCIONES ESPECÍFICAS
   ================== */

/* Carrusel de testimonios - Solo aquí necesitamos overflow hidden */
.t-carousel {
  overflow: hidden;
  width: 100%;
}

.t-track {
  overflow: visible;
}

/* Filtros de proyectos */
.project-filters {
  overflow: visible;
}

/* Página de contacto */
.section-contact,
.section-contact-info {
  overflow: visible;
  height: auto;
}

/* --------------------
   TABLETS (< 992px)
   -------------------- */
@media (max-width: 991.98px) {
  
  /* Hero */
  .hero-caption h1,
  .page-header-nosotros h1 {
    font-size: 48px;
  }
  
  .hero-caption .lead {
    font-size: 20px;
  }
  
  /* Tarjetas de Servicio */
  .cards-container {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
  
  .service-card {
    width: 100%;
    max-width: 100%;
    height: auto;
  }
  
  /* Carrusel Testimonios */
  .t-track {
    grid-auto-columns: 50%;
  }
  
  .t-btn {
    left: 10px;
  }
  
  .t-btn.t-next {
    right: 10px;
  }
  
  /* Footer */
  .main-footer .col-lg-3 {
    flex-basis: 50%;
    text-align: center;
  }
  
  .main-footer .navbar-brand {
    justify-content: center;
  }
}

/* --------------------
   MÓVILES (< 768px)
   -------------------- */
@media (max-width: 767.98px) {
  
  /* IMPORTANTE: Solo en móvil aplicamos estas restricciones */
  
  /* Mejora el scroll en móviles */
  html {
    -webkit-overflow-scrolling: touch;
  }
  
  /* Body en móvil */
  body {
    overflow-x: hidden;
    width: 100vw;
    max-width: 100vw;
  }
  
  /* Previene overflow horizontal en móvil */
  .container,
  .container-fluid {
    padding-left: 15px;
    padding-right: 15px;
    max-width: 100vw;
  }
  
  /* Rows en móvil */
  .row {
    margin-left: 0;
    margin-right: 0;
    max-width: 100%;
  }
  
  .row > * {
    padding-left: 15px;
    padding-right: 15px;
  }
  
  /* Hero en móvil */
  .hero-slider-container {
    min-height: 500px;
    height: 80vh;
    width: 100vw;
    max-width: 100vw;
  }
  
  .hero-caption h1,
  .page-header-nosotros h1 {
    font-size: 36px;
  }
  
  .hero-caption .lead {
    font-size: 18px;
  }
  
  /* Tarjetas de Servicio en móvil */
  .cards-container {
    grid-template-columns: 1fr;
    padding-left: 15px;
    padding-right: 15px;
    width: 100%;
  }
  
  /* Métricas */
  .metric-number {
    font-size: 2.5rem;
  }
  
  .metric-label {
    font-size: 0.75rem;
  }
  
  .section-metrics-solmex {
    padding-bottom: 70px;
    clip-path: polygon(0% 0%, 100% 0%, 100% calc(100% - 30px), 50% 100%, 0% calc(100% - 30px));
    width: 100vw;
    max-width: 100vw;
  }
  
  /* Proyectos - Filtros con scroll horizontal */
  .project-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    justify-content: flex-start !important;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Carrusel Testimonios en móvil */
  .t-track {
    grid-auto-columns: 100%;
  }
  
  /* Contacto en móvil */
  .section-contact-info .row {
    flex-direction: column-reverse;
  }
  
  .section-contact,
  .section-contact-info {
    padding-left: 20px;
    padding-right: 20px;
    width: 100%;
  }
  
  .page-header-nosotros h1 {
    padding-left: 10px;
    padding-right: 10px;
    text-align: center;
  }
  
  .page-header-nosotros p,
  .page-header-nosotros .lead {
    padding-left: 10px;
    padding-right: 10px;
    text-align: center;
  }
  
  .contact-info-item,
  .contact-detail {
    padding-left: 20px;
    padding-right: 20px;
    margin-left: 0;
    margin-right: 0;
  }
  
  .contact-form-container {
    padding-left: 15px;
    padding-right: 15px;
  }
  
  .contact-form-container input,
  .contact-form-container textarea,
  .contact-form-container select {
    width: 100%;
    max-width: 100%;
  }
  
  .contact-map,
  .contact-map iframe {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }
  
  /* Footer en móvil */
  .main-footer .col-lg-3 {
    flex-basis: 100%;
  }
  
  .main-footer .brand-mark {
    width: 200px !important;
    height: auto !important;
  }
  
  /* Botones Flotantes en móvil */
  #btn-back-to-top {
    right: 15px;
    bottom: 15px;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    position: fixed;
    z-index: 1050;
  }
  
  .joinchat {
    right: 15px !important;
    bottom: 70px !important;
    position: fixed !important;
    z-index: 1050 !important;
  }
  
  /* Previene que cualquier elemento sobresalga en móvil */
  * {
    max-width: 100vw;
  }
  
  img,
  video,
  iframe {
    max-width: 100% !important;
  }
}

/* --------------------
   MÓVILES PEQUEÑOS (< 576px)
   -------------------- */
@media (max-width: 575.98px) {
  
  .hero-caption h1,
  .page-header-nosotros h1 {
    font-size: 28px;
  }
  
  .hero-caption .lead {
    font-size: 16px;
  }
  
  #btn-back-to-top {
    right: 10px;
    bottom: 10px;
    width: 35px;
    height: 35px;
    font-size: 1rem;
  }
  
  .joinchat {
    right: 10px !important;
    bottom: 60px !important;
  }
  
  .section-contact,
  .section-contact-info {
    padding-left: 15px;
    padding-right: 15px;
  }
}