/* Книжные подборки. Цвета и шрифты — из main.css темы.
   Текст на телефоне — 16 px, межстрочный 1.5; мелкими остаются только подписи-метки (13 px). */

html {
    scroll-behavior: auto;
}

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* ---------- Вступление ---------- */

.page-text.collection-intro {
    max-width: 760px;
    margin-bottom: 20px;
}

.page-text.collection-intro p {
    font-size: 16px;
    line-height: 1.55;
    color: #222228;
    margin: 0 0 12px;
}

.page-text.collection-intro p:last-child {
    margin-bottom: 0;
}

/* ---------- Оглавление «В подборке» ---------- */

.book-toc {
    margin: 0 0 24px;
    padding: 14px 16px 8px;
    border-radius: 20px;
    background: #F0F1F9;
}

.page-text .book-toc-title,
.book-toc-title {
    margin: 0 0 4px;
    font-family: Montserrat, sans-serif;
    font-size: 13px;
    line-height: 18px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #52535D;
}

.book-toc-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.book-toc-link {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-height: 44px;
    padding: 9px 0;
    border-top: 1px solid rgba(34, 34, 40, 0.1);
    font-size: 16px;
    line-height: 1.4;
    font-weight: 500;
    color: #222228;
}

.book-toc-list li:first-child .book-toc-link {
    border-top: 0;
}

a.book-toc-link:hover,
a.book-toc-link:focus-visible {
    color: #222228;
}

a.book-toc-link:hover .book-toc-text {
    text-decoration: underline;
    text-decoration-color: #9DC826;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

a.book-toc-link:focus-visible {
    outline: 2px solid #222228;
    outline-offset: 2px;
    border-radius: 8px;
}

.book-toc-num {
    flex: 0 0 auto;
    min-width: 26px;
    height: 26px;
    border-radius: 13px;
    background: #CAEF63;
    font-family: Montserrat, sans-serif;
    font-size: 13px;
    font-weight: 700;
    line-height: 26px;
    text-align: center;
}

.book-toc-author {
    font-weight: 400;
    color: #52535D;
}

/* ---------- Карточки книг ---------- */

.book-collection {
    margin: 8px 0 32px;
}

.book-list {
    display: grid;
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.book-card {
    display: grid;
    gap: 14px;
    padding: 16px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid #D3D5E0;
    scroll-margin-top: 16px;
}

.book-card:target {
    border-color: #222228;
    box-shadow: 0 0 0 3px #CAEF63;
}

.book-card-top {
    display: flex;
    align-items: center;
    gap: 14px;
}

.book-card-cover {
    flex: 0 0 auto;
}

/* Обложка целиком, в своих пропорциях: ширина задана, высота считается по файлу. */
.book-card-cover img {
    display: block;
    width: 84px;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(34, 34, 40, 0.18);
}

.book-cover-placeholder {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 84px;
    aspect-ratio: 2 / 3;
    padding: 10px 8px;
    border-radius: 6px;
    border-left: 4px solid #CAEF63;
    background: linear-gradient(160deg, #2F333E 0%, #222228 100%);
    color: #fff;
    overflow: hidden;
}

.book-cover-placeholder-title {
    font-family: Montserrat, sans-serif;
    font-weight: 700;
    font-size: 11px;
    line-height: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-cover-placeholder-author {
    font-size: 10px;
    line-height: 12px;
    color: #CAEF63;
}

.book-card-head {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    min-width: 0;
}

.book-card-num {
    flex: 0 0 auto;
    min-width: 28px;
    height: 28px;
    border-radius: 14px;
    background: #CAEF63;
    color: #222228;
    font-family: Montserrat, sans-serif;
    font-weight: 700;
    font-size: 14px;
    line-height: 28px;
    text-align: center;
}

.page-text .book-card-title,
.book-card-title {
    margin: 0 0 4px;
    font-family: Montserrat, sans-serif;
    font-size: 19px;
    line-height: 1.25;
    font-weight: 700;
    color: #222228;
    overflow-wrap: anywhere;
}

.book-card-author {
    font-size: 15px;
    line-height: 1.35;
    color: #52535D;
}

.book-card-body {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.page-text .book-card-summary,
.book-card-summary {
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
    color: #222228;
}

/* Два коротких пункта без «карточек»: цветная метка и текст. */
.book-points {
    display: grid;
    gap: 12px;
    margin: 0;
}

.book-point {
    margin: 0;
}

.book-point dt {
    display: inline-block;
    margin: 0 0 4px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 13px;
    line-height: 20px;
    font-weight: 700;
    color: #222228;
    background: #E6F3C1;
}

.book-point-fit dt {
    background: #DCE1F5;
}

.book-point-talk dt {
    background: #E3DCF2;
}

.book-talk-list {
    margin: 0;
    padding-left: 20px;
}

.book-talk-list li + li {
    margin-top: 6px;
}

.book-point dd {
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
    color: #222228;
}

.book-card-more p {
    margin: 0 0 8px;
    font-size: 16px;
    line-height: 1.5;
    color: #222228;
}

.book-card-more p:last-child {
    margin-bottom: 0;
}

.book-card-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
}

.page-text a.book-buy-btn,
a.book-buy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 22px;
    border-radius: 24px;
    background: #222228;
    color: #fff !important;
    font-family: Montserrat, sans-serif;
    font-weight: 600;
    font-size: 15px;
    line-height: 20px;
    text-decoration: none !important;
    transition: background .15s ease, color .15s ease;
}

a.book-buy-btn:hover,
a.book-buy-btn:focus {
    background: #CAEF63;
    color: #222228 !important;
}

.book-ad-marking {
    font-size: 13px;
    line-height: 1.35;
    color: #52535D;
}

/* Телефон: обложка и заголовок — компактная верхняя часть, текст ниже на всю ширину карточки. */
@media (max-width: 767.98px) {
    a.book-buy-btn {
        width: 100%;
    }
    .book-ad-marking {
        width: 100%;
    }
}

@media (min-width: 768px) {
    .book-toc {
        padding: 18px 24px 12px;
    }
    .book-toc-list {
        columns: 2;
        column-gap: 32px;
    }
    .book-toc-list li {
        break-inside: avoid;
    }
    .book-toc-link,
    .book-toc-list li:first-child .book-toc-link {
        min-height: 44px;
        padding: 6px 0;
        border-top: 0;
    }
    .book-card {
        grid-template-columns: 132px minmax(0, 1fr);
        align-items: start;
        gap: 24px;
        padding: 24px;
    }
    .book-card-top {
        display: contents;
    }
    .book-card-cover {
        grid-column: 1;
        grid-row: 1 / span 2;
    }
    .book-card-cover img,
    .book-cover-placeholder {
        width: 132px;
    }
    .book-card-head {
        grid-column: 2;
        grid-row: 1;
    }
    .book-card-body {
        grid-column: 2;
        grid-row: 2;
        max-width: 780px;
    }
    .page-text .book-card-title,
    .book-card-title {
        font-size: 22px;
    }
    .book-cover-placeholder-title {
        font-size: 13px;
        line-height: 17px;
    }
    .book-cover-placeholder-author {
        font-size: 11px;
        line-height: 14px;
    }
}

@media (min-width: 992px) {
    .book-points {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
    }

    .book-point-talk {
        grid-column: 1 / -1;
    }
}

/* ---------- «Похожие подборки» / «Другие подборки»: компактные карточки ---------- */

.book-more {
    margin-top: -24px;
    padding: 0 0 48px;
}

.book-more-title {
    margin: 0 0 14px;
    font-size: 24px;
    line-height: 30px;
    color: #222228;
}

.book-more-list {
    display: grid;
    gap: 10px;
}

a.book-more-card {
    display: flex;
    gap: 14px;
    align-items: center;
    min-height: 76px;
    padding: 10px 14px 10px 10px;
    border-radius: 18px;
    background: #F0F1F9;
    color: #222228;
}

.book-more-image {
    position: relative;
    flex: 0 0 88px;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 10px;
    background: #E6F3C1;
}

.book-more-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-more-type {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    padding: 6px;
    font-family: Montserrat, sans-serif;
    font-size: 13px;
    font-weight: 700;
    line-height: 16px;
}

.book-more-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.book-more-name {
    font-family: Montserrat, sans-serif;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
}

.book-more-meta {
    font-size: 15px;
    line-height: 1.35;
    color: #52535D;
}

a.book-more-card:hover,
a.book-more-card:focus-visible {
    color: #222228;
}

a.book-more-card:hover .book-more-name {
    text-decoration: underline;
    text-decoration-color: #9DC826;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

a.book-more-card:focus-visible {
    outline: 2px solid #222228;
    outline-offset: 3px;
}

@media (min-width: 768px) {
    .book-more-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px;
    }
    .book-more-list.is-single {
        grid-template-columns: minmax(0, 480px);
    }
    a.book-more-card {
        align-items: flex-start;
    }
}

/* Партнёрское предложение Литрес (общий блок после списка книг) */
.books-offer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px 32px;
    align-items: center;
    margin: 0 0 40px;
    padding: 24px 28px;
    border-radius: 20px;
    background: #222228;
    color: #fff;
}

.books-offer-label {
    display: inline-block;
    margin-bottom: 8px;
    padding: 3px 12px;
    border-radius: 12px;
    background: #CAEF63;
    color: #222228;
    font-size: 12px;
    line-height: 18px;
    font-weight: 600;
}

.page-text .books-offer-title,
.books-offer-title {
    font-family: Montserrat, sans-serif;
    font-size: 20px;
    line-height: 26px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 6px;
}

.page-text .books-offer-text,
.books-offer-text {
    font-size: 15px;
    line-height: 23px;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
}

.books-offer-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 280px;
}

.books-offer-promo {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 6px 6px 14px;
    border: 1px dashed #CAEF63;
    border-radius: 14px;
}

.books-offer-promo-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.books-offer-code {
    flex: 1 1 auto;
    font-family: Menlo, Consolas, monospace;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #CAEF63;
    background: none;
    padding: 0;
    word-break: break-all;
}

.books-offer-copy {
    flex: 0 0 auto;
    padding: 7px 14px;
    border: 1px solid #CAEF63;
    border-radius: 10px;
    background: transparent;
    color: #CAEF63;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.books-offer-copy:hover,
.books-offer-copy.is-copied {
    background: #CAEF63;
    color: #222228;
}

.page-text a.books-offer-btn,
a.books-offer-btn {
    display: block;
    padding: 12px 20px;
    border-radius: 24px;
    background: #CAEF63;
    color: #222228 !important;
    text-align: center;
    font-family: Montserrat, sans-serif;
    font-weight: 700;
    font-size: 14px;
    line-height: 20px;
    text-decoration: none !important;
}

a.books-offer-btn:hover,
a.books-offer-btn:focus {
    background: #fff;
}

.books-offer-status {
    grid-column: 1 / -1;
    min-height: 0;
    font-size: 13px;
    font-weight: 600;
    color: #CAEF63;
}

.books-offer-status:empty {
    display: none;
}

.books-offer-marking {
    grid-column: 1 / -1;
    color: rgba(255, 255, 255, 0.55);
}

@media (max-width: 767.98px) {
    .books-offer {
        grid-template-columns: minmax(0, 1fr);
        padding: 20px 16px;
        margin-bottom: 32px;
    }
    .books-offer-actions {
        min-width: 0;
    }
    .page-text .books-offer-title,
    .books-offer-title {
        font-size: 18px;
        line-height: 24px;
    }
}
