:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #eef2fa;
    --text: #111827;
    --muted: #5b6779;
    --line: #e2e8f2;
    --brand: #2f5bff;
    --brand-dark: #1e43cd;
    --brand-soft: #e9eeff;
    --up: #0f9d58;
    --up-soft: #e3f6ec;
    --down: #d93a32;
    --down-soft: #fdeceb;
    --unknown: #97a1b2;
    --unknown-soft: #eef1f6;
    --radius: 18px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 18px 40px -26px rgba(16, 24, 40, .35);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background:
        radial-gradient(900px 500px at 12% -10%, rgba(47, 91, 255, .10), transparent 60%),
        radial-gradient(700px 420px at 92% 0%, rgba(15, 157, 88, .08), transparent 55%),
        var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

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

.container {
    width: min(1160px, calc(100% - 48px));
    margin: 0 auto;
}

/* ---------- 顶部导航 ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: saturate(160%) blur(14px);
    background: rgba(245, 247, 251, .82);
    border-bottom: 1px solid rgba(226, 232, 242, .9);
}

.site-header .inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    height: 68px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.brand .mark {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: linear-gradient(140deg, var(--brand), #6f8cff);
    color: #fff;
    font-size: 16px;
    box-shadow: 0 8px 18px -8px rgba(47, 91, 255, .8);
}

.brand small {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    line-height: 1.2;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-links a {
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
    transition: background .16s ease, color .16s ease;
}

.nav-links a:hover {
    background: var(--brand-soft);
    color: var(--brand-dark);
}

.nav-links a.primary {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 8px 20px -10px rgba(47, 91, 255, .9);
}

.nav-links a.primary:hover {
    background: var(--brand-dark);
    color: #fff;
}

/* ---------- Hero ---------- */
.hero {
    padding: 72px 0 40px;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
    gap: 40px;
    align-items: center;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--line);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: .05em;
}

.eyebrow .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--up);
    box-shadow: 0 0 0 4px rgba(15, 157, 88, .14);
}

.hero h1 {
    margin: 18px 0 14px;
    font-size: clamp(32px, 4.6vw, 50px);
    line-height: 1.15;
    letter-spacing: -.03em;
    font-weight: 800;
}

.hero p.lead {
    margin: 0;
    max-width: 640px;
    color: var(--muted);
    font-size: 16.5px;
}

.hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.stat {
    min-width: 128px;
    padding: 16px 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
}

.stat strong {
    display: block;
    font-size: 26px;
    line-height: 1.2;
    letter-spacing: -.02em;
}

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

.profile-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 26px;
    box-shadow: var(--shadow);
}

.profile-card .avatar {
    width: 62px;
    height: 62px;
    border-radius: 18px;
    object-fit: cover;
    background: linear-gradient(140deg, #93a9ff, #2f5bff);
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 24px;
    font-weight: 700;
}

.profile-card h3 {
    margin: 16px 0 6px;
    font-size: 18px;
    letter-spacing: -.01em;
}

.profile-card p {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
    white-space: pre-line;
}

.profile-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.profile-links a {
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--surface-soft);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--muted);
}

.profile-links a:hover {
    background: var(--brand-soft);
    color: var(--brand-dark);
}

/* ---------- 分类与卡片 ---------- */
main {
    padding-bottom: 80px;
}

.category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0 6px;
    margin-bottom: 8px;
}

.category-nav a {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    font-size: 13px;
    color: var(--muted);
}

.category-nav a:hover {
    border-color: var(--brand);
    color: var(--brand-dark);
}

.category-block {
    padding-top: 40px;
}

.category-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.category-head h2 {
    margin: 0;
    font-size: 22px;
    letter-spacing: -.02em;
}

.category-head span {
    font-size: 13px;
    color: var(--muted);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.project-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.project-card:hover {
    transform: translateY(-3px);
    border-color: rgba(47, 91, 255, .35);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 26px 48px -28px rgba(47, 91, 255, .55);
}

.card-cover {
    position: relative;
    aspect-ratio: 16 / 8.4;
    background: linear-gradient(135deg, #dbe4ff, #eef1f8);
    overflow: hidden;
}

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

.card-cover .placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 46px;
    font-weight: 800;
    color: rgba(47, 91, 255, .32);
    letter-spacing: -.04em;
}

.badge-featured {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(17, 24, 39, .78);
    color: #fff;
    font-size: 11.5px;
    font-weight: 600;
    backdrop-filter: blur(6px);
}

.status-pill {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    background: rgba(255, 255, 255, .92);
    color: var(--muted);
    box-shadow: 0 1px 4px rgba(16, 24, 40, .12);
}

.status-pill::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--unknown);
}

.status-pill.up::before {
    background: var(--up);
}

.status-pill.down::before {
    background: var(--down);
}

.card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 20px 20px 18px;
}

.card-body h3 {
    margin: 0 0 8px;
    font-size: 18px;
    letter-spacing: -.01em;
}

.card-body p {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
}

.tag {
    padding: 3px 9px;
    border-radius: 7px;
    background: var(--surface-soft);
    color: #47536a;
    font-size: 11.5px;
    font-weight: 500;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px dashed var(--line);
}

.mode-label {
    font-size: 12px;
    color: var(--muted);
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .16s ease, color .16s ease, border-color .16s ease;
}

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

.btn-primary:hover {
    background: var(--brand-dark);
}

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

.btn-ghost:hover {
    background: var(--brand-soft);
    color: var(--brand-dark);
}

/* ---------- 空状态 ---------- */
.empty-state {
    margin-top: 48px;
    padding: 64px 32px;
    text-align: center;
    background: var(--surface);
    border: 1px dashed var(--line);
    border-radius: 24px;
}

.empty-state h2 {
    margin: 0 0 10px;
    font-size: 22px;
    letter-spacing: -.02em;
}

.empty-state p {
    margin: 0 auto 22px;
    max-width: 460px;
    color: var(--muted);
    font-size: 14.5px;
}

/* ---------- 详情页 ---------- */
.detail-wrap {
    padding: 36px 0 0;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 22px;
}

.breadcrumb a:hover {
    color: var(--brand-dark);
}

.detail-head {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(260px, .8fr);
    gap: 32px;
    align-items: start;
    margin-bottom: 34px;
}

.detail-head h1 {
    margin: 10px 0 12px;
    font-size: clamp(28px, 3.8vw, 40px);
    line-height: 1.2;
    letter-spacing: -.03em;
}

.detail-head .summary {
    margin: 0;
    color: var(--muted);
    font-size: 16px;
}

.detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.info-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
}

.info-card dl {
    margin: 0;
    display: grid;
    gap: 14px;
}

.info-card dt {
    font-size: 12px;
    color: var(--muted);
    letter-spacing: .04em;
}

.info-card dd {
    margin: 3px 0 0;
    font-size: 14px;
    font-weight: 600;
    word-break: break-all;
}

.detail-cover {
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    margin-bottom: 34px;
    background: var(--surface);
}

.detail-cover img {
    width: 100%;
}

.content-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: clamp(22px, 4vw, 40px);
    box-shadow: var(--shadow);
}

.markdown-body {
    font-size: 15.5px;
    color: #1f2937;
}

.markdown-body > :first-child {
    margin-top: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    margin: 1.6em 0 .6em;
    line-height: 1.3;
    letter-spacing: -.02em;
}

.markdown-body h1 {
    font-size: 26px;
}

.markdown-body h2 {
    font-size: 21px;
    padding-bottom: .35em;
    border-bottom: 1px solid var(--line);
}

.markdown-body h3 {
    font-size: 17px;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body blockquote {
    margin: .9em 0;
}

.markdown-body ul,
.markdown-body ol {
    padding-left: 1.4em;
}

.markdown-body a {
    color: var(--brand-dark);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.markdown-body code {
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--surface-soft);
    font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
    font-size: .88em;
}

.markdown-body pre {
    padding: 16px 18px;
    border-radius: 12px;
    background: #111827;
    color: #e5e7eb;
    overflow-x: auto;
}

.markdown-body pre code {
    padding: 0;
    background: transparent;
    color: inherit;
}

.markdown-body blockquote {
    padding: 10px 18px;
    border-left: 3px solid var(--brand);
    background: var(--brand-soft);
    color: #33415c;
    border-radius: 0 10px 10px 0;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.2em 0;
    font-size: 14px;
}

.markdown-body th,
.markdown-body td {
    padding: 9px 12px;
    border: 1px solid var(--line);
    text-align: left;
}

.markdown-body th {
    background: var(--surface-soft);
}

.related {
    padding-top: 48px;
}

.related h2 {
    margin: 0 0 18px;
    font-size: 20px;
    letter-spacing: -.02em;
}

/* ---------- 页脚 ---------- */
.site-footer {
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, .6);
    padding: 26px 0;
    color: var(--muted);
    font-size: 13px;
}

.site-footer .inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
}

.site-footer .inner > :last-child {
    justify-self: end;
}

.site-footer .icp {
    justify-self: center;
    color: var(--muted);
    font-size: 13px;
}

.site-footer .icp:hover {
    color: var(--brand-dark);
    text-decoration: underline;
}

/* ---------- 错误页 ---------- */
.error-page {
    min-height: 70vh;
    display: grid;
    place-items: center;
    padding: 60px 0;
}

.error-card {
    max-width: 520px;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 52px 36px;
    box-shadow: var(--shadow);
}

.error-card .code {
    font-size: 64px;
    font-weight: 800;
    letter-spacing: -.05em;
    color: var(--brand);
    line-height: 1;
}

.error-card h1 {
    margin: 18px 0 10px;
    font-size: 22px;
}

.error-card p {
    margin: 0 0 24px;
    color: var(--muted);
    font-size: 14.5px;
}

@media (max-width: 900px) {
    .hero {
        padding-top: 48px;
    }

    .hero-grid,
    .detail-head {
        grid-template-columns: 1fr;
    }

    .profile-card {
        order: -1;
    }
}

@media (max-width: 560px) {
    .container {
        width: min(1160px, calc(100% - 32px));
    }

    .site-header .inner {
        height: 60px;
    }

    .nav-links a {
        padding: 7px 10px;
        font-size: 13px;
    }

    .hero-stats .stat {
        flex: 1 1 100px;
        min-width: 0;
    }

    .site-footer .inner {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .site-footer .inner > :last-child {
        justify-self: center;
    }
}
