/* 연구총서 목록 — 표지 중심 그리드 */

/* --- 상단 도구막대: 건수 / 검색 / 정렬 --- */
.book-toolbar {
    font-family: 'Noto Sans KR', sans-serif;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 0;
    border-top: 2px solid #222;
    border-bottom: 1px solid #e3e3e3;
    margin-bottom: 32px;
}

.book-count {
    font-size: 14px;
    color: #666;
}

.book-count strong {
    color: #c9171e;
    font-weight: 700;
}

.book-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.book-search {
    display: flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 2px;
    background: #fff;
}

.book-search:focus-within {
    border-color: #c9171e;
}

.book-search input {
    width: 220px;
    border: none;
    outline: none;
    padding: 9px 12px;
    font-size: 14px;
    font-family: inherit;
    background: transparent;
}

.book-search button {
    display: flex;
    align-items: center;
    border: none;
    background: none;
    padding: 0 10px;
    cursor: pointer;
}

.book-search button svg {
    fill: #666;
}

.book-search button:hover svg {
    fill: #c9171e;
}

#book-sort {
    padding: 9px 10px;
    font-size: 14px;
    font-family: inherit;
    border: 1px solid #ccc;
    border-radius: 2px;
    background: #fff;
    cursor: pointer;
}

/* --- 그리드 --- */
.book-grid {
    font-family: 'Noto Sans KR', sans-serif;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 44px 32px;
}

.book-grid .empty-data {
    grid-column: 1 / -1;
}

.book {
    display: flex;
    flex-direction: column;
    gap: 14px;
    color: inherit;
    text-decoration: none;
}

/* 표지: 책 비율(3:4) 고정, 왼쪽 그림자로 책등 느낌 */
.book-cover {
    position: relative;
    aspect-ratio: 3 / 4;
    background: #f4f1ec;
    border-radius: 2px 4px 4px 2px;
    overflow: hidden;
    box-shadow:
        inset 4px 0 6px -3px rgba(0, 0, 0, 0.25),
        0 6px 14px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.book:hover .book-cover,
.book:focus-visible .book-cover {
    transform: translateY(-4px);
    box-shadow:
        inset 4px 0 6px -3px rgba(0, 0, 0, 0.25),
        0 12px 24px rgba(0, 0, 0, 0.18);
}

/* 표지 이미지가 없거나 깨졌을 때: 제목을 세로 중앙에 둔 기본 표지 */
.book-cover-fallback {
    display: none;
    position: absolute;
    inset: 0;
    padding: 20px 16px;
    background: linear-gradient(160deg, #8c1d22 0%, #5e1216 100%);
    color: #f5e9d8;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.book-cover-fallback span {
    font-family: 'KnuTruth', 'Noto Sans KR', sans-serif;
    font-size: 1.05rem;
    line-height: 1.5;
    word-break: keep-all;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-cover.no-image img {
    display: none;
}

.book-cover.no-image .book-cover-fallback {
    display: flex;
}

/* --- 서지 정보 --- */
.book-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.book-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
    color: #222;
    word-break: keep-all;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book:hover .book-title {
    color: #c9171e;
}

.book-author,
.book-sub {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-author {
    color: #555;
}

.book-sub {
    color: #999;
}

/* --- 페이지 이동 --- */
.book-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 56px;
}

.book-pagination:empty {
    display: none;
}

.book-pagination a,
.book-pagination span {
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 34px;
    height: 34px;
    padding: 0 4px;
    box-sizing: border-box;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
}

.book-pagination a[href]:hover {
    background-color: #f3e2e3;
}

.book-pagination .active {
    background-color: #c9171e;
    color: #fff;
    font-weight: 700;
}

.book-pagination .active:hover {
    background-color: #c9171e;
}

.book-pagination .dots {
    color: #999;
}

.book-pagination .arrow svg {
    fill: #c9171e;
}

.book-pagination .arrow.disabled svg {
    fill: #ccc;
}

/* --- 반응형 --- */
@media (max-width: 1024px) {
    .book-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 36px 24px;
    }
}

@media (max-width: 768px) {
    .book-toolbar {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 24px;
    }

    .book-controls {
        width: 100%;
    }

    .book-search {
        flex: 1;
        min-width: 0;
    }

    .book-search input {
        width: 100%;
        min-width: 0;
    }

    .book-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 28px 16px;
    }

    .book-title {
        font-size: 14px;
    }

    .book-author,
    .book-sub {
        font-size: 12px;
    }

    .book-pagination {
        margin-top: 40px;
    }
}
