* {
    box-sizing: border-box; /* Esto evita que el padding agrande los elementos */
    margin: 0;
    padding: 0;
}

:root {
    --primary-red: #D62828;
    --primary-dark: #0f1014;
    --secondary-dark: #1b1e26;
    --text-main: #f0f0f0;
    --text-muted: #a0aec0;
    --border-color: #2d3748;
}

html, body {
    width: 100%;
    max-width: 100%; /* Asegura que nada sea más ancho que la ventana */
    overflow-x: hidden; /* Corta cualquier elemento rebelde que sobresalga */
    position: relative; /* Ayuda a contener elementos absolutos */
}

body {
    background-color: var(--primary-dark);
    color: var(--text-main);
    font-family: 'Rubik', sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- ESTILOS GENERALES Y TIPOGRAFÍA --- */
h1, h2, h3 { 
    color: #fff; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    text-align: center; 
    margin: 0;
}
.text-highlight { color: var(--primary-red); }

/* --- NAVBAR --- */
.navbar { 
    background-color: rgba(15, 16, 20, 0.95); 
    border-bottom: 1px solid var(--border-color); 
    position: fixed; 
    width: 100%; 
    top: 0; 
    z-index: 1000; 
    padding: 10px 0; 
    backdrop-filter: blur(10px); 
}
.nav-container { display: flex; justify-content: space-between; align-items: center; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.nav-logo { height: 50px; width: auto; display: block; }
.nav-menu { display: flex; list-style: none; gap: 25px; margin: 0; padding: 0; align-items: center; }
.nav-link { color: #fff; text-decoration: none; font-size: 0.95rem; font-weight: 500; transition: color 0.3s ease; }
.nav-link:hover { color: var(--primary-red); }
.btn-ht { background-color: var(--primary-red); color: #fff; padding: 12px 30px; border: none; text-transform: uppercase; font-weight: bold; cursor: pointer; transition: all 0.3s ease; border-radius: 2px; text-decoration: none; display: inline-block;}
.btn-ht:hover { background-color: #b01e1e; box-shadow: 0 0 15px rgba(214, 40, 40, 0.4); }

/* Menú Hamburguesa */
.hamburger { display: none; cursor: pointer; }
.bar { display: block; width: 25px; height: 3px; margin: 5px auto; background-color: #fff; transition: all 0.3s ease-in-out; }

/* Responsive Nav */
@media (max-width: 768px) {
    .hamburger { display: block; }
    .nav-menu { position: fixed; left: -100%; top: 70px; flex-direction: column; background-color: var(--primary-dark); width: 100%; text-align: center; transition: 0.3s; padding: 20px 0; border-bottom: 2px solid var(--primary-red); box-shadow: 0 10px 15px rgba(0,0,0,0.5); }
    .nav-menu.active { left: 0; }
}

/* --- HERO VIDEO BACKGROUND (CORREGIDO Y CENTRADO) --- */

.hero-video-section {
    position: relative;
    width: 100%;
    margin-top: 72px;
    height: calc(100vh - 72px);
    overflow: hidden;
    background-color: #000;
}

/* 1. Fondo de Video */
.video-container, .video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video-player {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-overlay {
    background: rgba(0, 0, 0, 0.5);
    z-index: 2;
}

/* 2. Contenedor Principal */
.hero-content-container {
    position: relative;
    z-index: 3;
    height: 100%; 
    width: 100%;
    
    /* El centrado Flexbox hará todo el trabajo */
    padding: 0; /* Quitamos el relleno extra */
    
    display: flex;
    flex-direction: column;
    justify-content: center; /* Centrado Vertical */
    align-items: center;     /* Centrado Horizontal */
}

/* 3. El Swiper ocupa toda la pantalla */
.hero-text-swiper {
    width: 100%;
    height: 100%; /* CLAVE: Ocupa el 100% de la altura disponible */
    max-width: 1200px;
    margin: 0 auto; /* Centrado horizontal del contenedor */
}

/* 4. El Slide individual centra el contenido */
.hero-text-slide {
    background: transparent !important; /* Forzamos transparencia */
    
    /* Flexbox para centrar el texto EXACTAMENTE en el medio */
    display: flex !important; /* Importante para sobreescribir defaults */
    flex-direction: column;
    justify-content: center; /* Centrado Vertical */
    align-items: center;     /* Centrado Horizontal */
    text-align: center;
    
    width: 100%;
    height: 100%; /* El slide también ocupa toda la altura */
}

/* Estilos de Texto */
.hero-text-slide h1 {
    font-size: 3.5rem;
    margin-bottom: 20px;
    color: #fff;
    text-shadow: 0 4px 30px rgba(0,0,0,1);
    line-height: 1.1;
    max-width: 90%;
}

.hero-text-slide p {
    font-size: 1.5rem;
    color: #f0f0f0;
    margin-bottom: 40px;
    text-shadow: 0 2px 20px rgba(0,0,0,1);
    max-width: 700px;
}

/* Paginación (Puntitos) */
.hero-pagination {
    bottom: 40px !important; /* Los subimos un poco desde el borde inferior */
    z-index: 10;
}

.hero-pagination .swiper-pagination-bullet {
    background: #fff;
    opacity: 0.5;
    width: 12px;
    height: 12px;
    margin: 0 8px !important;
}
.hero-pagination .swiper-pagination-bullet-active {
    background: var(--primary-red);
    opacity: 1;
    transform: scale(1.2);
}

/* Responsive Móvil */
@media (max-width: 768px) {
    .hero-text-slide h1 { font-size: 2rem; }
    .hero-text-slide p { font-size: 1rem; margin-bottom: 30px; }
}

/* --- SWIPER GLOBAL (Galerías de Proyectos) --- */
.gallery-container {
    background-color: #000;
    height: 100%;
    width: 100%;
    position: relative;
    overflow: hidden;
}
.swiper { width: 100%; height: 100%; }

.swiper-slide {
    text-align: center;
    background: #000; /* Fondo negro para fotos, el Hero lo sobreescribe con transparent */
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%; 
    height: 100%;
}

.swiper-slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.swiper-button-next, .swiper-button-prev { color: var(--primary-red) !important; font-weight: bold; text-shadow: 0 0 5px #000; }
.swiper-pagination-bullet-active { background: var(--primary-red) !important; }

/* --- SERVICIOS GRID --- */
.services-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 30px; }

.service-card { position: relative; height: 350px; border-radius: 8px; overflow: hidden; cursor: pointer; border: 1px solid #333; background-size: cover; background-position: center; transition: transform 0.3s ease; }
.bg-mineria { background-image: url('../img/services/mineria-card.jpg'); }
.bg-gas { background-image: url('../img/services/gas-card.jpg'); }
.bg-drone { background-image: url('../img/services/drone-card.jpg'); }
.bg-civil { background-image: url('../img/services/civil-card.jpg'); }

.card-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(to bottom, rgba(0,0,0,0.2) 0%, rgba(10,10,10,0.95) 80%); transition: background 0.3s ease; }
.service-card:hover .card-overlay { background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(214, 40, 40, 0.1) 50%, rgba(0,0,0,1) 100%); }
.card-content { position: absolute; bottom: 0; padding: 25px; z-index: 2; width: 100%; box-sizing: border-box; }
.read-more { color: var(--primary-red); font-size: 0.85rem; font-weight: bold; text-transform: uppercase; }

/* Responsive Servicios */
@media (min-width: 1400px) { .services-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px) { .services-grid { grid-template-columns: 1fr; } }

/* --- PROYECTOS GRID --- */
.project-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; width: 100%; }
.project-card { background-color: var(--secondary-dark); border: 1px solid #2d3748; border-radius: 4px; overflow: hidden; cursor: pointer; transition: transform 0.3s ease; }
.project-card:hover { transform: translateY(-5px); border-color: var(--primary-red); }
.project-img { height: 200px; width: 100%; background-size: cover; background-position: center; filter: grayscale(100%); transition: filter 0.3s ease; }
.project-card:hover .project-img { filter: grayscale(0%); }
.project-content { padding: 25px; }
.project-tag { background-color: var(--primary-red); color: white; font-size: 0.7rem; padding: 4px 8px; border-radius: 2px; font-weight: bold; }
.client-name { color: #fff; font-weight: bold; border-bottom: 1px solid #444; padding-bottom: 10px; display: inline-block; }

/* --- MODALES --- */
.modal { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0, 0, 0, 0.9); backdrop-filter: blur(5px); animation: fadeIn 0.3s ease; }
.modal-content { background-color: #1a1d24; margin: 5% auto; border: 1px solid var(--primary-red); width: 90%; max-width: 1000px; border-radius: 8px; position: relative; animation: slideUp 0.3s ease; padding: 0; overflow: hidden; }
.close-modal { position: absolute; top: 15px; right: 20px; color: #fff; z-index: 500; font-size: 40px; font-weight: bold; cursor: pointer; text-shadow: 0 0 5px #000; line-height: 1;}
.close-modal:hover { color: var(--primary-red); }
.modal-grid-project { display: grid; grid-template-columns: 1.5fr 1fr; min-height: 500px; }
.project-info { padding: 40px; overflow-y: auto; max-height: 600px; }

/* Responsive Modales */
@media (max-width: 768px) {
    .modal-grid-project { grid-template-columns: 1fr; height: auto; }
    .gallery-container { height: 300px; }
}

/* --- CONTACTO Y EXTRAS --- */

/* 1. Contenedor Principal (Grid) */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Escritorio: 2 columnas */
    gap: 60px;
    max-width: 100%; /* Seguridad extra */
}

/* 2. Estilos del Formulario */
.tech-form .form-group {
    margin-bottom: 20px;
}

.tech-form label {
    display: block;
    margin-bottom: 8px;
    color: #aaa;
    font-size: 0.9rem;
}

.tech-form input, 
.tech-form select, 
.tech-form textarea {
    width: 100%; /* Ocupar todo el ancho disponible */
    padding: 12px;
    background: var(--primary-dark);
    border: 1px solid #2d3748;
    color: #fff;
    border-radius: 4px;
    font-family: 'Rubik', sans-serif;
    font-size: 1rem; /* Evita zoom automático en iPhone */
}

.tech-form input:focus,
.tech-form select:focus,
.tech-form textarea:focus {
    border-color: var(--primary-red);
    outline: none;
    box-shadow: 0 0 0 2px rgba(214, 40, 40, 0.2);
}

/* 3. Fila de Email/Teléfono (Para que no se rompa) */
.form-row {
    display: flex;
    gap: 20px;
}

/* --- RESPONSIVE (LA SOLUCIÓN A TU PROBLEMA) --- */
@media (max-width: 900px) {
    
    /* 1. Convertir la grilla principal a 1 sola columna */
    .contact-grid {
        grid-template-columns: 1fr; 
        gap: 40px; /* Menos espacio entre info y form */
    }

    /* 2. Arreglar la fila de Email/Teléfono */
    .form-row {
        flex-direction: column; /* Apilar uno sobre otro */
        gap: 20px;
    }
    
    /* 3. Ajustar márgenes del formulario para que no toque los bordes */
    .contact-form-wrapper {
        padding: 0 5px; /* Pequeño respiro lateral */
    }

    /* 4. Ajustar textos */
    .contact-info h2 {
        font-size: 1.8rem; /* Título más chico */
        text-align: center; /* Centrado en móvil */
    }
    
    .contact-info p {
        text-align: center;
    }

    /* Centrar botones y datos de contacto */
    .info-item, .contact-info .btn-ht {
        text-align: center;
        display: block;
        margin-left: auto;
        margin-right: auto;
    }
}

/* --- SECCIÓN CLIENTES (SLIDER INFINITO) --- */

#clientes {
    padding: 60px 0;
    background-color: var(--primary-dark);
    border-top: 1px solid var(--border-color);
    overflow: hidden; /* Evita que el scroll horizontal rompa la página */
}

/* El contenedor que recorta los logos */
.slider-area {
    height: 100px;
    margin: auto;
    overflow: hidden;
    position: relative;
    width: 100%;
    
    /* Máscara para desvanecer los bordes (Efecto elegante) */
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

/* La pista larga que se mueve */
.slide-track {
    display: flex;
    /* CÁLCULO: 250px de ancho x 16 logos = 4000px total */
    width: calc(250px * 16); 
    animation: scroll 40s linear infinite;
}

/* Cada logo individual */
.slide {
    height: 100px;
    width: 250px; /* Ancho fijo por logo */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

.slide img {
    max-width: 160px;
    max-height: 70px;
    filter: grayscale(100%) opacity(0.5); /* Logos apagados */
    transition: all 0.3s ease;
}

.slide img:hover {
    filter: grayscale(0%) opacity(1); /* Logos a color al pasar mouse */
    transform: scale(1.1);
}

/* Animación de desplazamiento */
@keyframes scroll {
    0% { transform: translateX(0); }
    /* Se mueve hasta la mitad (8 logos) y luego salta al inicio imperceptiblemente */
    100% { transform: translateX(calc(-250px * 8)); }
}

/* --- AJUSTE RESPONSIVO PARA MÓVIL --- */
@media (max-width: 768px) {
    /* En celular, hacemos los logos un poco más chicos para que entren más */
    .slide {
        width: 150px; /* Reducimos ancho */
        padding: 10px;
    }
    .slide img {
        max-width: 100px; /* Reducimos imagen */
    }
    
    .slide-track {
        /* Recalculamos el ancho total: 150px * 16 logos */
        width: calc(150px * 16); 
    }
    
    @keyframes scroll {
        0% { transform: translateX(0); }
        /* Recalculamos el desplazamiento: 150px * 8 logos */
        100% { transform: translateX(calc(-150px * 8)); }
    }
}

/* --- CORRECCIÓN DE ESPACIADO EN MODALES --- */

.modal-body {
    /* Esto despega el texto de los bordes (Arriba/Abajo: 40px, Izq/Der: 40px) */
    padding: 40px; 
    background-color: #1a1d24; /* Aseguramos fondo oscuro */
    color: #d1d1d1;
}

/* Título interno del modal */
.modal-body h4 {
    color: #fff;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
    margin-bottom: 20px;
    text-align: left; /* Alineado a la izquierda para leer mejor */
    font-size: 1.2rem;
}

/* Listas dentro del modal */
.modal-body ul {
    padding-left: 20px; /* Espacio para los puntitos */
}

.modal-body li {
    margin-bottom: 10px;
    line-height: 1.6;
}

/* Ajuste para celulares (menos relleno para aprovechar espacio) */
@media (max-width: 768px) {
    .modal-body {
        padding: 25px; 
    }
}

/* --- SECCIÓN TECNOLOGÍA (CATÁLOGO) --- */
.tech-section {
    padding: 80px 20px;
    background-color: var(--secondary-dark); /* Fondo oscuro para resaltar equipos */
    text-align: center;
}

.section-header h2 {
    margin-bottom: 10px;
}
.section-subtitle {
    color: var(--text-muted);
    margin-bottom: 50px;
    font-size: 1.1rem;
}

.tech-grid {
    display: grid;
    /* Grilla inteligente: se adapta automáticamente */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 30px;
}

.tech-card {
    background: #252a33; /* Un gris un poco más claro que el fondo */
    border: 1px solid #333;
    border-radius: 8px;
    padding: 30px 20px;
    transition: all 0.3s ease;
    cursor: default;
    position: relative;
    overflow: hidden;
}

.tech-card:hover {
    transform: translateY(-10px); /* Efecto levitación */
    border-color: var(--primary-red); /* Borde rojo al pasar mouse */
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* Contenedor de la imagen (El "Showcase") */
.tech-img-container {
    height: 180px; /* Altura fija para uniformidad */
    width: 100%;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Círculo decorativo sutil detrás del equipo */
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0) 70%);
}

.tech-img-container img {
    max-width: 90%;
    max-height: 100%;
    object-fit: contain; /* CLAVE: Muestra el equipo entero sin recortes */
    filter: drop-shadow(0 10px 10px rgba(0,0,0,0.5)); /* Sombra realista al equipo */
    transition: transform 0.3s ease;
}

.tech-card:hover .tech-img-container img {
    transform: scale(1.1); /* Zoom sutil al equipo */
}

/* Textos */
.tech-category {
    display: block;
    color: var(--primary-red);
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.tech-info h4 {
    color: #fff;
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.tech-info p {
    color: #aaa;
    font-size: 0.9rem;
    margin: 0;
}