/* ===== eBook Library – public site ===== */
:root {
    --brand: #4f46e5; --brand-2: #a855f7;
    --bg: #f7f7fc; --surface: #fff; --line: #e9e9f3; --text: #171a2c; --muted: #6b7089;
    --radius: 18px;
    --shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.06);
}
body { font-family: 'Plus Jakarta Sans', system-ui, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; display: flex; flex-direction: column; min-height: 100vh; }
a { text-decoration: none; color: var(--brand); }
.min-w-0 { min-width: 0; }
.btn { border-radius: 11px; font-weight: 600; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: #4338ca; --bs-btn-hover-border-color: #4338ca; --bs-btn-active-bg: #3730a3; }
.btn-soft { background: rgba(79,70,229,.1); color: var(--brand); border: 0; }
.btn-soft:hover { background: rgba(79,70,229,.18); color: var(--brand); }
.btn-icon { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 11px; color: var(--muted); padding: 0; }
.btn-icon:hover { background: rgba(79,70,229,.1); color: var(--brand); }

/* Nav */
.site-nav { position: sticky; top: 0; z-index: 100; padding: .9rem 0; background: rgba(255,255,255,.8); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.site-brand { display: flex; align-items: center; gap: .6rem; font-size: 1.2rem; font-weight: 600; color: var(--text); }
.site-brand b { color: var(--brand); font-weight: 800; }
.site-brand .logo { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.nav-search { position: relative; width: 340px; }
.nav-search i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.nav-search input { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: .55rem 1rem .55rem 2.4rem; background: var(--bg); outline: none; }
.nav-search input:focus { border-color: var(--brand); background: #fff; }

/* Hero */
.hero { padding: 5.5rem 0 4.5rem; background: radial-gradient(ellipse at 15% 0%, rgba(99,102,241,.18), transparent 55%), radial-gradient(ellipse at 85% 10%, rgba(168,85,247,.16), transparent 50%); }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 800; letter-spacing: -.035em; line-height: 1.1; margin: 1.2rem 0 1rem; }
.hero .lead { color: var(--muted); max-width: 560px; margin: 0 auto 2rem; }
.grad { background: linear-gradient(90deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pill { display: inline-block; padding: .35rem .9rem; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: .85rem; font-weight: 600; color: var(--brand); box-shadow: var(--shadow); }
.hero-search { position: relative; display: flex; gap: .5rem; max-width: 620px; margin: 0 auto; padding: .45rem; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 40px rgba(79,70,229,.12); }
.hero-search i { position: absolute; left: 22px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1.1rem; }
.hero-search input { flex: 1; border: 0; outline: none; padding: .6rem .6rem .6rem 2.6rem; font-size: 1.02rem; background: transparent; }
.hero-search .btn { padding: .6rem 1.4rem; }

.section-head { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.section-head h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; margin: 0; }

/* Category cards */
.cat-card { --c: #4f46e5; position: relative; display: block; height: 100%; padding: 1.5rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--text); box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s, border-color .2s; overflow: hidden; }
.cat-card::after { content: ''; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: color-mix(in srgb, var(--c) 10%, transparent); transition: transform .3s; }
.cat-card:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(16,24,40,.1); border-color: color-mix(in srgb, var(--c) 40%, var(--line)); }
.cat-card:hover::after { transform: scale(1.3); }
.cat-card h3 { font-size: 1.15rem; font-weight: 700; margin: 1rem 0 .4rem; }
.cat-card p { color: var(--muted); font-size: .9rem; min-height: 2.6em; }
.cat-card.sm { padding: 1.1rem; }
.cat-card.sm h3 { margin: .7rem 0 0; font-size: 1rem; }
.cat-ico { --c: #4f46e5; width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; font-size: 1.4rem; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); position: relative; z-index: 1; }
.cat-ico.lg { width: 64px; height: 64px; font-size: 1.8rem; background: rgba(255,255,255,.2); color: #fff; }
.cat-meta { display: flex; gap: 1rem; font-size: .82rem; font-weight: 600; color: var(--muted); }
.cat-arrow { position: absolute; right: 1.2rem; bottom: 1.2rem; color: var(--c); opacity: 0; transition: .2s; }
.cat-card:hover .cat-arrow { opacity: 1; }

/* Banner */
.page-banner { --c: #4f46e5; padding: 2.5rem 0 2.8rem; color: #fff; background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 55%, #1e1b4b)); }
.page-banner h1 { font-weight: 800; letter-spacing: -.03em; margin: 0; font-size: clamp(1.7rem, 4vw, 2.4rem); }
.page-banner p { opacity: .85; margin: .4rem 0 0; max-width: 720px; }
.page-banner .hero-search { margin: 0; }
.crumbs { display: flex; flex-wrap: wrap; gap: .45rem; font-size: .85rem; margin-bottom: 1rem; }
.crumbs a, .crumbs span { color: inherit; opacity: .8; }
.crumbs span { opacity: 1; font-weight: 600; }
.crumbs > * + *::before { content: '/'; margin-right: .45rem; opacity: .5; }
.filter-box { position: relative; width: 260px; }
.filter-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.filter-box input { width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: .5rem .8rem .5rem 2.2rem; outline: none; background: #fff; }

/* Books */
.book-list { display: flex; flex-direction: column; gap: .7rem; }
.book-row { display: flex; align-items: center; gap: 1.1rem; padding: 1.1rem 1.3rem; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; color: var(--text); transition: .2s; }
.book-row:hover { border-color: var(--brand); transform: translateX(4px); box-shadow: var(--shadow); }
.book-row h3 { font-size: 1.05rem; font-weight: 700; margin: 0; }
.book-row p { margin: .2rem 0 0; color: var(--muted); font-size: .88rem; }
.book-num { --c: #4f46e5; width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-weight: 800; color: var(--c); background: color-mix(in srgb, var(--c) 11%, transparent); flex-shrink: 0; }
.badge-soft { padding: .35rem .75rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--bg); color: var(--muted); white-space: nowrap; }

/* PDF cards */
.pdf-card { display: flex; align-items: center; gap: 1rem; padding: .9rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; transition: .2s; height: 100%; }
.pdf-card:hover { box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); }
.pdf-card.lg { padding: 1.1rem 1.2rem; }
.pdf-ico { width: 44px; height: 52px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; color: #fff; font-weight: 800; font-size: .7rem; letter-spacing: .04em; background: linear-gradient(160deg, #f43f5e, #be123c); box-shadow: 0 6px 14px rgba(225,29,72,.25); }
.pdf-title { display: block; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdf-title:hover { color: var(--brand); }
.pdf-sub { display: block; font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Reader */
.reader { flex: 1; }
.reader-side { background: var(--surface); border-right: 1px solid var(--line); padding: 1.5rem; max-height: calc(100vh - 68px); overflow: auto; position: sticky; top: 68px; }
.reader-side .crumbs { color: var(--muted); }
.toc a { display: flex; gap: .7rem; padding: .6rem .7rem; border-radius: 10px; color: var(--text); font-size: .9rem; font-weight: 500; }
.toc a span { color: var(--muted); font-weight: 700; min-width: 1.4rem; }
.toc a:hover { background: var(--bg); }
.toc a.active { background: rgba(79,70,229,.1); color: var(--brand); font-weight: 700; }
.reader-main { display: flex; flex-direction: column; }
.reader-bar { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; padding: .9rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.reader-bar h1 { font-size: 1.1rem; font-weight: 700; margin: 0; min-width: 0; }
.reader-frame { width: 100%; height: calc(100vh - 140px); border: 0; background: #525659; }
@media (max-width: 991.98px) { .reader-side { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); } .reader-frame { height: 80vh; } }

.empty { text-align: center; padding: 4rem 1rem; color: var(--muted); }
.empty i { font-size: 2.6rem; display: inline-grid; place-items: center; width: 84px; height: 84px; border-radius: 24px; background: #fff; border: 1px solid var(--line); color: var(--brand); margin-bottom: 1rem; }
.site-footer { margin-top: auto; padding: 1.6rem 0; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: .9rem; }
