:root {
    --navy: #054B5C;
    --primary: #0E7C93;
    --text: #12182B;
    --muted: #6B7280;
    --muted-2: #4B5563;
    --bg: #FFFFFF;
    --bg-soft: #F7F8FA;
    --bg-chip: #EEF1F6;
    --border: #E5E8EE;
    --radius: 12px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Golos Text', system-ui, -apple-system, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

.container { max-width: 1280px; margin: 0 auto; padding: 0 32px; }
@media (max-width: 640px) { .container { padding: 0 20px; } }

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--navy);
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    min-height: 76px;
    flex-wrap: wrap;
    padding-top: 8px;
    padding-bottom: 8px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.logo:hover { text-decoration: none; }
.logo img {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
}
.site-footer .logo img { width: 32px; height: 32px; }
.logo-text {
    color: #fff;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.nav { display: flex; align-items: center; gap: 6px; }
.nav a {
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    padding: 8px 14px;
    border-radius: 8px;
}
.nav a:hover { text-decoration: none; background: rgba(255, 255, 255, 0.08); }
.nav a.active { font-weight: 600; background: rgba(255, 255, 255, 0.15); }
.header-search {
    flex: 1;
    max-width: 420px;
    margin-left: auto;
    position: relative;
    min-width: 200px;
}
.header-search input {
    width: 100%;
    height: 42px;
    border-radius: 10px;
    border: none;
    background: #fff;
    color: var(--text);
    padding: 0 16px 0 40px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
}
.header-search .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border: 2px solid #9CA3AF;
    border-radius: 50%;
    pointer-events: none;
}

/* Бургер и выезжающее меню на мобильных (Mobile-макет) */
.burger {
    display: none;
    margin-left: auto;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    padding: 8px 6px;
    cursor: pointer;
}
.burger span { display: block; width: 22px; height: 2px; background: #fff; border-radius: 2px; }
.mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(18,24,43,.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    z-index: 70;
}
.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 78%;
    max-width: 320px;
    background: #fff;
    box-shadow: -8px 0 24px rgba(18,24,43,.15);
    transform: translateX(102%);
    transition: transform .28s ease;
    z-index: 71;
    display: flex;
    flex-direction: column;
}
body.menu-open { overflow: hidden; }
body.menu-open .mobile-menu-backdrop { opacity: 1; pointer-events: auto; }
body.menu-open .mobile-menu { transform: translateX(0); }
.mobile-menu-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.mobile-menu-head .logo img { width: 28px; height: 28px; }
.mobile-menu-name { color: var(--text); font-size: 17px; font-weight: 600; }
.menu-close, .sheet-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--muted);
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
}
.mobile-menu-links { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.mobile-menu-links a { padding: 13px 12px; border-radius: 10px; color: var(--text); font-size: 15px; font-weight: 500; }
.mobile-menu-links a:hover { text-decoration: none; background: var(--bg-soft); }
.mobile-menu-links a.active { background: var(--bg-chip); color: var(--primary); font-weight: 600; }
.mobile-menu-search { padding: 8px 20px 20px; margin-top: auto; }
.mobile-menu-search input {
    width: 100%;
    height: 44px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    padding: 0 14px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
}
@media (max-width: 860px) {
    .burger { display: flex; }
    .site-header .nav, .site-header .header-search { display: none; }
    .header-inner { min-height: 60px; flex-wrap: nowrap; }
    .site-header .logo img { width: 30px; height: 30px; }
    .site-header .logo-text { font-size: 18px; }
}
@media (min-width: 861px) {
    .mobile-menu, .mobile-menu-backdrop { display: none; }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 46px;
    padding: 0 24px;
    background: var(--primary);
    color: #fff;
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
}
.btn:hover { background: #0B6377; text-decoration: none; }
.btn-outline { background: transparent; color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.link-more {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

/* Hero */
.hero { padding: 72px 0 56px; }
.hero-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 56px;
    align-items: center;
}
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } .hero { padding: 44px 0 32px; } }
.hero-badge {
    display: inline-block;
    background: var(--bg-chip);
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    margin-bottom: 20px;
}
.hero h1 {
    font-size: 44px;
    line-height: 1.15;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin: 0 0 20px;
}
@media (max-width: 640px) { .hero h1 { font-size: 32px; } }
.hero-text {
    font-size: 17px;
    line-height: 1.7;
    color: var(--muted-2);
    max-width: 520px;
    margin: 0 0 32px;
}
.hero-search {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 480px;
}
.hero-search input {
    flex: 1;
    height: 52px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-soft);
    padding: 0 18px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    min-width: 0;
}
.hero-search .btn { height: 52px; }
.hero-stats { display: flex; gap: 36px; margin-top: 40px; }
.hero-stat-value { font-size: 26px; font-weight: 600; }
.hero-stat-label { font-size: 13px; color: var(--muted); }
@media (max-width: 480px) {
    .hero { padding: 32px 0 24px; }
    .hero h1 { font-size: 26px; }
    .hero-text { font-size: 15px; margin-bottom: 24px; }
    .hero-stats { gap: 24px; margin-top: 28px; }
    .hero-stat-value { font-size: 22px; }
}

/* Hero book collage */
.hero-art { position: relative; height: 380px; overflow: hidden; }
@media (max-width: 860px) { .hero-art { display: none; } }
.hero-art .art-book {
    position: absolute;
    width: 34%;
    aspect-ratio: 3 / 4;
    border-radius: 14px;
}
.hero-art .art-1 { background: var(--bg-chip); top: 20px; left: 2%; box-shadow: 0 20px 40px rgba(18,24,43,.12); transform: rotate(-6deg); }
.hero-art .art-2 { background: #DCE4F5; top: 56px; left: 33%; box-shadow: 0 24px 48px rgba(18,24,43,.16); }
.hero-art .art-3 {
    background: var(--primary);
    top: 20px;
    left: 64%;
    box-shadow: 0 20px 40px rgba(18,24,43,.14);
    transform: rotate(7deg);
    display: flex;
    align-items: center;
    justify-content: center;
}
.hero-art .art-3 span {
    width: 22%;
    aspect-ratio: 40 / 54;
    border-left: 4px solid rgba(255,255,255,.5);
    border-right: 4px solid rgba(255,255,255,.5);
    border-radius: 3px;
}

/* Sections */
.section { padding: 40px 0; }
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 28px;
}
.section-head h2 { font-size: 26px; font-weight: 600; margin: 0; }

/* боковые отступы наследуются от .container — не обнулять их */
.page { padding-top: 40px; padding-bottom: 64px; }
.page h1 { font-size: 32px; font-weight: 600; letter-spacing: -0.02em; }

/* Grid */
.grid { display: grid; gap: 24px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
/* На мобильных книги и карточки списков — 2 колонки (Mobile-макет);
   .grid-mobile-rows (главная) — компактные строки в одну колонку */
@media (max-width: 480px) {
    .grid-4 { gap: 18px 14px; }
    .grid-mobile-rows { grid-template-columns: 1fr; gap: 10px; }
}

/* Book card */
.book-card { display: flex; flex-direction: column; transition: transform .15s; }
.book-card:hover { transform: translateY(-3px); }
.book-card-cover {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(18,24,43,.08);
    background: #fff;
    border: 1px solid var(--border);
}
.book-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-card-cover img.cover-default { object-fit: contain; }
.book-card-format {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(30,42,61,.85);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
}
.book-card-title {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
}
.book-card-title a { color: var(--text); }
.book-card-authors { margin: 0; font-size: 13px; color: var(--muted); }
@media (max-width: 480px) {
    .book-card-title { font-size: 13px; }
    .book-card-authors { font-size: 12px; }
}

/* Author card */
.author-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px 16px;
    transition: border-color .15s;
}
.author-card:hover { border-color: var(--primary); }
.author-card-photo {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: var(--bg-chip);
    overflow: hidden;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.author-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.author-card-photo .no-photo {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(30,42,61,.15);
}
.author-card h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.author-card h3 a { color: var(--text); }
.author-card-count { margin: 0; font-size: 13px; color: var(--muted); }

/* Mobile-макет: на странице «Муаллифон» — компактная сетка 2 колонки,
   на главной (.grid-mobile-rows) — строки */
@media (max-width: 480px) {
    .author-card { padding: 18px 10px; border-radius: 12px; }
    .author-card-photo { width: 56px; height: 56px; margin-bottom: 10px; }
    .author-card-photo .no-photo { width: 22px; height: 22px; }
    .author-card h3 { font-size: 13px; }
    .author-card-count { font-size: 11px; }
    .grid-mobile-rows .author-card {
        flex-direction: row;
        text-align: left;
        align-items: center;
        gap: 12px;
        padding: 10px 12px;
        border-radius: 10px;
    }
    .grid-mobile-rows .author-card-photo { width: 40px; height: 40px; margin-bottom: 0; flex-shrink: 0; }
    .grid-mobile-rows .author-card-photo .no-photo { width: 18px; height: 18px; }
    .grid-mobile-rows .author-card h3 { margin: 0; }
}

/* Detail pages (book, author, term) */
/* боковые отступы наследуются от .container — не обнулять их */
.detail-page { padding-top: 36px; padding-bottom: 72px; max-width: 1100px; }
.breadcrumbs {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 13px;
    color: #9CA3AF;
    margin-bottom: 32px;
    flex-wrap: wrap;
}
.breadcrumbs a { color: #9CA3AF; }
.breadcrumbs .current { color: var(--muted-2); }

.book-detail {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 44px;
    margin-bottom: 56px;
}
/* мобильная версия — в блоке «Саҳифаи китоб на мобильных» ниже */
.book-detail-cover {
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(18,24,43,.1);
    margin-bottom: 20px;
    position: relative;
}
.book-detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-detail-cover img.cover-default { object-fit: contain; }
.book-detail h1 {
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 14px;
}

/* File download rows */
.file-list { display: flex; flex-direction: column; gap: 10px; }
.file-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color .15s;
}
.file-row:hover { border-color: var(--primary); text-decoration: none; }
.file-ext {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.file-info { flex: 1; min-width: 0; }
.file-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-size { display: block; font-size: 12px; color: #9CA3AF; }
.file-arrow {
    width: 12px;
    height: 12px;
    border-bottom: 2px solid var(--primary);
    border-left: 2px solid var(--primary);
    transform: rotate(-45deg);
    flex-shrink: 0;
}

/* Meta items */
.meta-items { display: flex; flex-wrap: wrap; gap: 20px 28px; margin-bottom: 24px; }
.meta-label { font-size: 12px; color: #9CA3AF; margin-bottom: 2px; }
.meta-value { font-size: 14px; font-weight: 500; }
.meta-value a { color: var(--primary); }
.meta-value a:hover { color: var(--navy); }

/* Term chips (categories, tags) */
.term-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.term-chip {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    color: var(--muted-2);
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 16px;
}
.term-chip:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }

.detail-text { border-top: 1px solid var(--border); padding-top: 28px; }
.detail-text h2, .term-detail h2 { font-size: 18px; font-weight: 600; margin: 0 0 14px; }
.book-description, .term-description { font-size: 15px; line-height: 1.85; color: #374151; }
.book-description p:first-child { margin-top: 0; }

/* SEO-ключевые слова под описанием книги */
.book-keywords {
    border-top: 1px solid var(--border);
    margin-top: 28px;
    padding-top: 28px;
    font-size: 15px;
    line-height: 1.85;
    color: #374151;
}
.book-keywords-title { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 14px; }

.related h2 { font-size: 20px; font-weight: 600; margin: 0 0 20px; }
.related + .related { margin-top: 44px; }

/* Саҳифаи китоб на мобильных (Mobile-макет): обложка по центру,
   файлы после тегов; display:contents перемешивает две колонки в один поток */
@media (max-width: 720px) {
    .book-detail { display: flex; flex-direction: column; gap: 0; margin-bottom: 40px; }
    .book-detail > div { display: contents; }
    .book-detail-cover { order: 1; width: 170px; margin: 0 auto 18px; box-shadow: 0 8px 20px rgba(18,24,43,.1); }
    .book-detail h1 { order: 2; font-size: 22px; text-align: center; margin-bottom: 12px; }
    .meta-items { order: 3; justify-content: center; gap: 12px 20px; margin-bottom: 18px; }
    .meta-item { text-align: center; }
    .meta-label { font-size: 11px; margin-bottom: 0; }
    .meta-value { font-size: 13px; }
    .term-chips { order: 4; justify-content: center; margin-bottom: 22px; }
    .file-list { order: 5; margin-bottom: 24px; }
    .detail-text { order: 6; }
    .book-keywords { order: 7; }
}
/* «Асарҳои дигари муаллиф» на мобильных — горизонтальная лента */
@media (max-width: 640px) {
    .related .grid { display: flex; overflow-x: auto; gap: 12px; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
    .related .grid .book-card { width: 110px; flex-shrink: 0; }
    .related .grid .book-card-title { font-size: 12px; }
    .related .grid .book-card-authors { font-size: 11px; }
}

/* Term / author detail */
.term-detail {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 44px;
    margin-bottom: 56px;
}
@media (max-width: 720px) { .term-detail { grid-template-columns: 1fr; } }
.term-profile { display: flex; flex-direction: column; align-items: center; text-align: center; }
.term-avatar {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: var(--bg-chip);
    overflow: hidden;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.term-avatar img { width: 100%; height: 100%; object-fit: cover; }
.term-avatar .no-photo { width: 60px; height: 60px; border-radius: 50%; background: rgba(30,42,61,.15); }
.term-name { font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.term-years { font-size: 13px; color: #9CA3AF; }
.term-count { font-size: 13px; color: var(--primary); font-weight: 600; margin-top: 4px; }
.term-books .section-head h2 { font-size: 20px; }
/* Саҳифаи муаллиф на мобильных (Mobile-макет) */
@media (max-width: 720px) {
    .term-detail { gap: 24px; margin-bottom: 40px; }
    .term-avatar { width: 110px; height: 110px; margin-bottom: 12px; }
    .term-avatar .no-photo { width: 40px; height: 40px; }
    .term-name { font-size: 18px; }
}

.grid-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1000px) { .grid-5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .grid-5 { grid-template-columns: repeat(2, 1fr); } }

/* Books page: sidebar layout */
.books-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 36px;
    padding-top: 36px;
    padding-bottom: 80px;
}
@media (max-width: 860px) { .books-layout { grid-template-columns: 1fr; } }
.filters-sidebar { display: flex; flex-direction: column; gap: 24px; }
.filters-sidebar h1 { font-size: 22px; font-weight: 600; margin: 0; }
.filters-sidebar form { display: flex; flex-direction: column; gap: 24px; }
.filter-block { display: flex; flex-direction: column; gap: 8px; }
.filter-label { font-size: 13px; font-weight: 600; color: var(--text); }
.filter-block input, .filter-years input {
    height: 42px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    padding: 0 14px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    width: 100%;
}
.filter-group { border-top: 1px solid var(--border); padding-top: 18px; }
.filter-group .filter-label { margin-bottom: 12px; }
.filter-options { display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; }
.filter-option {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 14px;
    color: var(--muted-2);
    cursor: pointer;
}
.filter-option[hidden] { display: none; }
.filter-option input { width: 16px; height: 16px; accent-color: var(--primary); flex-shrink: 0; }
.filter-option-search {
    position: sticky;
    top: 0;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    padding: 0 10px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    width: 100%;
    flex-shrink: 0;
}
.filter-more {
    border: none;
    background: none;
    padding: 0;
    text-align: left;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
}
.filter-more:hover { text-decoration: underline; }
.filter-more[hidden] { display: none; }
.filter-option span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-count { margin-left: auto; color: #9CA3AF; font-size: 12px; flex-shrink: 0; }
.filter-years { display: flex; gap: 10px; }
.filter-years input { height: 38px; border-radius: 8px; padding: 0 10px; font-size: 13px; }
.filter-actions { display: flex; flex-direction: column; gap: 12px; }
.filter-apply { width: 100%; }
.filter-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--muted-2);
    font-weight: 600;
    font-size: 14px;
}
.filter-clear:hover { text-decoration: none; border-color: var(--primary); color: var(--primary); }

.results-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.results-count { font-size: 14px; color: var(--muted); }
.results-count strong { color: var(--text); }
/* min-width:0 — чтобы длинный select сортировки не распирал колонку на мобильных */
.books-results { min-width: 0; }
.results-sort { display: flex; align-items: center; gap: 10px; min-width: 0; }
.results-sort span { font-size: 13px; color: var(--muted); flex-shrink: 0; }
.results-sort select {
    min-width: 0;
    max-width: 100%;
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    padding: 0 12px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    outline: none;
}

/* Тулбар списков терминов (Муаллифон, Бахшҳо…): поиск слева, сортировка справа */
.terms-search { flex: 1; min-width: 200px; max-width: 360px; }
.terms-search input {
    width: 100%;
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    padding: 0 12px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    outline: none;
}
.terms-search input:focus { border-color: var(--primary); }

.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.filter-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-chip);
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 10px 6px 14px;
    border-radius: 20px;
}
.filter-chip:hover { text-decoration: none; }
.chip-x {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(14,124,147,.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.books-grid { gap: 24px 20px; }

/* Мобильные фильтры (Mobile-макет): тулбар «поиск + Филтр» над результатами,
   сами фильтры — нижняя панель (bottom sheet) */
.books-toolbar, .sheet-head, .filters-backdrop { display: none; }
@media (max-width: 860px) {
    .books-toolbar { display: block; margin-bottom: 18px; }
    .books-toolbar-title { font-size: 24px; font-weight: 600; margin-bottom: 14px; }
    .books-toolbar-row { display: flex; gap: 8px; }
    .books-toolbar-row form { flex: 1; min-width: 0; }
    .books-toolbar-row input {
        width: 100%;
        height: 44px;
        border-radius: 10px;
        border: 1px solid var(--border);
        background: var(--bg-soft);
        padding: 0 14px;
        font-size: 14px;
        font-family: inherit;
        outline: none;
    }
    .btn-filter { height: 44px; padding: 0 16px; border-radius: 10px; font-size: 14px; gap: 8px; }
    .filter-icon { display: inline-flex; flex-direction: column; gap: 3px; align-items: center; }
    .filter-icon span { display: block; height: 2px; background: #fff; border-radius: 2px; }
    .filter-icon span:nth-child(1) { width: 14px; }
    .filter-icon span:nth-child(2) { width: 10px; }
    .filter-icon span:nth-child(3) { width: 5px; }

    .filters-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(18,24,43,.4);
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s ease;
        z-index: 60;
    }
    body.filters-open { overflow: hidden; }
    body.filters-open .filters-backdrop { opacity: 1; pointer-events: auto; }

    .filters-sidebar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        height: 82%;
        background: #fff;
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -8px 24px rgba(18,24,43,.18);
        transform: translateY(102%);
        transition: transform .28s ease;
        z-index: 61;
        gap: 0;
        overflow: hidden;
    }
    body.filters-open .filters-sidebar { transform: translateY(0); }
    .filters-sidebar h1 { display: none; }
    .sheet-head { display: block; flex-shrink: 0; }
    .sheet-grabber { display: block; width: 36px; height: 4px; background: var(--border); border-radius: 2px; margin: 10px auto 6px; }
    .sheet-title {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 2px 18px 12px;
        border-bottom: 1px solid var(--border);
        font-size: 16px;
        font-weight: 600;
    }
    .filters-sidebar form { flex: 1; overflow-y: auto; padding: 16px 18px 0; }
    .filter-actions {
        position: sticky;
        bottom: 0;
        margin-top: auto;
        background: #fff;
        border-top: 1px solid var(--border);
        padding: 14px 0;
        flex-direction: row-reverse;
    }
    .filter-actions .filter-apply { flex: 1.4; width: auto; }
    .filter-actions .filter-clear { flex: 1; }
}

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.page-item {
    min-width: 38px;
    height: 38px;
    padding: 0 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    background: #fff;
    border: 1px solid var(--border);
    color: var(--muted-2);
}
.page-item:hover { text-decoration: none; border-color: var(--primary); color: var(--primary); }
.page-item.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-dots { border: none; }

.page-subtitle { font-size: 15px; color: var(--muted); margin: -6px 0 24px; }

.more-wrap, .pagination-wrap { margin-top: 32px; text-align: center; }
.empty { color: var(--muted); }

/* Footer */
.site-footer { background: var(--navy); margin-top: 64px; }
.footer-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 32px;
    padding: 48px 0 28px;
}
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-about {
    color: rgba(255,255,255,.55);
    font-size: 14px;
    line-height: 1.7;
    max-width: 340px;
    margin: 0;
}
.footer-title { color: #fff; font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.footer-links { display: flex; flex-direction: column; gap: 10px; }
.footer-links a, .footer-links span { color: rgba(255,255,255,.55); font-size: 14px; }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.1);
    padding: 18px 32px;
    text-align: center;
    color: rgba(255,255,255,.4);
    font-size: 13px;
}

/* Category card */
.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px 16px;
    transition: border-color .15s;
}
.category-card:hover { border-color: var(--primary); }
.category-card-photo {
    width: 88px;
    height: 88px;
    border-radius: 14px;
    background: var(--bg-chip);
    overflow: hidden;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.category-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.category-card-photo .no-cover span {
    display: block;
    width: 26px;
    height: 34px;
    border: 2.5px solid rgba(30,42,61,.25);
    border-radius: 3px;
}
.category-card h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.category-card h3 a { color: var(--text); }
.category-card-count { margin: 0; font-size: 13px; color: var(--muted); }
/* Mobile-макет: на страницах списков — компактная сетка 2 колонки,
   на главной (.grid-mobile-rows) — строки */
@media (max-width: 480px) {
    .category-card { padding: 18px 10px; border-radius: 12px; }
    .category-card-photo { width: 56px; height: 56px; border-radius: 10px; margin-bottom: 10px; }
    .category-card-photo .no-cover span { width: 18px; height: 24px; border-width: 2px; }
    .category-card h3 { font-size: 13px; }
    .category-card-count { font-size: 11px; }
    .grid-mobile-rows .category-card {
        flex-direction: row;
        text-align: left;
        align-items: center;
        gap: 12px;
        padding: 10px 12px;
        border-radius: 10px;
    }
    .grid-mobile-rows .category-card-photo { width: 40px; height: 40px; border-radius: 8px; margin-bottom: 0; flex-shrink: 0; }
    .grid-mobile-rows .category-card-photo .no-cover span { width: 14px; height: 18px; }
    .grid-mobile-rows .category-card h3 { margin: 0; }
}

/* Страница 404 (NotFound из дизайн-проекта) */
.error-page {
    min-height: 60vh;
    max-width: 520px;
    margin: 0 auto;
    padding: 64px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.error-books { position: relative; width: 150px; height: 190px; margin-bottom: 32px; }
.error-book {
    position: absolute;
    width: 120px;
    height: 170px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    top: 10px;
    left: 15px;
    box-shadow: 0 12px 28px rgba(18, 24, 43, .08);
    transform: rotate(-8deg);
}
.error-book-front {
    top: 6px;
    transform: rotate(6deg);
    box-shadow: 0 16px 34px rgba(18, 24, 43, .1);
    display: flex;
    align-items: center;
    justify-content: center;
}
.error-book-front span { font-size: 44px; font-weight: 600; color: var(--primary); }
.error-code {
    font-size: 64px;
    font-weight: 600;
    color: var(--navy);
    letter-spacing: -.02em;
    line-height: 1;
    margin-bottom: 16px;
}
.error-page h1 { font-size: 22px; font-weight: 600; margin: 0 0 12px; }
.error-page p { font-size: 15px; line-height: 1.7; color: var(--muted); margin: 0 0 32px; }
.error-search { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 420px; margin-bottom: 28px; }
.error-search input {
    flex: 1;
    min-width: 0;
    height: 48px;
    border-radius: 11px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    padding: 0 16px;
    font: inherit;
    font-size: 14px;
    outline: none;
}
.error-search input:focus { border-color: var(--primary); background: #fff; }
.error-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.btn-navy { background: var(--navy); border-color: var(--navy); }
.btn-navy:hover { background: #043D4B; }
.btn-gray { background: #fff; border-color: var(--border); color: var(--muted-2); }
.btn-gray:hover { background: var(--bg-soft); color: var(--muted-2); }
/* 500/503 — часы на карточке (страница 503) */
.error-clock {
    display: block;
    width: 54px;
    height: 54px;
    border: 4px solid var(--primary);
    border-radius: 50%;
    position: relative;
}
.error-clock::before,
.error-clock::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 50%;
    margin-left: -2px;
    width: 4px;
    background: var(--primary);
    border-radius: 2px;
    transform-origin: 50% 100%;
}
.error-clock::before { height: 18px; transform: rotate(115deg); }
.error-clock::after { height: 13px; transform: rotate(-40deg); }

/* Страница «Дар бораи сомона» */
.about-page h1 { text-align: center; }
.prose { max-width: 720px; margin: 20px auto 0; }
.prose p { margin-bottom: 18px; line-height: 1.7; text-align: justify; }
.prose a { color: var(--primary); }
.prose p.prose-epigraph { text-align: center; font-style: italic; color: var(--muted); }

/* Зербахшҳо (подкатегории) */
.filter-option-child { padding-left: 25px; }
.term-children { margin-top: 26px; }
.term-children-title { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 14px; }
.term-children-list { display: flex; flex-wrap: wrap; gap: 8px; }
.term-child {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-soft);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
.term-child:hover { border-color: var(--primary); color: var(--primary); }
.term-child span { color: #9CA3AF; font-weight: 500; font-size: 12px; }
.category-card-children {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 10px;
    margin-top: 8px;
}
.category-card-children a { font-size: 12px; color: var(--primary); white-space: nowrap; }
.category-card-children a:hover { text-decoration: underline; }
@media (max-width: 480px) {
    .category-card-children { display: none; }
}
