.cartillas-container {
    padding: 2rem; /* margen lateral respecto a la ventana */
    width: 100%;
    max-width: 1200px; /* ancho máximo del contenedor */
    margin: 0 auto; /* centrado horizontal */
}

.cartillas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.cartilla {
    background-color: transparent; /* Fondo gris azulado claro */
    border: 1px solid var(--light-gray);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    text-align: center;
    transition: all 0.3s, box-shadow 0.3s;
    height: 150px;
}

.cartilla:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15);
    height: 300px;
}

.img-wrapper {
    position: relative;
    height: 150px;
    overflow: hidden;
    transition: height 0.3s ease-in-out;
}

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

.img-wrapper:hover::after {
    background: rgba(0, 0, 0, 0.1); /* capa oscura */
}

.img-wrapper::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.2); /* capa oscura */
}

.cartilla h4 {
    margin: 0.8rem 0 0.3rem;
    font-size: 1.1rem;
    color: var(--dark);
    z-index: 1;
}

.cartilla h4 a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.3s;
}

.cartilla h4 a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.cartilla p {
    padding: 0 1rem 1rem;
    font-size: 0.95rem;
    color: var(--light-gray);
    z-index: 1;
}

@media (max-width: 772px) {
    .cartillas-grid .cartilla:last-child:nth-child(odd) {
        grid-column: 1 / -1;
        max-width: 100%;
    }
}