/* =========================
   GRID DE TARJETAS
========================= */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

/* responsive */
@media (max-width: 768px) {
    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }
}

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


/* =========================
   TARJETA BASE
========================= */

.card {
    width: 100%;
}

/* enlace completo */
.card a.hometarj {
    display: block;
    text-decoration: none;
    color: inherit;
}


/* =========================
   IMAGEN
========================= */

.card-thumb {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
}

.card-thumb img {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    display: block;
    height: auto;
}
.tag-generos {
    position: absolute;
    z-index: 1;
    bottom: 6px;
    font-size: 13px;
    display: flex;
    justify-content: flex-end;
    width: 100%;
    gap: 3px;
    right: 4px;
}
.tag-generos span.tag-genero {
    font-size: 10px;
    padding: 2px 3px;
    background: #3F51B5;
    border-radius: 2px;
    color: #efefef;
}


/* =========================
   BADGES
========================= */

.card-thumb .badge {
    position: absolute;
    top: 0;
    left: 0;
    background: #d61823;
    color: #fff;
    font-size: 12px;
    padding: 4px 6px;
}

.card-thumb .tajanio {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: #3b77ff;
    color: #fff;
    padding: 3px 8px;
    font-size: 12px;
    border-radius: 3px;
}


/* =========================
   INFO
========================= */

.card-info {
    padding-top: 6px;
}

.card-info .tituhom {
    font-size: .95em;
    font-weight: 500;
    line-height: 1.25em;
    margin: 0;

    /* corte en 2 líneas */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* =========================
   LAZY LOAD IMÁGENES
========================= */

.card-thumb {
    background: #eaeaea;
}

/* imagen aún no cargada */
.card-thumb img.lazy-img {
    opacity: 0;
    transition: opacity .3s ease;
}

/* imagen cargada */
.card-thumb img.loaded {
    opacity: 1;
}

/* spinner */
.img-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.img-spinner::after {
    content: "";
    width: 28px;
    height: 28px;
    border: 3px solid rgba(0,0,0,.2);
    border-top-color: var(--color-secundario);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ocultar spinner cuando cargó */
.card-thumb.loaded .img-spinner {
    display: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

