/* ============================================================
   文字优先设计：绝大多数文章为纯文字列表，封面图为可选增强
   ============================================================ */

:root {
    --bg: #ffffff;
    --bg-soft: #f5f7fa;
    --bg-card: #ffffff;
    --text: #1a1f29;
    --text-soft: #4a5568;
    --text-mute: #8a94a6;
    --border: #e8ebf0;
    --brand: #d11a2a;
    --brand-soft: #fdecee;
    --link: #1a56db;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05);
    --radius: 12px;
    --maxw: 1100px;
    --header-h: 64px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f141b;
        --bg-soft: #161e29;
        --bg-card: #161e29;
        --text: #e8edf4;
        --text-soft: #aab4c4;
        --text-mute: #76828f;
        --border: #243040;
        --brand: #ff5a66;
        --brand-soft: #2a1417;
        --link: #6ea8ff;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    }
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.7;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

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

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 18px;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--brand);
    color: #fff;
    padding: 8px 14px;
    z-index: 1000;
    border-radius: 0 0 8px 0;
}

.skip-link:focus {
    left: 0;
}

.read-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: var(--brand);
    z-index: 1100;
    transition: width .1s linear;
}

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 900;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
}

.site-header .bar {
    display: flex;
    align-items: center;
    gap: 14px;
    height: var(--header-h);
}

.logo {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 800;
    font-size: 20px;
    color: var(--text);
    letter-spacing: .5px;
}

.logo .mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 16px;
    font-weight: 900;
}

.logo:hover {
    text-decoration: none;
}

.slogan {
    color: var(--text-mute);
    font-size: 13px;
    font-weight: 500;
}

.nav {
    margin-left: auto;
}

.nav ul {
    list-style: none;
    display: flex;
    gap: 2px;
    margin: 0;
    padding: 0;
}

.nav a {
    color: var(--text-soft);
    font-size: 15px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 8px;
    display: block;
}

.nav a:hover {
    color: var(--text);
    background: var(--bg-soft);
    text-decoration: none;
}

.nav a.active {
    color: var(--brand);
    background: var(--brand-soft);
}

.nav-toggle {
    display: none;
    margin-left: auto;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 9px;
    width: 42px;
    height: 42px;
    cursor: pointer;
    position: relative;
}

.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
    content: "";
    position: absolute;
    left: 11px;
    width: 20px;
    height: 2px;
    background: var(--text);
    transition: .2s;
}

.nav-toggle span {
    top: 20px;
}

.nav-toggle span::before {
    top: -6px;
}

.nav-toggle span::after {
    top: 6px;
}

/* ---------- 标签 ---------- */
.tag {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 6px;
    background: var(--brand-soft);
    color: var(--brand);
}

.tag.cat {
    background: var(--bg-soft);
    color: var(--text-soft);
}

/* ---------- 面包屑 ---------- */
.breadcrumb {
    margin: 18px 0 0;
    font-size: 13.5px;
    color: var(--text-mute);
}

.breadcrumb a {
    color: var(--text-soft);
}

.breadcrumb .sep {
    margin: 0 7px;
    opacity: .6;
}

/* ---------- 头条（可选封面） ---------- */
.lead-story {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 26px;
    align-items: center;
    padding: 26px 0 24px;
    border-bottom: 2px solid var(--border);
}

.lead-story .lead-body {
    min-width: 0;
}

.lead-story .lead-title {
    margin: 12px 0 10px;
    font-size: 30px;
    line-height: 1.32;
}

.lead-story .lead-title a {
    color: var(--text);
}

.lead-story .lead-title a:hover {
    color: var(--brand);
    text-decoration: none;
}

.lead-story .lead-excerpt {
    font-size: 16px;
    color: var(--text-soft);
    margin: 0 0 12px;
}

.lead-story .meta {
    color: var(--text-mute);
    font-size: 13.5px;
}

.lead-thumb {
    width: 300px;
    height: 188px;
    border-radius: var(--radius);
    object-fit: cover;
    background: var(--bg-soft);
}

.lead-story:not(.has-cover) {
    grid-template-columns: 1fr;
}

/* ---------- 双栏布局 ---------- */
.home-main {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
    align-items: start;
    margin-top: 8px;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 26px;
    position: sticky;
    top: calc(var(--header-h) + 16px);
}

/* ---------- 文字 Feed 列表 ---------- */
.feed {
    display: flex;
    flex-direction: column;
}

.post {
    display: flex;
    gap: 16px;
    padding: 18px 0;
    border-bottom: 1px solid var(--border);
}

.post:first-child {
    padding-top: 6px;
}

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

.post h3 {
    margin: 5px 0 6px;
    font-size: 18.5px;
    line-height: 1.42;
}

.post h3 a {
    color: var(--text);
}

.post h3 a:hover {
    color: var(--brand);
    text-decoration: none;
}

.post .excerpt {
    color: var(--text-soft);
    font-size: 14.5px;
    margin: 0 0 9px;
}

.post .meta {
    color: var(--text-mute);
    font-size: 13px;
}

.post-thumb {
    flex: none;
    width: 150px;
    height: 96px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--bg-soft);
}

/* ---------- 区块标题 ---------- */
.section-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    border-left: 4px solid var(--brand);
    padding-left: 12px;
    margin: 30px 0 4px;
}

.section-head h2 {
    margin: 0;
    font-size: 21px;
}

.section-head .more {
    margin-left: auto;
    font-size: 13px;
    color: var(--text-mute);
}

/* ---------- 侧栏面板 ---------- */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
}

.panel h3 {
    margin: 0 0 12px;
    font-size: 16px;
    border-left: 3px solid var(--brand);
    padding-left: 10px;
}

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

.hot-list li {
    counter-increment: hot;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 9px 0;
    border-bottom: 1px dashed var(--border);
}

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

.hot-list li::before {
    content: counter(hot);
    flex: none;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--bg-soft);
    color: var(--text-mute);
    font-size: 12px;
    font-weight: 800;
    display: grid;
    place-items: center;
}

.hot-list li:nth-child(-n+3)::before {
    background: var(--brand);
    color: #fff;
}

.hot-list a {
    color: var(--text);
    font-size: 14.5px;
}

.hot-list a:hover {
    color: var(--brand);
    text-decoration: none;
}

.cat-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cat-links a {
    font-size: 14px;
    font-weight: 600;
    padding: 7px 13px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--text-soft);
}

.cat-links a:hover {
    color: var(--brand);
    border-color: var(--brand);
    text-decoration: none;
}

/* ---------- 分类页头部 ---------- */
.cat-hero {
    margin-top: 18px;
    padding: 22px 24px;
    border-radius: var(--radius);
    color: #fff;
    background: var(--brand);
}

.cat-hero h1 {
    margin: 0 0 6px;
    font-size: 24px;
}

.cat-hero p {
    margin: 0;
    opacity: .92;
    font-size: 14.5px;
}

/* ---------- 分页 ---------- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 28px 0 6px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    min-width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-soft);
    font-size: 14px;
    font-weight: 600;
    padding: 0 10px;
}

.pagination a:hover {
    color: var(--brand);
    border-color: var(--brand);
    text-decoration: none;
}

.pagination .current {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

.pagination .disabled {
    opacity: .4;
    pointer-events: none;
}

/* ---------- 详情页 ---------- */
.article {
    max-width: 760px;
    margin: 0 auto;
}

.article-header {
    margin-top: 8px;
}

.article-header h1 {
    font-size: 30px;
    line-height: 1.34;
    margin: 14px 0 12px;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    color: var(--text-mute);
    font-size: 14px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.article-meta .author {
    color: var(--text-soft);
    font-weight: 600;
}

.article-cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius);
    margin: 20px 0;
    background: var(--bg-soft);
}

.article-content {
    font-size: 17.5px;
    line-height: 1.9;
    color: var(--text);
}

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

.article-content .lead {
    font-size: 19px;
    color: var(--text-soft);
    border-left: 3px solid var(--brand);
    padding-left: 14px;
    margin-bottom: 1.4em;
}

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

.article-tags .tag {
    background: var(--bg-soft);
    color: var(--text-soft);
}

.share {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 18px 0 26px;
    color: var(--text-mute);
    font-size: 14px;
}

.share a {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    color: var(--text-soft);
    font-weight: 700;
    font-size: 13px;
}

.share a:hover {
    color: var(--brand);
    border-color: var(--brand);
    text-decoration: none;
}

.related {
    margin: 36px auto;
    max-width: 760px;
}

/* ---------- 回到顶部 ---------- */
.to-top {
    position: fixed;
    right: 18px;
    bottom: 18px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    border: 0;
    cursor: pointer;
    font-size: 20px;
    box-shadow: 0 6px 18px rgba(209, 26, 42, .35);
    opacity: 0;
    visibility: hidden;
    transition: .25s;
    z-index: 950;
}

.to-top.show {
    opacity: 1;
    visibility: visible;
}

/* ---------- Footer ---------- */
.site-footer {
    margin-top: 54px;
    border-top: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--text-soft);
    font-size: 14px;
}

.site-footer .inner {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    justify-content: space-between;
    align-items: center;
    padding: 26px 0;
}

.site-footer a {
    color: var(--text-soft);
}

.site-footer .links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 900px) {
    .home-main {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        order: -1;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sidebar .panel {
        flex: 1 1 260px;
    }
}

@media (max-width: 760px) {
    :root {
        --header-h: 58px;
    }

    .nav {
        position: absolute;
        top: var(--header-h);
        left: 0;
        right: 0;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        max-height: 0;
        overflow: hidden;
        transition: max-height .25s ease;
    }

    .nav.open {
        max-height: 60vh;
        overflow-y: auto;
    }

    .nav ul {
        flex-direction: column;
        gap: 0;
        padding: 6px 12px 14px;
    }

    .nav a {
        padding: 12px 10px;
    }

    .nav-toggle {
        display: block;
    }

    .slogan {
        display: none;
    }

    .lead-story {
        grid-template-columns: 1fr;
        gap: 14px;
        padding: 20px 0;
    }

    .lead-story.has-cover .lead-thumb {
        width: 100%;
        height: auto;
        aspect-ratio: 16/10;
        order: -1;
    }

    .lead-story .lead-title {
        font-size: 24px;
    }

    .post-thumb {
        width: 110px;
        height: 72px;
    }

    .article-header h1 {
        font-size: 24px;
    }

    .article-content {
        font-size: 16.5px;
    }
}

@media (max-width: 520px) {
    .post {
        gap: 12px;
    }

    .post h3 {
        font-size: 16.5px;
    }

    .post-thumb {
        width: 92px;
        height: 60px;
    }
}