/* AI知识库 · 前台文档站样式
   视觉语言：浅色、留白、圆角卡片、吸顶导航 + 横向分类胶囊。 */

:root {
    --blue: #1a73e8;
    --blue-soft: #e8f0fe;
    --ink: #1f2328;
    --ink-2: #4b5563;
    --muted: #8a94a6;
    --line: #edf0f5;
    --bg: #f4f6fa;
    --card: #ffffff;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .05);
    --max: 1210px;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.6;
}

a {
    color: var(--blue);
    text-decoration: none;
}

a:hover {
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
}

button,
input {
    font: inherit;
}

/* 顶部吸顶导航 */
.hd {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(255, 255, 255, .96);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--line);
}

.hd-inner {
    max-width: var(--max);
    margin: 0 auto;
    height: 60px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 22px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 0 0 auto;
    color: var(--ink);
    font-weight: 800;
    font-size: 18px;
    letter-spacing: .5px;
}

.logo-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: block;
    box-shadow: 0 3px 8px rgba(26, 115, 232, .25);
}

.logo-text {
    white-space: nowrap;
}

.hd-meta {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.hd-stat strong {
    color: var(--ink);
    font-size: 15px;
    margin-right: 3px;
}

/* 分类胶囊导航（横向滚动，吸顶在导航下方） */
.cat-bar {
    position: sticky;
    top: 60px;
    z-index: 25;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: saturate(180%) blur(8px);
}

.cat-bar-wrap {
    position: relative;
    max-width: var(--max);
    margin: 0 auto;
    display: flex;
    align-items: center;
}

.cat-bar-inner {
    flex: 1 1 auto;
    min-width: 0;
    padding: 9px 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.cat-bar-inner::-webkit-scrollbar {
    display: none;
}

.cat-pill {
    position: relative;
    flex: 0 0 auto;
    padding: 7px 14px;
    border-radius: 999px;
    color: var(--ink-2);
    font-size: 14px;
    line-height: 1.2;
    transition: color .15s, background .15s;
}

.cat-pill:hover {
    color: var(--blue);
    background: #f4f8ff;
}

.cat-pill.on {
    color: var(--blue);
    background: var(--blue-soft);
    font-weight: 700;
}

/* 主体 */
.main {
    max-width: var(--max);
    margin: 0 auto;
    padding: 22px 16px 40px;
}

.page-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 4px 2px 16px;
}

.page-head h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 750;
    display: flex;
    align-items: center;
    gap: 9px;
}

.page-head .count {
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 16px;
}

.section-head h2 {
    font-size: 20px;
    margin: 0;
    font-weight: 700;
}

.section-head span {
    color: var(--muted);
    font-size: 13px;
}

/* 面包屑 */
.crumb {
    display: flex;
    gap: 8px;
    align-items: center;
    color: var(--muted);
    font-size: 13px;
    margin: 4px 2px 12px;
}

.crumb a {
    color: var(--ink-2);
}

.crumb a:hover {
    color: var(--blue);
}

/* 分类卡片网格 */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 18px;
}

.cat {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.cat-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.cat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    flex: none;
}

.cat h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
}

.cat h3 a {
    color: var(--ink);
}

.cat h3 a:hover {
    color: var(--blue);
}

.cat-count {
    font-size: 12.5px;
    color: var(--muted);
    margin-top: 2px;
}

.cat-desc {
    color: var(--ink-2);
    font-size: 13.5px;
    margin: 0 0 14px;
    min-height: 2.6em;
    line-height: 1.6;
}

/* 卡片内内容列表（.r 行样式） */
.book-list {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--line);
    margin-bottom: 14px;
    flex: 1;
}

.book-list .r {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 4px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    transition: background .12s;
}

.book-list .r:last-child {
    border-bottom: 0;
}

.book-list .r:hover {
    background: #f7faff;
}

.book-list .r:hover .title-text,
.book-list .r:hover .ar {
    color: var(--blue);
}

.cat-badge {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* 分类统一用图片徽标，不再叠加分类色底；color 仅用于无图片时的文字兜底 */
    background: transparent;
    color: #46536b;
    font-size: 12px;
    font-weight: 700;
    overflow: hidden;
}
.cat-badge img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.bd {
    flex: 1 1 auto;
    min-width: 0;
}

.tt {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

.title-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14.5px;
    font-weight: 500;
}

.sm {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ar {
    flex: 0 0 auto;
    color: #c3cad6;
    font-size: 20px;
    line-height: 1;
    transition: color .12s;
}

.cat-more {
    font-size: 13px;
    font-weight: 600;
    color: var(--blue);
}

/* 内容扁平列表（.list：标题 + 简介） */
.list {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.list .r {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    transition: background .12s;
}

.list .r:last-child {
    border-bottom: 0;
}

.list .r:hover {
    background: #f7faff;
}

.list .r:hover .title-text,
.list .r:hover .ar {
    color: var(--blue);
}

.list .sm {
    margin-top: 3px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tt .tm {
    margin-left: auto;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
    flex: 0 0 auto;
    padding-left: 8px;
}

/* 空状态 */
.empty {
    background: var(--card);
    border: 1px dashed #cbd5e3;
    border-radius: var(--radius);
    padding: 46px 20px;
    text-align: center;
    color: var(--ink-2);
}

.empty p {
    margin: 0 0 6px;
}

.empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    color: #c3cad6;
    display: block;
}

.empty-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* 卡片内「暂无文档」占位：用中性文档图标，不用分类徽标（避免看起来像真实文档） */
.cat-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 8px;
    color: var(--muted);
    font-size: 13.5px;
}

.cat-empty-ic {
    width: 22px;
    height: 22px;
    color: #b9c2d0;
    flex: none;
}

.empty-sub {
    color: var(--muted);
    font-size: 13px;
}

/* 页脚 */
.foot {
    border-top: 1px solid var(--line);
    background: #fff;
    margin-top: 16px;
}

.foot-in {
    max-width: var(--max);
    margin: 0 auto;
    padding: 22px 16px 30px;
    color: var(--muted);
    font-size: 12.5px;
    text-align: center;
}

.foot-in p {
    margin: 0 0 4px;
}

.foot-in a {
    color: #7f8da3;
    margin-left: 8px;
}

.foot-in a:hover {
    color: var(--blue);
}

/* 友情链接 */
.foot-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 14px;
    margin: 0 0 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--line);
}

.foot-links-label {
    color: #657089;
    font-weight: 600;
    margin-right: 2px;
}

.foot-links a {
    margin-left: 0;
    color: #7f8da3;
    text-decoration: none;
}

.foot-links a:hover {
    color: var(--blue);
    text-decoration: underline;
}

.foot-icp {
    margin-top: 6px;
}

.foot-icp a {
    margin-left: 0;
    color: #7f8da3;
    text-decoration: none;
}

.foot-icp a:hover {
    color: var(--blue);
    text-decoration: underline;
}

/* 移动端 */
@media (max-width: 720px) {
    .hd-inner {
        height: auto;
        min-height: 56px;
        padding: 8px 12px;
        flex-wrap: wrap;
        gap: 8px 12px;
    }

    .logo-text {
        font-size: 17px;
    }

    .hd-meta {
        gap: 8px;
    }

    .cat-bar {
        top: 104px;
    }

    .cat-bar-inner {
        padding: 8px 12px;
    }

    .cat-pill {
        padding: 7px 12px;
        font-size: 13.5px;
    }

    .main {
        padding: 16px 12px 30px;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .page-head h1 {
        font-size: 19px;
    }
}
