/* 赶知识网 — 知识站样式（本地，无外部依赖） */
:root {
    --ink: #1c1917;
    --ink-soft: #44403c;
    --muted: #78716c;
    --bg: #f7f6f3;
    --paper: #ffffff;
    --border: #e7e5e4;
    --border-strong: #d6d3d1;
    --accent: #0f766e;
    --accent-soft: #ccfbf1;
    --accent-hover: #0d9488;
    --danger: #b91c1c;
    --warn: #c2410c;
    --radius: 4px;
    --content-width: 1120px;
    --read-width: 46rem;
    --sidebar-width: 240px;
    --header-h: 64px;
    --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    --font-serif: "Songti SC", "STSong", "SimSun", "Noto Serif SC", Georgia, serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.7;
    color: var(--ink);
    background: var(--bg);
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-hover);
}

img {
    max-width: 100%;
    height: auto;
}

ul, ol {
    margin: 0;
    padding: 0;
}

h1, h2, h3, h4 {
    margin: 0;
    font-weight: 600;
    line-height: 1.35;
    color: var(--ink);
}

.container {
    width: 100%;
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* ========== Header ========== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.header .container {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 1.5rem;
}

.logo {
    flex-shrink: 0;
    margin: 0;
    font-size: 0;
    line-height: 0;
}

.logo a {
    display: block;
}

.logo img {
    height: 52px;
    width: auto;
    display: block;
    border: 0;
}

.logo-text {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: 0.04em;
}

.logo-text span {
    color: var(--accent);
}

.search-container {
    flex: 1;
    max-width: 400px;
}

.search-container form {
    display: flex;
    align-items: stretch;
    margin: 0;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg);
    transition: border-color 0.2s;
}

.search-container form:focus-within {
    border-color: var(--accent);
    background: var(--paper);
}

.search-input {
    flex: 1;
    min-width: 0;
    height: 38px;
    padding: 0 0.85rem;
    border: none;
    border-radius: 0;
    background: transparent;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--ink);
}

.search-input:focus {
    outline: none;
}

.search-button {
    flex-shrink: 0;
    min-width: 4rem;
    height: 38px;
    padding: 0 1rem;
    border: none;
    border-left: 1px solid var(--border-strong);
    border-radius: 0;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    transition: background 0.15s;
}

.search-button:hover {
    background: var(--accent-hover);
    color: #fff;
}

.nav {
    margin-left: auto;
    position: relative;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0.25rem;
}

.nav-item a {
    display: block;
    padding: 0.4rem 0.75rem;
    color: var(--ink-soft);
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
}

.nav-item a:hover,
.nav-item a.is-active {
    color: var(--accent);
    background: var(--accent-soft);
}

.nav-toggle {
    display: none;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--paper);
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.nav-toggle span {
    display: block;
    width: 16px;
    height: 2px;
    background: var(--ink);
}

/* ========== Main ========== */
.main {
    padding: 1.75rem 0 3rem;
    min-height: calc(100vh - var(--header-h) - 80px);
}

.page-head {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.page-head h1 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 700;
}

.page-head p {
    margin: 0.4rem 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

/* 双栏：内容 + 侧栏 */
.layout-with-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--sidebar-width);
    gap: 2.5rem;
    align-items: start;
}

.layout-primary {
    min-width: 0;
}

.layout-sidebar {
    position: sticky;
    top: calc(var(--header-h) + 1rem);
}

/* ========== 文章列表（知识站：列表而非卡片墙） ========== */
.article-feed {
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.article-row {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.article-row:last-child {
    border-bottom: none;
}

.article-row:hover {
    background: #fafaf9;
}

.article-row .article-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.article-row .article-title a {
    color: var(--ink);
}

.article-row .article-title a:hover {
    color: var(--accent);
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    color: var(--muted);
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.article-excerpt {
    margin: 0;
    color: var(--ink-soft);
    font-size: 0.92rem;
    line-height: 1.65;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.read-more {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

/* 首页精简列表 */
.home-feed .article-row {
    display: grid;
    grid-template-columns: 5.5rem minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.home-feed .article-date {
    font-size: 0.8rem;
    color: var(--muted);
    padding-top: 0.2rem;
    font-variant-numeric: tabular-nums;
}

.home-feed .article-title {
    margin-bottom: 0.25rem;
}

/* ========== 侧栏 ========== */
.sidebar-block {
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    margin-bottom: 1rem;
}

.sidebar-title {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.85rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.category-list,
.popular-list {
    list-style: none;
}

.category-list li,
.popular-list li {
    border-bottom: 1px dotted var(--border);
}

.category-list li:last-child,
.popular-list li:last-child {
    border-bottom: none;
}

.category-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0;
    color: var(--ink-soft);
    font-size: 0.9rem;
}

.category-list a:hover {
    color: var(--accent);
}

.category-count {
    color: var(--muted);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

.popular-list a {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.55rem 0;
    color: var(--ink-soft);
    font-size: 0.9rem;
}

.popular-list a:hover {
    color: var(--accent);
}

.popular-rank {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    line-height: 1.25rem;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--muted);
    background: var(--bg);
    border-radius: 2px;
}

.popular-list li:nth-child(1) .popular-rank,
.popular-list li:nth-child(2) .popular-rank,
.popular-list li:nth-child(3) .popular-rank {
    color: var(--paper);
    background: var(--accent);
}

.popular-title {
    flex: 1;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========== 文章详情 ========== */
.article-header {
    margin-bottom: 1.5rem;
}

.article-header .article-title {
    font-family: var(--font-serif);
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 0.85rem;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.75rem;
}

.tag {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    font-size: 0.8rem;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: 2px;
}

.tag:hover {
    background: var(--accent);
    color: var(--paper);
}

.article-body {
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem 2rem;
    margin-bottom: 1.5rem;
    font-size: 1.02rem;
    line-height: 1.85;
    color: var(--ink-soft);
}

.article-body h2,
.article-body h3,
.article-body h4 {
    margin: 1.75rem 0 0.75rem;
    color: var(--ink);
}

.article-body h2 {
    font-size: 1.35rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}

.article-body h3 {
    font-size: 1.15rem;
}

.article-body p {
    margin: 0 0 1.1rem;
}

.article-body ul,
.article-body ol {
    margin: 0 0 1.1rem;
    padding-left: 1.5rem;
}

.article-body li {
    margin-bottom: 0.35rem;
}

.article-body a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.article-body img {
    display: block;
    margin: 1.25rem auto;
    border: 1px solid var(--border);
}

.article-body blockquote {
    margin: 1.25rem 0;
    padding: 0.75rem 1.15rem;
    border-left: 3px solid var(--accent);
    background: var(--bg);
    color: var(--muted);
}

.article-body pre,
.article-body .code {
    margin: 1.25rem 0;
    padding: 1rem 1.15rem;
    background: #1c1917;
    color: #e7e5e4;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.55;
    font-family: Consolas, "Courier New", monospace;
}

.article-body code {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.9em;
    padding: 0.1em 0.35em;
    background: var(--bg);
    border-radius: 2px;
}

.article-body pre code {
    padding: 0;
    background: none;
    color: inherit;
}

.download-box {
    margin: 0 0 1.25rem;
    padding: 1rem 1.15rem;
    background: var(--bg);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    list-style: none;
}

.download-box li {
    margin: 0.35rem 0;
    font-size: 0.9rem;
}

.download-box a {
    font-weight: 500;
}

.article-actions {
    margin-bottom: 1.5rem;
}

.action-btn {
    display: inline-block;
    padding: 0.45rem 1rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--paper);
    color: var(--ink-soft);
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.action-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

/* 评论 */
.article-comments {
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.section-title {
    font-size: 1.1rem;
    margin-bottom: 1.15rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.comment-form {
    display: flex;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}

.comment-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg);
}

.comment-input-area {
    flex: 1;
}

.comment-input-area textarea,
.comment-input-area input {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    background: var(--bg);
}

.comment-input-area textarea:focus,
.comment-input-area input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--paper);
}

.comment-actions {
    margin-top: 0.65rem;
    display: flex;
    justify-content: flex-end;
}

.comment-submit {
    padding: 0.45rem 1.15rem;
    border: none;
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--paper);
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
}

.comment-submit:hover {
    background: var(--accent-hover);
}

.comment-list {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

.comment-item {
    display: flex;
    gap: 0.85rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.comment-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.comment-content {
    flex: 1;
    min-width: 0;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.comment-author {
    font-weight: 600;
    font-size: 0.9rem;
}

.comment-time {
    color: var(--muted);
    font-size: 0.8rem;
}

.comment-text {
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--ink-soft);
}

.comment-text p {
    margin: 0;
}

/* ========== 书签 ========== */
.bookmarks-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.bookmark-item {
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.15rem 1.25rem;
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s;
}

.bookmark-item:hover {
    border-color: var(--accent);
}

.bookmark-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.35rem;
    word-break: break-word;
}

.bookmark-url {
    font-size: 0.75rem;
    color: var(--muted);
    margin-bottom: 0.5rem;
    word-break: break-all;
}

.bookmark-description {
    flex: 1;
    margin: 0 0 0.85rem;
    font-size: 0.875rem;
    color: var(--ink-soft);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bookmark-actions {
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

/* ========== 分页 ========== */
.pagination-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding: 0.75rem 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.pagination-wrap a {
    color: var(--accent);
    font-weight: 500;
}

.pagination-wrap a:hover {
    text-decoration: underline;
}

/* ========== Footer ========== */
.footer {
    border-top: 1px solid var(--border);
    background: var(--paper);
    padding: 1.5rem 0;
    text-align: center;
}

.footer p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.footer a {
    color: var(--ink-soft);
}

.footer a:hover {
    color: var(--accent);
}

/* 返回顶部 */
.back-to-top {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--paper);
    color: var(--ink-soft);
    font-size: 1.1rem;
    line-height: 38px;
    text-align: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s, color 0.15s, border-color 0.15s;
    z-index: 90;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* ========== 流量卡 / 反馈等兼容块 ========== */
.card-list .shadow_box {
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    position: relative;
}

.card-list .shadow_box > i {
    position: absolute;
    left: 0;
    top: 0;
    width: 28px;
    height: 28px;
    background: var(--accent);
    color: #fff;
    font-style: normal;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    line-height: 28px;
    border-radius: 0 var(--radius) var(--radius) 0;
}

.card-list .shadow_box h3 {
    font-size: 1.05rem;
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.card_tips {
    line-height: 1.8;
    font-size: 0.92rem;
}

.card_tips ul {
    list-style: none;
    margin-bottom: 0.75rem;
}

.card_tips li {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.card_tips li span {
    flex: 0 0 5.5rem;
    font-weight: 600;
    color: var(--ink);
}

.card_tips li div {
    flex: 1;
    color: var(--ink-soft);
}

.feedback-list {
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 1.5rem;
}

.feedback-list li {
    list-style: none;
    padding: 1rem 0;
    border-bottom: 1px dashed var(--border);
    font-size: 0.92rem;
}

.feedback-list li:last-child {
    border-bottom: none;
}

.feedback-list .content {
    padding: 0.5rem 0 0 1rem;
    color: var(--ink-soft);
}

.feedback-list .reply {
    margin-top: 0.35rem;
    color: var(--warn);
}

/* 旧评论 AJAX 片段 */
.post-comments .comment-title,
#comments .comment-title {
    font-size: 1rem;
    margin: 1rem 0 0.75rem;
}

.comments-list {
    list-style: none;
}

.comments-list li {
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border);
}

.comments-list .desc-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.35rem;
}

.comments-list .desc-top h6 {
    margin: 0;
    font-size: 0.9rem;
}

.comments-list .date {
    color: var(--muted);
    font-size: 0.8rem;
}

.comments-list .reply,
.feedback-list .reply {
    margin-top: 0.35rem;
    color: var(--warn);
}

/* ========== 响应式 ========== */
@media (max-width: 900px) {
    .layout-with-sidebar {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .layout-sidebar {
        position: static;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .layout-sidebar .sidebar-block {
        margin-bottom: 0;
    }

    .bookmarks-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 720px) {
    .header .container {
        gap: 0.75rem;
    }

    .search-container {
        max-width: none;
        order: 3;
        flex: 1 1 100%;
        margin: 0;
    }

    .header {
        height: auto;
        padding: 0.65rem 0;
    }

    .header .container {
        flex-wrap: wrap;
    }

    .nav {
        margin-left: 0;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        display: none;
        position: absolute;
        right: 0;
        top: calc(100% + 0.5rem);
        flex-direction: column;
        min-width: 140px;
        background: var(--paper);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 0.35rem;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-item a {
        padding: 0.55rem 0.85rem;
    }

    .layout-sidebar {
        grid-template-columns: 1fr;
    }

    .home-feed .article-row {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .article-body {
        padding: 1.15rem;
    }

    .article-header .article-title {
        font-size: 1.45rem;
    }

    .bookmarks-grid {
        grid-template-columns: 1fr;
    }

    .comment-avatar {
        display: none;
    }
}
