/* ===== 前台样式 ===== */
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: #222;
    background: #f5f6f8;
    line-height: 1.7;
}
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* 顶部导航 */
.site-header { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.site-header.fixed { position: sticky; top: 0; z-index: 100; }
.topbar { border-bottom: 1px solid #eee; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; text-decoration: none; }
.logo { max-height: 40px; }
.brand-text { font-size: 20px; font-weight: 700; color: #2563eb; }
.main-nav { display: flex; gap: 22px; flex-wrap: wrap; }
.main-nav a { color: #333; text-decoration: none; font-size: 15px; padding: 4px 0; }
.main-nav a:hover { color: #2563eb; }
.banner img { width: 100%; max-height: 280px; object-fit: cover; display: block; }

/* 主体 */
.site-main { padding: 24px 0 48px; }
.cat-nav { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0; }
.cat-nav a {
    padding: 6px 16px; background: #fff; border-radius: 20px; text-decoration: none;
    color: #555; font-size: 14px; border: 1px solid #eee;
}
.cat-nav a.active, .cat-nav a:hover { background: #2563eb; color: #fff; border-color: #2563eb; }

/* 文章网格 */
.article-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.card { background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,.05); transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,.1); }
.card-link { text-decoration: none; color: inherit; display: block; }
.card-cover { height: 160px; overflow: hidden; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 14px 16px 18px; }
.card-body h3 { margin: 0 0 8px; font-size: 17px; line-height: 1.4; }
.card-sum { margin: 0 0 12px; color: #777; font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; justify-content: space-between; font-size: 12px; color: #999; }
.cat-tag { background: #eef2ff; color: #2563eb; padding: 2px 8px; border-radius: 4px; font-size: 12px; }

/* 列表页 */
.page-h1 { font-size: 24px; margin: 8px 0 18px; }
.article-list { display: flex; flex-direction: column; gap: 14px; }
.list-item { background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 6px rgba(0,0,0,.05); }
.li-link { display: flex; flex-direction: row; flex-wrap: nowrap; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 18px; text-decoration: none; color: inherit; }
.li-cover { width: 160px; height: 110px; flex: 0 0 160px; overflow: hidden; border-radius: 6px; }
.li-cover img { width: 100%; height: 100%; object-fit: cover; }
.li-body { flex: 1; min-width: 0; }
.li-title { margin: 0; font-size: 18px; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-sum { margin: 0 0 10px; color: #777; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.li-meta { font-size: 13px; color: #999; flex: 0 0 auto; white-space: nowrap; }

/* 文章详情 */
.article-wrap { max-width: 820px; }
.post { background: #fff; border-radius: 12px; padding: 28px 32px; box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.post-head h1 { margin: 0 0 12px; font-size: 28px; line-height: 1.35; }
.post-meta { display: flex; gap: 14px; align-items: center; color: #999; font-size: 13px; margin-bottom: 18px; }
.post-cover { margin: -8px -8px 20px; }
.post-cover img { width: 100%; border-radius: 8px; }
.post-content { font-size: 16px; line-height: 1.9; word-break: break-word; }
.post-content img { max-width: 100%; height: auto; border-radius: 6px; }
.post-content h2, .post-content h3 { margin: 1.2em 0 .6em; }
.post-content pre { background: #f4f4f5; padding: 14px; border-radius: 8px; overflow: auto; }
.related { background: #fff; border-radius: 12px; padding: 18px 24px; margin-top: 22px; }
.rel-title { font-size: 18px; margin: 0 0 10px; }
.related ul { margin: 0; padding-left: 20px; }
.related li { margin: 6px 0; }
.related a { color: #2563eb; text-decoration: none; }
.back { margin-top: 22px; }
.back a { color: #666; text-decoration: none; }

/* 广告位 */
.ad { display: block; margin: 18px 0; border-radius: 8px; overflow: hidden; }
.ad-text { background: #fff7e6; border: 1px dashed #ffd591; padding: 14px 18px; color: #8a6d3b; text-decoration: none; }
.ad-text .ad-title { font-weight: 700; margin-bottom: 4px; }
.ad-image img { width: 100%; display: block; }

/* 页脚 */
.site-footer { background: #1f2937; color: #cbd5e1; padding: 28px 0; margin-top: 40px; text-align: center; font-size: 13px; }
.site-footer .icp { color: #94a3b8; margin-top: 6px; }
.empty { text-align: center; color: #999; padding: 60px 0; }

@media (max-width: 768px) {
    .article-grid { grid-template-columns: 1fr; }
    .li-cover { width: 100%; height: 180px; flex: none; }
    .post { padding: 18px; }
}
