/* ==========================================================================
   Tarjetas de obra (listados, buscador, perfil)
   --------------------------------------------------------------------------
   El theme resuelve la rejilla con `.manga-list{display:flex}` y
   `.book-item{width:33.333%}`: tres por fila a cualquier ancho, asi que en
   pantalla grande las portadas salian enormes y deformadas, y en movil
   apretadas. Aqui pasa a una rejilla fluida con la proporcion real de una
   portada (2:3), sin tocar el marcado.

   Tokens: los mismos de mb-suggest.css.
   ========================================================================== */

.list.manga-list,
.section-body.grid-items,
.section.box.grid-items {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
    gap: 22px 16px;
    align-items: start;
}

.list.manga-list .book-item,
.grid-items .book-item {
    width: 100% !important;
    padding: 0 !important;
    margin: 0;
}

/* ---- portada ----------------------------------------------------------- */
.book-item .thumb {
    position: relative;
    display: block;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: var(--mbs-surface-2, #071a2b);   /* color de espera */
    /* la proporcion la fija el contenedor: la imagen ya no salta */
    aspect-ratio: 2 / 3;
    box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .9);
}

.book-item .thumb > a { display: block; width: 100%; height: 100%; }

.book-item .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    /* solo transform: la animacion no toca el layout */
    transition: transform 260ms cubic-bezier(.2, .7, .3, 1);
}

.book-item:hover .thumb img { transform: scale(1.04); }

/* velo inferior para que el texto sobre la portada se lea siempre */
.book-item .thumb::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 46%;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, .78));
    opacity: .85;
    pointer-events: none;
}

/* chips de genero: encima del velo, discretos */
.book-item .genres {
    position: absolute;
    left: 6px;
    bottom: 6px;
    z-index: 2;
    gap: 3px;
    max-width: calc(100% - 12px);
    overflow: hidden;
}
.book-item .genres span {
    font-size: 8.5px !important;
    padding: 2px 5px !important;
    border-radius: 3px;
    margin: 0 !important;
    line-height: 1.4;
    opacity: .92;
}

.book-item .latest-chapter { z-index: 2; font-size: 9.5px; }

/* ---- texto ------------------------------------------------------------- */
.book-item .meta { padding-top: 8px; }

.book-item .meta .title h3 {
    margin: 0;
    font-size: 13px;
    line-height: 1.35;
    font-weight: 700;
}
.book-item .meta .title h3 a {
    color: var(--mbs-text, #eef3f8);
    text-decoration: none !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.7em;                   /* dos lineas: las filas no bailan */
}
.book-item:hover .meta .title h3 a { color: #fff; }

.book-item .rating-view {
    gap: 1px;
    margin-top: 4px;
    font-size: 11px;
    color: var(--mbs-text-2, #9fb3c8);
}
.book-item .rating-view i { font-size: 10px; color: var(--mbs-star, #f39c12); }
.book-item .rating-view .ml-2 { margin-left: 5px; font-variant-numeric: tabular-nums; }

.book-item .chapters { margin-top: 6px; display: grid; gap: 3px; }
.book-item .chap-item { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.book-item .chap-item h4 { margin: 0; font-size: 11.5px; min-width: 0; }
.book-item .chap-item h4 a {
    color: var(--mbs-text-2, #9fb3c8);
    text-decoration: none !important;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.book-item .chap-item h4 a:hover { color: var(--mbs-accent-soft, #4d7f99); }
.book-item .updated-date span {
    font-size: 10px;
    color: var(--mbs-text-3, #64798d);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* ---- carrusel de la portada (HOT UPDATES) ------------------------------ */
.trending-item .icon {
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 2 / 3;
    background: var(--mbs-surface-2, #071a2b);
}
.trending-item .icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.trending-item .meta .name {
    font-size: 12.5px !important;
    line-height: 1.3;
    margin-top: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- ranking lateral --------------------------------------------------- */
.top-list .top-item .thumb {
    width: 46px;
    aspect-ratio: 2 / 3;
    border-radius: 5px;
    overflow: hidden;
    background: var(--mbs-surface-2, #071a2b);
    flex: 0 0 auto;
}
.top-list .top-item .thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---- responsive -------------------------------------------------------- */
@media (max-width: 991px) {
    .list.manga-list,
    .section-body.grid-items,
    .section.box.grid-items { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 18px 12px; }
}

@media (max-width: 575px) {
    .list.manga-list,
    .section-body.grid-items,
    .section.box.grid-items { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 16px 10px; }
    .book-item .meta .title h3 { font-size: 12px; }
    .book-item .genres { display: none; }        /* se cae lo prescindible */
}

@media (prefers-reduced-motion: reduce) {
    .book-item .thumb img,
    .book-item:hover .thumb img { transition: none; transform: none; }
}

/* logo SVG de la marca (MB_BRAND); sin logo se pinta el nombre en texto */
.navbar-item.logo .mb-logo { display: block; height: 36px; width: auto; max-width: 160px; }
@media (max-width: 767px) { .navbar-item.logo .mb-logo { height: 30px; } }
