/*
Theme Name: Yupin
Theme URI: https://www.ypvps.com/
Description: 为御品VPS打造的现代博客主题 — 纸感底色、编辑级排版、沉浸阅读体验
Version: 1.1.5
Author: Muse
Author URI: https://www.ypvps.com/
Tags: blog, clean, responsive, chinese
*/

/* ============ 基础 ============ */
:root {
    --bg: #faf8f3;
    --bg-card: #ffffff;
    --ink: #1a1a1a;
    --ink-soft: #4a4a4a;
    --ink-mute: #8a8a8a;
    --line: #e8e2d6;
    --accent: #b5442c;
    --accent-soft: #f5e6e0;
    --gold: #c9a96a;
    --radius: 12px;
    --shadow: 0 2px 24px rgba(0,0,0,.06);
    --font-serif: "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
    --font-sans: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --font-mono: "JetBrains Mono", "SF Mono", Consolas, monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); text-decoration: none; transition: color .25s; }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }
::selection { background: var(--accent); color: #fff; }

/* 纸纹质感 */
body::before {
    content: "";
    position: fixed; inset: 0;
    background-image: radial-gradient(rgba(0,0,0,.025) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
    z-index: 0;
}

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; position: relative; z-index: 1; }
.wrap-narrow { max-width: 760px; margin: 0 auto; padding: 0 24px; position: relative; z-index: 1; }

/* ============ 顶栏 ============ */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(250,248,243,.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
}
.header-inner {
    display: flex; align-items: center; justify-content: space-between;
    height: 68px;
}
.logo {
    font-family: var(--font-serif);
    font-size: 22px; font-weight: 700; letter-spacing: 2px;
}
.logo span { color: var(--accent); }
.nav { display: flex; gap: 28px; align-items: center; }
.nav a {
    font-size: 14px; color: var(--ink-soft); letter-spacing: 1px;
    position: relative; padding: 4px 0;
}
.nav a::after {
    content: ""; position: absolute; left: 0; bottom: 0;
    width: 0; height: 2px; background: var(--accent);
    transition: width .3s;
}
.nav a:hover::after, .nav a.current::after { width: 100%; }
.nav a:hover, .nav a.current { color: var(--ink); }
.search-btn {
    background: none; border: 1px solid var(--line); border-radius: 20px;
    padding: 6px 16px; font-size: 13px; color: var(--ink-mute); cursor: pointer;
    transition: all .25s;
}
/* 手机菜单按钮：桌面端隐藏，900px 以下显示 */
.menu-btn {
    display: none; background: none; border: 1px solid var(--line); border-radius: 8px;
    padding: 6px 12px; font-size: 18px; line-height: 1; color: var(--ink);
    cursor: pointer;
}
.menu-btn:hover { border-color: var(--accent); color: var(--accent); }
.search-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ============ Hero ============ */
.hero {
    text-align: center;
    padding: 72px 24px 56px;
    position: relative;
}
.hero::before {
    content: "御";
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -58%);
    font-family: var(--font-serif);
    font-size: 280px; font-weight: 700;
    color: rgba(0,0,0,.028);
    pointer-events: none; user-select: none;
    line-height: 1;
}
.hero h1 {
    font-family: var(--font-serif);
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 700; letter-spacing: 6px;
    margin-bottom: 12px;
    position: relative;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { color: var(--ink-mute); font-size: 15px; letter-spacing: 2px; position: relative; }
.hero-line {
    width: 48px; height: 3px; background: var(--accent);
    margin: 20px auto 0; border-radius: 2px; position: relative;
}

/* ============ 文章卡片 ============ */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 28px;
    padding-bottom: 64px;
}
.post-card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .35s cubic-bezier(.2,.7,.3,1), box-shadow .35s;
    display: flex; flex-direction: column;
}
.post-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.post-card .thumb {
    aspect-ratio: 16/9; overflow: hidden; background: #eee;
    position: relative;
}
.post-card .thumb img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .6s cubic-bezier(.2,.7,.3,1);
}
.post-card:hover .thumb img { transform: scale(1.06); }
.post-card .thumb .cat {
    position: absolute; top: 12px; left: 12px;
    background: rgba(26,26,26,.82); color: #fff;
    font-size: 12px; padding: 4px 12px; border-radius: 20px;
    letter-spacing: 1px; backdrop-filter: blur(4px);
}
.post-card .body { padding: 22px 24px 20px; flex: 1; display: flex; flex-direction: column; }
.post-card h2 {
    font-family: var(--font-serif);
    font-size: 19px; font-weight: 700; line-height: 1.5;
    margin-bottom: 10px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.post-card h2 a:hover { color: var(--accent); }
.post-card .excerpt {
    color: var(--ink-mute); font-size: 14px; line-height: 1.75;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    margin-bottom: 16px; flex: 1;
}
.post-card .meta {
    display: flex; align-items: center; gap: 14px;
    font-size: 12.5px; color: var(--ink-mute);
    border-top: 1px dashed var(--line); padding-top: 14px;
}
.post-card .meta .dot { width: 3px; height: 3px; background: var(--line); border-radius: 50%; }

/* 列表式（archive 页） */
.post-list { padding-bottom: 64px; }
.post-item {
    display: flex; gap: 24px;
    background: var(--bg-card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 22px;
    margin-bottom: 18px; transition: box-shadow .3s, transform .3s;
}
.post-item:hover { box-shadow: var(--shadow); transform: translateX(4px); }
.post-item .thumb-sm {
    width: 200px; height: 132px; flex-shrink: 0;
    border-radius: 8px; overflow: hidden; background: #eee;
}
.post-item .thumb-sm img { width: 100%; height: 100%; object-fit: cover; }
.post-item .info { flex: 1; min-width: 0; }
.post-item h2 { font-family: var(--font-serif); font-size: 18px; margin-bottom: 8px; }
.post-item .excerpt {
    color: var(--ink-mute); font-size: 14px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    margin-bottom: 10px;
}
.post-item .meta { font-size: 12.5px; color: var(--ink-mute); display: flex; gap: 12px; }

/* ============ 文章页 ============ */
.article-hero {
    text-align: center; padding: 56px 24px 36px; max-width: 760px; margin: 0 auto;
}
.article-hero .cat {
    display: inline-block; font-size: 12px; letter-spacing: 2px;
    color: var(--accent); border: 1px solid var(--accent);
    padding: 4px 16px; border-radius: 20px; margin-bottom: 18px;
}
.article-hero h1 {
    font-family: var(--font-serif);
    font-size: clamp(26px, 4vw, 36px); font-weight: 700; line-height: 1.5;
    margin-bottom: 16px;
}
.article-hero .meta {
    color: var(--ink-mute); font-size: 13.5px;
    display: flex; gap: 16px; justify-content: center; align-items: center;
}
.article-cover {
    max-width: 860px; margin: 0 auto 40px; padding: 0 24px;
}
.article-cover img { border-radius: var(--radius); box-shadow: var(--shadow); }
.post-content {
    font-size: 17px; line-height: 2;
    color: var(--ink-soft);
    padding-bottom: 48px;
}
.post-content h2, .post-content h3, .post-content h4 {
    font-family: var(--font-serif); color: var(--ink);
    margin: 36px 0 16px; line-height: 1.5;
}
.post-content h2 { font-size: 24px; padding-left: 14px; border-left: 4px solid var(--accent); }
.post-content h3 { font-size: 20px; }
.post-content p { margin-bottom: 18px; text-align: justify; }
.post-content blockquote {
    border-left: 3px solid var(--gold);
    background: #fff; padding: 16px 22px; margin: 24px 0;
    border-radius: 0 8px 8px 0; color: var(--ink-soft); font-size: 15.5px;
}
.post-content code {
    font-family: var(--font-mono); font-size: .88em;
    background: #f0ebe0; padding: 2px 7px; border-radius: 5px; color: var(--accent);
}
.post-content pre {
    background: #1e1e1e; color: #d4d4d4; border-radius: 10px;
    padding: 20px 22px; overflow-x: auto; margin: 24px 0; font-size: 14px; line-height: 1.7;
}
.post-content pre code { background: none; color: inherit; padding: 0; }
.post-content ul, .post-content ol { margin: 0 0 18px 24px; }
.post-content li { margin-bottom: 8px; }
.post-content img { border-radius: 10px; margin: 24px auto; box-shadow: var(--shadow); }
.post-content table { width: 100%; border-collapse: collapse; margin: 24px 0; font-size: 15px; }
.post-content th, .post-content td { border: 1px solid var(--line); padding: 10px 14px; text-align: left; }
.post-content th { background: #f5f1e8; font-weight: 600; }
.post-content hr { border: none; border-top: 1px solid var(--line); margin: 32px 0; }
.post-content a { color: var(--accent); border-bottom: 1px dotted var(--accent); }
.post-content a:hover { border-bottom-style: solid; }

/* 标签 */
.tags { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 40px; }
.tags a {
    font-size: 13px; color: var(--ink-soft);
    border: 1px solid var(--line); border-radius: 20px; padding: 5px 16px;
    transition: all .25s; background: #fff;
}
.tags a:hover { border-color: var(--accent); color: var(--accent); }
.tags a::before { content: "#"; color: var(--ink-mute); margin-right: 2px; }

/* 上下篇 */
.post-nav {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
    margin-bottom: 48px;
}
.post-nav a {
    background: var(--bg-card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 18px 22px;
    transition: all .3s; display: block;
}
.post-nav a:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.post-nav .label { font-size: 12px; color: var(--ink-mute); letter-spacing: 2px; display: block; margin-bottom: 6px; }
.post-nav .title { font-family: var(--font-serif); font-size: 15px; font-weight: 600; }
.post-nav .next { text-align: right; }

/* ============ 评论 ============ */
.comments { margin-bottom: 64px; }
.comments h3 {
    font-family: var(--font-serif); font-size: 20px; margin-bottom: 24px;
    display: flex; align-items: center; gap: 10px;
}
.comments h3::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.comment-list { list-style: none; }
.comment-item {
    background: var(--bg-card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 20px 22px; margin-bottom: 14px;
}
.comment-item .c-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.comment-item .avatar { width: 40px; height: 40px; border-radius: 50%; }
.comment-item .c-author { font-weight: 600; font-size: 14.5px; }
.comment-item .c-time { font-size: 12px; color: var(--ink-mute); }
.comment-item .c-body { font-size: 15px; color: var(--ink-soft); }
.comment-item .c-reply { text-align: right; margin-top: 8px; }
.comment-item .c-reply a { font-size: 13px; color: var(--accent); }
.comment-children { list-style: none; margin: 14px 0 0 28px; }
.comment-form {
    background: var(--bg-card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 28px; margin-top: 24px;
}
.comment-form .row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.comment-form input, .comment-form textarea {
    width: 100%; border: 1px solid var(--line); border-radius: 8px;
    padding: 12px 14px; font-size: 14px; font-family: var(--font-sans);
    background: var(--bg); transition: border-color .25s;
}
.comment-form input:focus, .comment-form textarea:focus { outline: none; border-color: var(--accent); }
.comment-form textarea { min-height: 120px; resize: vertical; }
.comment-form .submit {
    background: var(--ink); color: #fff; border: none; border-radius: 8px;
    padding: 12px 36px; font-size: 14px; letter-spacing: 2px; cursor: pointer;
    transition: background .25s;
}
.comment-form .submit:hover { background: var(--accent); }

/* ============ 侧边栏小件 ============ */
.page-layout { display: grid; grid-template-columns: 1fr 300px; gap: 40px; padding-bottom: 64px; align-items: start; }
.sidebar .widget {
    background: var(--bg-card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 24px; margin-bottom: 24px;
}
.sidebar .widget h3 {
    font-family: var(--font-serif); font-size: 16px; margin-bottom: 16px;
    padding-bottom: 12px; border-bottom: 2px solid var(--accent); display: inline-block;
}
.sidebar .widget ul { list-style: none; }
.sidebar .widget li { padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.sidebar .widget li:last-child { border: none; }
.sidebar .widget li a { color: var(--ink-soft); }
.sidebar .widget li a:hover { color: var(--accent); }
.tag-cloud a {
    display: inline-block; font-size: 13px; margin: 0 8px 8px 0;
    color: var(--ink-mute);
}
.tag-cloud a:hover { color: var(--accent); }

/* ============ 分页 ============ */
.pagination { display: flex; justify-content: center; gap: 10px; padding-bottom: 64px; }
.pagination a, .pagination span {
    min-width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line); border-radius: 10px; font-size: 14px;
    background: var(--bg-card); padding: 0 12px; transition: all .25s;
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .current { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ============ 页脚 ============ */
.site-footer {
    border-top: 1px solid var(--line);
    padding: 48px 0 32px; text-align: center;
    background: #f5f1e8;
}
.site-footer .f-logo { font-family: var(--font-serif); font-size: 20px; letter-spacing: 3px; margin-bottom: 12px; }
.site-footer .f-logo span { color: var(--accent); }
.site-footer p { font-size: 13px; color: var(--ink-mute); line-height: 2; }
.site-footer a { color: var(--ink-soft); }
.site-footer a:hover { color: var(--accent); }

/* ============ 404 ============ */
.e404 { text-align: center; padding: 100px 24px; }
.e404 .num {
    font-family: var(--font-serif); font-size: 120px; font-weight: 700;
    color: var(--line); line-height: 1; margin-bottom: 16px;
}
.e404 h2 { font-family: var(--font-serif); font-size: 24px; margin-bottom: 12px; }
.e404 p { color: var(--ink-mute); margin-bottom: 28px; }
.btn {
    display: inline-block; background: var(--ink); color: #fff;
    padding: 12px 36px; border-radius: 8px; font-size: 14px; letter-spacing: 2px;
    transition: background .25s;
}
.btn:hover { background: var(--accent); color: #fff; }

/* ============ 归档标题 ============ */
.archive-head { text-align: center; padding: 56px 24px 40px; }
.archive-head h1 { font-family: var(--font-serif); font-size: 30px; letter-spacing: 4px; margin-bottom: 10px; }
.archive-head p { color: var(--ink-mute); font-size: 14px; }
.archive-head .count { color: var(--accent); font-weight: 700; }

/* 搜索框 */
.search-form { display: flex; gap: 10px; max-width: 480px; margin: 0 auto; }
.search-form input {
    flex: 1; border: 1px solid var(--line); border-radius: 8px;
    padding: 12px 16px; font-size: 14px; background: #fff;
}
.search-form input:focus { outline: none; border-color: var(--accent); }
.search-form button {
    background: var(--ink); color: #fff; border: none; border-radius: 8px;
    padding: 0 28px; font-size: 14px; letter-spacing: 2px; cursor: pointer;
}
.search-form button:hover { background: var(--accent); }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
    .page-layout { grid-template-columns: 1fr; }
    .sidebar { order: 2; }
    .post-item { flex-direction: column; }
    .post-item .thumb-sm { width: 100%; height: 180px; }
    .comment-form .row { grid-template-columns: 1fr; }
    .post-nav { grid-template-columns: 1fr; }
    .menu-btn { display: inline-block; }
    /* 手机端导航改为顶栏下方下拉面板，默认收起，.open 时展开 */
    .nav {
        display: none; position: absolute; top: 100%; left: 0; right: 0;
        flex-direction: column; align-items: stretch; gap: 0;
        background: var(--bg-card); border-bottom: 1px solid var(--line);
        box-shadow: var(--shadow); padding: 8px 20px 14px; z-index: 60;
    }
    .nav.open { display: flex; }
    .nav a { padding: 12px 4px; border-bottom: 1px solid var(--line); font-size: 15px; }
    .nav a::after { display: none; }
    .nav .search-btn { margin-top: 12px; align-self: flex-start; }
    .hero::before { font-size: 180px; }
}
@media (max-width: 560px) {
    .post-grid { grid-template-columns: 1fr; }
    .hero { padding: 48px 20px 40px; }
}

/* ============ 面包屑（文章页） ============ */
.breadcrumb {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    font-size: 13px; color: var(--ink-mute); margin-bottom: 14px;
}
.breadcrumb a { color: var(--ink-mute); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--line); }
.breadcrumb .current { color: var(--ink-soft); }

/* ============ 相关文章（文章页图文内链） ============ */
.related { margin-bottom: 48px; }
.related h3 {
    font-family: var(--font-serif); font-size: 20px; margin-bottom: 20px;
    display: flex; align-items: center; gap: 10px;
}
.related h3::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.related-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.related-card {
    background: var(--bg-card); border: 1px solid var(--line);
    border-radius: var(--radius); overflow: hidden; display: block;
    transition: all .3s;
}
.related-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.related-card .r-thumb img { width: 100%; height: 130px; object-fit: cover; }
.related-card .r-title {
    display: block; padding: 12px 16px 2px;
    font-family: var(--font-serif); font-size: 15px; font-weight: 600; line-height: 1.55;
}
.related-card .r-date { display: block; padding: 0 16px 12px; font-size: 12px; color: var(--ink-mute); }
@media (max-width: 640px) {
    .related-grid { grid-template-columns: 1fr; }
}

/* 顶栏分类较多时允许换行 */
.nav { flex-wrap: wrap; row-gap: 4px; }
