::-webkit-scrollbar {
    display: block;
}

html {
    scrollbar-width: thin;
}

.library-container {
    max-width: 960px;
    margin: 30px auto 80px auto;
    padding: 0 20px;
    color: #E3DAD2;
    font-family: 'Playfair Display', serif;
}

.library-header {
    text-align: center;
    margin-bottom: 36px;
}

.library-title {
    margin: 0 0 12px 0;
    letter-spacing: 0.14em;
    font-weight: 500;
}

.library-subtitle {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(227, 218, 210, 0.55);
}

/* ==================== КАТАЛОЖНАЯ ПАНЕЛЬ (ФИЛЬТРЫ И СОРТИРОВКА) ==================== */
.library-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    margin-bottom: 36px;
    background: rgba(227, 218, 210, 0.03);
    border-top: 1px solid rgba(227, 218, 210, 0.22);
    border-bottom: 1px solid rgba(227, 218, 210, 0.22);
}

.library-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.library-cat-chip {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(227, 218, 210, 0.72);
    text-decoration: none;
    padding: 6px 12px;
    border: 1px solid rgba(227, 218, 210, 0.16);
    border-radius: 3px;
    transition: all 0.2s ease;
}

.library-cat-chip:hover {
    border-color: rgba(227, 218, 210, 0.45);
    color: #E3DAD2;
}

.library-cat-chip.active {
    background: #E3DAD2;
    color: #2E2A27;
    border-color: #E3DAD2;
    font-weight: 500;
}

.library-sort {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.library-sort a {
    color: rgba(227, 218, 210, 0.55);
    text-decoration: none;
    padding-bottom: 2px;
    border-bottom: 1px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.library-sort a:hover {
    color: #E3DAD2;
}

.library-sort a.active {
    color: #E3DAD2;
    border-bottom-color: #E3DAD2;
}

/* ==================== КНИЖНЫЕ КАРТОЧКИ СТАТЕЙ ==================== */
.library-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.book-card {
    position: relative;
    display: flex;
    gap: 26px;
    align-items: stretch;
    background: linear-gradient(135deg, rgba(227, 218, 210, 0.07) 0%, rgba(227, 218, 210, 0.02) 100%);
    border: 1px solid rgba(227, 218, 210, 0.2);
    border-left: 4px solid #E3DAD2;
    border-radius: 2px 6px 6px 2px;
    padding: 24px 28px;
    transition: transform 0.25s ease, border-color 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

/* Тонкая линия переплета рядом с корешком */
.book-card::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 5px;
    width: 1px;
    background: rgba(227, 218, 210, 0.16);
    pointer-events: none;
}

.book-card:hover {
    transform: translateY(-2px);
    border-color: rgba(227, 218, 210, 0.45);
    background: linear-gradient(135deg, rgba(227, 218, 210, 0.11) 0%, rgba(227, 218, 210, 0.03) 100%);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.book-cover {
    flex: 0 0 210px;
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid rgba(227, 218, 210, 0.16);
    background: rgba(227, 218, 210, 0.04);
    display: block;
    text-decoration: none;
}

.book-cover img {
    width: 100%;
    height: 100%;
    min-height: 175px;
    max-height: 220px;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.book-card:hover .book-cover img {
    transform: scale(1.04);
}

/* Заглушка обложки, если у статьи нет фото */
.book-cover-placeholder {
    width: 100%;
    height: 100%;
    min-height: 175px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    text-align: center;
    background: radial-gradient(circle at center, rgba(227, 218, 210, 0.09) 0%, rgba(54, 50, 47, 0.4) 100%);
    color: rgba(227, 218, 210, 0.45);
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.book-cover-placeholder span {
    border-top: 1px solid rgba(227, 218, 210, 0.25);
    border-bottom: 1px solid rgba(227, 218, 210, 0.25);
    padding: 8px 12px;
}

.book-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.book-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(227, 218, 210, 0.6);
    margin-bottom: 10px;
}

.book-meta a {
    color: rgba(227, 218, 210, 0.82);
    text-decoration: none;
    transition: color 0.2s ease;
}

.book-meta a:hover {
    color: #E3DAD2;
}

.book-meta-dot {
    opacity: 0.4;
}

.book-title {
    margin: 0 0 10px 0;
    font-size: 1.48rem;
    line-height: 1.28;
    font-weight: 600;
}

.book-title a {
    color: #E3DAD2;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.book-title a:hover {
    opacity: 0.78;
}

.book-annotation {
    margin: 0 0 18px 0;
    font-size: 0.98rem;
    line-height: 1.6;
    color: rgba(227, 218, 210, 0.82);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-footer {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid rgba(227, 218, 210, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.book-date {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: rgba(227, 218, 210, 0.5);
}

.book-read-link {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.74rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #E3DAD2;
    text-decoration: none;
    opacity: 0.85;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.book-read-link:hover {
    opacity: 1;
    transform: translateX(3px);
}

.library-empty {
    text-align: center;
    padding: 64px 20px;
    color: rgba(227, 218, 210, 0.6);
    font-style: italic;
    font-size: 1.15rem;
}

/* ==================== ПАГИНАЦИЯ ==================== */
.library-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 48px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
}

.library-pagination a,
.library-pagination span {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(227, 218, 210, 0.2);
    border-radius: 3px;
    color: rgba(227, 218, 210, 0.78);
    text-decoration: none;
    transition: all 0.2s ease;
}

.library-pagination a:hover {
    border-color: #E3DAD2;
    color: #E3DAD2;
    background: rgba(227, 218, 210, 0.08);
}

.library-pagination .page-current {
    background: #E3DAD2;
    color: #2E2A27;
    border-color: #E3DAD2;
    font-weight: 500;
}

.library-pagination .page-ellipsis {
    border: none;
    opacity: 0.5;
}

/* ==================== АДАПТИВ ==================== */
@media (max-width: 680px) {
    .library-container {
        margin: 90px auto 50px auto;
        padding: 0 14px;
    }

    .library-controls {
        padding: 14px;
    }

    .book-card {
        flex-direction: column;
        padding: 20px 20px 20px 24px;
        gap: 16px;
    }

    .book-cover {
        flex: none;
        width: 100%;
    }

    .book-cover img,
    .book-cover-placeholder {
        height: 200px;
        min-height: 200px;
        max-height: 200px;
    }

    .book-title {
        font-size: 1.3rem;
    }
}