/* Contenedor de la cuadrícula */
.grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
    width: 100%;
}

/* Cada elemento de la cuadrícula */
.grid-item {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
}

/* Contenedor de la imagen */
.image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    border-radius: 10px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Imagen dentro de cada cuadrícula */
.grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease-in-out;
}

/* Efecto de zoom y sombra al pasar el mouse */
.grid-item:hover .image-wrapper {
    transform: scale(1.05);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* Superposición del texto */
.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    box-sizing: border-box;
    border-radius: 10px;
    text-align: center;
}

/* Capa oscura semitransparente detrás del texto */
.grid-overlay::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
}

/* Título dentro de la imagen */
.grid-overlay h2 {
    position: relative;
    color: white;
    font-size: 1.3rem;
    text-align: center;
    margin: 0;
    padding: 5px;
    z-index: 2;
    width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}

/* Fecha dentro de la imagen */
.grid-overlay p {
    position: relative;
    color: white;
    font-size: 0.85rem;
    margin: 0;
    padding: 5px;
    z-index: 2;
    width: 90%;
    text-align: center;
    margin-top: 5px;
}

/* Ajustes responsivos */
@media (max-width: 1024px) {
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: repeat(1, 1fr);
    }
}
