@import url('/static/css/scrollbars.css');

:root {
    --bg: #f5f5f7;
    --bg-accent: #fbfbfd;
    --card: #fff;
    --text: #1d1d1f;
    --muted: #86868b;
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --accent-soft: rgba(0, 113, 227, 0.08);
    --accent-light: #2997ff;
    --border: rgba(0, 0, 0, 0.06);
    --border-hover: rgba(0, 0, 0, 0.12);
    --focus-ring: rgba(0, 113, 227, 0.28);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 8px 28px rgba(0, 0, 0, 0.08);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.06);
    --radius: 4px;
    --radius-lg: 4px;
    --radius-pill: 980px;
    --sidebar-w: 272px;
    --max-w: 980px;
    --post-link: #1d1d1f;
    --post-link-visited: #6e6e73;
    --post-link-hover: #0071e3;
    --post-link-active: #0077ed;
    --font-sans: 'MiSans', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-serif: 'MiSans', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.47059;
    font-size: 17px;
    font-weight: 400;
    letter-spacing: -0.022em;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--accent-hover); }
.article-body a {
    text-decoration: underline;
    text-underline-offset: 3px;
}
.sidebar-list a,
.category-page-list a {
    transition: color 0.2s ease;
}
.category-page-list a:link {
    color: var(--text);
}
.category-page-list a:visited {
    color: var(--post-link-visited);
}
.category-page-list a:hover {
    color: var(--post-link-hover);
}
.category-page-list a:active {
    color: var(--post-link-active);
}

/* header — 默认桌面布局；磨砂放在 ::before，避免 backdrop-filter 压扁顶栏或限制 fixed 菜单 */
.blog-top {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0 max(22px, calc((100% - var(--max-w)) / 2));
    height: 48px;
    min-height: 48px;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    box-sizing: border-box;
    isolation: isolate;
}
.blog-top::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    z-index: 0;
    pointer-events: none;
}
.blog-top > .blog-logo,
.blog-top > .nav-toggle,
.blog-top > .blog-nav--desktop,
.blog-top > .nav-search-wrap {
    position: relative;
    z-index: 1;
}
.blog-logo {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text);
    flex-shrink: 0;
    letter-spacing: -0.03em;
}
.blog-logo:hover { color: var(--text); opacity: 0.72; }

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 6px;
}
.nav-toggle span {
    display: block;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
    transition: transform 0.2s, opacity 0.2s;
}
.nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* PC 顶栏导航 */
.blog-nav--desktop {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    justify-content: center;
    margin: 0 12px;
}
/* 移动端全屏菜单（独立于 header，避免与 PC 样式冲突） */
.blog-nav--mobile {
    display: none;
}
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    color: var(--text);
    font-size: 0.8235rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.4;
    white-space: nowrap;
    opacity: 0.88;
    transition: opacity 0.2s, background 0.2s;
}
a.nav-link:hover,
.nav-dropdown-toggle:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text);
    opacity: 1;
}

.nav-item {
    position: relative;
}
/* 悬停桥：消除菜单与下拉之间的空隙，避免鼠标移入时菜单收起 */
.blog-nav--desktop .nav-item.has-dropdown::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 12px;
    z-index: 199;
}
.nav-caret {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 2px;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    opacity: 0.55;
    transition: transform 0.2s;
}
.blog-nav--desktop .nav-item.is-open .nav-caret,
.blog-nav--desktop .nav-item:hover .nav-caret {
    transform: rotate(180deg);
}

.nav-dropdown {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 148px;
    list-style: none;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    padding: 6px 0;
    z-index: 200;
    transform: translateY(-4px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
.blog-nav--desktop .nav-item:hover .nav-dropdown,
.blog-nav--desktop .nav-item.is-open .nav-dropdown,
.blog-nav--desktop .nav-item.is-hover .nav-dropdown {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.nav-dropdown li a {
    display: block;
    padding: 8px 16px;
    color: var(--text);
    font-size: 0.88rem;
    white-space: nowrap;
}
.nav-dropdown li a:hover {
    background: var(--accent-soft);
    color: var(--text);
}

.nav-search-wrap {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 0;
    position: relative;
}
.nav-search-field {
    position: relative;
    display: flex;
    align-items: center;
}
.nav-search-input {
    width: 0;
    min-width: 0;
    opacity: 0;
    padding: 0;
    margin: 0;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.9rem;
    outline: none;
    background: var(--card);
    pointer-events: none;
    transition:
        width 0.32s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.24s ease,
        padding 0.32s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.2s ease,
        margin 0.32s ease;
}
.nav-search-wrap.is-open .nav-search-input {
    width: 240px;
    opacity: 1;
    padding: 7px 12px;
    margin-right: 4px;
    border-color: var(--border);
    pointer-events: auto;
}
.nav-search-wrap.is-open .nav-search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--focus-ring);
}
.nav-search-results {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 320px;
    max-height: 360px;
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 6px 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    z-index: 300;
}
.nav-search-results li a {
    display: block;
    padding: 10px 14px;
    color: var(--text);
    transition: background 0.15s;
}
.nav-search-results li a:hover,
.nav-search-results li.is-active a {
    background: var(--accent-soft);
    color: var(--text);
}
.nav-search-results li.is-active a .sr-title {
    color: var(--accent);
}
.nav-search-results .sr-title {
    display: block;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 2px;
}
.nav-search-results .sr-meta {
    display: block;
    font-size: 0.78rem;
    color: var(--muted);
}
.nav-search-empty {
    padding: 12px 14px;
    font-size: 0.88rem;
    color: var(--muted);
}
.nav-search-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 0.92rem;
    cursor: pointer;
    border-radius: 6px;
    font-family: inherit;
    flex-shrink: 0;
}
.nav-search-btn:hover {
    background: var(--accent-soft);
    color: var(--text);
}

/* layout */
.blog-wrap {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 24px 20px 48px;
}
.blog-hero {
    padding: 48px 0 36px;
    margin-bottom: 8px;
    background: none;
    border: none;
    box-shadow: none;
    text-align: center;
}
.blog-hero h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 12px;
    color: var(--text);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.05;
}
.blog-hero p {
    color: var(--muted);
    font-size: 1.0625rem;
    letter-spacing: -0.01em;
    max-width: 32em;
    margin: 0 auto;
    line-height: 1.5;
}
.blog-hero #heroSubtitle {
    color: var(--text);
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: -0.02em;
}
.hero-proverb-note {
    margin-top: 10px !important;
    font-size: 0.9375rem !important;
    color: var(--muted) !important;
    max-width: 28em;
}

.blog-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--sidebar-w);
    gap: 24px;
    align-items: start;
}
.blog-grid > * {
    min-width: 0;
}

.blog-wrap--article {
    max-width: 1180px;
}
.blog-grid--article {
    grid-template-columns: 188px minmax(0, 1fr) var(--sidebar-w);
    gap: 20px 24px;
}
.blog-grid--article .article-toc {
    grid-column: 1;
    grid-row: 1;
}
.blog-grid--article .article-card {
    grid-column: 2;
    grid-row: 1;
}
.blog-grid--article .blog-sidebar {
    grid-column: 3;
    grid-row: 1;
}

.article-toc {
    position: sticky;
    top: 64px;
    align-self: start;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    padding: 14px 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.article-toc[hidden] {
    display: none;
}
.article-toc-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin: 0 0 10px;
    padding: 0;
    border: none;
    background: transparent;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: inherit;
    cursor: default;
}
.article-toc-caret {
    display: none;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    opacity: 0.6;
    transition: transform 0.2s;
}
.article-toc.is-expanded .article-toc-caret {
    transform: rotate(180deg);
}
.article-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.article-toc-list li {
    margin: 0;
}
.article-toc-list a {
    display: block;
    padding: 6px 8px 6px 10px;
    font-size: 0.8125rem;
    color: var(--text);
    border-left: 2px solid transparent;
    line-height: 1.45;
    text-decoration: none;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.82;
    cursor: pointer;
}
.article-toc-list a:hover {
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: 4px;
    opacity: 1;
}
.article-toc-list a.is-active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: var(--accent-soft);
    font-weight: 500;
    opacity: 1;
}
.article-toc-list li.toc-h3 a {
    padding-left: 18px;
    font-size: 0.78rem;
}
.article-toc-list li.toc-h4 a {
    padding-left: 26px;
    font-size: 0.75rem;
}

@media (min-width: 1181px) {
    .article-toc-title {
        pointer-events: none;
    }
    .article-toc-list {
        display: block !important;
    }
}

/* post cards */
.post-list { display: flex; flex-direction: column; gap: 20px; }
.post-load-sentinel {
    height: 1px;
    width: 100%;
    flex-shrink: 0;
    pointer-events: none;
}
.post-load-status {
    text-align: center;
    padding: 18px 16px 8px;
    font-size: 0.88rem;
    color: var(--muted);
}
.post-load-status.is-hidden { display: none; }
.post-load-status.is-loading { color: var(--accent); }
.post-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    box-shadow: var(--shadow-card);
    border: 1px solid transparent;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}
.post-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}
.post-card.is-read {
    background: var(--bg-accent);
    border-color: var(--border);
}
.post-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.post-card h2 {
    flex: 1;
    min-width: 0;
    font-size: 1.25rem;
    margin-bottom: 0;
    line-height: 1.3;
    font-weight: 600;
    letter-spacing: -0.03em;
}
.post-read-tag {
    flex-shrink: 0;
    display: none;
    margin-top: 4px;
    padding: 2px 8px;
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    letter-spacing: 0.02em;
    line-height: 1.4;
}
.post-card.is-read .post-read-tag {
    display: inline-block;
}

/* 文章列表链接：link / visited / hover / active */
.post-link,
.archive-post-list a,
.sidebar-list li[data-post-url] > a {
    text-decoration: none;
    background-image: linear-gradient(currentColor, currentColor);
    background-size: 0 1px;
    background-repeat: no-repeat;
    background-position: 0 100%;
    transition: color 0.2s ease, background-size 0.22s ease;
}
.post-link:link,
.archive-post-list a:link,
.sidebar-list li[data-post-url] > a:link {
    color: var(--post-link);
}
.post-link:visited,
.archive-post-list a:visited,
.sidebar-list li[data-post-url] > a:visited {
    color: var(--post-link-visited);
}
.post-link.is-read,
.archive-post-list a.is-read,
.sidebar-list li[data-post-url] > a.is-read {
    color: var(--post-link-visited);
}
.post-link:hover,
.archive-post-list a:hover,
.sidebar-list li[data-post-url] > a:hover {
    color: var(--post-link-hover);
    background-size: 100% 1px;
}
.post-link:active,
.archive-post-list a:active,
.sidebar-list li[data-post-url] > a:active {
    color: var(--post-link-active);
    background-size: 100% 1px;
}
.post-link.is-read:hover,
.archive-post-list a.is-read:hover,
.sidebar-list li[data-post-url] > a.is-read:hover {
    color: var(--post-link-hover);
}
.post-link.is-read:active,
.archive-post-list a.is-read:active,
.sidebar-list li[data-post-url] > a.is-read:active {
    color: var(--post-link-active);
}
.post-card.is-read .post-link:link,
.post-card.is-read .post-link:visited {
    color: var(--post-link-visited);
}
.post-card.is-read .post-link:hover {
    color: var(--post-link-hover);
}
.post-card.is-read .post-link:active {
    color: var(--post-link-active);
}
.post-meta {
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}
.post-meta .cat {
    background: var(--bg);
    border: none;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    text-decoration: none;
    transition: color 0.2s ease, background 0.2s ease;
}
.post-meta .cat:link {
    color: var(--muted);
}
.post-meta .cat:visited {
    color: #86868b;
}
.post-meta .cat:hover {
    color: var(--post-link-hover);
    background: var(--accent-soft);
}
.post-meta .cat:active {
    color: var(--post-link-active);
    background: rgba(0, 113, 227, 0.14);
}
.post-excerpt {
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}
.post-card.is-read .post-excerpt {
    color: #86868b;
}
.filter-hint {
    background: var(--bg-accent);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.88rem;
}
.filter-hint a { margin-left: 8px; }

/* article */
.article-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 36px 40px;
    box-shadow: var(--shadow-card);
    border: 1px solid transparent;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
}
.article-card h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.1;
    letter-spacing: -0.04em;
    padding-bottom: 0;
    border-bottom: none;
}
.article-body {
    margin-top: 24px;
    font-size: 1rem;
    line-height: 1.85;
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
    color: var(--text);
}
/* 正文首个 h1 与标题重复时隐藏 */
.article-body > h1:first-child {
    display: none;
}
.article-body > h2:first-child,
.article-body > h3:first-child {
    margin-top: 0;
}
.article-body img,
.article-body video,
.article-body iframe {
    max-width: 100%;
    height: auto;
}
.article-body h2,
.article-body h3,
.article-body h4 {
    scroll-margin-top: 72px;
}
.article-body h2 {
    margin: 1.8em 0 0.8em;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    padding-bottom: 0.35em;
    border-bottom: 1px solid var(--border);
    letter-spacing: -0.02em;
}
.article-body h3 {
    margin: 1.5em 0 0.6em;
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text);
    padding-left: 0;
    border-left: none;
}
.article-body h4 { margin: 1.2em 0 0.5em; font-size: 1.02rem; }
.article-body p { margin: 1em 0; }
.article-body ul, .article-body ol { margin: 1em 0; padding-left: 1.8em; }
.article-body li { margin: 0.35em 0; }
.article-body li > ul, .article-body li > ol { margin: 0.3em 0; }
.article-body hr {
    border: none;
    border-top: 1px dashed var(--border);
    margin: 2em 0;
}
.article-body a { word-break: break-all; }
.article-body strong { color: var(--text); font-weight: 600; }
.article-body code {
    background: var(--bg-accent);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}
.article-body pre {
    background: #1d1d1f;
    color: #f5f5f7;
    padding: 18px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 1em 0;
    font-size: 0.8824rem;
}
.article-body pre code { background: none; padding: 0; color: inherit; }
.article-body table {
    display: block;
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.article-body th, .article-body td {
    border: 1px solid var(--border);
    padding: 8px 12px;
}
.article-body blockquote {
    border-left: 3px solid var(--border-hover);
    padding-left: 16px;
    color: var(--muted);
    margin: 1em 0;
}

.article-body img.article-img {
    display: block;
    margin: 1.25em auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-accent);
    opacity: 0;
    transition: opacity 0.25s ease;
    content-visibility: auto;
    contain-intrinsic-size: 320px 180px;
    cursor: zoom-in;
}
.article-body img:not(.is-error) {
    cursor: zoom-in;
}
.article-body img.article-img.is-loaded,
.article-body img.article-img[loading="eager"],
.article-body img.article-img:not([loading="lazy"]) {
    opacity: 1;
}
.article-body img.article-img.is-error {
    opacity: 0.45;
    min-height: 120px;
}

.img-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 24px 24px;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.img-lightbox[hidden] {
    display: none;
}
.img-lightbox-img {
    max-width: min(96vw, 1280px);
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.35);
}
.img-lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
}
.img-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.24);
}

.article-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.article-nav-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    border: none;
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    text-decoration: none;
    transition: background 0.2s, transform 0.2s;
    min-width: 0;
}
.article-nav-link:hover {
    background: #ebebed;
    text-decoration: none;
    color: var(--text);
}
.article-nav-link.next { text-align: right; }
.article-nav-link.is-disabled {
    color: var(--muted);
    background: var(--bg-accent);
    cursor: default;
    pointer-events: none;
}
.article-nav-label {
    font-size: 0.75rem;
    color: var(--muted);
    letter-spacing: 0.02em;
}
.article-nav-title {
    font-size: 0.875rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.article-comments {
    margin-top: 36px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}
.article-comments-head {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 14px;
}
.article-comments-head h2 {
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.comment-count {
    font-size: 0.75rem;
    color: var(--muted);
}
.comment-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}
.comment-form input,
.comment-form textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.8125rem;
    outline: none;
    background: var(--card);
    resize: vertical;
}
.comment-form input:focus,
.comment-form textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--focus-ring);
}
.comment-form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}
.comment-submit {
    padding: 7px 16px;
    border: none;
    border-radius: var(--radius-pill);
    background: var(--accent);
    color: #fff;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}
.comment-submit:hover:not(:disabled) { background: var(--accent-hover); }
.comment-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.comment-hint {
    font-size: 0.75rem;
    color: var(--muted);
    margin: 0;
}
.comment-hint.is-error { color: var(--danger, #dc2626); }
.comment-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.comment-list > .comment-item {
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.comment-list > .comment-item:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow);
}
.comment-item-inner {
    display: flex;
    align-items: flex-start;
    gap: 9px;
}
.comment-main {
    flex: 1;
    min-width: 0;
}
.comment-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
    background: var(--bg-accent);
}
.comment-replies .comment-avatar {
    width: 24px;
    height: 24px;
}
.comment-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
    line-height: 1.4;
}
.comment-author {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text);
}
.comment-time {
    font-size: 0.6875rem;
    color: var(--muted);
}
.comment-time::before {
    content: '·';
    margin-right: 6px;
    color: var(--border-hover);
}
.comment-body {
    font-size: 0.8125rem;
    line-height: 1.55;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}
.comment-empty,
.comment-loading {
    padding: 16px;
    text-align: center;
    color: var(--muted);
    font-size: 0.75rem;
}
.comment-replies {
    list-style: none;
    margin: 8px 0 0;
    padding: 4px 0 0 11px;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.comment-replies .comment-item {
    padding: 6px 0 2px;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
.comment-replies .comment-item:hover {
    box-shadow: none;
}
.comment-replies .comment-body {
    font-size: 0.75rem;
    line-height: 1.5;
    color: #424245;
}
.comment-replies .comment-author {
    font-size: 0.6875rem;
}
.comment-replies .comment-time {
    font-size: 0.625rem;
}
.comment-reply-btn {
    margin-left: auto;
    padding: 1px 6px;
    border: none;
    border-radius: 3px;
    background: transparent;
    color: var(--muted);
    font-size: 0.6875rem;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s ease, background 0.15s ease;
}
.comment-reply-btn:hover {
    color: var(--accent);
    background: var(--accent-soft);
}
.comment-replying {
    font-size: 0.75rem;
    color: var(--muted);
    margin: 0 0 6px;
    padding: 6px 8px;
    background: var(--bg-accent);
    border-radius: var(--radius);
}
.comment-reply-cancel {
    margin-left: 8px;
    padding: 0;
    border: none;
    background: none;
    color: var(--text);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: inherit;
}
.comment-captcha-row label {
    display: block;
    font-size: 0.75rem;
    margin-bottom: 5px;
    color: var(--text);
}
.captcha-question {
    font-weight: 600;
    margin-left: 4px;
}
.article-backlinks {
    margin-top: 32px;
    font-size: 0.875rem;
    color: var(--muted);
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 640px) {
    .article-nav { grid-template-columns: 1fr; }
    .article-nav-link.next { text-align: left; }
}

/* sidebar */
.blog-sidebar { display: flex; flex-direction: column; gap: 20px; }
.sidebar-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-card);
    border: 1px solid transparent;
}
.sidebar-card.profile {
    background: var(--card);
}
.sidebar-card h3 {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 14px;
    padding-bottom: 0;
    border-bottom: none;
    color: var(--muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.profile {
    text-align: center;
}
.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(145deg, #e8e8ed, #d2d2d7);
    color: var(--text);
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}
.profile-name { font-weight: 600; margin-bottom: 4px; letter-spacing: -0.01em; }
.profile-motto { font-size: 0.85rem; color: var(--muted); margin-bottom: 12px; }
.profile-social {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.social-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text);
    transition: transform 0.2s, background 0.2s, color 0.2s;
}
.social-icon:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.social-github:hover { background: #24292e; }
.social-email:hover { background: #4a7dbe; }
.social-weixin:hover { background: #07c160; }
.social-facebook:hover { background: #0f94f4; }
.sidebar-list { list-style: none; }
.sidebar-list li {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}
.sidebar-list li:last-child { border-bottom: none; }
.sidebar-list li[data-post-url] > a {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-list .count { color: var(--muted); flex-shrink: 0; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud a {
    font-size: 0.8rem;
    padding: 5px 12px;
    background: var(--bg);
    border-radius: var(--radius-pill);
    color: var(--muted);
    border: none;
}
.tag-cloud a:hover { background: var(--accent); color: #fff; }
.site-info-desc {
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.55;
    margin: -4px 0 12px;
}
.site-info-stats {
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
}
.site-info-stats li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.84rem;
}
.site-info-stats li:last-child { border-bottom: none; }
.site-info-stats span { color: var(--muted); }
.site-info-stats strong {
    font-weight: 600;
    color: var(--text);
    font-size: 0.88rem;
}
.site-info-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.site-info-links a {
    font-size: 0.78rem;
    padding: 5px 11px;
    background: var(--bg);
    border-radius: var(--radius-pill);
    color: var(--muted);
    transition: background 0.15s, color 0.15s;
}
.site-info-links a:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

/* footer */
.blog-footer {
    text-align: center;
    padding: 36px 20px 40px;
    color: var(--muted);
    font-size: 0.82rem;
    border-top: 1px solid var(--border);
    margin-top: 32px;
    letter-spacing: 0;
}
.blog-footer a {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s ease;
}
.blog-footer a:hover {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* back to top */
.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 32px;
    z-index: 500;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    color: var(--accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-hover);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s, box-shadow 0.2s;
}
.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.back-to-top:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.back-to-top svg {
    display: block;
}

/* search */
.blog-search {
    margin-bottom: 16px;
}
.blog-search input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    outline: none;
}
.blog-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }

/* friend links */
.flink-desc { color: var(--muted); margin-bottom: 12px; }
.flink-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin: 16px 0 28px;
}
.flink-item {
    display: block;
    padding: 18px;
    border: none;
    border-radius: var(--radius-lg);
    background: var(--card);
    color: var(--text);
    box-shadow: var(--shadow-card);
    transition: transform 0.2s, box-shadow 0.2s;
}
.flink-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    color: var(--text);
}
.flink-item img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
}
.flink-item-name { font-weight: 600; margin-bottom: 4px; }
.flink-item-desc { font-size: 0.85rem; color: var(--muted); }

.list-hint { color: var(--muted); margin-bottom: 20px; }
.archive-year { margin: 24px 0 12px; font-size: 1.2rem; }
.archive-post-list { list-style: none; }
.archive-post-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border);
}
.archive-post-list span { color: var(--muted); font-size: 0.88rem; flex-shrink: 0; }
.tag-cloud-page { margin-top: 8px; }
.category-page-list { list-style: none; }
.category-page-list li {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px dashed var(--border);
}
.category-page-list a { color: var(--text); font-size: 1.05rem; }
.category-page-list a:hover { color: var(--accent); }

/* resources */
.resource-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0 28px;
    padding-bottom: 16px;
    border-bottom: 1px dashed var(--border);
}
.resource-nav a {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--muted);
    font-size: 0.875rem;
}
.resource-nav a:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.resource-section {
    margin-bottom: 36px;
}
.resource-section h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 8px;
    padding-left: 0;
    border-left: none;
    letter-spacing: -0.02em;
}
.resource-desc {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 16px;
}
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}
.photo-item {
    display: block;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--card);
    transition: border-color 0.2s;
}
.photo-item:hover {
    border-color: var(--border-hover);
}
.photo-item img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
}
.photo-caption {
    display: block;
    padding: 6px 8px;
    font-size: 0.78rem;
    color: var(--muted);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.music-list, .movie-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.music-item, .movie-item {
    display: flex;
    gap: 14px;
    padding: 16px;
    border: none;
    border-radius: var(--radius-lg);
    background: var(--card);
    color: var(--text);
    box-shadow: var(--shadow-card);
    transition: transform 0.2s, box-shadow 0.2s;
}
.music-item:hover, .movie-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    color: var(--text);
}
.music-cover {
    width: 64px;
    height: 64px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}
.music-title, .movie-title {
    font-weight: 600;
    margin-bottom: 4px;
}
.music-meta, .movie-meta {
    font-size: 0.85rem;
    color: var(--muted);
}
.movie-cover {
    width: 80px;
    height: 112px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}
.movie-desc {
    margin-top: 6px;
    font-size: 0.88rem;
    color: var(--muted);
    line-height: 1.5;
}

@media (max-width: 1180px) {
    .blog-grid--article {
        grid-template-columns: minmax(0, 1fr) var(--sidebar-w);
    }
    .blog-grid--article .article-toc {
        grid-column: 1 / -1;
        grid-row: 1;
        position: static;
        max-height: none;
        margin-bottom: 4px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    .blog-grid--article .article-card {
        grid-column: 1;
        grid-row: 2;
    }
    .blog-grid--article .blog-sidebar {
        grid-column: 2;
        grid-row: 1 / span 2;
    }
    .article-toc-title {
        cursor: pointer;
        margin-bottom: 0;
        padding: 2px 0;
    }
    .article-toc-caret {
        display: inline-block;
    }
    .article-toc:not(.is-expanded) .article-toc-list {
        display: none;
    }
    .article-toc.is-expanded .article-toc-title {
        margin-bottom: 10px;
    }
    .article-toc.is-expanded .article-toc-list {
        display: block;
        max-height: 240px;
        overflow-y: auto;
    }
}

@media (max-width: 960px) {
    .blog-grid,
    .blog-grid--article { grid-template-columns: 1fr; }
    .blog-sidebar { order: 2; }
    .post-list { order: 1; }
    .blog-wrap--article { max-width: var(--max-w); }

    .blog-grid--article .article-toc {
        grid-column: 1;
        grid-row: 1;
        width: 100%;
        max-width: 100%;
    }
    .blog-grid--article .article-card {
        grid-column: 1;
        grid-row: 2;
    }
    .blog-grid--article .blog-sidebar {
        grid-column: 1;
        grid-row: 3;
    }

    body.nav-menu-open {
        overflow: hidden;
    }
    html.nav-menu-open {
        overflow: hidden;
    }

    .blog-top {
        z-index: 300;
        display: grid;
        grid-template-columns: 1fr auto auto;
        grid-template-rows: 48px;
        align-items: center;
        max-width: none;
        margin: 0;
        padding: 0;
        height: auto;
        min-height: 0;
        gap: 0;
        border-bottom: 1px solid var(--border);
    }
    .blog-top::before {
        position: static;
        inset: auto;
        grid-column: 1 / -1;
        grid-row: 1;
        align-self: stretch;
        min-height: 48px;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .blog-top > .blog-logo,
    .blog-top > .nav-toggle,
    .blog-top > .nav-search-wrap {
        grid-row: 1;
    }
    .blog-logo {
        grid-column: 1;
        padding-left: 16px;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .nav-toggle {
        grid-column: 2;
        display: flex;
        flex-shrink: 0;
    }
    .nav-search-wrap {
        grid-column: 3;
        padding-right: 16px;
        flex-shrink: 0;
    }
    .blog-nav--desktop {
        display: none;
    }
    .blog-nav--mobile {
        display: none;
        position: fixed;
        top: 48px;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 295;
        flex-direction: column;
        align-items: stretch;
        margin: 0;
        padding: 0;
        background: #fff;
        border: none;
        border-top: 1px solid var(--border);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        min-height: calc(100vh - 48px);
        min-height: calc(100dvh - 48px);
    }
    .blog-nav--mobile.is-open {
        display: flex;
    }

    .blog-nav--mobile > .nav-link,
    .blog-nav--mobile > .nav-item {
        width: 100%;
        background: #fff;
        border-bottom: 1px solid var(--border);
    }
    .blog-nav--mobile > .nav-item:last-child,
    .blog-nav--mobile > .nav-link:last-child {
        border-bottom: none;
    }
    .blog-nav--mobile .nav-item {
        width: 100%;
    }
    .blog-nav--mobile .nav-link,
    .blog-nav--mobile .nav-dropdown-toggle {
        width: 100%;
        justify-content: space-between;
        padding: 14px 16px;
        border-radius: 0;
        opacity: 1;
        color: var(--text);
        background: #fff;
    }
    .blog-nav--mobile a.nav-link:hover,
    .blog-nav--mobile .nav-dropdown-toggle:hover {
        background: transparent;
        color: var(--text);
    }
    .blog-nav--mobile .nav-item:hover .nav-caret {
        transform: none;
    }
    .blog-nav--mobile .nav-item.is-open .nav-caret {
        transform: rotate(180deg);
    }

    .blog-nav--mobile .nav-item.has-dropdown::before {
        display: none;
    }

    .blog-nav--mobile .nav-dropdown {
        display: none;
        position: static;
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
        transform: none;
        box-shadow: none;
        border: none;
        border-radius: 0;
        padding: 0 0 8px 12px;
        margin: 0;
        background: transparent;
        min-width: 0;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .blog-nav--mobile .nav-item.is-open .nav-dropdown {
        display: block;
        background: #fff;
    }
    .blog-nav--mobile .nav-dropdown li {
        display: block;
        margin: 0;
    }
    .blog-nav--mobile .nav-dropdown li a {
        display: block;
        padding: 10px 12px;
        border-radius: 6px;
        color: var(--text);
        font-size: 0.9rem;
        white-space: normal;
        word-break: break-word;
    }
    .blog-nav--mobile .nav-dropdown li a:hover {
        background: var(--bg);
        color: var(--accent);
    }

    .nav-search-text { display: none; }
    .nav-search-btn {
        padding: 8px 10px;
    }
    .nav-search-wrap.is-open .nav-search-input {
        width: min(36vw, 140px);
    }
    .nav-search-results {
        width: min(92vw, 300px);
        right: 0;
    }

    .back-to-top {
        right: 16px;
        bottom: 20px;
        width: 40px;
        height: 40px;
    }
}
