/* ==========================================================================
   沉墨个人博客 · 前台样式
   ========================================================================== */

:root {
    --paper: #f7f4ee;
    --paper-deep: #efeae1;
    --card: #fffdf9;
    --ink: #1d1c1a;
    --ink-soft: #4a4741;
    --ink-muted: #8b857b;
    --line: #e5dfd4;
    --accent: #a83232;
    --accent-soft: #c25b4e;
    --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
    --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
    --radius: 14px;
    --maxw: 1120px;
    --shadow: 0 1px 2px rgba(29, 28, 26, .04), 0 14px 34px rgba(29, 28, 26, .06);
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    background-color: var(--paper);
    background-image:
        radial-gradient(circle at 12% 8%, rgba(168, 50, 50, .05), transparent 45%),
        radial-gradient(circle at 88% 0%, rgba(70, 90, 80, .06), transparent 40%);
    background-repeat: no-repeat;
    color: var(--ink);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color .2s ease;
}

a:hover {
    color: var(--accent);
}

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

h1, h2, h3, h4 {
    font-family: var(--serif);
    font-weight: 600;
    letter-spacing: .01em;
    color: var(--ink);
}

button,
input,
textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

/* --------------------------------------------------------------------------
   头部
   -------------------------------------------------------------------------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(247, 244, 238, .86);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid transparent;
    transition: border-color .25s ease, box-shadow .25s ease;
}

.site-header.is-scrolled {
    border-bottom-color: var(--line);
    box-shadow: 0 6px 24px rgba(29, 28, 26, .05);
}

.header-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 28px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.brand-seal {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: var(--accent);
    color: #fff8f2;
    border-radius: 7px;
    font-family: var(--serif);
    font-size: 13px;
    line-height: 1.05;
    letter-spacing: .04em;
    box-shadow: 0 4px 12px rgba(168, 50, 50, .25);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-text strong {
    font-family: var(--serif);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: .06em;
}

.brand-text small {
    font-size: 11px;
    color: var(--ink-muted);
    letter-spacing: .08em;
    margin-top: 2px;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
}

.nav-link {
    position: relative;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--ink-soft);
    border-radius: 8px;
}

.nav-link::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 2px;
    width: 0;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
    transform: translateX(-50%);
    transition: width .25s ease;
}

.nav-link:hover {
    color: var(--ink);
}

.nav-link.is-active {
    color: var(--accent);
}

.nav-link.is-active::after,
.nav-link:hover::after {
    width: 16px;
}

.header-tools {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-search {
    display: flex;
    align-items: center;
    background: var(--paper-deep);
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 4px 6px 4px 14px;
    transition: border-color .2s ease, background .2s ease;
}

.header-search:focus-within {
    background: var(--card);
    border-color: var(--line);
}

.header-search input {
    width: 132px;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 13px;
    padding: 4px 0;
}

.header-search input::placeholder {
    color: var(--ink-muted);
}

.header-search button {
    border: 0;
    background: transparent;
    color: var(--ink-muted);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}

.header-search button:hover {
    background: var(--paper-deep);
    color: var(--accent);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--card);
    cursor: pointer;
    padding: 0 9px;
}

.nav-toggle span {
    display: block;
    height: 1.5px;
    background: var(--ink);
    border-radius: 2px;
    transition: transform .25s ease, opacity .2s ease;
}

.nav-toggle.is-open span:nth-child(1) {
    transform: translateY(5.5px) rotate(45deg);
}

.nav-toggle.is-open span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.is-open span:nth-child(3) {
    transform: translateY(-5.5px) rotate(-45deg);
}

/* --------------------------------------------------------------------------
   主体容器
   -------------------------------------------------------------------------- */

.site-main {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 34px 24px 70px;
    min-height: 60vh;
}

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 312px;
    gap: 44px;
    align-items: start;
}

.layout-side {
    position: sticky;
    top: 90px;
}

.flash-area {
    margin-bottom: 22px;
}

.flash {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 10px;
    border-left: 3px solid var(--accent);
    background: var(--card);
    box-shadow: var(--shadow);
}

.flash-error {
    border-left-color: #b3392f;
    color: #8f2b22;
}

.flash-success {
    border-left-color: #3f6b57;
    color: #2f5344;
}

/* --------------------------------------------------------------------------
   首页头图
   -------------------------------------------------------------------------- */

.hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    padding: 46px 48px;
    margin-bottom: 42px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.hero::before {
    content: "";
    position: absolute;
    right: -80px;
    top: -120px;
    width: 340px;
    height: 340px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(168, 50, 50, .09), transparent 68%);
    pointer-events: none;
}

.hero-main {
    max-width: 640px;
    position: relative;
    z-index: 1;
}

.hero-eyebrow {
    margin: 0 0 14px;
    font-size: 11px;
    letter-spacing: .34em;
    color: var(--accent);
    text-transform: uppercase;
}

.hero-title {
    margin: 0 0 16px;
    font-size: 34px;
    line-height: 1.45;
    letter-spacing: .02em;
}

.hero-desc {
    margin: 0 0 22px;
    color: var(--ink-soft);
    font-size: 15px;
    line-height: 1.9;
}

.hero-stats {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 13px;
    color: var(--ink-muted);
}

.hero-stats strong {
    font-family: var(--serif);
    font-size: 17px;
    color: var(--ink);
    margin-right: 3px;
}

.hero-seal {
    flex-shrink: 0;
    width: 108px;
    height: 108px;
    border: 2px solid var(--accent);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--accent);
    font-family: var(--serif);
    font-size: 34px;
    letter-spacing: .04em;
    opacity: .82;
    transform: rotate(-3deg);
}

.hero-seal span {
    display: block;
    line-height: 1;
}

/* --------------------------------------------------------------------------
   栏目标题
   -------------------------------------------------------------------------- */

.section-head {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.section-title {
    margin: 0;
    font-size: 19px;
    letter-spacing: .04em;
    white-space: nowrap;
}

.section-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--line), transparent);
}

.page-head {
    margin-bottom: 30px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
}

.page-eyebrow {
    margin: 0 0 10px;
    font-size: 11px;
    letter-spacing: .3em;
    color: var(--accent);
    text-transform: uppercase;
}

.page-title {
    margin: 0 0 8px;
    font-size: 30px;
    line-height: 1.4;
}

.page-desc {
    margin: 0 0 8px;
    color: var(--ink-soft);
}

.page-count {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--ink-muted);
}

.meta-sep {
    color: var(--line);
}

/* --------------------------------------------------------------------------
   文章卡片
   -------------------------------------------------------------------------- */

.post-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.post-card {
    display: flex;
    gap: 22px;
    padding: 24px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.post-card:hover {
    transform: translateY(-2px);
    border-color: #d9d1c3;
    box-shadow: var(--shadow);
}

.post-cover {
    flex-shrink: 0;
    width: 196px;
    height: 132px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--paper-deep);
}

.post-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s ease;
}

.post-card:hover .post-cover img {
    transform: scale(1.04);
}

.post-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.post-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12.5px;
    color: var(--ink-muted);
    letter-spacing: .02em;
}

.post-cat {
    display: inline-block;
    padding: 2px 9px;
    background: rgba(168, 50, 50, .08);
    color: var(--accent);
    border-radius: 999px;
    font-size: 12px;
}

.post-cat:hover {
    background: rgba(168, 50, 50, .16);
}

.badge-top {
    padding: 1px 8px;
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 4px;
    font-size: 11px;
}

.post-title {
    margin: 10px 0 8px;
    font-size: 21px;
    line-height: 1.5;
}

.post-title a:hover {
    color: var(--accent);
}

.post-excerpt {
    margin: 0;
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.85;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-foot {
    margin-top: auto;
    padding-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.read-more {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--accent);
}

.read-more svg {
    transition: transform .2s ease;
}

.read-more:hover svg {
    transform: translateX(3px);
}

/* --------------------------------------------------------------------------
   分页
   -------------------------------------------------------------------------- */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 34px;
}

.page-link {
    min-width: 38px;
    height: 38px;
    padding: 0 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--card);
    font-size: 13px;
    color: var(--ink-soft);
    transition: all .2s ease;
}

.page-link:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.page-link.is-active {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--paper);
}

.page-link.is-disabled {
    opacity: .45;
    pointer-events: none;
}

.page-ellipsis {
    color: var(--ink-muted);
    padding: 0 4px;
}

/* --------------------------------------------------------------------------
   侧边栏
   -------------------------------------------------------------------------- */

.widget {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 18px;
}

.widget-title {
    margin: 0 0 16px;
    font-size: 15px;
    letter-spacing: .06em;
    position: relative;
    padding-left: 12px;
}

.widget-title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 14px;
    background: var(--accent);
    border-radius: 2px;
}

.author-card {
    text-align: center;
}

.author-head {
    display: flex;
    align-items: center;
    gap: 13px;
    text-align: left;
    padding-bottom: 16px;
    border-bottom: 1px dashed var(--line);
}

.author-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.author-avatar.is-text {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ink);
    color: var(--paper);
    font-family: var(--serif);
    font-size: 22px;
}

.author-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.author-meta strong {
    font-family: var(--serif);
    font-size: 16px;
    letter-spacing: .04em;
}

.author-meta span {
    font-size: 12px;
    color: var(--ink-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.author-bio {
    margin: 14px 0 0;
    font-size: 13px;
    color: var(--ink-soft);
    line-height: 1.8;
    text-align: left;
}

.author-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.author-stats li {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 0;
    border-radius: 8px;
    transition: background .2s ease;
}

.author-stats li:hover {
    background: var(--paper-deep);
}

.author-stats strong {
    font-family: var(--serif);
    font-size: 17px;
}

.author-stats span {
    font-size: 11px;
    color: var(--ink-muted);
}

.rank-list {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: rank;
}

.rank-list li {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 13.5px;
    line-height: 1.6;
}

.rank-list li:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.rank-num {
    flex-shrink: 0;
    width: 17px;
    height: 17px;
    margin-top: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--ink-muted);
    border-radius: 4px;
    background: var(--paper-deep);
}

.rank-list li:nth-child(1) .rank-num {
    background: var(--accent);
    color: #fff;
}

.rank-list li:nth-child(2) .rank-num,
.rank-list li:nth-child(3) .rank-num {
    background: rgba(168, 50, 50, .16);
    color: var(--accent);
}

.rank-list a {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-list em {
    display: none;
    font-style: normal;
    font-size: 11px;
    color: var(--ink-muted);
    flex-shrink: 0;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
    padding: 4px 11px;
    background: var(--paper-deep);
    border-radius: 999px;
    font-size: 12.5px;
    color: var(--ink-soft);
    transition: all .2s ease;
}

.tag-chip sup {
    font-size: 10px;
    color: var(--ink-muted);
}

.tag-chip:hover {
    background: var(--ink);
    color: var(--paper);
}

.tag-chip:hover sup {
    color: rgba(247, 244, 238, .6);
}

.link-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.link-list li {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    border-bottom: 1px dashed var(--line);
}

.link-list li:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.link-list a {
    font-size: 13.5px;
}

.link-list span {
    font-size: 11.5px;
    color: var(--ink-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   空状态 / 按钮
   -------------------------------------------------------------------------- */

.empty-state {
    background: var(--card);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 54px 24px;
    text-align: center;
}

.empty-mark {
    margin: 0 auto 14px;
    width: 54px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--line);
    font-family: var(--serif);
    font-size: 22px;
    color: var(--ink-muted);
}

.empty-state h3 {
    margin: 0 0 8px;
    font-size: 17px;
}

.empty-state p {
    margin: 0 0 18px;
    color: var(--ink-muted);
    font-size: 13.5px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 40px;
    padding: 0 20px;
    border-radius: 9px;
    font-size: 14px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all .2s ease;
}

.btn-primary {
    background: var(--ink);
    color: var(--paper);
}

.btn-primary:hover {
    background: var(--accent);
    color: #fff;
}

.btn-ghost {
    border-color: var(--line);
    background: transparent;
    color: var(--ink-soft);
}

.btn-ghost:hover {
    border-color: var(--ink);
    color: var(--ink);
}

/* --------------------------------------------------------------------------
   文章详情
   -------------------------------------------------------------------------- */

.article {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 48px 56px;
    box-shadow: var(--shadow);
}

.article-head {
    padding-bottom: 26px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 32px;
}

.article-title {
    margin: 14px 0 12px;
    font-size: 32px;
    line-height: 1.45;
}

.article-summary {
    margin: 0;
    padding-left: 14px;
    border-left: 3px solid var(--line);
    color: var(--ink-muted);
    font-size: 14px;
    line-height: 1.85;
}

.article-cover {
    margin: 0 0 30px;
    border-radius: 12px;
    overflow: hidden;
}

.article-body {
    font-size: 16px;
    line-height: 1.95;
    color: #2b2925;
    word-wrap: break-word;
}

.article-body p {
    margin: 0 0 1.2em;
}

.article-body h2 {
    margin: 2em 0 .8em;
    font-size: 22px;
    padding-left: 12px;
    border-left: 4px solid var(--accent);
    scroll-margin-top: 90px;
}

.article-body h3 {
    margin: 1.7em 0 .7em;
    font-size: 18.5px;
    scroll-margin-top: 90px;
}

.article-body h4 {
    margin: 1.5em 0 .6em;
    font-size: 16.5px;
}

.article-body a {
    color: var(--accent);
    border-bottom: 1px solid rgba(168, 50, 50, .3);
}

.article-body a:hover {
    border-bottom-color: var(--accent);
}

.article-body blockquote {
    margin: 1.4em 0;
    padding: 14px 20px;
    background: var(--paper-deep);
    border-left: 3px solid var(--accent);
    border-radius: 0 8px 8px 0;
    color: var(--ink-soft);
    font-size: 15px;
}

.article-body blockquote p:last-child {
    margin-bottom: 0;
}

.article-body ul,
.article-body ol {
    margin: 0 0 1.2em;
    padding-left: 1.6em;
}

.article-body li {
    margin-bottom: .45em;
}

.article-body img {
    border-radius: 10px;
    margin: 1.2em auto;
}

.article-body hr {
    border: 0;
    height: 1px;
    background: var(--line);
    margin: 2.2em 0;
}

.article-body code {
    background: var(--paper-deep);
    padding: 2px 6px;
    border-radius: 5px;
    font-family: "JetBrains Mono", Consolas, Monaco, monospace;
    font-size: .88em;
    color: #a3402f;
}

.article-body .cm-code {
    background: #23211e;
    color: #e8e2d8;
    padding: 20px 22px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 1.4em 0;
    font-size: 13.5px;
    line-height: 1.7;
}

.article-body .cm-code code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: inherit;
}

.article-foot {
    margin-top: 40px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.article-share {
    font-size: 12.5px;
    color: var(--ink-muted);
}

.post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 22px 0 34px;
}

.post-nav-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 18px 22px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: all .2s ease;
}

.post-nav-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.post-nav-item small {
    font-size: 11.5px;
    color: var(--ink-muted);
    letter-spacing: .08em;
}

.post-nav-item strong {
    font-family: var(--serif);
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.6;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.post-nav-item.is-next {
    text-align: right;
    align-items: flex-end;
}

.post-nav-item.is-empty {
    opacity: .55;
}

.related {
    margin-bottom: 34px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.related-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    transition: all .2s ease;
}

.related-card:hover {
    border-color: var(--accent);
}

.related-card img {
    width: 100%;
    height: 96px;
    object-fit: cover;
    border-radius: 8px;
}

.related-card small {
    font-size: 11.5px;
    color: var(--ink-muted);
}

/* --------------------------------------------------------------------------
   评论
   -------------------------------------------------------------------------- */

.comments {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 34px 40px;
}

.comments-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.comments-head .section-title {
    font-size: 17px;
}

.count {
    font-family: var(--sans);
    font-size: 12px;
    color: var(--accent);
    background: rgba(168, 50, 50, .09);
    padding: 1px 8px;
    border-radius: 999px;
    margin-left: 4px;
    vertical-align: middle;
}

.comment-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.comment-item {
    display: flex;
    gap: 14px;
    padding: 18px 0;
    border-bottom: 1px dashed var(--line);
}

.comment-item:last-child {
    border-bottom: 0;
}

.comment-avatar {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--paper-deep);
    color: var(--ink-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--serif);
    font-size: 15px;
}

.comment-main {
    flex: 1;
    min-width: 0;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    font-size: 12.5px;
    color: var(--ink-muted);
}

.comment-author {
    font-size: 13.5px;
    color: var(--ink);
    font-weight: 600;
}

.comment-author.is-admin {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent);
}

.comment-author.is-admin span {
    font-size: 10px;
    font-weight: 400;
    padding: 1px 6px;
    border: 1px solid var(--accent);
    border-radius: 4px;
}

.comment-reply {
    margin-left: auto;
    border: 0;
    background: transparent;
    color: var(--ink-muted);
    font-size: 12.5px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 5px;
    transition: all .2s ease;
}

.comment-reply:hover {
    background: var(--paper-deep);
    color: var(--accent);
}

.comment-content {
    font-size: 14px;
    line-height: 1.85;
    color: var(--ink-soft);
    word-wrap: break-word;
}

.comment-children {
    margin: 14px 0 0;
    padding: 0 0 0 14px;
    list-style: none;
    border-left: 2px solid var(--line);
}

.comment-item.is-child {
    padding: 12px 0;
    border-bottom: 0;
}

.comments-empty {
    color: var(--ink-muted);
    font-size: 13.5px;
    padding: 18px 0;
}

.comment-form {
    margin-top: 26px;
    padding-top: 26px;
    border-top: 1px solid var(--line);
}

.form-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.form-head h3 {
    margin: 0;
    font-size: 16px;
}

.reply-tip {
    font-size: 12.5px;
    color: var(--ink-muted);
}

.reply-tip strong {
    color: var(--accent);
}

.reply-tip button {
    border: 0;
    background: transparent;
    color: var(--ink-muted);
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field > span {
    font-size: 12.5px;
    color: var(--ink-muted);
}

.field input,
.field textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--paper);
    border-radius: 9px;
    padding: 9px 12px;
    font-size: 14px;
    outline: 0;
    transition: border-color .2s ease, background .2s ease;
}

.field input:focus,
.field textarea:focus {
    border-color: var(--ink-soft);
    background: var(--card);
}

.field textarea {
    resize: vertical;
    line-height: 1.8;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 14px;
}

.form-tip {
    color: var(--ink-muted);
    font-size: 12px;
    margin-right: auto;
}

/* --------------------------------------------------------------------------
   归档
   -------------------------------------------------------------------------- */

.year-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 28px;
}

.filter-chip {
    padding: 6px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    font-size: 13px;
    color: var(--ink-soft);
}

.filter-chip sup {
    font-size: 10px;
    color: var(--ink-muted);
    margin-left: 2px;
}

.filter-chip.is-active,
.filter-chip:hover {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--paper);
}

.filter-chip.is-active sup,
.filter-chip:hover sup {
    color: rgba(247, 244, 238, .65);
}

.archive-year {
    margin-bottom: 36px;
}

.archive-year-title {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 0 0 16px;
    font-size: 26px;
    color: var(--accent);
    letter-spacing: .06em;
}

.archive-year-title span {
    font-family: var(--sans);
    font-size: 12px;
    color: var(--ink-muted);
    letter-spacing: .04em;
}

.archive-month {
    margin-bottom: 14px;
    padding: 16px 22px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.archive-month-title {
    margin: 0 0 10px;
    font-size: 13.5px;
    color: var(--ink-muted);
    letter-spacing: .1em;
}

.archive-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.archive-list li {
    display: flex;
    align-items: baseline;
    gap: 14px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--line);
}

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

.archive-list time {
    flex-shrink: 0;
    width: 42px;
    font-size: 12.5px;
    color: var(--ink-muted);
    font-variant-numeric: tabular-nums;
}

.archive-list a {
    flex: 1;
    min-width: 0;
    font-size: 14.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.archive-views {
    flex-shrink: 0;
    font-size: 11.5px;
    color: var(--ink-muted);
}

/* --------------------------------------------------------------------------
   分类 / 友链
   -------------------------------------------------------------------------- */

.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.category-card {
    position: relative;
    padding: 26px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: all .25s ease;
    overflow: hidden;
}

.category-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.category-card h2 {
    margin: 0 0 8px;
    font-size: 19px;
    letter-spacing: .04em;
}

.category-card p {
    margin: 0 0 16px;
    font-size: 13px;
    color: var(--ink-muted);
    line-height: 1.8;
}

.category-count {
    position: absolute;
    right: 22px;
    top: 20px;
    font-family: var(--serif);
    font-size: 30px;
    color: rgba(29, 28, 26, .08);
    line-height: 1;
}

.category-more {
    font-size: 12.5px;
    color: var(--accent);
}

.link-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.link-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    transition: all .2s ease;
}

.link-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.link-initial {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 10px;
    background: var(--paper-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--serif);
    font-size: 17px;
    color: var(--ink-soft);
}

.link-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.link-info strong {
    font-size: 14.5px;
    font-weight: 600;
}

.link-info small {
    font-size: 12px;
    color: var(--ink-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notice-card {
    margin-top: 24px;
    padding: 22px 26px;
    background: var(--paper-deep);
    border-radius: var(--radius);
}

.notice-card h3 {
    margin: 0 0 8px;
    font-size: 15px;
}

.notice-card p {
    margin: 0;
    font-size: 13.5px;
    color: var(--ink-soft);
    line-height: 1.85;
}

/* --------------------------------------------------------------------------
   关于
   -------------------------------------------------------------------------- */

.about-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 40px;
    align-items: start;
}

.about-card {
    position: sticky;
    top: 90px;
    padding: 34px 26px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 20px;
    text-align: center;
    box-shadow: var(--shadow);
}

.about-avatar {
    width: 96px;
    height: 96px;
    margin: 0 auto 18px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--ink);
    color: var(--paper);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--serif);
    font-size: 38px;
}

.about-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.about-name {
    margin: 0 0 6px;
    font-size: 22px;
    letter-spacing: .06em;
}

.about-role {
    margin: 0 0 14px;
    font-size: 12.5px;
    color: var(--accent);
    letter-spacing: .08em;
}

.about-bio {
    margin: 0;
    font-size: 13.5px;
    color: var(--ink-soft);
    line-height: 1.85;
}

.about-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin: 22px 0 0;
    padding: 16px 0 0;
    border-top: 1px dashed var(--line);
    list-style: none;
}

.about-stats li {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.about-stats strong {
    font-family: var(--serif);
    font-size: 19px;
}

.about-stats span {
    font-size: 11.5px;
    color: var(--ink-muted);
}

.about-content {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 36px 44px;
}

/* --------------------------------------------------------------------------
   搜索页
   -------------------------------------------------------------------------- */

.search-page-form {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    max-width: 480px;
}

.search-page-form input {
    flex: 1;
    height: 40px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--card);
    outline: 0;
    font-size: 14px;
}

.search-page-form input:focus {
    border-color: var(--ink-soft);
}

/* --------------------------------------------------------------------------
   404
   -------------------------------------------------------------------------- */

.error-page {
    text-align: center;
    padding: 70px 20px 40px;
}

.error-code {
    margin: 0;
    font-family: var(--serif);
    font-size: 96px;
    line-height: 1;
    color: rgba(168, 50, 50, .18);
    letter-spacing: .08em;
}

.error-title {
    margin: 10px 0 12px;
    font-size: 26px;
    letter-spacing: .1em;
}

.error-desc {
    margin: 0 0 26px;
    color: var(--ink-muted);
    font-size: 14px;
}

.error-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* --------------------------------------------------------------------------
   页脚
   -------------------------------------------------------------------------- */

.site-footer {
    border-top: 1px solid var(--line);
    background: rgba(239, 234, 225, .5);
    margin-top: 20px;
}

.footer-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 40px 24px 26px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 30px;
    flex-wrap: wrap;
}

.footer-brand {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    max-width: 420px;
}

.footer-brand strong {
    font-family: var(--serif);
    font-size: 16px;
    letter-spacing: .06em;
}

.footer-brand p {
    margin: 4px 0 0;
    font-size: 12.5px;
    color: var(--ink-muted);
    line-height: 1.8;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    padding-top: 6px;
}

.footer-nav a {
    font-size: 13px;
    color: var(--ink-soft);
}

.footer-bottom {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 16px 24px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    border-top: 1px dashed var(--line);
    font-size: 12px;
    color: var(--ink-muted);
}

.footer-bottom a {
    color: var(--ink-soft);
    border-bottom: 1px solid var(--line);
}

.back-top {
    position: fixed;
    right: 26px;
    bottom: 30px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--ink-soft);
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all .25s ease;
    z-index: 40;
}

.back-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-top:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* --------------------------------------------------------------------------
   响应式
   -------------------------------------------------------------------------- */

@media (max-width: 1000px) {
    .layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 30px;
    }

    .layout-side {
        position: static;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .layout-side .widget {
        margin-bottom: 0;
    }

    .article {
        padding: 36px 32px;
    }

    .comments {
        padding: 28px 26px;
    }

    .about-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .about-card {
        position: static;
        display: grid;
        grid-template-columns: auto 1fr;
        column-gap: 22px;
        text-align: left;
        align-items: center;
        padding: 28px;
    }

    .about-avatar {
        margin: 0;
        grid-row: span 2;
    }

    .about-stats {
        grid-column: 1 / -1;
    }
}

@media (max-width: 820px) {
    .header-inner {
        padding: 12px 18px;
        gap: 14px;
        flex-wrap: wrap;
    }

    .site-nav {
        order: 3;
        width: 100%;
        margin: 0;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: 10px 0 4px;
        border-top: 1px solid var(--line);
    }

    .site-nav.is-open {
        display: flex;
    }

    .nav-link {
        padding: 10px 8px;
        border-radius: 8px;
    }

    .nav-link::after {
        display: none;
    }

    .nav-link.is-active {
        background: var(--paper-deep);
    }

    .nav-toggle {
        display: flex;
    }

    .header-search input {
        width: 96px;
    }

    .site-main {
        padding: 22px 18px 56px;
    }

    .hero {
        padding: 32px 26px;
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .hero-title {
        font-size: 26px;
    }

    .hero-seal {
        width: 74px;
        height: 74px;
        font-size: 24px;
    }

    .post-card {
        padding: 18px;
        flex-direction: column;
        gap: 14px;
    }

    .post-cover {
        width: 100%;
        height: 168px;
    }

    .post-title {
        font-size: 18.5px;
    }

    .article {
        padding: 26px 20px;
        border-radius: 14px;
    }

    .article-title {
        font-size: 24px;
    }

    .article-body {
        font-size: 15.5px;
    }

    .article-body h2 {
        font-size: 19px;
    }

    .comments {
        padding: 22px 18px;
        border-radius: 14px;
    }

    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .post-nav,
    .related-grid,
    .category-grid,
    .link-grid,
    .layout-side {
        grid-template-columns: minmax(0, 1fr);
    }

    .post-nav-item.is-next {
        text-align: left;
        align-items: flex-start;
    }

    .page-title {
        font-size: 24px;
    }

    .footer-inner {
        flex-direction: column;
        padding: 30px 18px 20px;
    }

    .footer-bottom {
        padding: 14px 18px 24px;
        flex-direction: column;
        align-items: flex-start;
    }

    .back-top {
        right: 16px;
        bottom: 20px;
        width: 38px;
        height: 38px;
    }
}

@media (max-width: 480px) {
    .brand-text small {
        display: none;
    }

    .header-search {
        display: none;
    }

    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .about-card {
        grid-template-columns: minmax(0, 1fr);
        text-align: center;
    }

    .about-avatar {
        margin: 0 auto;
        grid-row: auto;
    }
}

/* ==========================================================================
   阅读体验增强：深色模式 / 目录 / 进度条 / 图片放大
   ========================================================================== */

/* --------------------------------------------------------------------------
   主题切换按钮
   -------------------------------------------------------------------------- */

.theme-toggle {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--card);
    color: var(--ink-soft);
    cursor: pointer;
    transition: color .2s ease, border-color .2s ease, transform .2s ease;
}

.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.theme-toggle:active {
    transform: scale(.94);
}

.theme-toggle .icon-sun {
    display: none;
}

/* --------------------------------------------------------------------------
   文章目录
   -------------------------------------------------------------------------- */

.toc {
    margin: 0 0 30px;
    padding: 16px 20px;
    background: var(--paper-deep);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.toc summary {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    list-style: none;
    font-family: var(--serif);
    font-size: 14.5px;
    letter-spacing: .06em;
    color: var(--ink);
}

.toc summary::-webkit-details-marker {
    display: none;
}

.toc summary::after {
    content: "展开";
    margin-left: auto;
    font-family: var(--sans);
    font-size: 11.5px;
    letter-spacing: 0;
    color: var(--ink-muted);
}

.toc[open] summary::after {
    content: "收起";
}

.toc-count {
    font-family: var(--sans);
    font-size: 11px;
    letter-spacing: 0;
    color: var(--accent);
    background: rgba(168, 50, 50, .1);
    padding: 1px 7px;
    border-radius: 999px;
}

.toc ol {
    margin: 14px 0 0;
    padding: 10px 0 0;
    list-style: none;
    counter-reset: toc;
    border-top: 1px dashed var(--line);
}

.toc li {
    padding: 4px 0;
    font-size: 13.5px;
    line-height: 1.7;
}

.toc li:not(.is-sub) {
    counter-increment: toc;
}

.toc li a {
    display: flex;
    gap: 9px;
    color: var(--ink-soft);
}

.toc li a:hover {
    color: var(--accent);
}

.toc li a::before {
    content: counter(toc, decimal-leading-zero);
    flex-shrink: 0;
    padding-top: 1px;
    font-size: 11px;
    color: var(--ink-muted);
}

.toc li.is-sub {
    padding-left: 20px;
}

.toc li.is-sub a::before {
    content: "·";
}

/* --------------------------------------------------------------------------
   阅读进度条
   -------------------------------------------------------------------------- */

.read-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    z-index: 80;
    pointer-events: none;
}

.read-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #d98b6a);
    transition: width .12s linear;
}

/* --------------------------------------------------------------------------
   图片放大
   -------------------------------------------------------------------------- */

.article-body img.zoomable {
    cursor: zoom-in;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 34px;
    background: rgba(12, 11, 10, .93);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}

.lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.lightbox img {
    max-width: 92vw;
    max-height: 86vh;
    border-radius: 8px;
    box-shadow: 0 26px 70px rgba(0, 0, 0, .55);
}

.lightbox-close {
    position: absolute;
    top: 18px;
    right: 22px;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 50%;
    background: rgba(255, 255, 255, .06);
    color: #f3ede3;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background .2s ease;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, .16);
}

/* --------------------------------------------------------------------------
   深色主题
   -------------------------------------------------------------------------- */

html[data-theme="dark"] {
    color-scheme: dark;
    --paper: #151412;
    --paper-deep: #201e1b;
    --card: #1c1b18;
    --ink: #e9e3d8;
    --ink-soft: #c3bcaf;
    --ink-muted: #8d867a;
    --line: #322f2a;
    --accent: #d3685a;
    --accent-soft: #e08a7c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 16px 36px rgba(0, 0, 0, .35);
}

html[data-theme="dark"] .theme-toggle .icon-moon {
    display: none;
}

html[data-theme="dark"] .theme-toggle .icon-sun {
    display: block;
}

html[data-theme="dark"] body {
    background-image:
        radial-gradient(circle at 12% 8%, rgba(211, 104, 90, .07), transparent 45%),
        radial-gradient(circle at 88% 0%, rgba(120, 150, 130, .06), transparent 40%);
}

html[data-theme="dark"] .site-header {
    background: rgba(21, 20, 18, .88);
}

html[data-theme="dark"] .site-footer {
    background: rgba(32, 30, 27, .45);
}

html[data-theme="dark"] .hero::before {
    background: radial-gradient(circle, rgba(211, 104, 90, .1), transparent 68%);
}

html[data-theme="dark"] .article-body {
    color: #d6cfc2;
}

html[data-theme="dark"] .article-body code {
    color: var(--accent-soft);
}

html[data-theme="dark"] .article-body .cm-code {
    background: #0f0e0d;
}

html[data-theme="dark"] .post-card:hover {
    border-color: #3a3731;
}

html[data-theme="dark"] .flash-error {
    color: #eda9a1;
}

html[data-theme="dark"] .flash-success {
    color: #93c3ad;
}

html[data-theme="dark"] .empty-mark,
html[data-theme="dark"] .error-code {
    color: rgba(211, 104, 90, .34);
}

html[data-theme="dark"] .lightbox {
    background: rgba(6, 6, 5, .95);
}

@media (max-width: 820px) {
    .theme-toggle {
        width: 32px;
        height: 32px;
    }

    .toc {
        padding: 14px 16px;
    }
}

