﻿body {
    background: #F4F1EC;
}

.lib-page {
    background: #F4F1EC;
}

/* ============ HERO ============ */
.lib-hero {
    position: relative;
    background: #1E3A1E;
    overflow: hidden;
}

.lib-hero-bg {
    position: absolute;
    inset: 0;
    opacity: 0.08;
    background-image: radial-gradient(circle at 82% 28%, #C9A84C 0, transparent 45%), radial-gradient(circle at 12% 85%, #C9A84C 0, transparent 42%);
    pointer-events: none;
}

.lib-hero-inner {
    position: relative;
    max-width: 1320px;
    margin: 0 auto;
    padding: 28px 20px 32px;
}

.lib-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #9DB89A;
    margin-bottom: 16px;
}

    .lib-breadcrumb a {
        color: #9DB89A;
        text-decoration: none;
    }

        .lib-breadcrumb a:hover {
            color: #C9A84C;
        }

    .lib-breadcrumb i {
        font-size: 9px;
    }

    .lib-breadcrumb span {
        color: #C9A84C;
        font-weight: 600;
    }

.lib-hero-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
}

.lib-hero-copy {
    max-width: 640px;
}

.lib-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #C9A84C;
    margin-bottom: 12px;
}

.lib-hero-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: 700;
    color: #F4F1EC;
    line-height: 1.1;
    font-size: 30px;
    margin: 0;
}

.lib-hero-sub {
    color: #D8E0D6;
    font-size: 14px;
    line-height: 1.7;
    margin: 14px 0 0;
}

.lib-hero-stats {
    display: none;
}

.lib-stat {
    text-align: right;
}

.lib-stat-num {
    font-family: Georgia, serif;
    font-weight: 700;
    color: #C9A84C;
    font-size: 34px;
    line-height: 1;
    margin: 0;
}

.lib-stat-label {
    color: #9DB89A;
    font-size: 12px;
    margin: 6px 0 0;
}

/* ============ TOOLBAR ============ */
.lib-toolbar {
    background: white;
    border-bottom: 1px solid #E2DDD6;
    position: sticky;
    top: 0;
    z-index: 20;
}

.lib-toolbar-inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.lib-search {
    position: relative;
    flex: 1;
    min-width: 220px;
    max-width: 460px;
    display: flex;
    align-items: center;
}

    .lib-search i {
        position: absolute;
        left: 16px;
        color: #9A9388;
        font-size: 14px;
        pointer-events: none;
    }

    .lib-search input {
        width: 100%;
        background: #F4F1EC;
        border: 1px solid #E2DDD6;
        border-radius: 999px;
        padding: 11px 16px 11px 42px;
        font-size: 14px;
        color: #1A1A1A;
        outline: none;
        transition: border-color 0.15s, box-shadow 0.15s;
    }

        .lib-search input::placeholder {
            color: #9A9388;
        }

        .lib-search input:focus {
            border-color: #2D5A27;
            box-shadow: 0 0 0 3px rgba(45,90,39,0.12);
        }

.lib-sort {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid #E2DDD6;
    border-radius: 999px;
    padding: 7px 36px 7px 14px;
    margin-left: auto;
}

.lib-sort-label {
    font-size: 12px;
    color: #7A7268;
}

.lib-sort select {
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    color: #1E3A1E;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.lib-sort-caret {
    position: absolute;
    right: 14px;
    font-size: 10px;
    color: #7A7268;
    pointer-events: none;
}

/* ============ MAIN / GRID ============ */
.lib-main {
    max-width: 1320px;
    margin: 0 auto;
    padding: 24px 20px 56px;
}

.lib-count {
    font-size: 13px;
    color: #7A7268;
    margin: 0 0 20px;
}

    .lib-count strong {
        color: #1A1A1A;
        font-weight: 600;
    }

.lib-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* ============ BOOK CARD ============ */
.lib-card {
    background: white;
    border: 1px solid #E2DDD6;
    border-radius: 18px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

    .lib-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 18px 36px rgba(30,58,30,0.14);
    }

        .lib-card:hover .lib-cover {
            transform: scale(1.03);
        }

.lib-shelf {
    background: linear-gradient(180deg, #efe9df 0%, #e7dfd2 100%);
    padding: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    position: relative;
}

.lib-cover {
    max-height: 230px;
    max-width: 100%;
    width: auto;
    object-fit: contain;
    border-radius: 3px;
    box-shadow: 0 12px 28px rgba(30,40,20,0.32);
    transition: transform 0.4s ease;
}

.lib-cover-fallback {
    display: none;
    color: #b3a892;
    font-size: 48px;
}

.lib-shelf.no-cover .lib-cover-fallback {
    display: block;
}

.lib-card-body {
    padding: 18px 18px 20px;
    border-top: 1px solid #F0EDE6;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.lib-card-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 17px;
    font-weight: 700;
    color: #1A1A1A;
    line-height: 1.32;
    margin: 0 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lib-card-desc {
    font-size: 13px;
    line-height: 1.6;
    color: #5A5651;
    margin: 0 0 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lib-card-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: #7A7268;
    margin: 0 0 14px;
}

    .lib-card-meta i {
        color: #2D5A27;
        font-size: 13px;
    }

.lib-view-btn {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    border: 1px solid #1E3A1E;
    border-radius: 999px;
    background: white;
    color: #1E3A1E;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
}

.lib-card:hover .lib-view-btn {
    background: #1E3A1E;
    color: white;
}

/* ============ DONATE CARD ============ */
.lib-donate-card {
    background: #FAF6EE;
    border: 1px dashed #C9A84C;
    border-radius: 18px;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
    transition: background 0.15s;
}

    .lib-donate-card:hover {
        background: #f6efe0;
    }

.lib-donate-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #F0D9A0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5A4615;
    font-size: 22px;
    margin-bottom: 16px;
}

.lib-donate-title {
    font-family: Georgia, serif;
    font-size: 18px;
    font-weight: 700;
    color: #1A1A1A;
    margin: 0 0 8px;
}

.lib-donate-text {
    font-size: 13px;
    color: #5A5651;
    line-height: 1.6;
    margin: 0 0 18px;
}

.lib-donate-btn {
    background: #C9A84C;
    color: #3A2E08;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 22px;
    border-radius: 999px;
}

.lib-empty {
    display: none;
    text-align: center;
    color: #7A7268;
    font-size: 14px;
    padding: 40px 0;
}

/* ============ RESPONSIVE GRID ============ */
@media (min-width: 768px) {
    .lib-hero-title {
        font-size: 38px;
    }

    .lib-hero-stats {
        display: flex;
        align-items: center;
        gap: 32px;
        padding-bottom: 2px;
    }

    .lib-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
}

@media (min-width: 1200px) {
    .lib-hero-inner {
        padding: 44px 40px 48px;
    }

    .lib-hero-title {
        font-size: 44px;
    }

    .lib-toolbar-inner {
        padding: 16px 40px;
    }

    .lib-main {
        padding: 36px 40px 64px;
    }

    .lib-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 28px;
    }
}

/* ============ MODAL ============ */
.lib-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(26,26,26,0.55);
    backdrop-filter: blur(2px);
    align-items: flex-end;
    justify-content: center;
}

    .lib-modal.open {
        display: flex;
    }

.lib-modal-inner {
    width: 100%;
    max-height: 94vh;
    background: #F4F1EC;
    border-radius: 24px 24px 0 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: libSlideUp 0.25s ease;
}

@keyframes libSlideUp {
    from {
        transform: translateY(40px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.lib-modal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    background: #1E3A1E;
    color: white;
    flex-shrink: 0;
}

.lib-modal-crumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #9DB89A;
    min-width: 0;
}

    .lib-modal-crumb i {
        font-size: 9px;
    }

    .lib-modal-crumb .crumb-current {
        color: #C9A84C;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

.lib-modal-close {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    color: white;
    font-size: 15px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}

    .lib-modal-close:hover {
        background: rgba(255,255,255,0.22);
    }

.lib-modal-body {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.lib-modal-gallery {
    background: linear-gradient(180deg, #efe9df 0%, #e7dfd2 100%);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lib-modal-cover-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lib-modal-cover {
    max-height: 320px;
    max-width: 100%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 18px 40px rgba(30,40,20,0.4);
    background: white;
}

.lib-modal-thumbs {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

    .lib-modal-thumbs img {
        width: 58px;
        height: 74px;
        object-fit: cover;
        border-radius: 8px;
        background: white;
        cursor: pointer;
        border: 2px solid transparent;
        opacity: 0.7;
        transition: opacity 0.15s, border-color 0.15s;
    }

        .lib-modal-thumbs img.active {
            opacity: 1;
            border-color: #1E3A1E;
        }

.lib-modal-details {
    padding: 24px;
}

.lib-modal-title {
    font-family: Georgia, serif;
    font-size: 23px;
    font-weight: 700;
    color: #1A1A1A;
    line-height: 1.25;
    margin: 0;
}

.lib-modal-meta {
    font-size: 13px;
    color: #7A7268;
    margin: 10px 0 0;
    display: flex;
    align-items: center;
    gap: 7px;
}

    .lib-modal-meta i {
        color: #2D5A27;
    }

    .lib-modal-meta:empty {
        display: none;
    }

.lib-modal-divider {
    height: 1px;
    background: #E2DDD6;
    margin: 18px 0;
}

.lib-modal-seclabel {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #7A7268;
    margin: 0 0 8px;
}

.lib-modal-desc {
    font-size: 14px;
    line-height: 1.75;
    color: #444;
    margin: 0;
}

/* Tablet modal */
@media (min-width: 768px) {
    .lib-modal {
        align-items: center;
        padding: 24px;
    }

    .lib-modal-inner {
        max-width: 640px;
        border-radius: 20px;
        max-height: 90vh;
    }
}

/* Desktop modal — two columns like the reference */
@media (min-width: 1024px) {
    .lib-modal-inner {
        max-width: 1000px;
    }

    .lib-modal-body {
        flex-direction: row;
    }

    .lib-modal-gallery {
        width: 420px;
        flex-shrink: 0;
        border-right: 1px solid #E2DDD6;
        padding: 36px 28px;
    }

    .lib-modal-cover {
        max-height: 400px;
    }

    .lib-modal-details {
        flex: 1;
        padding: 32px;
        overflow-y: auto;
    }

    .lib-modal-title {
        font-size: 28px;
    }
}

/* ============ MOBILE CHIPS ROW ============ */
.lib-chips-row {
    display: none;
}

@media (max-width: 767px) {
    /* ── Hero ── */
    .lib-hero-inner {
        padding: 18px 16px 22px;
    }

    .lib-hero-title {
        font-size: 24px;
    }

    .lib-hero-sub {
        font-size: 12.5px;
        line-height: 1.65;
        margin-top: 10px;
    }

    .lib-hero-stats {
        display: none !important;
    }
    /* ── Toolbar ── */
    .lib-toolbar-inner {
        padding: 12px 16px 10px;
        flex-wrap: nowrap;
    }

    .lib-search {
        max-width: none;
    }

    .lib-sort {
        display: none;
    }

    .lib-chips-row {
        display: block;
        border-top: 1px solid #F0EDE6;
        padding: 10px 16px;
        overflow-x: auto;
        scrollbar-width: none;
    }

        .lib-chips-row::-webkit-scrollbar {
            display: none;
        }

    .lib-chips {
        display: flex;
        gap: 8px;
        white-space: nowrap;
    }

    .lib-chip {
        font-size: 12px;
        font-weight: 500;
        padding: 6px 14px;
        border-radius: 999px;
        border: 1px solid #E2DDD6;
        background: white;
        color: #5A5651;
        cursor: pointer;
        transition: background 0.15s, color 0.15s, border-color 0.15s;
    }

        .lib-chip.active {
            background: #1E3A1E;
            color: white;
            border-color: #1E3A1E;
        }
    /* ── Main ── */
    .lib-main {
        padding: 14px 16px 48px;
    }

    .lib-count {
        font-size: 12px;
    }
    /* ── Grid → list ── */
    .lib-grid {
        display: flex;
        flex-direction: column;
        gap: 14px;
    }
    /* ── Card: horizontal row ── */
    .lib-card {
        flex-direction: row;
        border-radius: 14px;
    }

    .lib-shelf {
        width: 110px;
        min-width: 110px;
        min-height: auto;
        padding: 12px;
        border-radius: 0;
        flex-shrink: 0;
    }

    .lib-cover {
        max-height: 130px;
    }

    .lib-card-body {
        padding: 12px 14px 14px;
        border-top: none;
        border-left: 1px solid #F0EDE6;
    }

    .lib-card-title {
        font-size: 13.5px;
        margin-bottom: 6px;
        -webkit-line-clamp: 2;
    }

    .lib-card-desc {
        font-size: 11.5px;
        -webkit-line-clamp: 2;
        margin-bottom: 8px;
    }

    .lib-card-meta {
        font-size: 11px;
        margin-bottom: 10px;
    }
    /* "View details" becomes a simple inline text link on mobile */
    .lib-view-btn {
        width: auto;
        padding: 0;
        border: none;
        background: transparent;
        font-size: 12px;
        font-weight: 600;
        color: #1E3A1E;
        justify-content: flex-start;
        gap: 6px;
    }

    .lib-card:hover .lib-view-btn {
        background: transparent;
        color: #1E3A1E;
    }
    /* ── Donate card ── */
    .lib-donate-card {
        padding: 24px 20px;
        border-radius: 14px;
    }

    .lib-donate-title {
        font-size: 16px;
    }

    .lib-donate-text {
        font-size: 12px;
    }
}

