.contenedor-galeria {
    width: 90%;
    height: 400px; /* Reducido de 500px a 400px */
    overflow: hidden;
    margin: 100px auto;
    box-shadow: 0 0 10px 1px rgba(0, 0, 0, 0.466);
    -webkit-box-shadow: 0 0 10px 1px rgba(0, 0, 0, 0.35);
    -moz-box-shadow: 0 0 10px 1px rgba(0, 0, 0, 0.35);
    display: flex;
    justify-content: center;
}

h5 {
    margin: 10px auto -20px auto;
    font-size: 3em;
    text-align: center;
    color: #9bf5cc;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    position: relative;
    letter-spacing: 2px;
    padding-bottom: 15px;
}

h5::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 4px;
    background: linear-gradient(to right, #80af9b, #3a7158);
    border-radius: 2px;
}

/* Ajusta la lista para que sea flexible */
.contenedor-galeria ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: space-around;
}

/* Ajusta cada elemento de la lista */
.contenedor-galeria li {
    position: relative;
    width: calc(20% - 0px); 
    margin: 0px;
    box-shadow: 0 0 25px 10px rgba(0, 0, 0, 0.5);
    -webkit-box-shadow: 0 0 25px 10px rgba(0, 0, 0, 0.5);
    -moz-box-shadow: 0 0 25px 10px rgba(0, 0, 0, 0.671);
    transition: all 0.5s;
}

/* Al hacer hover, ajusta el ancho para que no se corra demasiado */
.contenedor-galeria ul:hover li {
    width: calc(20% - 20px);
    filter: brightness(30%);
}

/* Al hacer hover sobre un elemento específico, ajusta su ancho */
.contenedor-galeria ul li:hover {
    width: calc(40% - 20px);
    filter: brightness(100%);
}

/* Ajusta las imágenes dentro del carousel */
.carousel {
    justify-content: center;
    width: 100%;
    height: 90%;
    overflow: hidden;
    position: relative;
    border-radius: 10px;
    box-shadow: 4px 4px 15px rgba(96, 177, 153, 0.582);
}

.carousel-images {
    display: flex;
    width: 200%; /* Cambiado para asegurar que cada imagen ocupe exactamente el 100% */
    height: 100%;
    transition: transform 0.5s ease-in-out;
}

.carousel-images img {
    width: 50%; /* Cada imagen ocupa exactamente la mitad del contenedor */
    height: 100%;
    object-fit: cover;
}

.carousel:hover .carousel-images {
    cursor: pointer;
    animation: slide 7s infinite alternate;
}

@keyframes slide {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); } /* Asegura que se muestre completamente la segunda imagen */
}

/* Mantén el estilo del título y botón igual */
.titulo-imagen {
    font-family: 'Times New Roman', Times, serif;
    background: #1b3831; /* Fondo sólido sin transparencia */
    position: absolute;
    top: 100%;
    width: 100%;
    display: block;
    transition: all 0.5s ease;
}

.titulo-imagen a {
    display: block;
    color: #fff;
    text-decoration: none;
    text-align: center;
    padding: 20px;
    font-size: 19px;
    text-shadow: 0 1px 2px #000;
    transition: all 0.5s ease;
}

.contenedor-galeria ul li:hover .titulo-imagen {
    top: 0%;
    box-shadow: 0 0 25px 10px rgba(0, 0, 0, 0.5);
    -webkit-box-shadow: 0 0 25px 10px rgba(0, 0, 0, 0.5);
    -moz-box-shadow: 0 0 25px 10px rgba(0, 0, 0, 0.5);
}

.titulo-imagen:hover a {
    transform: scale(1.1);
    transition: all 0.5s ease;
}

.btntabi {
    font-family: 'Times New Roman', Times, serif;
    height: 50px;
    background: #0a423f;
    font-size: 20px;
    color: white;
    margin-top: -5px;
    padding: 0px 20px;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.dos {
    display: grid;
    font-size: 1.3em;
    grid-template-columns: repeat(2, 1fr); 
    align-items: center;
    gap: 30px;
    margin: 10px 150px;
}

.btntabi:hover {
    background-color: #4ea186;
    color: #000;
}

/* Añade media queries para hacerlo más responsive */
@media (max-width: 1000px) {
    .contenedor-galeria {
        height: 300px;
    }
    .contenedor-galeria li {
        width: 30%;
    }   
    .contenedor-galeria ul li:hover {
        width: calc(50% - 20px);
    }
}

@media (max-width: 480px) {
    .contenedor-galeria li {
        width: calc(50% - 20px);
    }
    .contenedor-galeria ul li:hover {
        width: calc(100% - 20px);
    }
}

.bouncing-title {
    margin-top: 30px;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
    color: #1d2929;
    animation: bounce 10s ease infinite;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    cursor: pointer;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateY(-20px);
    }
    20%, 40%, 60%, 80% {
        transform: translateY(0);
    }
    15%, 35%, 55%, 75%, 95% {
        transform: translateY(-10px);
    }
}

/* Opcional: efecto de color adicional */
.bouncing-title:hover {
    color: #4a4a4a;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.4);
}

/* Modal */
.modal {
     font-size:1em;
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto; /* Cambio clave para permitir el desplazamiento */
    background-color: rgb(0,0,0);
    background-color: rgba(0,0,0,0.4);
}

/* Modal Content/Box */
.modal-content {
    font-size:1em;
    border-radius: 20px;
    color:black;
    background-color: #cafae9ae;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-height: 90vh; /* Altura máxima del 90% de la ventana */
    overflow-y: auto; /* Permite desplazamiento vertical */
} /* Permite desplazamiento dentro del modal */


/* The Close Button */
.close {
    color: #696767;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Slider */
.slider-container {
    position: relative;
    width: 100%;
    height: auto; /* Altura automática para permitir el contenido fluido */
    margin: auto;
    background-color: #f0f0f0;
    overflow: visible; /* Cambiado de hidden a visible */
}

.slider-wrapper {
    width: 100%;
    height: auto; /* Altura automática */
    min-height: 350px; /* Altura mínima */
    position: relative;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto; /* Altura automática */
    display: none;
}

.slide.active {
    display: block;
    position: relative; /* Cambiado de absolute a relative */
}

.boton1 {
    width: 25%;
    height: 48px;
    margin: 20px 35%;
    background: linear-gradient(135deg, #80af9b, #3a7158);
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: #ffffff; 
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(92, 143, 122, 0.4);
    letter-spacing: 1px;
}

.boton1:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(92, 143, 122, 0.6);
    background: linear-gradient(135deg, #68a88e, #5c8f7a);
}

.boton1:active {
    transform: translateY(1px);
    box-shadow: 0 2px 10px rgba(92, 143, 122, 0.4);
}

.boton1:before {
    content: '';
    position: absolute;
    top: -180px;
    left: 0;
    width: 30px;
    height: 300px;
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(45deg);
    transition: 0.5s;
    opacity: 0;
}

.boton1:hover:before {
    left: 120%;
    opacity: 1;
    transition: 0.7s ease-in-out;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(92, 143, 122, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(92, 143, 122, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(92, 143, 122, 0);
    }
}

.boton1:hover {
    animation: pulse 1.5s infinite;
}

.boton1 a {
    text-decoration: none;
    color: #000000;
    display: block;
    width: 100%;
    height: 100%;
    line-height: 48px;
    text-align: center;
}

.slide h2 {
    color: #0a423f;
    text-align: center;
    margin-top: 20px;
    font-size: 3em;
}

.slide p {
    color: #000000;
    text-align: center;
    margin: 20px 10px;
    font-size: 1em;
    text-align: justify;
}

.gallery {
    display: flex;
    justify-content: center;
    margin: 20px auto;
    gap: 50px;
    max-width: 1200px;
    width: 100%;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 300px;
    flex-shrink: 0;
}

.gallery-item:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

@media (max-width: 1200px) {
    .gallery {
        flex-wrap: wrap;
        justify-content: center;
    }
}

.prev-button, .next-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: #9cf0f0;
    color: rgb(0, 0, 0);
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    z-index: 10; /* Asegura que los botones estén encima del contenido */
}

.prev-button {
    left: 10px;
}

.next-button {
    right: 10px;
}

.prev-button:hover, .next-button:hover {
    background-color: #9fddcf;
}

/* Responsivo */
@media (max-width: 1200px) {
    .contenedor-galeria {
        height: 350px;
        margin: 60px auto;
    }
    
    .gallery {
        flex-wrap: wrap;
        gap: 20px;
        justify-content: center;
    }
    
    .gallery-item {
        width: 45%;
        margin-bottom: 15px;
    }
    
    .modal-content {
        margin-top: 10%;
        width: 90%;
        padding: 15px;
        max-height: 75vh;
    }
    
    .slider-container {
        height: auto;
    }
    
    .boton1 {
        width: 50%;
        margin: 20px 25%;
    }
}

@media (max-width: 992px) {
    h1 {
        font-size: 2.5em;
        margin-top: 100px;
    }
    
    .bouncing-title {
        font-size: 2rem;
    }
    
    .contenedor-galeria {
        height: auto;
        overflow: visible;
        display: block;
    }
    
    .contenedor-galeria ul {
        display: block;
    }
    
    .contenedor-galeria li {
        width: 60%;
        margin: 20px auto;
        box-shadow: 0 0 15px 5px rgba(0, 0, 0, 0.3);
        height: 250px; /* Reducida de 300px */
        overflow: hidden;
    }
    
    .contenedor-galeria ul:hover li {
        width: 80%;
        filter: brightness(100%);
    }
    
    .contenedor-galeria ul li:hover {
        width: 80%;
    }
    
    /* Modificado para móviles: cada imagen ocupa 100% */
    .carousel-images {
        width: 200%;
    }
    
    .carousel-images img {
        width: 50%;
    }
    
    .carousel {
        width: 100%;
        height: 85%;
    }
    
    .titulo-imagen {
        top: 85%;
    }
    
    .btntabi {
        width: 100%;
        margin-top: 0;
    }
    
    .slide p {
        font-size: 1.1em;
        padding: 0 15px;
    }
    
    .dos {
        grid-template-columns: 1fr;
        margin: 10px 20px;
        gap: 20px;
        font-size: 1em;
    }
    
    .gallery-item img {
        height: 200px;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 2em;
        margin-top: 30px;
    }
    
    .contenedor-galeria li {
        width: 70%;
        height: 250px;
    }
    
    .gallery-item {
        width: 80%;
    }
    
    .gallery-item img {
        height: 180px;
    }
    
    .modal-content {
        padding: 15px;
        margin: 90px auto;
        height: auto;
        max-height: 80vh;
    }
    
    .slider-wrapper {
        min-height: 300px;
    }
    
    .bouncing-title {
        font-size: 1.6rem;
        margin-top: 15px;
    }
    
    .slide p {
        font-size: 0.9em;
    }
    
    .prev-button, .next-button {
        padding: 8px 15px;
    }
    
    .boton1 {
        width: 70%;
        margin: 15px 15%;
        height: 40px;
        font-size: 18px;
    }
    .close {
        margin-top:-10px;
        font-size: 24px;
    }
    .boton1 a {
        line-height: 40px;
    }
}

@media (max-width: 580px) {
    h5 {
        font-size: 1.5em;
    }
    
    .contenedor-galeria li {
        width: 95%;
        height: 200px;
        margin: 15px auto;
    }
    
    .titulo-imagen a {
        padding: 10px;
        font-size: 16px;
    }
    
    .btntabi {
        height: 40px;
        font-size: 16px;
        padding: 0 10px;
    }
    
    .gallery {
        gap: 10px;
        margin: 10px auto;
    }
    
    .gallery-item {
        width: 95%;
    }
    
    .gallery-item img {
        height: 100px;
    }
    
    .bouncing-title {
        font-size: 1.3rem;
    }
    
    .dos {
        margin: 10px;
        font-size: 0.8em;
    }
    
    .slide p {
        font-size: 0.8em;
    }
    
    .prev-button, .next-button {
        padding: 5px 10px;
        font-size: 14px;
    }
    
    .boton1 {
        width: 90%;
        margin: 10px 5%;
        font-size: 16px;
    }
    
    .close {
        margin-top:-10px;
        font-size: 24px;
    }
    
    .slider-wrapper {
        min-height: 200px;
    }
}