/* ================= HX1991 技术博客 · 前台样式 ================= */
:root {
    --ink: #111827;
    --ink-soft: #374151;
    --muted: #6b7280;
    --line: #e8ebf2;
    --bg: #f7f8fb;
    --card: #ffffff;
    --brand: #2563eb;
    --brand-dark: #1d4ed8;
    --brand-soft: #eff4ff;
    --code-bg: #0d1117;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

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

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; border: 0; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ---------------- 顶部导航 ---------------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
}
.header-inner { height: 64px; display: flex; align-items: center; gap: 26px; }
.logo { font-size: 21px; font-weight: 800; letter-spacing: -.6px; color: var(--ink); flex: 0 0 auto; }
.logo span { color: var(--brand); }
.nav { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-link {
    padding: 6px 12px; border-radius: 8px; font-size: 14px; color: #4b5563;
    white-space: nowrap; transition: background .15s ease, color .15s ease;
}
.nav-link:hover { background: #f3f4f6; color: var(--ink); }
.nav-link.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

.search-form { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.search-input {
    width: 190px; height: 36px; padding: 0 14px; font-size: 13px;
    border: 1px solid var(--line); border-radius: 999px; background: #fff;
    outline: none; transition: all .15s ease; font-family: inherit;
}
.search-input:focus { border-color: #bfdbfe; box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); width: 220px; }
.search-btn {
    height: 36px; padding: 0 15px; border-radius: 999px; border: 1px solid var(--brand);
    background: var(--brand); color: #fff; font-size: 13px; cursor: pointer;
    transition: background .15s ease;
}
.search-btn:hover { background: var(--brand-dark); }

/* ---------------- 首屏 ---------------- */
.hero {
    padding: 58px 0 46px;
    background:
        radial-gradient(900px 320px at 12% 0%, #e6efff 0%, rgba(230, 239, 255, 0) 70%),
        radial-gradient(760px 320px at 88% 6%, #f1e9ff 0%, rgba(241, 233, 255, 0) 68%),
        linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
    border-bottom: 1px solid var(--line);
}
.hero-inner { max-width: 780px; }
.hero-eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 12px; color: var(--brand); background: var(--brand-soft);
    padding: 4px 12px; border-radius: 999px; font-weight: 600; letter-spacing: .3px;
}
.hero h1 {
    font-size: 38px; line-height: 1.25; letter-spacing: -1px;
    margin: 16px 0 12px; font-weight: 800;
}
.hero h1 em { font-style: normal; color: var(--brand); }
.hero p { color: #4b5563; font-size: 16px; margin: 0 0 22px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 26px; color: var(--muted); font-size: 13px; }
.hero-stats b { color: var(--ink); font-size: 18px; font-weight: 700; margin-right: 4px; }

/* ---------------- 主布局 ---------------- */
.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 34px;
    padding-top: 40px;
    padding-bottom: 64px;
    align-items: start;
}
.main-col { min-width: 0; }

.section-head { margin-bottom: 20px; }
.section-head h2 {
    font-size: 20px; margin: 0 0 6px; letter-spacing: -.3px;
    display: flex; align-items: center; gap: 10px;
}
.section-head h2::before {
    content: ''; width: 4px; height: 18px; border-radius: 2px;
    background: linear-gradient(180deg, #3b82f6, #6366f1);
}
.section-head p { margin: 0; color: var(--muted); font-size: 13px; }

/* ---------------- 文章卡片 ---------------- */
.post-list { display: flex; flex-direction: column; gap: 16px; }
.post-card {
    background: var(--card); border: 1px solid var(--line); border-radius: 14px;
    padding: 24px 26px; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.post-card:hover {
    transform: translateY(-2px);
    border-color: #c7d7fe;
    box-shadow: 0 18px 40px -26px rgba(37, 99, 235, .5);
}
.post-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.post-cat {
    color: var(--brand); background: var(--brand-soft);
    padding: 2px 10px; border-radius: 999px; font-weight: 600; font-size: 12px;
}
.post-title { font-size: 20px; line-height: 1.45; margin: 0 0 10px; letter-spacing: -.3px; }
.post-title a:hover { color: var(--brand); }
.post-excerpt {
    margin: 0 0 16px; color: #4b5563; font-size: 14px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.post-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    border-top: 1px dashed #eef0f6; padding-top: 14px;
}
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
    font-size: 12px; color: #64748b; background: #f4f6fa;
    padding: 3px 10px; border-radius: 7px; transition: all .15s ease;
}
.tag:hover { background: var(--brand-soft); color: var(--brand); }
.post-views { font-size: 12px; color: #98a2b3; white-space: nowrap; }

/* ---------------- 侧边栏 ---------------- */
.sidebar { position: sticky; top: 84px; }
.side-card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: 14px; padding: 20px; margin-bottom: 18px;
}
.side-title {
    font-size: 14px; font-weight: 700; margin: 0 0 14px;
    display: flex; align-items: center; gap: 8px; letter-spacing: .2px;
}
.side-title::before { content: ''; width: 3px; height: 14px; border-radius: 2px; background: var(--brand); }

.author { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.author-avatar {
    width: 44px; height: 44px; border-radius: 13px; flex: 0 0 44px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff; font-weight: 800; font-size: 15px;
    display: flex; align-items: center; justify-content: center;
}
.author-name { font-weight: 700; font-size: 15px; }
.author-role { font-size: 12px; color: var(--muted); }
.author-desc { font-size: 13px; color: #4b5563; margin: 0 0 14px; line-height: 1.7; }
.author-link { font-size: 13px; color: var(--brand); }

.side-list { display: flex; flex-direction: column; gap: 2px; }
.side-list a {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 7px 8px; border-radius: 8px; font-size: 13px; color: #4b5563;
    transition: background .15s ease, color .15s ease;
}
.side-list a:hover { background: #f6f8fd; color: var(--brand); }
.side-list .count { font-size: 12px; color: #a4adba; }

.zt-link { display: block; padding: 10px 12px; border-radius: 10px; background: #f8fafc; margin-bottom: 8px; transition: all .15s ease; }
.zt-link:hover { background: var(--brand-soft); }
.zt-link .zt-name { font-size: 13px; font-weight: 600; }
.zt-link .zt-count { font-size: 12px; color: var(--muted); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud a {
    font-size: 12px; color: #4b5563; background: #f4f6fa;
    padding: 4px 11px; border-radius: 999px; transition: all .15s ease;
}
.tag-cloud a:hover { background: var(--brand); color: #fff; }

/* ---------------- 分页 ---------------- */
.pager { margin-top: 30px; }
.pagination {
    display: flex; gap: 8px; list-style: none; padding: 0; margin: 0;
    flex-wrap: wrap; justify-content: center;
}
.pagination li a, .pagination li span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px; padding: 0 12px;
    border: 1px solid var(--line); border-radius: 10px;
    background: #fff; color: #475467; font-size: 13px; transition: all .15s ease;
}
.pagination li a:hover { border-color: #bfdbfe; color: var(--brand); }
.pagination li.active span { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination li.disabled span { color: #cbd5e1; }

/* ---------------- 文章详情 ---------------- */
.breadcrumb { font-size: 12px; color: var(--muted); margin-bottom: 18px; display: flex; gap: 6px; flex-wrap: wrap; }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb .sep { color: #cbd5e1; }

.article-card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: 16px; padding: 38px 42px 34px;
}
.article-cat { font-size: 12px; color: var(--brand); background: var(--brand-soft); padding: 3px 11px; border-radius: 999px; font-weight: 600; }
.article-title {
    font-size: 32px; line-height: 1.35; letter-spacing: -.8px;
    margin: 16px 0 14px; font-weight: 800;
}
.article-meta {
    display: flex; align-items: center; flex-wrap: wrap; gap: 16px;
    font-size: 12.5px; color: var(--muted);
    padding-bottom: 22px; border-bottom: 1px solid var(--line); margin-bottom: 26px;
}
.article-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: #cbd5e1; }

.article-content { font-size: 15.5px; line-height: 1.9; color: #1f2937; word-wrap: break-word; }
.article-content h2 {
    font-size: 22px; margin: 36px 0 14px; line-height: 1.5;
    padding-left: 12px; border-left: 3px solid var(--brand); letter-spacing: -.2px;
}
.article-content h3 { font-size: 18px; margin: 28px 0 12px; letter-spacing: -.1px; }
.article-content h4 { font-size: 16px; margin: 22px 0 10px; }
.article-content p { margin: 0 0 16px; }
.article-content ul, .article-content ol { margin: 0 0 18px; padding-left: 24px; }
.article-content li { margin: 7px 0; }
.article-content blockquote {
    margin: 20px 0; padding: 14px 18px; color: #475467;
    background: #f8fafc; border-left: 3px solid #cbd5e1; border-radius: 0 10px 10px 0;
}
.article-content a { color: var(--brand); border-bottom: 1px solid #bfdbfe; }
.article-content a:hover { border-bottom-color: var(--brand); }
.article-content img { border-radius: 10px; margin: 8px 0; box-shadow: 0 10px 30px -20px rgba(15, 23, 42, .5); }
.article-content table { border-collapse: collapse; width: 100%; margin: 18px 0; font-size: 14px; }
.article-content table th, .article-content table td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; }
.article-content table th { background: #f9fafb; font-weight: 600; }
.article-content hr { border: 0; border-top: 1px dashed var(--line); margin: 30px 0; }
.article-content code {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: .92em; background: #f1f5f9; color: #be185d;
    padding: 2px 6px; border-radius: 5px;
}

/* 代码块外壳 */
pre {
    margin: 20px 0; padding: 18px 20px;
    background: var(--code-bg); color: #e6edf3;
    border-radius: 12px; overflow-x: auto;
    font-size: 13.5px; line-height: 1.7;
}
pre code { background: none !important; color: inherit; padding: 0 !important; font-size: inherit; }
pre code.hljs { background: transparent !important; padding: 0 !important; }

.code-wrap {
    margin: 20px 0; border-radius: 12px; overflow: hidden;
    background: var(--code-bg); border: 1px solid #1f2633;
    box-shadow: 0 16px 40px -30px rgba(15, 23, 42, .8);
}
.code-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 14px; background: #161b22; border-bottom: 1px solid #21262d;
}
.code-lang {
    font-family: ui-monospace, Consolas, monospace;
    font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: #8b949e;
}
.code-copy {
    display: inline-flex; align-items: center; gap: 5px;
    border: 1px solid #30363d; background: transparent; color: #c9d1d9;
    font-size: 12px; padding: 3px 10px; border-radius: 7px; cursor: pointer;
    transition: all .15s ease; font-family: inherit;
}
.code-copy:hover { background: #21262d; color: #fff; }
.code-copy.copied { color: #3fb950; border-color: #238636; background: rgba(35, 134, 54, .12); }
.code-wrap pre { margin: 0; border-radius: 0; box-shadow: none; }

/* 文章底部 */
.article-tags { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 34px; padding-top: 22px; border-top: 1px dashed var(--line); }
.article-tags .label { font-size: 12px; color: var(--muted); margin-right: 2px; }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.post-nav a {
    background: var(--card); border: 1px solid var(--line); border-radius: 12px;
    padding: 16px 18px; transition: all .15s ease;
}
.post-nav a:hover { border-color: #c7d7fe; box-shadow: 0 12px 30px -24px rgba(37, 99, 235, .6); }
.post-nav .dir { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.post-nav .ttl { font-size: 14px; font-weight: 600; color: var(--ink); }
.post-nav .right { text-align: right; }
.post-nav .empty { color: #cbd5e1; font-size: 13px; }

.related { margin-top: 30px; }
.related-title { font-size: 16px; font-weight: 700; margin: 0 0 14px; }
.related-list { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.related-item {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 14px 20px; border-bottom: 1px solid #f1f3f9; font-size: 14px;
}
.related-item:last-child { border-bottom: 0; }
.related-item:hover { background: #fafbff; }
.related-item .date { font-size: 12px; color: #a4adba; white-space: nowrap; }

/* ---------------- 专题 ---------------- */
.zt-hero {
    background: var(--card); border: 1px solid var(--line); border-radius: 16px;
    overflow: hidden; margin-bottom: 24px;
}
.zt-cover { width: 100%; height: 200px; object-fit: cover; display: block; background: linear-gradient(135deg, #eff4ff, #f4efff); }
.zt-body { padding: 26px 30px; }
.zt-body h1 { font-size: 26px; margin: 0 0 10px; letter-spacing: -.5px; }
.zt-body p { margin: 0; color: #4b5563; font-size: 14px; }
.zt-meta { margin-top: 14px; font-size: 12px; color: var(--muted); }

.zt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.zt-card {
    background: var(--card); border: 1px solid var(--line); border-radius: 14px;
    overflow: hidden; transition: all .18s ease;
}
.zt-card:hover { transform: translateY(-2px); border-color: #c7d7fe; box-shadow: 0 18px 40px -28px rgba(37, 99, 235, .55); }
.zt-card .cover { height: 120px; background: linear-gradient(135deg, #e8efff, #f3ecff); object-fit: cover; width: 100%; display: block; }
.zt-card .body { padding: 16px 18px; }
.zt-card h3 { font-size: 15px; margin: 0 0 8px; }
.zt-card p { font-size: 13px; color: #4b5563; margin: 0 0 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.zt-card .meta { font-size: 12px; color: #a4adba; }

/* ---------------- 关于 / 空状态 / 页脚 ---------------- */
.about-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 34px 38px; }
.about-card h1 { font-size: 26px; margin: 0 0 18px; letter-spacing: -.5px; }
.about-card p { color: #374151; margin: 0 0 14px; font-size: 15px; line-height: 1.9; }
.about-card h3 { font-size: 16px; margin: 26px 0 10px; }

.empty-state {
    background: var(--card); border: 1px dashed #dbe2ef; border-radius: 14px;
    padding: 64px 20px; text-align: center; color: var(--muted);
}
.empty-state .title { font-size: 16px; color: var(--ink); margin-bottom: 6px; font-weight: 600; }

.site-footer {
    border-top: 1px solid var(--line); background: #fff;
    padding: 26px 0; font-size: 13px; color: var(--muted);
}
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 16px; }
.footer-links a:hover { color: var(--brand); }

/* 错误页 */
.error-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    text-align: center; padding: 40px 20px;
}
.error-page .code { font-size: 88px; font-weight: 800; letter-spacing: -4px; color: #dbe4ff; line-height: 1; }
.error-page h1 { font-size: 22px; margin: 10px 0 8px; }
.error-page p { color: var(--muted); margin: 0 0 22px; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1024px) {
    .layout { grid-template-columns: 1fr; gap: 26px; padding-top: 28px; }
    .sidebar { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
    .side-card { margin-bottom: 0; }
}
@media (max-width: 860px) {
    .header-inner { height: 58px; gap: 14px; }
    .search-form { display: none; }
    .hero { padding: 40px 0 34px; }
    .hero h1 { font-size: 28px; }
    .article-card { padding: 26px 22px; }
    .article-title { font-size: 24px; }
    .post-card { padding: 20px 20px; }
    .post-title { font-size: 18px; }
    .post-nav { grid-template-columns: 1fr; }
}
