/* ========== Book List Page Styles ========== */

/* ===== Page hero (aligned with homepage) ===== */
.book-list-page .book-page-hero {
    position: relative;
    min-height: 42vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #1565c0 0%, var(--primary-color) 38%, #2563eb 72%, #1d4ed8 100%);
    overflow: hidden;
    padding: var(--spacing-xxl) 0;
}

.book-list-page .book-page-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 85% 65% at 12% -5%, rgba(255, 255, 255, 0.2) 0%, transparent 52%),
        radial-gradient(ellipse 55% 50% at 92% 95%, rgba(99, 102, 241, 0.45) 0%, transparent 55%);
}

.book-list-page .book-page-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.12) 0%, rgba(15, 23, 42, 0.26) 100%);
    z-index: 1;
}

.book-list-page .book-page-hero-inner {
    position: relative;
    z-index: 2;
    text-align: center;
    color: var(--light-bg);
    max-width: 44rem;
    margin: 0 auto;
}

.book-list-page .book-page-hero-kicker {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.9);
    margin: 0 0 var(--spacing-md);
}

.book-list-page .book-page-hero-title {
    font-size: 2.75rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin: 0 0 var(--spacing-md);
    color: var(--light-bg);
}

.book-list-page .book-page-hero-lead {
    font-size: 1.0625rem;
    line-height: 1.65;
    margin: 0;
    color: rgba(255, 255, 255, 0.94);
    max-width: 36rem;
    margin-left: auto;
    margin-right: auto;
}

/* ===== Book list body ===== */
.book-list-page .book-section.book-list-body {
    padding: var(--spacing-xxl) 0 calc(var(--spacing-xxl) + var(--spacing-md));
    background: linear-gradient(180deg, #f8fafc 0%, var(--light-bg) 22%, var(--light-bg) 100%);
    position: relative;
}

.book-list-page .book-section.book-list-body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: min(45%, 400px);
    min-height: 200px;
    background: linear-gradient(90deg, rgba(33, 150, 243, 0.06) 0%, transparent 100%);
    pointer-events: none;
}

.book-list-page .book-list-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
    position: relative;
}

.book-list-page .book-list-tagline {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    max-width: 28rem;
    line-height: 1.55;
}

.book-list-page .results-pill {
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.book-list-page .results-pill .results-text strong {
    color: var(--text-primary);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Legacy / empty state helpers */
.book .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xxl);
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.book .section-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.book .results-info {
    font-size: 1rem;
    color: var(--text-secondary);
}

.book .results-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* ===== Book Grid ===== */
.book .book-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xxl);
    min-width: 0;
    width: 100%;
}

.book .book-card {
    background: var(--light-bg);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-xl);
    transition: var(--transition);
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
    display: flex;
    gap: var(--spacing-lg);
    min-height: 280px;
    position: relative;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.book .book-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 36px rgba(37, 99, 235, 0.12);
    border-color: rgba(37, 99, 235, 0.35);
}

.book .book-cover-wrapper {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.book .book-cover-link {
    display: block;
    transition: var(--transition);
}

.book .book-cover {
    width: 150px;
    height: 200px;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--light-secondary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

.book .book-card:hover .book-cover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.book .book-cover .cover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.book .book-card:hover .book-cover .cover-image {
    transform: scale(1.05);
}

.book .book-cover-placeholder {
    display: block;
    width: 100%;
    height: 100%;
}

.book .book-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.book .book-info-top {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.book .book-title {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: var(--spacing-md);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.book .book-title-link {
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}

.book .book-title-link:hover {
    color: var(--primary-color);
}

.book .book-author-names {
    margin: 0 0 var(--spacing-sm);
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.book .book-author-names .author-label {
    font-weight: 500;
    margin-right: var(--spacing-xs);
}

.book .book-summary-wrapper,
.book .book-introduction-wrapper {
    position: relative;
    margin-bottom: var(--spacing-md);
    flex: 1;
    min-height: 0;
}

.book .book-summary,
.book .book-introduction {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.7;
    margin: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.book .book-info-bottom {
    margin-top: auto;
    padding-top: var(--spacing-md);
}

.book .book-meta-line {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.book .book-meta-line .meta-sep {
    margin: 0 var(--spacing-xs);
    color: var(--text-muted);
    user-select: none;
}

.book .book-meta-line .meta-publisher {
    color: var(--text-secondary);
}

.book .book-meta-line .meta-year,
.book .book-meta-line .meta-category {
    color: var(--text-secondary);
}

/* ===== Empty State ===== */
.book .empty-state {
    text-align: center;
    padding: var(--spacing-xxl) var(--spacing-xl);
    color: var(--text-muted);
}

.book .empty-state i {
    font-size: 4rem;
    margin-bottom: var(--spacing-lg);
    opacity: 0.5;
}

.book .empty-state h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.book .empty-state p {
    font-size: 1rem;
    color: var(--text-muted);
}

/* ===== Scroll Animation ===== */
.book [data-animate] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.book [data-animate].animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Responsive ===== */
@media (max-width: 991.98px) {
    .book .book-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }
    .book .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .book-list-page .book-list-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 767.98px) {
    .book-list-page .book-page-hero-title {
        font-size: 2.125rem;
    }

    .book-list-page .book-page-hero-lead {
        font-size: 1rem;
    }
    .book .section-title {
        font-size: 1.75rem;
    }
    .book .book-card {
        flex-direction: column;
        padding: var(--spacing-lg);
    }
    .book .book-cover-wrapper {
        width: 100%;
        display: flex;
        justify-content: center;
        margin-bottom: var(--spacing-lg);
    }
    .book .book-cover {
        width: 120px;
        height: 160px;
    }
    .book .book-title {
        font-size: 1.25rem;
    }
}

@media (max-width: 575.98px) {
    .book-list-page .book-page-hero {
        min-height: 36vh;
        padding: var(--spacing-xl) 0;
    }

    .book-list-page .book-page-hero-title {
        font-size: 1.85rem;
    }

    .book-list-page .book-page-hero-kicker {
        font-size: 0.6875rem;
    }

    .book .book-card {
        padding: var(--spacing-md);
    }
}

/* ========== Book Detail Page Styles ========== */
.book-detail-page {
    padding: var(--spacing-lg) 0 var(--spacing-xxl);
    background: linear-gradient(180deg, #f1f5f9 0%, var(--light-bg) 18%, var(--light-bg) 100%);
}

.book-detail .book-article {
    width: 100%;
}

.book-detail-page .book-detail-breadcrumb {
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--light-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

/* ===== Detail Layout ===== */
.book-detail .book-detail-layout {
    display: grid;
    grid-template-columns: minmax(260px, 300px) 1fr;
    gap: var(--spacing-lg) var(--spacing-xl);
    align-items: start;
    margin-bottom: var(--spacing-xl);
    min-width: 0;
}

.book-detail .book-primary-card {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    background: var(--light-bg);
    border-radius: var(--border-radius-lg);
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 10px 32px rgba(15, 23, 42, 0.08);
    position: sticky;
    /* --header-height set at runtime by /js/book/book.js from .header height */
    top: calc(var(--header-height, 120px) + 0.75rem);
}

.book-detail .book-cover-wrap {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.14), 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    background: var(--light-secondary);
    position: relative;
    aspect-ratio: 2/3;
}

.book-detail .book-cover-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.08);
}

.book-detail .book-cover-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.book-detail .book-cover-placeholder {
    width: 100%;
    height: 100%;
    min-height: 280px;
    aspect-ratio: 2/3;
    display: block;
}

.book-detail .book-meta-block {
    padding: 0;
    min-width: 0;
}

.book-detail .book-detail-eyebrow {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--secondary-color);
    margin: 0 0 var(--spacing-xs);
}

.book-detail .book-title {
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin: 0 0 var(--spacing-lg);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.book-detail .book-title::after {
    content: '';
    display: block;
    width: 2.75rem;
    height: 3px;
    margin-top: var(--spacing-md);
    border-radius: 2px;
    background: linear-gradient(90deg, var(--primary-color), #818cf8);
}

.book-detail .book-info-list {
    margin: 0 0 var(--spacing-lg);
    padding: 0;
    list-style: none;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
    background: var(--light-secondary);
}

.book-detail .info-row {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: 0;
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
    align-items: baseline;
}

.book-detail .info-row:last-child {
    border-bottom: none;
}

.book-detail .info-row:nth-child(even) {
    background: rgba(255, 255, 255, 0.65);
}

.book-detail .info-row dt {
    flex: 0 0 5.5rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.book-detail .info-row dd {
    margin: 0;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* ===== Authors ===== */
.book-detail .book-authors {
    padding-top: var(--spacing-lg);
    margin-top: var(--spacing-md);
    border-top: 1px dashed var(--border-color);
}

.book-detail .authors-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: var(--spacing-sm);
}

/* ===== Secondary panels ===== */
.book-detail .book-secondary {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.book-detail .book-secondary .block-panel {
    margin-bottom: 0;
    padding: var(--spacing-lg);
    background: var(--light-bg);
    border-radius: var(--border-radius-lg);
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
}

.book-detail .book-summary-panel {
    border-left: 4px solid var(--primary-color);
}

.book-detail .block-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    letter-spacing: -0.01em;
    position: relative;
}

.book-detail .block-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 3rem;
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--primary-color), #818cf8);
}

.book-detail .block-content {
    font-size: 1.0625rem;
    line-height: 1.82;
    color: var(--text-primary);
}

.book-detail .summary-text {
    color: var(--text-secondary);
    font-size: 1.0625rem;
    line-height: 1.8;
    overflow-wrap: anywhere;
}

.book-detail .intro-text {
    white-space: pre-line;
}

.book-detail .book-summary-text {
    margin: 0;
    line-height: 1.75;
    color: var(--text-secondary);
}

.book-detail .block-content p {
    margin-bottom: var(--spacing-md);
}

.book-detail .catalog-content ul,
.book-detail .block-content ul {
    padding-left: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
}

/* ===== Responsive ===== */
@media (max-width: 991.98px) {
    .book-detail .book-detail-layout {
        grid-template-columns: 1fr;
    }

    .book-detail .book-primary-card {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .book-detail .book-cover-wrap {
        flex: 0 0 auto;
        width: 200px;
        max-width: 42%;
    }

    .book-detail .book-meta-block {
        flex: 1;
        min-width: 200px;
    }
}

@media (max-width: 767.98px) {
    .book-detail .book-primary-card {
        flex-direction: column;
    }

    .book-detail .book-cover-wrap {
        width: 100%;
        max-width: 220px;
        margin-left: auto;
        margin-right: auto;
    }

    .book-detail .book-title {
        font-size: 1.45rem;
        text-align: left;
    }

    .book-detail .block-title {
        font-size: 1.125rem;
    }

    .book-detail .book-secondary .block-panel {
        padding: var(--spacing-md);
    }

    .book-detail .book-primary-card {
        padding: var(--spacing-md);
    }
}

@media (max-width: 575.98px) {
    .book-detail .book-title {
        font-size: 1.3rem;
    }

    .book-detail .info-row dt {
        flex: 0 0 4.5rem;
    }
}
