/* Estilos globales para eliminar espacios innecesarios */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
}

.descripcion-container {
    display: flex;
    min-height: 100vh;
    background: #fff;
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100vh;
}

.descripcion-img-principal {
    flex: 2;
    overflow: hidden;
}

.descripcion-img-principal img {
    width: 100%;
    height: 100vh;
    object-fit: cover;
    /* Sin filtro: imagen principal a color */
}


.descripcion-info {
    flex: 1;
    background: #fff;
    padding: 60px 40px 40px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 400px;
    box-shadow: -2px 0 10px rgba(0,0,0,0.05);
}

.descripcion-info h1 {
    padding-top: 60px;
    padding-left: 20px;
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 0.2em;
    letter-spacing: 1px;
}

.descripcion-info hr {
    border: none;
    border-top: 2px solid #222;
    margin: 0.5em 0 1.5em 0;
    width: 90%;
}

.descripcion-proyecto {
    font-size: 1.1em;
    color: #444;
    margin-bottom: 1em;
}

.descripcion-img-principal { /* Container for the main image */
    height: 100vh; /* Set container height to full viewport height */
    display: flex; /* Use flexbox to easily center the image */
    align-items: center; /* Vertically center the image in the container */
    justify-content: center; /* Horizontally center the image in the container */
    background-color: #000000; /* Set background color to black */
}

.descripcion-img-principal img,
.descripcion-img-secundarias img {
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
   
}

.descripcion-img-principal img {
    max-width: 100%;  /* Ensure image does not overflow horizontally */
    max-height: 100%; /* Ensure image does not overflow vertically (respects container's 100vh) */
    width: auto;      /* Adjust width to maintain aspect ratio */
    height: auto;     /* Adjust height to maintain aspect ratio */
    display: block;   /* Good practice for images */
    object-fit: contain; /* Crucial: scales image to fit, preserving aspect ratio, no cropping */
}

.descripcion-info p {
    font-size: 1.3em;
    margin: 0.5em 0;
}

.descripcion-img-secundarias {
    display: flex;
    gap: 0px;
    margin-top:auto;
    position: relative;
    overflow: hidden;
    padding: 0;
}

.descripcion-img-secundarias img {
    width: 33.333%;
    height: 300px;
    object-fit: cover;
    filter: grayscale(100%);
    cursor: pointer;
    transition: filter 0.3s;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    min-width: 200px; /* Asegura un tamaño mínimo para las imágenes */
}

.descripcion-img-secundarias img:hover {
    filter: grayscale(60%);
}

.descripcion-img-secundarias img.active {
    filter: grayscale(0%);
    border: 2px solid #333;
}

/* Carousel navigation for secondary images */
.descripcion-img-secundarias .carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.7);
    color: #fff;
    border: none;
    font-size: 1.2rem;
    padding: 8px 12px;
    cursor: pointer;
    z-index: 2;
    border-radius: 50%;
    transition: background 0.2s;
    user-select: none;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.descripcion-img-secundarias .carousel-nav.prev {
    left: 10px;
}

.descripcion-img-secundarias .carousel-nav.next {
    right: 10px;
}

.descripcion-img-secundarias .carousel-nav:hover {
    background: rgba(0,0,0,0.9);
}

.descripcion-img-secundarias .carousel-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Carousel container for secondary images */
.descripcion-img-secundarias .carousel-container {
    display: flex;
    transition: transform 0.3s ease;
    width: 100%;
    gap: 0;
    margin: 0;
    padding: 0;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.descripcion-img-secundarias .carousel-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

.descripcion-img-secundarias .carousel-slide {
    min-width: 33.333%;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
}

/* Carousel indicators */
.descripcion-img-secundarias .carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
}

.descripcion-img-secundarias .carousel-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
    cursor: pointer;
    transition: background 0.3s;
}

.descripcion-img-secundarias .carousel-indicator.active {
    background: #333;
}

/* Carousel styles */
.carousel {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}
.carousel-img {
    max-width: 100%;
    max-height: 100vh;
    width: auto;
    height: auto;
    object-fit: contain;
    position: absolute;
    left: 0;
    right: 0;
    margin: auto;
    transition: opacity 0.5s;
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
    background: #000;
}
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    font-size: 2.5rem;
    padding: 0 18px;
    cursor: pointer;
    z-index: 2;
    border-radius: 50%;
    transition: background 0.2s;
    user-select: none;
}
.carousel-btn.prev { left: 20px; }
.carousel-btn.next { right: 20px; }
.carousel-btn:hover { background: rgba(0,0,0,0.8); }

/* --- MEJORAS RESPONSIVAS PARA MÓVILES --- */
@media (max-width: 1200px) {
    .descripcion-info {
        min-width: 300px;
        padding: 40px 20px 20px 20px;
    }
    .descripcion-img-secundarias img {
        min-width: 120px;
        height: 180px;
    }
}

@media (max-width: 900px) {
    .descripcion-container {
        flex-direction: column;
    }
    .descripcion-img-principal, .descripcion-info {
        min-width: 0;
        width: 100%;
        height: auto;
        padding: 20px 10px;
    }
    .descripcion-img-principal img {
        max-height: 50vh;
    }
    .descripcion-img-secundarias img {
        height: 120px;
    }
}

@media (max-width: 768px) {
    .descripcion-info {
        padding: 20px 5px 10px 5px;
        min-width: 0;
    }
    .descripcion-info h1 {
        font-size: 1.5em;
        padding-top: 20px;
        padding-left: 5px;
    }
    .descripcion-img-principal img {
        max-height: 40vh;
    }
    .descripcion-img-secundarias img {
        min-width: 80px;
        height: 80px;
    }
}

@media (max-width: 600px) {
    .descripcion-container {
        flex-direction: column;
        min-height: unset;
        height: 100vh;
        margin-top: 0;
        padding-top: 0;
        width: 100vw;
        overflow: hidden;
    }
    .descripcion-img-principal {
        height: auto;
        min-width: 0;
        width: 100vw;
        padding: 0;
        flex: 1;
        min-height: 60vh;
    }
    .descripcion-img-principal img {
        max-width: 100vw;
        width: 100vw;
        height: 60vh;
        object-fit: cover;
        display: block;
    }
    .descripcion-info {
        min-width: 0;
        width: 100vw;
        padding: 15px 15px 10px 15px;
        box-shadow: none;
        flex: 1;
        height: 40vh;
        overflow-y: auto;
        box-sizing: border-box;
    }
    .descripcion-info h1 {
        font-size: 1.1em;
        padding-top: 0;
        padding-left: 0;
        margin-bottom: 8px;
    }
    .descripcion-info p {
        font-size: 1em;
        margin: 6px 0;
    }
    .descripcion-img-secundarias {
        gap: 4px;
        overflow-x: auto;
        padding: 0 0 8px 0;
        margin-top: 10px;
        width: 100%;
        box-sizing: border-box;
        display: flex;
    }
    .descripcion-img-secundarias img {
        min-width: 120px;
        width: 120px;
        height: 80px;
        object-fit: cover;
        margin: 0 2px;
        flex-shrink: 0;
    }
}

@media (max-width: 400px) {
    .descripcion-info h1 {
        font-size: 0.9em;
    }
    .descripcion-info p {
        font-size: 0.9em;
    }
    .descripcion-img-secundarias img {
        min-width: 80px;
        width: 50vw;
        height: 40px;
    }
}

/* --- NUEVAS MEJORAS PARA MÓVILES --- */
@media (max-width: 480px) {
    .descripcion-container {
        padding-top: 0;
        min-height: 100vh;
        height: 100vh;
        margin-top: 0;
        width: 100vw;
        overflow: hidden;
    }
    
    .descripcion-img-principal {
        height: 60vh;
        min-height: 0;
        flex: 1;
        width: 100vw;
    }
    
    .descripcion-img-principal img {
        max-height: 60vh;
        min-height: 0;
        object-fit: cover;
        width: 100vw;
        height: 100%;
        display: block;
    }
    
    .descripcion-info {
        padding: 15px 15px 10px 15px;
        flex: 1;
        justify-content: flex-start;
        min-height: 0;
        height: 40vh;
        overflow-y: auto;
        width: 100vw;
        box-sizing: border-box;
    }
    
    .descripcion-info h1 {
        font-size: 1.3em;
        padding-top: 0;
        padding-left: 0;
        margin-bottom: 8px;
        line-height: 1.2;
    }
    
    .descripcion-info hr {
        margin: 8px 0 12px 0;
        width: 100%;
    }
    
    .descripcion-info p {
        font-size: 1em;
        margin: 6px 0;
        line-height: 1.4;
    }
    
    .descripcion-proyecto {
        font-size: 1em;
        margin-bottom: 12px;
    }
    
    .descripcion-img-secundarias {
        margin-top: 15px;
        gap: 6px;
        padding: 0 0 10px 0;
        width: 100%;
        box-sizing: border-box;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        flex-shrink: 0;
        display: flex;
    }
    
    .descripcion-img-secundarias img {
        min-width: 120px;
        width: 120px;
        height: 80px;
        object-fit: cover;
        margin: 0;
        scroll-snap-align: start;
        border-radius: 4px;
        transition: all 0.3s ease;
        flex-shrink: 0;
    }
    
    .descripcion-img-secundarias img:hover {
        filter: grayscale(40%);
        transform: scale(1.05);
    }
}

@media (max-width: 360px) {
    .descripcion-container {
        height: 100vh;
        min-height: 100vh;
        margin-top: 0;
        padding-top: 0;
        width: 100vw;
    }
    
    .descripcion-img-principal {
        height: 55vh;
        width: 100vw;
    }
    
    .descripcion-img-principal img {
        max-height: 55vh;
        height: 100%;
        width: 100vw;
    }
    
    .descripcion-info {
        height: 45vh;
        padding: 12px 12px 8px 12px;
        width: 100vw;
    }
    
    .descripcion-info h1 {
        font-size: 1.1em;
        margin-bottom: 6px;
    }
    
    .descripcion-info p {
        font-size: 0.9em;
        margin: 4px 0;
    }
    
    .descripcion-img-secundarias {
        margin-top: 12px;
        gap: 4px;
        width: 100%;
    }
    
    .descripcion-img-secundarias img {
        min-width: 100px;
        width: 100px;
        height: 70px;
    }
}