@charset "utf-8";

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

body {
    font-family: 'Open Sans', Arial, sans-serif;
    background-color: #2b3239;
    color: #fff;
}

/* Header y Navegación */
header {
    background: linear-gradient(135deg, #1a1f25 0%, #2b3239 100%);
    padding: 15px 40px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-container {
    display: flex;
    align-items: center;
}

.logo-container img {
    width: 120px;
    height: auto;
    transition: transform 0.3s;
}

.logo-container img:hover {
    transform: scale(1.1);
}

nav ul {
    list-style: none;
    display: flex;
    gap: 5px;
    align-items: center;
}

nav > ul > li {
    position: relative;
}

nav a {
    color: #fff;
    text-decoration: none;
    padding: 12px 20px;
    display: block;
    transition: all 0.3s;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
}

nav > ul > li > a:hover {
    background: rgba(255, 142, 0, 0.2);
    color: #ffb300;
}

/* Menú desplegable */
.menu-item-galeria {
    position: relative;
}

/* Estado inicial del submenu: presente en DOM pero oculto y animable */
.submenu {
    display: block;
    position: absolute;
    top: 100%;
    left: 0;
    background: linear-gradient(135deg, #1a1f25 0%, #2b3239 100%);
    min-width: 250px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.6);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 0;
    padding-top: 5px;

    /* control de visibilidad animable */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
}

/* Al hacer hover en desktop mostramos el submenu */
.menu-item-galeria:hover .submenu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition-delay: 0s;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.submenu li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.submenu a {
    padding: 12px 20px;
    font-size: 0.9rem;
    color: #ddd;
}

.submenu a:hover {
    background: rgba(255, 142, 0, 0.3);
    color: #ffb300;
    padding-left: 25px;
}

.menu-item-galeria > a::after {
    content: '▼';
    font-size: 0.7rem;
    margin-left: 8px;
    transition: transform 0.3s;
}

.menu-item-galeria:hover > a::after {
    transform: rotate(180deg);
}

/* Menú móvil */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 5px 10px;
}

/* Sección principal */
.seccion-principal {
    position: relative;
    padding: 60px 20px 140px 20px;
    text-align: center;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    z-index: 5;
}

.titulo-principal {
    font-size: 2.6rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    margin-bottom: 20px;
    animation: deslizarIzquierda 1s ease-out;
}

.subtitulo {
    font-size: 2.2rem;
    margin-bottom: 40px;
}

.color-acento {
    color: #ffb300;
    font-weight: 700;
}

/* Características */
.caracteristicas {
    position: absolute;
    bottom: 100px;
    left: 50%;
    z-index: 50;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    padding: 0 20px;
}

.tarjeta-caracteristica {
    background: #ffb300;
    color: black;
    padding: 5px 15px;
    border-radius: 12px;
    transition: transform 0.3s;
    animation: aparecer 1.2s ease-out;
    box-shadow: 6px 6px 12px black;
    z-index: 51;
}

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

.icono {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

/* Galería */
.galeria {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    padding: 60px 20px;
    max-width: 1200px;
    margin: -170px auto 0;
}

.contenedor-imagen {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    cursor: pointer;
    aspect-ratio: 1;
    animation: aparecer 1.5s ease-out;
    box-shadow: 6px 6px 12px black;
    background-color: #3a4149;
    z-index: 1;
}

.contenedor-imagen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
    display: block;
}

.contenedor-imagen:hover img {
    transform: scale(1.05);
}

#avancesObra {
    position: relative;
    display: block;
    margin: 30px 0px 120px 0px;
}

/* Animaciones */
@keyframes deslizarIzquierda {
    from {
        transform: translateX(-300px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes aparecer {
    from {
        transform: scale(0.3);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 968px) {
    header {
        padding: 15px 20px;
    }

    .menu-toggle {
        display: block;
    }

    /* menú principal colapsado en móvil (se abre con .active) */
    nav > ul {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, #1a1f25 0%, #2b3239 100%);
        padding: 20px;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.6);
        gap: 0;
    }

    nav > ul.active {
        display: flex;
    }

    nav > ul > li {
        width: 100%;
    }

    nav a {
        width: 100%;
        text-align: left;
    }

    /* submenu en móvil: comportamiento estático dentro del flujo */
    .submenu {
        position: static;
        display: none;
        box-shadow: none;
        margin-top: 0;
        margin-left: 20px;
        background: rgba(255, 142, 0, 0.1);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: none;
    }

    /* cuando el item tiene la clase .active (toggle por JS), mostramos su submenu */
    .menu-item-galeria.active .submenu {
        display: block;
    }

    .menu-item-galeria > a::after {
        float: right;
    }
}

@media (max-width: 768px) {
    .titulo-principal {
        font-size: 2rem;
    }

    .galeria {
        grid-template-columns: 1fr;
    }

    .caracteristicas {
        flex-direction: column;
        align-items: center;
        left: 50%;
    }
}

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

.lightbox.activo {
    display: flex;
}

.contenido-lightbox {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#imagen-lightbox {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

.boton-cerrar {
    position: absolute;
    top: 20px;
    right: 40px;
    font-size: 3rem;
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 2001;
    transition: color 0.3s;
}

.boton-cerrar:hover {
    color: #ffb300;
}

.boton-navegacion {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 4px;
}

.boton-navegacion:hover {
    background: rgba(255, 142, 0, 0.8);
}

.boton-anterior {
    left: 20px;
}

.boton-siguiente {
    right: 20px;
}
