/* Mobile: pin the Start/Continue + bookmark row to the
   bottom of the viewport for the whole series page.
   Full-bleed, its own padding, background = page bg.
   Docks just above the mobile tab bar (--mobile-tabbar-h). */
@media (max-width: 767.98px) {
    .series-cta-row {
        position: fixed;
        left: 0;
        right: 0;
        bottom: var(--mobile-tabbar-h, 0px);
        z-index: 40;
        padding: 0.7rem 0.75rem;
        background: #08080a;
    }

    .series-cta-row::before {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        top: -1.5rem;
        height: 1.5rem;
        background: linear-gradient(to top, #08080a, rgba(8, 8, 10, 0));
        pointer-events: none;
    }

    /* Clear the fixed CTA bar so the last content stays
       reachable (the tab bar's own gap comes from the
       body padding it sets). */
    .series-main {
        padding-bottom: 9rem;
    }
}

#chapters-list .ch-thumb {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
}

#chapters-list.is-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    padding: 12px 14px;
}

#chapters-list .ch-meta-inner {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

#chapters-list.is-grid .chapter-row {
    position: relative;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    overflow: hidden;
}

#chapters-list.is-grid .chapter-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

#chapters-list.is-grid .ch-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
    border-radius: 0;
}

#chapters-list.is-grid .ch-info {
    padding: 8px 10px 10px;
}

#chapters-list.is-grid .ch-title {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Grid cards show the terse "Chapter N" title; the list rows show the
   chapter's full displayName — see $ch_title / $ch_title_grid in
   components/chapter-list/index.php. */
#chapters-list.is-grid .ch-title-full {
    display: none;
}

#chapters-list.is-grid .ch-title-grid {
    display: -webkit-box;
}

/* Grid cards are too narrow for "20h ago · Sep 20, 2026" on one line —
   drop the absolute date and keep the row from wrapping/overflowing. */
#chapters-list.is-grid .ch-date-row {
    flex-wrap: nowrap;
    overflow: hidden;
}

#chapters-list.is-grid .ch-date-extra {
    display: none;
}

/* Grid: float the progress / paid badge as a pill centred on the cover */
#chapters-list.is-grid .ch-meta {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    aspect-ratio: 3 / 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    gap: 0;
    pointer-events: none;
}

#chapters-list.is-grid .ch-meta-inner {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 5px 5px;
    border-radius: 999px;
    background: rgb(17 17 19);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

/* Grid: the download button becomes a full-width card footer instead of
   the default small square (which just sat stranded under the info block).
   The card's own overflow:hidden + border-radius clips it into the bottom
   corners for free, so no border-radius is needed on the button itself. */
#chapters-list.is-grid .mo-row-btn {
    width: 100%;
    height: 34px;
    padding: 8px 0;
    border-radius: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
}

#chapters-list.is-grid .mo-row-btn:hover {
    background: rgba(255, 255, 255, 0.07);
}
