/* ============ 基础 ============ */
:root {
    --bg: #f5f6fa;
    --surface: #ffffff;
    --text: #1f2432;
    --muted: #6b7280;
    --line: #e6e8f0;
    --accent: #3b5bdb;
    --accent-strong: #2f4bbd;
    --accent-soft: #eef1ff;
    --danger: #d64545;
    --success: #15803d;
    --warning: #b45309;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 18px 40px -28px rgba(16, 24, 40, .35);
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
}

h1, h2, h3, h4 {
    line-height: 1.3;
    margin: 0;
    font-weight: 700;
}

p {
    margin: 0;
}

.container {
    width: 100%;
    max-width: 1420px;
    margin: 0 auto;
    padding: 0 24px;
}

.muted {
    color: var(--muted);
}

/* ============ 顶部导航 ============ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 68px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), #7b8cff);
    color: #fff;
    font-weight: 800;
    font-size: 17px;
    box-shadow: 0 8px 18px -8px rgba(59, 91, 219, .6);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

    .brand-text strong {
        font-size: 17px;
        letter-spacing: .2px;
    }

    .brand-text small {
        color: var(--muted);
        font-size: 12px;
    }

.site-nav {
    display: flex;
    align-items: center;
    gap: 22px;
    font-size: 14.5px;
    color: #3a3f4d;
}

    .site-nav > a {
        padding: 6px 2px;
        position: relative;
        white-space: nowrap;
    }

        .site-nav > a::after {
            content: "";
            position: absolute;
            left: 0;
            right: 0;
            bottom: 0;
            height: 2px;
            border-radius: 2px;
            background: var(--accent);
            transform: scaleX(0);
            transition: transform .2s ease;
        }

        .site-nav > a:hover {
            color: var(--accent);
        }

            .site-nav > a:hover::after {
                transform: scaleX(1);
            }

.nav-search input {
    width: 190px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f8f9fc;
    color: var(--text);
    font-size: 13.5px;
    outline: none;
    transition: border-color .2s, background .2s;
}

    .nav-search input:focus {
        border-color: #b8c3f6;
        background: #fff;
        box-shadow: 0 0 0 3px rgba(59, 91, 219, .1);
    }

.nav-toggle {
    display: none;
    width: 40px;
    height: 40px;
    padding: 9px 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    flex-direction: column;
    justify-content: space-between;
}

    .nav-toggle span {
        display: block;
        height: 2px;
        border-radius: 2px;
        background: #3a3f4d;
    }

/* ============ 主布局 ============ */
.main-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 306px;
    gap: 44px;
    padding-top: 44px;
    padding-bottom: 72px;
}

.content {
    min-width: 0;
}

.content-full {
    max-width: 1060px;
    margin: 0 auto;
}

/* ============ 首页 Hero ============ */
.hero {
    padding: 34px 0 28px;
}

.hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.hero h1 {
    font-size: clamp(30px, 4vw, 42px);
    letter-spacing: -.5px;
}

.hero p {
    margin-top: 12px;
    color: var(--muted);
    font-size: 16.5px;
    max-width: 640px;
}

.hero-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

    .hero-skills span {
        padding: 5px 12px;
        border-radius: 999px;
        background: #fff;
        border: 1px solid var(--line);
        color: #4a5165;
        font-size: 13px;
        font-weight: 600;
    }

.page-header {
    padding: 26px 0 26px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 28px;
}

    .page-header h1 {
        font-size: 28px;
        letter-spacing: -.3px;
    }

    .page-header p {
        margin-top: 8px;
        color: var(--muted);
    }

/* ============ 文章卡片 ============ */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.post-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 26px 28px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

    .post-card:hover {
        transform: translateY(-3px);
        border-color: #d9def7;
        box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 24px 50px -32px rgba(16, 24, 40, .4);
    }

    .post-card.has-cover {
        grid-template-columns: minmax(0, 1fr) 190px;
        align-items: center;
    }

.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    color: var(--muted);
    font-size: 13px;
}

    .post-meta a {
        color: var(--accent);
        background: var(--accent-soft);
        padding: 2px 9px;
        border-radius: 999px;
        font-size: 12.5px;
    }

.post-card-title {
    font-size: 22px;
    margin-top: 12px;
    letter-spacing: -.2px;
}

    .post-card-title a:hover {
        color: var(--accent);
    }

.post-card-summary {
    margin-top: 10px;
    color: #5a6172;
    font-size: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px dashed var(--line);
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    background: #f2f4f9;
    color: #5b6275;
    font-size: 12.5px;
    transition: background .18s, color .18s;
}

    .tag:hover {
        background: var(--accent-soft);
        color: var(--accent);
    }

.read-more {
    color: var(--accent);
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
}

.post-card-cover img {
    width: 100%;
    height: 132px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--line);
}

/* ============ 分页 ============ */
.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 34px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: #4a5062;
    font-size: 14px;
    transition: all .18s;
}

    .page-link:hover {
        border-color: #b9c4f2;
        color: var(--accent);
    }

    .page-link.active {
        background: var(--accent);
        border-color: var(--accent);
        color: #fff;
        font-weight: 600;
    }

    .page-link.disabled {
        opacity: .45;
        pointer-events: none;
    }

.page-ellipsis {
    color: var(--muted);
    padding: 0 4px;
}

/* ============ 侧边栏 ============ */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.widget {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow);
}

.widget-title {
    font-size: 14px;
    letter-spacing: .5px;
    margin-bottom: 14px;
    padding-left: 10px;
    position: relative;
}

    .widget-title::before {
        content: "";
        position: absolute;
        left: 0;
        top: 2px;
        bottom: 2px;
        width: 3px;
        border-radius: 3px;
        background: linear-gradient(180deg, var(--accent), #8ea0ff);
    }

.widget-text {
    color: var(--muted);
    font-size: 13.5px;
}

.widget-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

    .widget-list li + li {
        margin-top: 4px;
    }

    .widget-list a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 6px 8px;
        border-radius: 8px;
        font-size: 13.5px;
        color: #454b5c;
        transition: background .18s, color .18s;
    }

        .widget-list a:hover {
            background: #f6f8fd;
            color: var(--accent);
        }

    .widget-list em {
        font-style: normal;
        color: var(--muted);
        font-size: 12.5px;
    }

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

    .tag-cloud a {
        padding: 4px 11px;
        border-radius: 999px;
        background: #f3f5fa;
        font-size: 12.5px;
        color: #596074;
        transition: all .18s;
    }

        .tag-cloud a:hover {
            background: var(--accent);
            color: #fff;
        }

.widget-posts {
    list-style: none;
    margin: 0;
    padding: 0;
}

    .widget-posts li {
        padding: 8px 0;
        border-bottom: 1px dashed var(--line);
    }

        .widget-posts li:last-child {
            border-bottom: none;
            padding-bottom: 0;
        }

    .widget-posts a {
        display: block;
        font-size: 13.5px;
        line-height: 1.55;
        color: #343949;
    }

        .widget-posts a:hover {
            color: var(--accent);
        }

    .widget-posts span {
        display: block;
        margin-top: 3px;
        color: var(--muted);
        font-size: 12px;
    }

/* ============ 文章详情 ============ */
.article {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: clamp(24px, 4vw, 46px);
    box-shadow: var(--shadow);
}

.article-header h1 {
    margin-top: 14px;
    font-size: clamp(26px, 3.4vw, 36px);
    letter-spacing: -.6px;
}

.article-summary {
    margin-top: 14px;
    color: var(--muted);
    font-size: 15px;
    padding-left: 14px;
    border-left: 3px solid var(--accent-soft);
}

.article-cover {
    width: 100%;
    max-height: 380px;
    object-fit: cover;
    border-radius: 12px;
    margin: 26px 0 6px;
    border: 1px solid var(--line);
}

.markdown-body {
    font-size: 16px;
    line-height: 1.86;
    color: #2a2f3c;
    margin-top: 24px;
}

    .markdown-body h2, .markdown-body h3, .markdown-body h4 {
        margin: 38px 0 14px;
        scroll-margin-top: 90px;
    }

    .markdown-body h2 {
        font-size: 24px;
    }

    .markdown-body h3 {
        font-size: 19px;
    }

    .markdown-body p {
        margin: 14px 0;
    }

    .markdown-body ul, .markdown-body ol {
        padding-left: 24px;
        margin: 14px 0;
    }

    .markdown-body li {
        margin: 6px 0;
    }

    .markdown-body a {
        color: var(--accent);
        border-bottom: 1px solid rgba(59, 91, 219, .3);
    }

    .markdown-body blockquote {
        margin: 20px 0;
        padding: 12px 18px;
        border-left: 4px solid #c4cef7;
        background: #f7f8fe;
        border-radius: 0 10px 10px 0;
        color: #4b5266;
    }

    .markdown-body code {
        font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
        font-size: 13.5px;
        background: #f2f4f9;
        padding: 2px 6px;
        border-radius: 5px;
    }

    .markdown-body pre {
        background: #1f2430;
        color: #e5e9f5;
        padding: 18px 20px;
        border-radius: 12px;
        overflow-x: auto;
        line-height: 1.65;
        margin: 20px 0;
    }

        .markdown-body pre code {
            background: transparent;
            color: inherit;
            padding: 0;
            font-size: 13.5px;
        }

    .markdown-body table {
        width: 100%;
        border-collapse: collapse;
        margin: 20px 0;
        font-size: 14.5px;
    }

    .markdown-body th, .markdown-body td {
        border: 1px solid var(--line);
        padding: 9px 14px;
        text-align: left;
    }

    .markdown-body th {
        background: #f6f7fb;
    }

    .markdown-body img {
        border-radius: 10px;
        margin: 10px 0;
    }

.article-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 34px;
    padding-top: 20px;
    border-top: 1px dashed var(--line);
    font-size: 13.5px;
    color: var(--muted);
}

.article-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 22px;
}

.article-nav-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    box-shadow: var(--shadow);
    transition: border-color .18s, transform .18s;
}

    .article-nav-item:hover {
        border-color: #c2ccf6;
        transform: translateY(-2px);
    }

    .article-nav-item.next {
        text-align: right;
        align-items: flex-end;
    }

    .article-nav-item small {
        color: var(--muted);
        font-size: 12px;
    }

    .article-nav-item span {
        font-size: 14.5px;
        font-weight: 600;
    }

    .article-nav-item.empty {
        visibility: hidden;
    }

/* ============ 评论 ============ */
.comments {
    margin-top: 44px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: clamp(22px, 3vw, 34px);
    box-shadow: var(--shadow);
}

.comments-title {
    font-size: 20px;
}

    .comments-title span {
        color: var(--muted);
        font-size: 14px;
        font-weight: 500;
    }

.comment-list {
    margin-top: 22px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comment {
    display: flex;
    gap: 14px;
}

.comment-avatar {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
}

.comment-main {
    flex: 1;
    min-width: 0;
}

.comment-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

    .comment-head strong {
        font-size: 14px;
    }

    .comment-head span {
        color: var(--muted);
        font-size: 12.5px;
    }

.comment-content {
    margin-top: 4px;
    color: #4a5061;
    font-size: 14.5px;
    white-space: pre-line;
    word-break: break-word;
}

.comment-form {
    margin-top: 30px;
    padding-top: 26px;
    border-top: 1px solid var(--line);
}

    .comment-form h3 {
        font-size: 16px;
        margin-bottom: 16px;
    }

.honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

/* ============ 表单控件 ============ */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    margin-bottom: 16px;
}

    .form-group label {
        display: block;
        margin-bottom: 6px;
        font-size: 13.5px;
        font-weight: 600;
        color: #3d4354;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        width: 100%;
        padding: 10px 13px;
        border: 1px solid var(--line);
        border-radius: var(--radius-sm);
        background: #fff;
        color: var(--text);
        font-family: inherit;
        font-size: 14px;
        line-height: 1.6;
        outline: none;
        transition: border-color .18s, box-shadow .18s;
    }

    .form-group textarea {
        resize: vertical;
    }

        .form-group input:focus,
        .form-group select:focus,
        .form-group textarea:focus {
            border-color: #a9b8f5;
            box-shadow: 0 0 0 3px rgba(59, 91, 219, .1);
        }

.form-hint {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 12.5px;
}

.required {
    color: var(--danger);
}

.checkbox {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 13.5px;
    color: #454b5c;
    cursor: pointer;
    margin: 12px 0;
}

    .checkbox input {
        width: 16px;
        height: 16px;
        margin-top: 2px;
        accent-color: var(--accent);
    }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all .18s;
}

    .btn:hover {
        border-color: #bcc7f4;
        color: var(--accent);
    }

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 10px 22px -14px rgba(59, 91, 219, .9);
}

    .btn-primary:hover {
        background: var(--accent-strong);
        border-color: var(--accent-strong);
        color: #fff;
    }

.btn-block {
    width: 100%;
}

/* ============ 提示条 ============ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.alert-success {
    background: #ecfdf3;
    border-color: #c6f0d8;
    color: #166534;
}

.alert-error {
    background: #fef2f2;
    border-color: #fad1d1;
    color: #9f1c1c;
}

.alert:empty {
    display: none;
}

.validation-message {
    display: block;
    margin-top: 5px;
    color: var(--danger);
    font-size: 12.5px;
}

/* ============ 分类网格 ============ */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 16px;
}

.category-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 22px 24px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform .18s, border-color .18s;
}

    .category-card:hover {
        transform: translateY(-2px);
        border-color: #c8d2f7;
    }

    .category-card strong {
        font-size: 16.5px;
    }

    .category-card span {
        color: var(--muted);
        font-size: 13px;
    }

/* ============ 空状态与错误页 ============ */
.empty-state {
    padding: 56px 24px;
    text-align: center;
    background: #fff;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    color: #4a5061;
}

    .empty-state .muted {
        margin-top: 8px;
        font-size: 13.5px;
    }

.error-page {
    text-align: center;
    padding: 90px 20px 60px;
}

.error-code {
    font-size: clamp(64px, 12vw, 110px);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -4px;
    color: #dfe4f5;
}

.error-page h1 {
    margin-top: 18px;
    font-size: 24px;
}

.error-page .muted {
    margin: 10px 0 26px;
}

/* ============ 页脚 ============ */
.site-footer {
    border-top: 1px solid var(--line);
    background: #fff;
    padding: 26px 0;
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
}

    .footer-links a:hover {
        color: var(--accent);
    }

/* ============ 响应式 ============ */
@media (max-width: 980px) {
    .main-layout {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .sidebar {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
}

@media (max-width: 760px) {
    .container {
        padding: 0 16px;
    }

    .header-inner {
        min-height: 60px;
    }

    .nav-toggle {
        display: flex;
    }

    .site-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 14px 16px 18px;
        background: #fff;
        border-bottom: 1px solid var(--line);
        box-shadow: 0 20px 30px -24px rgba(16, 24, 40, .5);
    }

        .site-nav.open {
            display: flex;
        }

        .site-nav > a {
            padding: 10px 4px;
            border-bottom: 1px dashed var(--line);
        }

    .nav-search input {
        width: 100%;
        margin-top: 8px;
    }

    .main-layout {
        padding-top: 28px;
        padding-bottom: 48px;
    }

    .hero {
        padding: 20px 0 22px;
    }

    .post-card {
        padding: 22px;
    }

        .post-card.has-cover {
            grid-template-columns: 1fr;
        }

    .post-card-cover {
        display: none;
    }

    .post-card-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .article {
        padding: 22px;
        border-radius: 14px;
    }

    .article-nav {
        grid-template-columns: 1fr;
    }

    .article-nav-item.next {
        text-align: left;
        align-items: flex-start;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .sidebar {
        grid-template-columns: 1fr;
    }
}
