/**
 * File Path: assets/css/front/mbs-front-series-shelf.css
 *
 * Shelf grids — UX-003 (Session 115); updated Session 208
 * Constrains the .mbs-wrapper emitted by MBS_Cover_Renderer to thumbnail
 * width so width:100% on img/.mbs-cover resolves to thumbnail size instead
 * of full container width.
 *
 * Covers five section partials:
 *   templates/partials/section-series-order.php       (.mbs-series-order-grid)
 *   templates/partials/section-more-by-author.php     (.mbs-author-grid)
 *   templates/partials/section-more-in-collection.php (.mbs-collection-grid)
 *   templates/partials/section-more-in-universe.php   (.mbs-universe-grid)
 *   templates/partials/section-related-books.php      (.mbs-related-books-grid)
 *
 * Enqueued by MBS_Front_Assets with dep: mbs-front.
 * Flat selectors (CSS-002 / CSS-NEST-001 compliance).
 */

/* ==========================================================================
   section-series-order — .mbs-series-order-grid
   ========================================================================== */

.mbs-section-series-order {
    padding: 20px 0;
    border-top: 1px solid var(--mbs-border, #e0e0e0);
}

.mbs-series-order-heading {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 14px;
    color: var(--mbs-heading, inherit);
}

.mbs-series-order-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
}

.mbs-series-order-item {
    width: 110px;
    flex-shrink: 0;
    text-align: center;
}

.mbs-series-order-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.mbs-series-order-link:hover .mbs-series-order-title,
.mbs-series-order-link:focus .mbs-series-order-title {
    text-decoration: underline;
    color: var(--mbs-accent, var(--mbs-teal));
}

/* Constrain cover wrapper; position:relative for badge overlay. */
.mbs-series-order-cover {
    position: relative;
    width: 110px;
}

.mbs-series-order-cover .mbs-wrapper {
    width: 110px;
}

/* Reading-order / series-position badge — bottom-left pill. */
.mbs-series-order-number {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: var(--mbs-accent, var(--mbs-teal));
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    padding: 3px 7px;
    border-radius: 4px;
    pointer-events: none;
}

.mbs-series-order-title {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
    margin-top: 6px;
    color: var(--mbs-ink, #1f2937);
    transition: color 0.15s ease;
}

/* ==========================================================================
   section-more-by-author — .mbs-author-grid / .mbs-author-book
   Scoped under .mbs-section-more-by-author to win specificity over
   .mbs-author-grid in mbs-front-pro-author-directory.css (display:grid).
   ========================================================================== */

.mbs-section-more-by-author .mbs-author-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
    margin-top: 12px;
}

.mbs-section-more-by-author .mbs-author-book {
    width: 110px;
    flex-shrink: 0;
    text-align: center;
}

/* Constrain the cover renderer wrapper so width:100% resolves to 110px. */
.mbs-section-more-by-author .mbs-author-book .mbs-wrapper {
    width: 110px;
}

.mbs-section-more-by-author .mbs-author-book h4 {
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 6px 0 0;
    color: var(--mbs-ink, #1f2937);
}

.mbs-section-more-by-author .mbs-author-book h4 a {
    color: inherit;
    text-decoration: none;
}

.mbs-section-more-by-author .mbs-author-book h4 a:hover,
.mbs-section-more-by-author .mbs-author-book h4 a:focus {
    text-decoration: underline;
    color: var(--mbs-accent, var(--mbs-teal));
}

/* ==========================================================================
   section-more-in-collection — .mbs-collection-grid / .mbs-collection-book
   ========================================================================== */

.mbs-section-more-in-collection .mbs-collection-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
    margin-top: 12px;
}

.mbs-section-more-in-collection .mbs-collection-book {
    width: 110px;
    flex-shrink: 0;
    text-align: center;
}

/* Constrain the cover renderer wrapper so width:100% resolves to 110px. */
.mbs-section-more-in-collection .mbs-collection-book .mbs-wrapper {
    width: 110px;
}

.mbs-section-more-in-collection .mbs-collection-book h4 {
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 6px 0 0;
    color: var(--mbs-ink, #1f2937);
}

.mbs-section-more-in-collection .mbs-collection-book h4 a {
    color: inherit;
    text-decoration: none;
}

.mbs-section-more-in-collection .mbs-collection-book h4 a:hover,
.mbs-section-more-in-collection .mbs-collection-book h4 a:focus {
    text-decoration: underline;
    color: var(--mbs-accent, var(--mbs-teal));
}

/* ==========================================================================
   section-more-in-universe — .mbs-universe-grid / .mbs-universe-book
   ========================================================================== */

.mbs-section-more-in-universe .mbs-universe-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
    margin-top: 12px;
}

.mbs-section-more-in-universe .mbs-universe-book {
    width: 110px;
    flex-shrink: 0;
    text-align: center;
}

/* Constrain the cover renderer wrapper so width:100% resolves to 110px. */
.mbs-section-more-in-universe .mbs-universe-book .mbs-wrapper {
    width: 110px;
}

.mbs-section-more-in-universe .mbs-universe-book h4 {
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 6px 0 0;
    color: var(--mbs-ink, #1f2937);
}

.mbs-section-more-in-universe .mbs-universe-book h4 a {
    color: inherit;
    text-decoration: none;
}

.mbs-section-more-in-universe .mbs-universe-book h4 a:hover,
.mbs-section-more-in-universe .mbs-universe-book h4 a:focus {
    text-decoration: underline;
    color: var(--mbs-accent, var(--mbs-teal));
}

/* ==========================================================================
   section-related-books — .mbs-related-books-grid
   ========================================================================== */

.mbs-related-books {
    padding: 20px 0;
    border-top: 1px solid var(--mbs-border, #e0e0e0);
}

.mbs-related-books-heading {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 14px;
    color: var(--mbs-heading, inherit);
}

.mbs-related-books-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
}

.mbs-related-book-item {
    width: 110px;
    flex-shrink: 0;
    text-align: center;
}

/* Constrain the cover renderer wrapper so width:100% resolves to 110px. */
.mbs-related-book-item .mbs-wrapper {
    width: 110px;
}

.mbs-related-book-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.mbs-related-book-link:hover .mbs-related-book-title,
.mbs-related-book-link:focus .mbs-related-book-title {
    text-decoration: underline;
    color: var(--mbs-accent, var(--mbs-teal));
}

.mbs-related-book-title {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
    margin-top: 6px;
    color: var(--mbs-ink, #1f2937);
    transition: color 0.15s ease;
}

/* ==========================================================================
   CSS-NEST-001 flat override
   img and .mbs-cover inside shelf wrappers MUST get width:100% via flat
   selectors. The nested rule inside .mbs-wrapper{} in mbs-front.css uses
   bare element selectors (img) which older CSS-nesting parsers drop silently,
   leaving images at their intrinsic size.
   ========================================================================== */

.mbs-series-order-cover .mbs-wrapper .mbs-cover,
.mbs-series-order-cover .mbs-wrapper img {
    width: 100% !important;
    height: auto !important;
    display: block !important;
}

.mbs-section-more-by-author .mbs-author-book .mbs-wrapper .mbs-cover,
.mbs-section-more-by-author .mbs-author-book .mbs-wrapper img {
    width: 100% !important;
    height: auto !important;
    display: block !important;
}

.mbs-section-more-in-collection .mbs-collection-book .mbs-wrapper .mbs-cover,
.mbs-section-more-in-collection .mbs-collection-book .mbs-wrapper img {
    width: 100% !important;
    height: auto !important;
    display: block !important;
}

.mbs-section-more-in-universe .mbs-universe-book .mbs-wrapper .mbs-cover,
.mbs-section-more-in-universe .mbs-universe-book .mbs-wrapper img {
    width: 100% !important;
    height: auto !important;
    display: block !important;
}

.mbs-related-book-item .mbs-wrapper .mbs-cover,
.mbs-related-book-item .mbs-wrapper img {
    width: 100% !important;
    height: auto !important;
    display: block !important;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 480px) {
    .mbs-series-order-grid {
        gap: 12px;
    }
    .mbs-series-order-item {
        width: 90px;
    }
    .mbs-series-order-cover {
        width: 90px;
    }
    .mbs-series-order-cover .mbs-wrapper {
        width: 90px;
    }
}

@media (max-width: 480px) {
    .mbs-section-more-by-author .mbs-author-grid {
        gap: 12px;
    }
    .mbs-section-more-by-author .mbs-author-book {
        width: 90px;
    }
    .mbs-section-more-by-author .mbs-author-book .mbs-wrapper {
        width: 90px;
    }
}

@media (max-width: 480px) {
    .mbs-section-more-in-collection .mbs-collection-grid {
        gap: 12px;
    }
    .mbs-section-more-in-collection .mbs-collection-book {
        width: 90px;
    }
    .mbs-section-more-in-collection .mbs-collection-book .mbs-wrapper {
        width: 90px;
    }
}

@media (max-width: 480px) {
    .mbs-section-more-in-universe .mbs-universe-grid {
        gap: 12px;
    }
    .mbs-section-more-in-universe .mbs-universe-book {
        width: 90px;
    }
    .mbs-section-more-in-universe .mbs-universe-book .mbs-wrapper {
        width: 90px;
    }
}

@media (max-width: 480px) {
    .mbs-related-books-grid {
        gap: 12px;
    }
    .mbs-related-book-item {
        width: 90px;
    }
    .mbs-related-book-item .mbs-wrapper {
        width: 90px;
    }
}
