/* Homepage storybook shelf. Companion formats remain in the full Books library. */
.home-books-shelf {
    --books-color: #7040e8;
    padding: clamp(1rem, 2vw, 1.5rem);
    border: 1px solid #e0e6f2;
    border-radius: 1.5rem;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 4px 12px rgba(32, 79, 128, 0.08);
    color: #173b75;
}

.home-books-header,
.home-books-heading,
.home-books-heading h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.home-books-header { justify-content: space-between; flex-wrap: wrap; }
.home-books-heading { flex-wrap: wrap; gap: 0.35rem 1.3rem; }
.home-books-heading h3 {
    margin: 0;
    color: var(--books-color);
    font: 900 clamp(1.4rem, 2.2vw, 1.85rem) / 1.2 var(--font-ui);
}
.home-books-icon {
    width: 1.9rem;
    height: 1.9rem;
    flex: none;
    background: currentColor;
    mask: url('../images/nav-icons/books.png') center / contain no-repeat;
}
.home-books-heading p { margin: 0; color: var(--books-color); font-size: 0.85rem; font-weight: 900; }
.home-books-all {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0.5rem 0.85rem;
    border: 1px solid #d8ccef;
    border-radius: 2rem;
    color: var(--books-color);
    font-size: 0.85rem;
    font-weight: 800;
    text-decoration: none;
}
.home-books-list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - 3rem) / 4);
    overflow-x: auto;
    scroll-snap-type: x proximity;
    gap: 1rem;
    margin: 1rem 0 0;
    padding: 0.25rem;
    list-style: none;
}
.home-books-list > li { min-width: 0; scroll-snap-align: start; }
.home-book-card {
    display: grid;
    align-content: start;
    gap: 1rem;
    height: 100%;
    padding: 0.9rem;
    border: 1px solid #e8e8f1;
    border-radius: 1rem;
    background: #fafbfe;
    color: inherit;
    text-decoration: none;
    transition: background-color 160ms ease, border-color 160ms ease;
}
.home-book-cover {
    display: block;
    width: 100%;
    max-width: 12.75rem;
    height: auto;
    justify-self: center;
    border-radius: 0.5rem;
    box-shadow: 0 3px 8px rgba(27, 47, 81, 0.16);
}
.home-book-caption {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-content: center;
    align-items: start;
    gap: 0.35rem 0.6rem;
    min-width: 0;
}
.home-book-number {
    display: grid;
    place-items: center;
    min-width: 1.65rem;
    min-height: 1.65rem;
    padding: 0.1rem;
    border-radius: 50%;
    background: var(--books-color);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 900;
}
.home-book-title { font-size: 1rem; font-weight: 900; line-height: 1.4; }
.home-book-age { grid-column: 2; color: #625583; font-size: 0.85rem; font-weight: 700; }

.home-book-card:hover { border-color: #bca4ed; background: #f4efff; }
.home-books-all:hover { background: #f4efff; }
.home-book-card:focus-visible,
.home-books-all:focus-visible { outline: 3px solid var(--books-color); outline-offset: 3px; }

@media (min-width: 601px) and (max-width: 960px) {
    .home-books-list { grid-auto-columns: calc((100% - 1rem) / 2); }
}

@media (max-width: 600px) {
    .home-books-heading { display: block; flex: 1 1 10rem; }
    .home-books-heading p { margin-top: 0.5rem; font-size: 0.8rem; }
    .home-books-all { font-size: 0.8rem; }
    .home-books-list { grid-auto-columns: 82%; }
    .home-book-card { padding: 0.75rem; }
    .home-book-title { font-size: 0.9rem; }
    .home-book-caption { gap: 0.35rem; }
}

@media (prefers-reduced-motion: reduce) {
    .home-book-card { transition: none; }
}
