/* 行止集 · 样式表 */
/* 暖色纸张质感，中文衬线字体，舒适阅读 */

:root {
    --bg: #faf8f5;
    --bg-card: #ffffff;
    --bg-nav: #f5f0eb;
    --text: #2c2416;
    --text-secondary: #6b5c4d;
    --text-muted: #9a8b7a;
    --accent: #8b4513;
    --accent-light: #a0522d;
    --accent-bg: #f5ebe0;
    --border: #e8ddd0;
    --border-light: #f0e8dc;
    --link: #8b4513;
    --link-hover: #654321;
    --mark: #fff3cd;
    --shadow: rgba(139, 69, 19, 0.06);
    --font-body: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", "STSong", serif;
    --font-ui: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", monospace;
    --content-width: 720px;
    --wide-width: 960px;
}

/* ── 基础重置 ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 17px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-body);
    color: var(--text);
    background: var(--bg);
    line-height: 1.9;
    min-height: 100vh;
}

/* ── 导航栏 ── */
.site-nav {
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.nav-inner {
    max-width: var(--wide-width);
    margin: 0 auto;
    padding: 0.6rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: 0.1em;
}

.nav-brand-mobile {
    display: none;
}

.nav-links {
    display: flex;
    gap: 1.2rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--accent);
}

.nav-links a.nav-highlight {
    color: var(--accent);
    font-weight: 600;
    border-left: 2px solid var(--accent);
    padding-left: 0.6rem;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--text);
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    line-height: 1;
}

.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    min-width: 140px;
    z-index: 200;
    padding: 0.3rem 0;
    box-shadow: 0 4px 12px var(--shadow);
}

.nav-dropdown:hover .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu a {
    display: block;
    padding: 0.4rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.82rem;
    font-family: var(--font-ui);
}

.nav-dropdown-menu a:hover {
    background: var(--accent-bg);
    color: var(--accent);
}

/* ── 主内容区 ── */
.site-main {
    max-width: var(--wide-width);
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: calc(100vh - 200px);
}

/* ── 页脚 ── */
.site-footer {
    text-align: center;
    padding: 2rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-light);
    font-family: var(--font-ui);
}

.footer-meta {
    font-size: 0.75rem;
    margin-top: 0.3rem;
    opacity: 0.6;
}

/* ── 首页 ── */
.index-hero {
    text-align: center;
    padding: 4rem 0 3rem;
}

.hero-title {
    font-size: 2.8rem;
    font-weight: 900;
    color: var(--accent);
    letter-spacing: 0.15em;
    margin-bottom: 0.5rem;
}

.hero-slogan {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.hero-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.hero-stats {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-primary, .btn-secondary {
    font-family: var(--font-ui);
    padding: 0.6rem 1.5rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

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

.btn-secondary {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.btn-secondary:hover {
    background: var(--accent-bg);
}

/* ── 阅读路线 ── */
.reading-path {
    margin: 2rem 0 1rem;
    text-align: center;
}

.section-title {
    font-size: 1.3rem;
    color: var(--text);
    margin-bottom: 0.3rem;
}

.section-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: var(--font-ui);
}

/* ── 系列区块 ── */
.series-section {
    margin: 2.5rem 0;
    padding: 1.5rem;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.series-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.series-badge {
    width: 40px;
    height: 40px;
    background: var(--accent);
    color: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.series-info {
    flex: 1;
}

.series-name {
    font-size: 1.2rem;
    color: var(--text);
    margin: 0;
}

.series-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: var(--font-ui);
    margin: 0;
}

.series-count {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
}

.series-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

/* ── 文章卡片网格 ── */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.6rem;
}

.article-card {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    padding: 0.6rem 0.8rem;
    background: var(--bg);
    border-radius: 4px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.15s;
    border: 1px solid transparent;
}

.article-card:hover {
    border-color: var(--border);
    background: var(--accent-bg);
}

.card-id {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
    flex-shrink: 0;
}

.card-title {
    font-size: 0.88rem;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

@media (max-width: 640px) {
    .card-title {
        white-space: normal;
        overflow: visible;
    }
    .card-id {
        display: none;
    }
}

/* ── 文章页 ── */
.article-page {
    max-width: var(--content-width);
    margin: 0 auto;
}

.article-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.article-series {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
}

.article-series a {
    color: var(--accent);
    text-decoration: none;
}

.article-series a:hover {
    text-decoration: underline;
}

.series-sep {
    margin: 0 0.4rem;
    opacity: 0.5;
}

.article-title {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.4;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.article-meta {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ── 文章导航 ── */
.article-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.article-nav-bottom {
    margin-top: 3rem;
    border-top: 1px solid var(--border-light);
    border-bottom: none;
    padding: 1.5rem 0;
}

.article-nav a {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--accent);
    text-decoration: none;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    transition: opacity 0.2s;
}

.article-nav a:hover {
    opacity: 0.7;
}

.nav-arrow {
    font-size: 1.1rem;
}

.nav-text {
    display: flex;
    flex-direction: column;
}

.nav-title {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.nav-disabled {
    visibility: hidden;
}

/* ── 文章正文排版 ── */
.article-body {
    font-size: 1rem;
    line-height: 1.9;
}

.article-body h1 {
    font-size: 1.6rem;
    margin: 2rem 0 1rem;
    color: var(--text);
}

.article-body h2 {
    font-size: 1.3rem;
    margin: 2rem 0 0.8rem;
    color: var(--accent);
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border-light);
}

.article-body h3 {
    font-size: 1.1rem;
    margin: 1.5rem 0 0.6rem;
    color: var(--text);
}

.article-body h4, .article-body h5, .article-body h6 {
    font-size: 1rem;
    margin: 1.2rem 0 0.5rem;
    color: var(--text-secondary);
}

.article-body p {
    margin-bottom: 1rem;
}

.article-body a {
    color: var(--link);
    text-decoration: underline;
    text-decoration-color: var(--border);
    text-underline-offset: 2px;
    transition: all 0.15s;
}

.article-body a:hover {
    color: var(--link-hover);
    text-decoration-color: var(--link-hover);
}

.article-body strong {
    color: var(--text);
    font-weight: 700;
}

.article-body em {
    font-style: italic;
    color: var(--text-secondary);
}

.article-body blockquote {
    margin: 1.2rem 0;
    padding: 0.8rem 1.2rem;
    background: var(--accent-bg);
    border-left: 3px solid var(--accent);
    border-radius: 0 4px 4px 0;
    color: var(--text-secondary);
}

.article-body blockquote p:last-child {
    margin-bottom: 0;
}

.article-body ul, .article-body ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.article-body li {
    margin-bottom: 0.4rem;
}

.article-body code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: var(--bg-nav);
    padding: 0.15em 0.4em;
    border-radius: 3px;
    color: var(--accent);
}

.article-body pre {
    margin: 1.2rem 0;
    padding: 1rem 1.2rem;
    background: #2c2416;
    color: #e8ddd0;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.88rem;
    line-height: 1.6;
}

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

.article-body table {
    width: 100%;
    margin: 1.2rem 0;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.article-body th, .article-body td {
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    text-align: left;
}

.article-body th {
    background: var(--bg-nav);
    font-weight: 600;
    color: var(--text);
}

.article-body tr:nth-child(even) {
    background: var(--bg);
}

.article-body hr {
    margin: 2rem 0;
    border: none;
    height: 1px;
    background: var(--border);
}

.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 1rem 0;
}

/* ── 交叉引用样式 ── */
.cross-ref {
    background: var(--accent-bg);
    padding: 0.1em 0.3em;
    border-radius: 3px;
    text-decoration: none !important;
    font-size: 0.9em;
}

.cross-ref:hover {
    background: var(--border);
}

.unresolved-ref {
    color: var(--text-muted);
    font-style: italic;
}

/* ── 同系列目录 ── */
.series-toc {
    margin-top: 3rem;
    padding: 1.5rem;
    background: var(--bg-nav);
    border-radius: 8px;
}

.series-toc h3 {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
    font-family: var(--font-ui);
}

.series-toc ul {
    list-style: none;
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
}

.series-toc li {
    margin: 0;
}

.series-toc li.current {
    background: var(--accent-bg);
    border-radius: 4px;
}

.series-toc li.current a {
    color: var(--accent);
    font-weight: 600;
}

.series-toc a {
    display: flex;
    gap: 0.6rem;
    padding: 0.4rem 0.6rem;
    text-decoration: none;
    color: var(--text);
    font-size: 0.85rem;
    transition: background 0.15s;
    border-radius: 4px;
}

.series-toc a:hover {
    background: var(--bg);
}

.toc-id {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--accent);
    flex-shrink: 0;
    width: 3rem;
}

.toc-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── 评论区 ── */
.article-comments {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
}

.article-comments h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1.5rem;
}

#waline {
    font-family: var(--font-ui);
}

/* ── 搜索页 ── */
.search-page {
    max-width: var(--content-width);
    margin: 0 auto;
}

.search-page h1 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.search-box {
    margin-bottom: 2rem;
}

.search-box input {
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    font-family: var(--font-ui);
    border: 2px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: var(--accent);
}

.search-hint {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-ui);
}

.search-placeholder {
    text-align: center;
    color: var(--text-muted);
    font-family: var(--font-ui);
    padding: 2rem 0;
}

.result-count {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.result-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.result-item {
    display: block;
    padding: 1rem 1.2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.15s;
}

.result-item:hover {
    border-color: var(--accent);
    background: var(--accent-bg);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.3rem;
}

.result-series {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--accent);
    background: var(--accent-bg);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
}

.result-id {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.result-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.result-snippet {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

mark {
    background: var(--mark);
    color: var(--text);
    padding: 0.1em 0.2em;
    border-radius: 2px;
}

/* ── 首页底部 ── */
.index-footer {
    text-align: center;
    margin-top: 4rem;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-light);
}

.index-footer p:last-child {
    font-size: 0.8rem;
    margin-top: 0.3rem;
    opacity: 0.6;
}

/* ── 响应式 ── */
@media (max-width: 768px) {
    html {
        font-size: 16px;
    }

    .site-main {
        padding: 1rem;
    }

    /* 导航横向滑动 */
    .site-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .site-nav::-webkit-scrollbar {
        display: none;
    }

    .nav-inner {
        padding: 0.5rem 1rem;
        min-width: 700px;
        justify-content: center;
        gap: 1rem;
    }

    .nav-brand {
        flex-shrink: 0;
        font-size: 0.8rem;
    }

    .nav-brand-mobile {
        display: inline;
    }

    .nav-brand-desktop {
        display: none;
    }

    .nav-links {
        flex-shrink: 0;
        gap: 0.8rem;
    }

    .nav-links a {
        font-size: 0.8rem;
        flex-shrink: 0;
    }

    .nav-links .nav-series-link {
        display: inline;
    }

    .nav-dropdown-menu {
        display: none !important;
    }

    .index-hero {
        padding: 2rem 0;
    }

    .hero-title {
        font-size: 2rem;
    }

    .article-grid {
        grid-template-columns: 1fr;
    }

    .series-header {
        flex-wrap: wrap;
    }

    .article-title {
        font-size: 1.4rem;
    }

    .article-nav-bottom .nav-title {
        display: none;
    }
}

@media (max-width: 480px) {
    .hero-actions {
        flex-direction: column;
        align-items: center;
    }

    .series-section {
        padding: 1rem;
    }
}

/* ── 打印优化 ── */
@media print {
    .site-nav, .article-nav, .series-toc, .site-footer {
        display: none;
    }

    .article-body {
        font-size: 12pt;
        line-height: 1.6;
    }

    .article-body a {
        text-decoration: underline;
    }

    .article-body a::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}
