/* Variables de Diseño */
:root {
    --color-oscuro: #1a1a1a;
    --color-claro: #ffffff;
    --color-gris: #f4f4f4;
    --color-texto: #333333;
    --color-acento: #8c7853; 
    
    /* Nuevas fuentes tipográficas profesionales */
    --fuente-titulos: 'Montserrat', sans-serif;
    --fuente-cuerpo: 'Inter', sans-serif;
}


/* Estilos Generales */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--fuente-cuerpo); /* Inter para párrafos y textos generales */
    color: var(--color-texto);
    line-height: 1.7;
    font-weight: 400;
}

/* Aplicar Montserrat a todos los encabezados importantes */
h1, h2, h3, .logo, nav ul li a, .btn, .servicio-numero, .fase-numero, .stat-number {
    font-family: var(--fuente-titulos);
}

h1 {
    font-weight: 700;
}

h2 {
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px; /* Espaciado de letras sutil estilo arquitectónico */
    margin-bottom: 2rem;
    text-align: center;
}

h3 {
    font-weight: 700;
}

/* Asegurar que las tipografías de los campos de texto también se actualicen */
.form-contacto input, 
.form-contacto textarea {
    font-family: var(--fuente-cuerpo);
    font-weight: 400;
}


/* Encabezado y Menú */
/* --- EFECTO DE LOGO SUPERPUESTO (OVERLAP) --- */

/* Ajustes en el contenedor del encabezado */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(26, 26, 26, 0.95);
    color: var(--color-claro);
    display: flex;
    justify-content: space-between;
    align-items: center; /* Alinea los elementos verticalmente al centro */
    padding: 1rem 5%;    /* Reducimos un poco el padding vertical para controlar la altura de la barra */
    z-index: 1000;
    height: 80px;        /* Definimos una altura fija y estándar para la cabecera */
}

/* Ajustes en el contenedor del logo */
.logo {
    display: flex;
    align-items: flex-start; /* Hace que el logo se alinee desde la parte superior */
    position: relative;
}

/* Ajustes en la imagen del logo para que sobresalga */
.logo-img {
    height: 164px;       /* Ajusta este valor al tamaño original o deseado de tu logo */
    width: auto;         /* Mantiene la proporción horizontal intacta */
    display: block;
    position: absolute;  /* Permite que el logo ignore el límite de la cabecera */
    top: -20px;          /* Lo desplaza ligeramente hacia arriba para centrarlo visualmente */
    transition: transform 0.3s ease;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3)); /* Sombra suave para que resalte sobre la imagen de abajo */
}

.logo-img:hover {
    transform: scale(1.02); /* Animación sutil al pasar el mouse */
}

/* Ajuste responsivo para pantallas móviles */
@media (max-width: 768px) {
    header {
        height: 70px;    /* Cabecera un poco más compacta en celulares */
    }
    
    .logo-img {
        height: 90px;    /* El logo se reduce proporcionalmente en móviles para no tapar el menú */
        top: -15px;
    }
}




.menu-toggle {
    display: block;
    background: none;
    border: none;
    color: var(--color-claro);
    font-size: 1.8rem;
    cursor: pointer;
}

nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--color-oscuro);
    padding: 1rem 0;
}

nav.active {
    display: block;
}

nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    align-items: center;
}

nav ul li {
    margin: 1rem 0;
}

nav ul li a {
    color: var(--color-claro);
    text-decoration: none;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

/* Secciones */
.section {
    padding: 5rem 5%;
}

.bg-light {
    background-color: var(--color-gris);
}

/* Héroe / Inicio */
.hero {
    height: 100vh;
    background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), url('img/portada.jpg') no-repeat center center/cover;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--color-claro);
    padding: 0 5%;
}

.hero-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.hero-content p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.btn {
    display: inline-block;
    padding: 0.8rem 2rem;
    background-color: var(--color-acento);
    color: var(--color-claro);
    text-decoration: none;
    text-transform: uppercase;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn:hover {
    background-color: #6f5e41;
}

/* Proyectos (Grid responsivo) */
.grid-proyectos {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.tarjeta-proyecto {
    background: var(--color-claro);
    border: 1px solid #ddd;
    padding: 1rem;
}

.placeholder-img {
    height: 250px;
    background-color: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    margin-bottom: 1rem;
}

/* Nosotros */
.nosotros-container {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

/* Contacto */
.form-contacto {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-contacto input, .form-contacto textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ccc;
    font-family: var(--fuente);
}

/* Footer */
footer {
    background-color: var(--color-oscuro);
    color: #888;
    text-align: center;
    padding: 2rem 5%;
    font-size: 0.85rem;
}

/* --- DISEÑO DESKTOP (Pantallas medianas y grandes) --- */
@media (min-width: 768px) {
    .menu-toggle {
        display: none;
    }

    nav {
        display: block;
        position: static;
        width: auto;
        background: none;
        padding: 0;
    }

    nav ul {
        flex-direction: row;
    }

    nav ul li {
        margin: 0 0 0 2rem;
    }

    .hero-content h1 {
        font-size: 4rem;
    }

    .grid-proyectos {
        grid-template-columns: repeat(3, 1fr);
    }
}


/* --- ESTILOS DE LA GALERÍA INTERACTIVA --- */

.tarjeta-proyecto {
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: transform 0.3s ease;
}

.tarjeta-proyecto:hover {
    transform: translateY(-5px);
}

.galeria-img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

.proyecto-info {
    padding: 1.5rem 1rem;
    background: var(--color-claro);
}

/* El Modal (Fondo oscuro) */
.modal {
    display: none; 
    position: fixed;
    z-index: 2000; 
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
}

/* Contenedor de la imagen y texto */
.modal-contenido {
    max-width: 80%;
    max-height: 80%;
    text-align: center;
}

#img-modal {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

#caption-modal {
    color: var(--color-claro);
    margin-top: 1rem;
    font-size: 1.2rem;
    letter-spacing: 1px;
}

/* Botones de navegación y cierre */
.cerrar-modal {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

.nav-modal {
    background: none;
    border: none;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    padding: 2rem;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    user-select: none;
    transition: color 0.2s;
}

.nav-modal:hover {
    color: var(--color-acento);
}

.prev { left: 5%; }
.next { right: 5%; }

/* Ajustes para móviles */
@media (max-width: 768px) {
    .modal-contenido { max-width: 95%; }
    .nav-modal { font-size: 2rem; padding: 1rem; }
    .prev { left: 1%; }
    .next { right: 1%; }
}


/* --- ANIMACIONES CON EL SCROLL --- */

/* Estado inicial: oculto y ligeramente desplazado hacia abajo */
.fade-in-element {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    will-change: opacity, transform; /* Optimiza el rendimiento de la animación */
}

/* Estado activo: se activa mediante JavaScript cuando es visible */
.fade-in-element.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- ANIMACIÓN DESDE LA DERECHA --- */

/* Estado inicial: oculto y desplazado 50 píxeles a la derecha */
.fade-in-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    will-change: opacity, transform;
}

/* Estado activo: regresa a su posición original */
.fade-in-right.is-visible {
    opacity: 1;
    transform: translateX(0);
}


/* --- ANIMACIÓN ESCALONADA PARA TARJETAS --- */

.animacion-escalonada {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    will-change: opacity, transform;
}

.animacion-escalonada.is-visible {
    opacity: 1;
    transform: translateY(0);
}


/* --- DISEÑO AMPLIADO DE LA SECCIÓN NOSOTROS --- */

.nosotros-lead {
    font-size: 1.15rem;
    max-width: 800px;
    margin: 0 auto 3.5rem auto;
    color: #555;
}

/* Cuadrícula de características */
.nosotros-features {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
    margin-bottom: 4rem;
}

.feature-item {
    background: var(--color-claro);
    padding: 2.5rem 1.5rem;
    border-radius: 4px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    transition: transform 0.3s ease;
}

.feature-item:hover {
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.feature-item h3 {
    text-transform: uppercase;
    font-size: 1.1rem;
    letter-spacing: 1px;
    margin-bottom: 0.8rem;
    color: var(--color-oscuro);
}

.feature-item p {
    font-size: 0.95rem;
    color: #666;
}

/* Bloque de estadísticas */
.nosotros-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    border-top: 1px solid #ddd;
    padding-top: 3rem;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 3rem;
    font-weight: bold;
    color: var(--color-acento);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #777;
}

/* --- ADAPTABILIDAD DESKTOP (Pantallas medianas y grandes) --- */
@media (min-width: 768px) {
    .nosotros-features {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .nosotros-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}


/* --- ESTILOS DE LA SECCIÓN SERVICIOS --- */

.bg-dark-grid {
    background-color: #1f1f1f;
    color: var(--color-claro);
}

.bg-dark-grid h2 {
    color: var(--color-claro);
}

.grid-servicios {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.tarjeta-servicio {
    background: #2a2a2a;
    padding: 2.5rem 2rem;
    border-top: 3px solid var(--color-acento);
    position: relative;
    transition: background 0.3s ease, transform 0.3s ease;
}

.tarjeta-servicio:hover {
    background: #333333;
    transform: translateY(-5px);
}

.servicio-numero {
    font-size: 0.85rem;
    color: var(--color-acento);
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: 1rem;
}

.tarjeta-servicio h3 {
    font-size: 1.25rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

.tarjeta-servicio p {
    font-size: 0.95rem;
    color: #ccc;
    line-height: 1.7;
}

/* --- ADAPTABILIDAD DESKTOP PARA SERVICIOS --- */
@media (min-width: 768px) {
    .grid-servicios {
        grid-template-columns: repeat(2, 1fr); /* 2 columnas en tablets/laptops */
    }
}

@media (min-width: 1024px) {
    .grid-servicios {
        grid-template-columns: repeat(4, 1fr); /* 4 columnas en pantallas grandes */
    }
}


/* --- BOTÓN VOLVER ARRIBA --- */

.btn-ir-arriba {
    position: fixed;
    bottom: 30px;
    right: -60px; /* Inicia fuera de la pantalla (oculto) */
    width: 45px;
    height: 45px;
    background-color: var(--color-acento);
    color: var(--color-claro);
    border: none;
    border-radius: 4px;
    font-size: 1.25rem;
    font-weight: bold;
    cursor: pointer;
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: right 0.4s cubic-bezier(0.25, 1, 0.5, 1), background-color 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Clase activa que se añadirá con JavaScript */
.btn-ir-arriba.visible {
    right: 30px; /* Se desplaza hacia adentro de la pantalla */
}

.btn-ir-arriba:hover {
    background-color: #6f5e41;
}

/* Ajuste sutil para pantallas táctiles pequeñas */
@media (max-width: 768px) {
    .btn-ir-arriba {
        bottom: 20px;
        width: 40px;
        height: 40px;
    }
    .btn-ir-arriba.visible {
        right: 20px;
    }
}

/* --- ESTILOS DE LA SECCIÓN PROCESO --- */

.linea-proceso {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    padding-left: 2rem; /* Espacio para la línea en móviles */
}

/* Línea vertical central/lateral */
.linea-proceso::before {
    content: '';
    position: absolute;
    top: 0;
    left: 15px;
    width: 2px;
    height: 100%;
    background-color: #ddd;
}

.fase-item {
    display: flex;
    flex-direction: column;
    position: relative;
    margin-bottom: 3.5rem;
}

.fase-item:last-child {
    margin-bottom: 0;
}

.fase-numero {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--color-acento);
    background-color: var(--color-claro);
    width: 50px;
    height: 50px;
    border: 2px solid var(--color-acento);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: -39px;
    top: 0;
    z-index: 10;
}

.fase-contenido {
    background-color: var(--color-gris);
    padding: 2rem;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
}

.fase-contenido h3 {
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.8rem;
    color: var(--color-oscuro);
}

.fase-contenido p {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.6;
}

/* --- ADAPTABILIDAD DESKTOP PARA PROCESO (Efecto alternado) --- */
@media (min-width: 768px) {
    .linea-proceso {
        padding-left: 0;
    }

    .linea-proceso::before {
        left: 50%;
        transform: translateX(-50%);
    }

    .fase-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    /* Las fases impares van a la izquierda, las pares a la derecha */
    .fase-item:nth-child(odd) .fase-contenido {
        width: 42%;
        text-align: right;
    }

    .fase-item:nth-child(even) .fase-contenido {
        width: 42%;
        margin-left: auto; /* Empuja el bloque a la derecha */
    }

    /* Forzar reordenamiento de los números en estructura desktop */
    .fase-item .fase-numero {
        position: static;
        margin: 0 auto;
    }

    /* Ocultamos el nodo duplicado estructural del HTML para que se vea limpio en espejo */
    .fase-item:nth-child(odd) > .fase-numero:first-child { display: none; }
    .fase-item:nth-child(even) > .fase-numero:last-child { display: none; }
}
