/* 码农爱分享 · 个人博客主题
   编辑风格：纸面底色 + 衬线标题 + 锈红点缀 */

:root {
    --bg: #f7f5f0;
    --surface: #fffdf9;
    --ink: #26292f;
    --muted: #8a8577;
    --line: #e6e1d5;
    --accent: #b5493a;
    --accent-soft: #f3e5e1;
    --serif: Georgia, "Times New Roman", "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
    --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    --mono: "SF Mono", Menlo, Consolas, "Courier New", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.75;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

::selection { background: var(--accent-soft); }

a { color: var(--accent); text-decoration: none; transition: color .15s ease; }
a:hover { color: #8f382c; }

.wrap { max-width: 720px; margin: 0 auto; padding: 0 20px; }

/* ============ 头部 ============ */
.site-header {
    border-bottom: 1px solid var(--line);
    background: var(--bg);
}
.site-header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    padding-top: 18px;
    padding-bottom: 18px;
    flex-wrap: wrap;
}
.site-brand {
    font-family: var(--serif);
    font-size: 22px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: .5px;
}
.site-brand:hover { color: var(--accent); }
.site-nav { display: flex; gap: 18px; flex: 1; flex-wrap: wrap; }
.site-nav a {
    font-size: 14px;
    color: var(--muted);
    padding-bottom: 2px;
    border-bottom: 2px solid transparent;
}
.site-nav a:hover, .site-nav a.on { color: var(--ink); border-bottom-color: var(--accent); }
.site-search input {
    font-family: var(--sans);
    font-size: 13px;
    padding: 6px 12px;
    width: 140px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
    color: var(--ink);
    outline: none;
    transition: width .2s ease, border-color .15s ease;
}
.site-search input:focus { width: 190px; border-color: var(--accent); }

/* ============ 主体 ============ */
.site-main { flex: 1; padding: 48px 0 64px; }

/* 文章列表 */
.post-list { display: flex; flex-direction: column; }
.post-item {
    padding: 32px 0;
    border-bottom: 1px solid var(--line);
}
.post-item:first-child { padding-top: 0; }
.post-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12.5px;
    color: var(--muted);
    letter-spacing: .4px;
    text-transform: uppercase;
    margin-bottom: 10px;
}
.post-meta time { font-variant-numeric: tabular-nums; }
.post-cat {
    font-size: 12px;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 2px 10px;
    border-radius: 12px;
    letter-spacing: 0;
    text-transform: none;
}
.post-title {
    font-family: var(--serif);
    font-size: 26px;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 10px;
}
.post-title a { color: var(--ink); }
.post-title a:hover { color: var(--accent); }
.post-excerpt {
    font-size: 15px;
    color: #555a61;
    line-height: 1.8;
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.post-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13.5px;
}
.post-more { font-weight: 500; }
.post-views { color: var(--muted); }

/* 分页 */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 40px 0 8px;
    font-size: 14px;
}
.page-info { color: var(--muted); font-variant-numeric: tabular-nums; }
.pagination a { font-weight: 500; }

/* ============ 文章详情 ============ */
.post-detail { padding-bottom: 16px; }
.post-head { margin-bottom: 28px; }
.post-detail-title {
    font-family: var(--serif);
    font-size: 34px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 16px;
}
.meta-author { font-weight: 600; color: var(--ink); text-transform: none; }
.meta-views { text-transform: none; }
.post-cover {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 32px;
}

/* 正文排版 */
.post-body { font-size: 16.5px; line-height: 1.9; color: #33373d; }
.post-body h1, .post-body h2, .post-body h3, .post-body h4 {
    font-family: var(--serif);
    line-height: 1.4;
    margin: 36px 0 14px;
}
.post-body h1 { font-size: 26px; }
.post-body h2 { font-size: 23px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.post-body h3 { font-size: 19px; }
.post-body h4 { font-size: 16.5px; }
.post-body p { margin-bottom: 18px; }
.post-body ul, .post-body ol { margin: 0 0 18px 24px; }
.post-body li { margin-bottom: 6px; }
.post-body blockquote {
    margin: 24px 0;
    padding: 14px 20px;
    border-left: 3px solid var(--accent);
    background: var(--accent-soft);
    border-radius: 0 8px 8px 0;
    color: #5a5148;
}
.post-body blockquote p:last-child { margin-bottom: 0; }
.post-body code {
    font-family: var(--mono);
    font-size: .88em;
    background: #efece4;
    padding: 2px 6px;
    border-radius: 5px;
}
.post-body pre {
    background: #26292f;
    color: #e8e6e1;
    padding: 18px 20px;
    border-radius: 10px;
    overflow-x: auto;
    margin: 24px 0;
    font-size: 14px;
    line-height: 1.65;
}
.post-body pre code { background: none; padding: 0; color: inherit; }
.post-body img { max-width: 100%; height: auto; border-radius: 8px; margin: 12px 0; }
.post-body a { text-decoration: underline; text-underline-offset: 3px; }
.post-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 15px;
}
.post-body th, .post-body td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.post-body th { background: var(--surface); }
.post-body hr { border: none; border-top: 1px solid var(--line); margin: 36px 0; }

/* 标签 */
.post-tags { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 28px; }
.tag-chip {
    font-size: 13px;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 4px 14px;
    border-radius: 14px;
}
.tag-chip:hover { background: #ecd8d2; }

/* 上下篇 */
.prev-next {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 36px 0;
    padding-top: 28px;
    border-top: 1px solid var(--line);
}
.pn-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.pn-link:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.pn-next { text-align: right; margin-left: auto; width: 100%; }
.pn-label { font-size: 12.5px; color: var(--muted); }
.pn-title { font-size: 15px; color: var(--ink); font-weight: 600; }

/* 评论区 */
.comments { margin-top: 12px; padding-top: 28px; border-top: 1px solid var(--line); }
.comments-title { font-family: var(--serif); font-size: 20px; margin-bottom: 20px; }
.comment { padding: 16px 0; border-bottom: 1px dashed var(--line); }
.comment-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.comment-head strong { font-size: 14.5px; }
.comment-head time { font-size: 12.5px; color: var(--muted); }
.comment p { font-size: 15px; color: #44484e; }
.comment-reply { margin: 12px 0 0 24px; padding-left: 16px; border-left: 2px solid var(--line); }

.comment-form { margin-top: 24px; display: flex; flex-direction: column; gap: 12px; }
.cf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.comment-form input, .comment-form textarea {
    font-family: var(--sans);
    font-size: 14.5px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    outline: none;
    resize: vertical;
}
.comment-form input:focus, .comment-form textarea:focus { border-color: var(--accent); }
.comment-form button {
    align-self: flex-start;
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: none;
    padding: 10px 28px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s ease;
}
.comment-form button:hover { background: #8f382c; }

/* 归档页头 */
.archive-head { margin-bottom: 28px; }
.archive-title { font-family: var(--serif); font-size: 30px; font-weight: 700; }
.archive-desc { color: var(--muted); font-size: 14.5px; margin-top: 8px; }

/* 404 */
.error-page { text-align: center; padding: 80px 0; }
.error-code { font-family: var(--serif); font-size: 72px; color: var(--line); margin-bottom: 8px; }
.error-msg { color: var(--muted); margin-bottom: 24px; }
.error-home { font-weight: 500; }

.empty { color: var(--muted); padding: 40px 0; text-align: center; }

/* ============ 页脚 ============ */
.site-footer {
    border-top: 1px solid var(--line);
    padding: 28px 0;
    margin-top: auto;
}
.friend-links { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; font-size: 13.5px; }
.friend-links-label { color: var(--muted); }
.copyright { font-size: 13px; color: var(--muted); }
.copyright a { color: var(--muted); text-decoration: underline; }

/* ============ 移动端 ============ */
@media (max-width: 640px) {
    .site-header-inner { gap: 12px; }
    .site-search { order: 3; width: 100%; }
    .site-search input, .site-search input:focus { width: 100%; }
    .post-title { font-size: 22px; }
    .post-detail-title { font-size: 27px; }
    .prev-next { grid-template-columns: 1fr; }
    .cf-row { grid-template-columns: 1fr; }
}

/* 文章尾部导流卡：低调的企业站入口 */
.post-promo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 28px;
    padding: 16px 20px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    background: var(--surface);
    border-radius: 4px;
    font-size: 14px;
}
.promo-text { color: var(--muted); }
.promo-link { font-weight: 600; white-space: nowrap; }

/* 右侧悬浮工具 */
.float-tools {
    position: fixed;
    right: 32px;
    bottom: 48px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
}
.float-btn {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    transition: opacity .2s ease, transform .2s ease, color .15s ease, border-color .15s ease;
}
.float-btn:hover { color: var(--accent); border-color: var(--accent); }
#toTop { opacity: 0; visibility: hidden; transform: translateY(8px); }
#toTop.show { opacity: 1; visibility: visible; transform: none; }

/* 微信悬浮：悬停/聚焦弹出二维码 */
.float-wechat { position: relative; }
.wechat-pop {
    position: absolute;
    right: 54px;
    top: 50%;
    transform: translateY(-50%) translateX(6px);
    padding: 10px 10px 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(38,41,47,.08);
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s ease, transform .18s ease;
}
.float-wechat:hover .wechat-pop,
.float-wechat:focus-within .wechat-pop {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%);
}
.wechat-pop img { display: block; width: 140px; height: 140px; border-radius: 6px; }
.wechat-pop p { font-size: 12px; color: var(--muted); margin-top: 6px; white-space: nowrap; }
@media (max-width: 640px) {
    .float-tools { right: 16px; bottom: 24px; }
    .float-btn { width: 38px; height: 38px; }
}
