:root {
    --primary-red: #e63946;
    --white: #ffffff;
    --black: #000000;
    --bg-light: #f9f9f9;
    --font-main: 'Inter', sans-serif;
    --font-titles: 'Montserrat', sans-serif;
    --transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* GENERAL */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-main); color: #333; line-height: 1.6; background-color: var(--white); overflow-x: hidden; }

/* BARRA DE PROGRESO (Integrada en Header) */
#progress-container { position: fixed; top: 0; left: 0; width: 100%; height: 4px; background: transparent; z-index: 1100; }
#progress-bar { height: 100%; background: var(--primary-red); width: 0%; transition: width 0.1s ease-out; box-shadow: 0 0 10px var(--primary-red); } 

/* HEADER */
#main-header { position: fixed; top: 0; width: 100%; z-index: 1000; padding: 25px 0; transition: var(--transition); }
#main-header.scrolled { background: var(--black); padding: 12px 0; box-shadow: 0 4px 20px rgba(0,0,0,0.3); }
.navbar { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; padding: 0 20px; }

.main-logo { height: 45px; width: auto; transition: var(--transition); }
#main-header.scrolled .main-logo { height: 35px; }

.nav-menu { display: flex; list-style: none; }
.nav-link { 
    color: var(--white); text-decoration: none; margin-left: 25px; 
    font-family: var(--font-titles); font-size: 0.75rem; text-transform: uppercase; 
    font-weight: 800; letter-spacing: 1.5px; transition: var(--transition); 
    opacity: 0.9; text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.5);
}
.nav-link:hover, .nav-link.active { color: var(--primary-red); opacity: 1; text-shadow: none; }
#main-header.scrolled .nav-link { text-shadow: none; opacity: 0.8; }

/* TÍTULOS */
.section-title { font-family: var(--font-titles); font-size: 1.8rem; margin-bottom: 35px; position: relative; display: inline-block; text-transform: uppercase; letter-spacing: 1px; }
.section-title::after { content: ''; position: absolute; bottom: -8px; left: 0; width: 45px; height: 3px; background: var(--primary-red); }

/* --- CARRUSEL --- */
.carousel { position: relative; height: 100vh; background: #000; overflow: hidden; }
.carousel-item { position: absolute; width: 100%; height: 100%; opacity: 0; transition: opacity 1s; }
.carousel-item.active { opacity: 1; }

.carousel-item img { 
    width: 100%; height: 100%; object-fit: cover; filter: brightness(0.35); 
    transition: transform 8s ease-out; transform: scale(1);
}
.carousel-item.active img { transform: scale(1.15); }

.carousel-caption { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; color: white; width: 90%; z-index: 5; }

.carousel-caption h1, .carousel-caption p { opacity: 0; transition: opacity 0.5s ease-out, transform 0.7s cubic-bezier(0.215, 0.61, 0.355, 1); }
.carousel-caption h1 { font-family: var(--font-titles); font-size: clamp(1.6rem, 3.5vw, 2.8rem); text-transform: uppercase; margin-bottom: 15px; letter-spacing: 3px; transform: translateY(-60px); }
.carousel-caption p { font-size: 1.1rem; font-weight: 300; letter-spacing: 1px; transform: translateY(60px); max-width: 600px; margin: 0 auto; line-height: 1.8; }

.carousel-item.active h1, .carousel-item.active p { opacity: 1; transform: translateY(0); }
.carousel-item:not(.active) h1, .carousel-item:not(.active) p { opacity: 0; transform: translateY(0); transition: opacity 0.2s ease-in; }

.control { position: absolute; top: 50%; transform: translateY(-50%); z-index: 10; background: rgba(0, 0, 0, 0.3); border: none; color: white; font-size: 1.2rem; cursor: pointer; width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: var(--transition); opacity: 0; }
.carousel:hover .control { opacity: 1; }
.control:hover { background: var(--primary-red); }
.prev { left: 30px; }
.next { right: 30px; }

.indicators { position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%); }
.dot { height: 10px; width: 10px; background: rgba(255,255,255,0.3); border-radius: 50%; display: inline-block; margin: 0 6px; cursor: pointer; transition: 0.3s; }
.dot.active { background: var(--primary-red); transform: scale(1.2); }

/* SECCIONES */
.content-section { padding: 120px 20px; border-top: 1px solid rgba(0,0,0,0.03); }
.container { max-width: 1100px; margin: 0 auto; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: center; }
.image-content img { width: 100%; border-radius: 4px; box-shadow: 0 15px 35px rgba(0,0,0,0.1); }
.bg-light { background-color: var(--bg-light); }

/* --- CARDS (Servicios y Productos unificados) --- */
.service-card, .product-card { 
    background: var(--white); 
    border-radius: 12px; 
    overflow: hidden; 
    transition: var(--transition); 
    box-shadow: 0 10px 30px rgba(0,0,0,0.05); 
    border: 1px solid rgba(0,0,0,0.03); 
}

.service-card:hover, .product-card:hover { 
    transform: translateY(-8px); 
    box-shadow: 0 20px 50px rgba(0,0,0,0.12); 
}

/* SERVICIOS */
.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 30px; }
.service-card { padding: 50px 40px; border-bottom: 4px solid transparent; }
.service-card:hover { border-bottom-color: var(--primary-red); }
.service-icon { width: 45px; height: 45px; color: var(--primary-red); margin-bottom: 25px; }
.service-card h3 { font-family: var(--font-titles); margin-bottom: 15px; }
.service-card p { font-size: 0.9rem; color: #666; line-height: 1.7; }

/* PRODUCTOS */
/* --- FILTROS RESPONSIVOS (SCROLL SNAP) --- */
.filter-container {
    display: flex;
    gap: 15px;
    margin-bottom: 50px;
    padding: 10px 5px;
    overflow-x: auto; /* Permite scroll horizontal */
    scroll-snap-type: x mandatory; /* Hace que los botones "encajen" al deslizar */
    scrollbar-width: none; /* Oculta scrollbar en Firefox */
    -ms-overflow-style: none; /* Oculta scrollbar en IE/Edge */
    justify-content: center; /* Centrado en escritorio */
}

/* Ocultar barra de scroll en Chrome/Safari */
.filter-container::-webkit-scrollbar {
    display: none; 
}

.filter-btn {
    flex: 0 0 auto; /* Evita que los botones se encojan */
    scroll-snap-align: start;
    font-family: var(--font-titles);
    padding: 12px 25px;
    border: 1px solid rgba(230, 57, 70, 0.3);
    background: transparent;
    color: var(--primary-red);
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap; /* Evita que el texto salte de línea */
}

.filter-btn.active, .filter-btn:hover {
    background: var(--primary-red);
    color: var(--white);
    box-shadow: 0 5px 15px rgba(230, 57, 70, 0.4);
}

/* --- AJUSTE MÓVIL PARA FILTROS --- */
@media (max-width: 768px) {
    .filter-container {
        justify-content: flex-start; /* Alinea a la izquierda para poder scrollear */
        padding-left: 20px;
        padding-right: 20px;
        /* Creamos un margen imaginario al final para que el último botón no quede pegado */
    }
    
    /* Efecto de desvanecimiento a los lados para indicar scroll (Opcional pero muy Pro) */
    #productos .container {
        position: relative;
    }
    
    /* Esto añade una sombra sutil que indica que hay más filtros a la derecha */
    .filter-container::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        height: 50px;
        width: 40px;
        background: linear-gradient(to right, rgba(255,255,255,0), rgba(255,255,255,1));
        pointer-events: none;
    }
}

.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 30px; }
.product-img {
    overflow: hidden; /* Importante: actúa como marco para el zoom */
    line-height: 0;   /* Elimina espacios fantasma debajo de la imagen */
}

.product-img img { 
    width: 100%; 
    height: 220px; 
    object-fit: cover; 
    /* Transición suave para el zoom */
    transition: transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* Cuando el usuario pasa el mouse sobre la TARJETA, la IMAGEN crece */
.product-card:hover .product-img img {
    transform: scale(1.1); /* Zoom del 10% */
}

.product-card:hover h3 {
    color: var(--primary-red);
    transition: color 0.3s ease;
}

.product-info { padding: 30px; }
.category-tag { color: var(--primary-red); font-size: 0.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: 2px; display: inline-block; margin-bottom: 12px; }
.product-info h3 { font-family: var(--font-titles); font-size: 1.3rem; margin-bottom: 10px; color: var(--black); }
.product-info p { font-size: 0.85rem; font-weight: 400; color: #666; line-height: 1.7; letter-spacing: 0.3px; }

/* CONTACTO */
.bg-dark { background-color: #0d0d0d; color: white; }
.contact-wrapper { display: grid; grid-template-columns: 1fr 1fr; gap: 50px; margin-top: 30px; }
.info-label { color: var(--primary-red); font-family: var(--font-titles); font-size: 0.7rem; text-transform: uppercase; font-weight: 700; margin-bottom: 5px; display: block; }
.contact-map { border-radius: 4px; overflow: hidden; border: 1px solid #222; line-height: 0; }

.reveal { opacity: 0; transform: translateY(30px); transition: 0.8s ease-out; }
.reveal.active { opacity: 1; transform: translateY(0); }

/* FOOTER */
.main-footer { background-color: #0a0a0a; color: #b0b0b0; padding: 80px 0 0 0; font-size: 0.9rem; border-top: 1px solid #1a1a1a; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 60px; padding-bottom: 60px; }
.footer-logo { color: var(--white); font-family: var(--font-titles); font-size: 1.5rem; margin-bottom: 25px; letter-spacing: 2px; }
.footer-logo span { color: var(--primary-red); font-weight: 800; margin-right: 10px; }
.footer-col h3 { color: var(--white); font-family: var(--font-titles); font-size: 0.85rem; letter-spacing: 1.5px; margin-bottom: 25px; position: relative; padding-bottom: 10px; }
.footer-col h3::after { content: ''; position: absolute; bottom: 0; left: 0; width: 40px; height: 2px; background: var(--primary-red); }
.footer-links { list-style: none; }
.footer-links li { padding: 10px 0; border-bottom: 1px solid #1a1a1a; }
.footer-links li:last-child { border-bottom: none; }
.footer-links a { color: #b0b0b0; text-decoration: none; transition: var(--transition); display: block; }
.footer-links a:hover { color: var(--primary-red); padding-left: 8px; }
.footer-links a::before { content: '›'; color: var(--primary-red); margin-right: 10px; font-weight: bold; }
.footer-contact-item { margin-bottom: 20px; }
.footer-contact-item p { margin-bottom: 5px; }
.footer-bottom { background-color: #050505; padding: 30px 0; text-align: center; border-top: 1px solid #111; font-size: 0.8rem; }
.footer-bottom strong { color: var(--white); }

/* RESPONSIVE */
@media (max-width: 992px) {
    .footer-grid { grid-template-columns: 1fr; gap: 40px; text-align: center; }
    .footer-col h3::after { left: 50%; transform: translateX(-50%); }
    .footer-links a::before { display: none; }
}
@media (max-width: 768px) {
    .grid, .contact-wrapper { grid-template-columns: 1fr; text-align: center; }
    .nav-menu { display: none; }
    .control { opacity: 1; width: 40px; height: 40px; }
    .carousel-caption p { max-width: 85%; font-size: 0.95rem; }
}

/* ============================================================
   RESPONSIVE DESIGN (SOLUCIÓN PARA MÓVILES)
   ============================================================ */

@media (max-width: 768px) {
    /* 1. SECCIONES: Menos espacio para pantallas pequeñas */
    .content-section {
        padding: 60px 15px;
    }

    /* 2. GRIDS: Todo a una sola columna */
    .grid, .footer-grid, .contact-wrapper {
        grid-template-columns: 1fr !important;
        gap: 40px;
        text-align: center;
    }

    /* 3. CARRUSEL: Ajuste de textos para que no se corten */
    .carousel-caption {
        width: 85%;
    }
    .carousel-caption h1 {
        font-size: 1.8rem !important; /* Títulos más pequeños */
        letter-spacing: 1px;
    }
    .carousel-caption p {
        font-size: 0.95rem !important;
        line-height: 1.5;
        max-width: 100%;
    }

    /* 4. IMÁGENES: Que no excedan el ancho */
    .image-content img {
        max-width: 100%;
        height: auto;
    }

    /* 5. MENÚ: Para evitar que se amontone, lo ocultamos o simplificamos 
       (Recomendación: En móvil el menú suele ser un 'hamburguesa', 
       pero por ahora lo haremos legible) */
    .nav-menu {
        display: none; /* Oculto por defecto en móvil para evitar caos visual */
    }
    
    .navbar {
        justify-content: center; /* Centramos el logo en móviles */
    }

    /* 6. PRODUCTOS Y SERVICIOS: Ajuste de rejilla */
    .products-grid, .services-grid {
        grid-template-columns: 1fr !important;
    }

    /* 7. BOTONES DE FILTRO: Scroll lateral si no caben */
    .filter-container {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 10px;
        justify-content: flex-start;
    }
}

/* Ajuste fino para teléfonos muy pequeños (iPhone SE, etc.) */
@media (max-width: 480px) {
    .section-title {
        font-size: 1.4rem;
    }
    .carousel-caption h1 {
        font-size: 1.5rem !important;
    }
}

/* --- ESTILOS MENÚ MÓVIL PROFESIONAL --- */

.menu-toggle {
    display: none; /* Oculto en escritorio */
    flex-direction: column;
    cursor: pointer;
    z-index: 2000;
}

.menu-toggle span {
    width: 28px;
    height: 3px;
    background-color: var(--white);
    margin: 4px 0;
    transition: 0.4s;
    border-radius: 2px;
}

/* Animación a "X" */
.menu-toggle.open span:nth-child(1) { transform: rotate(-45deg) translate(-5px, 6px); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: rotate(45deg) translate(-5px, -6px); }

/* Overlay de pantalla completa */
.mobile-overlay {
    position: fixed;
    top: 0;
    right: -100%; /* Escondido a la derecha */
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px); /* Efecto cristal esmerilado */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.5s cubic-bezier(0.77, 0.2, 0.05, 1);
    z-index: 1500;
}

.mobile-overlay.active {
    right: 0;
}

.mobile-nav-menu {
    list-style: none;
    text-align: center;
}

.mobile-link {
    color: var(--white);
    text-decoration: none;
    font-family: var(--font-titles);
    font-size: 2rem;
    font-weight: 800;
    text-transform: uppercase;
    display: block;
    padding: 20px;
    transition: 0.3s;
}

.mobile-link:hover {
    color: var(--primary-red);
}

/* Mostrar hamburguesa solo en móviles */
@media (max-width: 768px) {
    .menu-toggle { display: flex; }
    .nav-menu { display: none; }
}