/*
Theme Name: Sanxiu Flatpaper
Theme URI: https://www.sanxiuchuhai.com/
Author: Sanxiu
Description: A paper-journal WordPress theme inspired by FlatPaper, with a single-column home feed.
Version: 2.0.0
Text Domain: sanxiu-flatpaper
*/

:root {
    --bg: #f7f8fa;
    --paper: #ffffff;
    --paper-warm: #fbfcfd;
    --ink: #303740;
    --ink-soft: #505966;
    --muted: #7b8490;
    --line: #e7ebef;
    --dash: #d7dee5;
    --accent: #6fa67c;
    --accent-strong: #4f8862;
    --accent-soft: #dcebd8;
    --blue: #79afd2;
    --orange: #e8a15f;
    --pink: #d98ba1;
    --violet: #9884be;
    --shadow: 0 18px 40px rgba(43, 55, 68, .12);
    --soft-shadow: 0 8px 24px rgba(43, 55, 68, .08);
    --paper-shadow: 0 4px 14px rgba(43, 55, 68, .08);
    --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

html[data-accent="blue"] { --accent: #6fa9d9; --accent-strong: #477fae; --accent-soft: #d9e9f5; }
html[data-accent="orange"] { --accent: #e59a5a; --accent-strong: #b96c31; --accent-soft: #f5dfcd; }
html[data-accent="pink"] { --accent: #d9879e; --accent-strong: #ad5871; --accent-soft: #f4dce3; }

html.dark-mode {
    --bg: #232825;
    --paper: #2d342f;
    --paper-warm: #363c36;
    --ink: #edf0ea;
    --ink-soft: #d1d8d1;
    --muted: #a9b0a7;
    --line: #4b544c;
    --dash: #596158;
    --accent-soft: #344d3b;
    --shadow: 0 16px 36px rgba(0, 0, 0, .28);
    --soft-shadow: 0 8px 22px rgba(0, 0, 0, .22);
    --paper-shadow: 0 2px 7px rgba(0, 0, 0, .2);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; background: var(--bg); }
body {
    min-height: 100%; margin: 0; overflow-x: clip;
    color: var(--ink); background: var(--bg);
    font-family: var(--font); font-size: 15px; line-height: 1.75;
    -webkit-font-smoothing: antialiased;
}
body::before {
    content: ""; position: fixed; inset: 0 0 auto; z-index: 19; height: 38px;
    background: linear-gradient(to bottom, var(--bg) 0 60%, transparent); pointer-events: none;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
button, input { font: inherit; }
button { color: inherit; }
::selection { color: var(--ink); background: var(--accent-soft); }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.page-grain {
    position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .07;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.16'/%3E%3C/svg%3E");
}
.lucide { width: 16px; height: 16px; flex: 0 0 auto; vertical-align: middle; }

/* Header */
.site-header {
    position: sticky; top: 16px; z-index: 20;
    width: min(96vw, 1400px); min-height: 72px; margin: 28px auto 0; padding: 12px 22px;
    display: grid; grid-template-columns: minmax(210px, auto) 1fr auto; align-items: center; gap: 22px;
    background: var(--paper); border-radius: 4px; box-shadow: var(--soft-shadow);
    transition: transform .28s cubic-bezier(.22,.61,.36,1), opacity .2s ease, box-shadow .2s ease;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-heading { min-width: 0; margin: 0; font-size: inherit; line-height: inherit; }
.brand-heading .brand-text { display: block; }
.brand-text { overflow: hidden; color: var(--ink); font-size: 21px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; transition: color .2s, transform .2s; }
.brand-text:hover { color: var(--accent-strong); transform: translateY(-1px); }
.brand-mark, .icon-button {
    display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0;
    border: 1px dashed var(--line); border-radius: 50%; background: transparent; cursor: pointer;
    transition: color .2s, background .2s, border-color .2s, transform .2s;
}
.brand-mark:hover, .icon-button:hover { color: var(--accent-strong); border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.brand-mark { visibility: visible; }
.brand-mark__logo { display: block; width: 32px; height: 32px; border-radius: 10px; }
.site-nav { display: flex; justify-content: center; min-width: 0; }
.nav-list { display: flex; align-items: center; justify-content: center; gap: 2px; margin: 0; padding: 0; list-style: none; }
.nav-list li { position: relative; }
.nav-list a {
    position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 38px; padding: 7px 14px; color: var(--muted); font-size: 14px; font-weight: 650;
}
.nav-list a::before {
    content: ""; position: absolute; z-index: -1; left: 7px; right: 7px; bottom: 7px; height: 14px;
    border-radius: 7px 3px 8px 4px; background-color: var(--accent-soft); opacity: 0; transform: scaleX(.4) rotate(-2deg); transition: .2s;
}
.nav-list a:hover, .nav-list .current-menu-item > a, .nav-list .current_page_item > a { color: var(--accent-strong); }
.nav-list a:hover::before, .nav-list .current-menu-item > a::before, .nav-list .current_page_item > a::before { opacity: .85; transform: scaleX(1) rotate(-1deg); }
.header-tools { display: flex; align-items: center; gap: 10px; }
.theme-icon--moon { display: none; }
.dark-mode .theme-icon--sun { display: none; }
.dark-mode .theme-icon--moon { display: inline-grid; }
.palette-icon { width: 18px; height: 18px; border: 2px dotted currentColor; border-radius: 50%; font-size: 0; }
.accent-picker { position: relative; }
.accent-menu {
    position: absolute; top: calc(100% + 10px); right: 0; display: none; gap: 5px; padding: 8px;
    background: var(--paper); border: 1px dashed var(--line); border-radius: 4px; box-shadow: var(--soft-shadow);
}
.accent-picker.is-open .accent-menu { display: flex; }
.accent-menu button { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.accent-menu button:hover { background: var(--paper-warm); }
.swatch { width: 15px; height: 15px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(44,53,49,.14); }
.swatch--green { background: #6fa67c; } .swatch--blue { background: #6fa9d9; } .swatch--orange { background: #e59a5a; } .swatch--pink { background: #d9879e; }

/* Layout and paper cards */
.paper-shell {
    width: min(96vw, 1400px); margin: 28px auto 0;
    display: grid; grid-template-columns: 270px minmax(0, 1fr); align-items: start; gap: 26px;
}
.paper-shell--article { grid-template-columns: 270px minmax(0, 1fr); }
.paper-main, .paper-sidebar { min-width: 0; display: grid; align-content: start; gap: 22px; }
.paper-sidebar--journal { display: contents; }
.side-card, .featured-paper, .post-card, .article-paper, .empty-paper {
    position: relative; z-index: 1; background: var(--paper); border-radius: 4px; box-shadow: var(--paper-shadow);
}
.side-card, .post-card { transition: transform .22s, box-shadow .22s; }
.side-card:hover, .post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.side-card { padding: 20px 22px; }
.side-card h2 { display: flex; align-items: center; gap: 9px; margin: 0 0 15px; font-size: 16px; }
.side-card h2 .lucide, .section-head .lucide { color: var(--accent); }

/* Profile and sidebars */
.profile-card { padding-top: 27px; text-align: center; }
.profile-avatar {
    display: grid; place-items: center; width: 84px; height: 84px; margin: 0 auto 12px; overflow: hidden;
    border: 1px dashed var(--dash); border-radius: 10px; color: var(--accent-strong); background: linear-gradient(155deg, var(--accent-soft), var(--paper-warm)); font-size: 34px; font-weight: 800;
}
.profile-avatar__img { width: 100%; height: 100%; object-fit: cover; }
.profile-card h3 { margin: 3px 0 1px; font-size: 18px; }
.profile-role { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.profile-card > p:last-of-type { margin: 0 auto 14px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.site-info { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.site-info > * { display: grid; gap: 2px; padding: 4px 1px; }
.site-info strong { font-size: 17px; line-height: 1.2; }
.site-info span { color: var(--muted); font-size: 12px; font-weight: 650; }
.site-info a:hover strong { color: var(--accent-strong); }
.wechat-card { padding: 19px 22px 21px; text-align: center; }
.wechat-card__eyebrow {
    display: inline-flex; margin-bottom: 9px; padding: 5px 14px; border-radius: 999px;
    color: var(--accent-strong); background: var(--accent-soft); font-size: 18px; font-weight: 800; letter-spacing: .06em;
}
.wechat-card h2 { display: block; margin: 0 0 7px; font-size: 20px; }
.wechat-card > p { margin: 0 auto 15px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.wechat-card__qr {
    width: min(100%, 184px); margin: 0 auto 10px; padding: 9px;
    border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.wechat-card__qr img { display: block; width: 100%; height: auto; border-radius: 3px; }
.wechat-card small { color: var(--muted); font-size: 12px; }
.categories-card > a { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 9px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.categories-card > a:last-child { border-bottom: 0; }
.categories-card > a:hover { color: var(--accent-strong); transform: translateX(2px); }
.categories-card strong { overflow: hidden; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.categories-card em { color: var(--muted); font-size: 12px; font-style: normal; }
.dot { width: 8px; height: 8px; border-radius: 3px; background: var(--accent); transform: rotate(-10deg); }
.dot-1 { background: var(--blue); } .dot-2 { background: var(--orange); } .dot-3 { background: var(--violet); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-cloud a, .article-tags a, .meta-tags a { padding: 3px 9px; border-radius: 8px 4px 7px 5px; color: var(--accent-strong); background: var(--accent-soft); font-size: 12px; font-weight: 650; }
.tag-cloud a:hover, .article-tags a:hover { color: var(--paper); background: var(--accent); }
.drawer-close { display: none; }

.journal-card { padding: 18px; }
.journal-photo {
    position: relative; aspect-ratio: 1; margin: -9px -5px 18px; padding: 7px 7px 22px; background: #fff;
    border-radius: 2px; box-shadow: 2px 4px 14px rgba(76,60,37,.16); transform: rotate(5deg);
}
.journal-photo img { width: 100%; height: 100%; object-fit: cover; }
.journal-card .hello { display: flex; align-items: center; gap: 8px; margin: 0 3px 7px; color: var(--accent-strong); font-size: 13px; font-weight: 700; }
.green-dot { width: 9px; height: 9px; border-radius: 3px; background: var(--accent); transform: rotate(15deg); }
.journal-card h2 { display: inline; position: relative; margin: 0; padding: 0 3px; font-size: 20px; line-height: 1.5; }
.journal-card h2::after { content: ""; position: absolute; z-index: -1; left: 3px; right: 3px; bottom: 0; height: 8px; background: rgba(241,193,84,.38); }
.journal-card > p:not(.hello) { margin: 12px 3px 17px; color: var(--muted); font-size: 13px; }
.paper-button {
    position: relative; display: flex; align-items: center; justify-content: center; gap: 7px; width: fit-content; min-height: 38px; margin-left: auto; padding: 7px 16px;
    border: 1px solid var(--dash); border-radius: 4px; color: var(--ink-soft); background: var(--paper-warm); font-size: 13px; font-weight: 650; transition: .2s;
}
.paper-button:hover { color: var(--accent-strong); border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.recent-list { margin: 0; padding: 0; list-style: none; }
.recent-list li + li { border-top: 1px dashed var(--line); }
.recent-list a { display: block; padding: 9px 3px; transition: color .15s, transform .15s; }
.recent-list a:hover { color: var(--accent-strong); transform: translateX(2px); }
.recent-list strong { display: -webkit-box; overflow: hidden; font-size: 13px; font-weight: 650; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.recent-list em { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-style: normal; }

/* Featured and single-column home feed */
.featured-paper { min-height: 344px; display: grid; grid-template-columns: minmax(0, 1.14fr) minmax(250px, .86fr); overflow: hidden; }
.featured-copy { display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: 34px 28px; }
.label-pill { display: inline-block; width: fit-content; margin-bottom: 10px; padding: 3px 12px; border-radius: 9px 4px 8px 5px; color: #fff; background: var(--accent); font-size: 12px; font-weight: 750; }
.featured-paper h2 { margin: 0; font-size: 22px; line-height: 1.45; }
.featured-paper h2 a:hover { color: var(--accent-strong); }
.featured-copy > p { margin: 12px 0 16px; color: var(--muted); font-size: 13px; line-height: 1.7; display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.featured-thumb { min-width: 0; overflow: hidden; background: var(--paper-warm); clip-path: polygon(7% 0,100% 0,100% 100%,7% 100%,2% 91%,7% 82%,2% 72%,7% 62%,2% 52%,7% 42%,2% 31%,7% 21%,2% 11%); }
.featured-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.featured-paper:hover .featured-thumb img { transform: scale(1.035); }
.section-head { display: flex; align-items: center; margin: 10px 6px 0; padding: 0 0 14px; border-bottom: 1px solid var(--line); }
.section-head h1, .section-head h2 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 22px; letter-spacing: .01em; }
.section-head--archive { padding: 18px 22px 20px; border: 1px solid var(--line); border-radius: 4px; background: var(--paper-warm); box-shadow: var(--paper-shadow); }
.section-head--archive h1, .section-head--archive h2 { font-size: 26px; }
.archive-intro { margin: -1px 0 24px; padding: 0 24px 22px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 4px 4px; color: var(--muted); background: var(--paper); font-size: 14px; line-height: 1.9; }
.archive-intro > :first-child { margin-top: 0; }
.archive-intro > :last-child { margin-bottom: 0; }
.section-head--archive:has(+ .archive-intro) { border-radius: 4px 4px 0 0; box-shadow: none; }
.breadcrumbs { min-width: 0; margin: 0 0 14px; color: var(--muted); font-size: 12px; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.breadcrumbs li { display: inline-flex; align-items: center; min-width: 0; }
.breadcrumbs li + li::before { content: "/"; margin-right: 6px; color: var(--line-strong); }
.breadcrumbs a:hover { color: var(--accent-strong); }
.breadcrumbs [aria-current="page"] { max-width: 52ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.post-card { min-height: 214px; display: grid; grid-template-columns: 245px minmax(0, 1fr); padding: 16px; overflow: hidden; }
.post-thumb-link { display: block; min-width: 0; }
.paper-thumb { display: block; width: 100%; height: 180px; overflow: hidden; border-radius: 4px; background: var(--paper-warm); }
.paper-thumb__img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.post-card:hover .paper-thumb__img { transform: scale(1.045); }
.post-card-copy { min-width: 0; display: flex; flex-direction: column; gap: 7px; padding: 4px 5px 2px 18px; }
.post-card h2, .post-card h3 { margin: 0; font-size: 17px; line-height: 1.5; display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.post-card h2 a:hover, .post-card h3 a:hover { color: var(--accent-strong); }
.post-card-copy > p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.meta-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.meta-tags a { padding: 1px 6px; color: var(--muted); background: transparent; font-size: 11px; }
.meta-tags a:hover { color: var(--accent-strong); }
.meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: auto; color: var(--muted); font-size: 11px; }
.meta-line > span, .meta-cat-link { display: inline-flex; align-items: center; gap: 5px; }
.meta-line .lucide { width: 13px; height: 13px; }
.meta-cat-link { color: var(--accent-strong); font-weight: 650; }
.featured-paper .meta-line .paper-button { margin-left: auto; }

/* Pagination */
.pagination { margin: 4px 0 0; }
.nav-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.page-numbers { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 38px; height: 38px; padding: 0 12px; border: 1px dashed var(--dash); border-radius: 4px; background: var(--paper); color: var(--muted); font-size: 13px; font-weight: 650; }
.page-numbers:hover, .page-numbers.current { color: var(--accent-strong); border-color: var(--accent); background: var(--accent-soft); }
.page-numbers.current { color: #fff; background: var(--accent); }
.page-numbers.dots { border: 0; background: transparent; }

/* Articles */
.article-paper { min-width: 0; padding: 56px 68px; overflow: hidden; }
.article-top-img { width: calc(100% + 136px); max-height: 470px; margin: -56px -68px 34px; overflow: hidden; }
.article-top-img img { width: 100%; max-height: 420px; object-fit: cover; }
.article-header { margin-bottom: 32px; padding-bottom: 22px; border-bottom: 1px dashed var(--dash); }
.article-title { margin: 0 0 14px; font-size: 34px; line-height: 1.38; letter-spacing: -.01em; }
.article-content { color: var(--ink-soft); font-size: 16px; line-height: 2; overflow-wrap: anywhere; }
.article-content p { margin: 0 0 19px; }
.article-content h2 { margin: 34px 0 15px; padding-left: 12px; border-left: 4px solid var(--accent); color: var(--ink); font-size: 22px; line-height: 1.4; }
.article-content h3 { margin: 26px 0 12px; color: var(--ink); font-size: 18px; }
.article-content h4 { margin: 22px 0 10px; color: var(--ink); font-size: 16px; }
.article-content ul, .article-content ol { margin: 0 0 20px; padding-left: 1.5em; }
.article-content li { margin: 7px 0; padding-left: .2em; }
.article-content li::marker { color: var(--accent-strong); font-weight: 700; }
.article-content a { color: var(--accent-strong); border-bottom: 1px solid var(--accent-soft); }
.article-content blockquote { margin: 20px 0; padding: 15px 20px; border-left: 4px solid var(--accent); border-radius: 0 4px 4px 0; background: var(--paper-warm); }
.article-content blockquote > :last-child { margin-bottom: 0; }
.article-content figure { max-width: 100%; margin: 24px auto; }
.article-content figcaption { margin-top: -8px; color: var(--muted); font-size: 12px; line-height: 1.6; text-align: center; }
.article-content hr { height: 1px; margin: 34px 0; border: 0; background: var(--line); }
.article-content pre { max-width: 100%; overflow-x: auto; margin: 20px 0; padding: 18px; border-radius: 4px; color: #edf0ea; background: #29312d; }
.article-content code { padding: 2px 5px; border-radius: 3px; color: var(--accent-strong); background: var(--paper-warm); font-family: Consolas, monospace; }
.article-content pre code { padding: 0; color: inherit; background: transparent; }
.article-content table { width: 100%; margin: 20px 0; border-collapse: collapse; }
.article-content th, .article-content td { padding: 9px 12px; border: 1px solid var(--line); text-align: left; }
.article-content img { margin: 18px auto; border-radius: 4px; }
.article-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 30px; padding-top: 20px; border-top: 1px dashed var(--dash); }
.related-posts { margin-top: 30px; padding-top: 24px; border-top: 1px dashed var(--dash); }
.related-posts__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 18px; margin-bottom: 12px; }
.related-posts__head h2 { margin: 0; color: var(--ink); font-size: 19px; line-height: 1.5; }
.related-posts__head p { margin: 0; color: var(--muted); font-size: 12px; }
.related-posts__head a { color: var(--accent-strong); border-bottom: 1px solid var(--accent-soft); }
.related-posts__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 22px; }
.related-posts__grid a { display: flex; min-width: 0; flex-direction: column; gap: 5px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.related-posts__grid em { width: fit-content; color: var(--accent-strong); font-size: 11px; font-style: normal; font-weight: 650; }
.related-posts__grid strong { color: var(--ink); font-size: 14px; line-height: 1.55; }
.related-posts__grid a:hover strong { color: var(--accent-strong); }
.related-posts__grid span { color: var(--muted); font-size: 11px; }
.article-nav { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; margin-top: 28px; padding-top: 20px; border-top: 1px dashed var(--dash); }
.article-nav a { display: flex; flex-direction: column; gap: 3px; min-width: 0; color: var(--muted); font-size: 12px; }
.article-nav strong { overflow: hidden; color: var(--accent-strong); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.article-nav .nav-next { text-align: right; }
.empty-paper { padding: 50px 28px; text-align: center; }
.empty-paper h1 { margin: 0 0 8px; font-size: 24px; }
.empty-paper p { margin: 0; color: var(--muted); }

/* Search */
.search-dialog { width: min(92vw, 560px); padding: 30px; border: 0; border-radius: 4px; color: var(--ink); background: var(--paper); box-shadow: var(--shadow); }
.search-dialog::backdrop { background: rgba(31,35,32,.52); backdrop-filter: blur(3px); }
.search-dialog h2 { margin: 0 0 18px; font-size: 20px; }
.search-dialog form { display: flex; gap: 8px; }
.search-dialog input { flex: 1; min-width: 0; height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); background: var(--paper-warm); outline: none; }
.search-dialog input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-dialog form button { display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 16px; border: 0; border-radius: 4px; color: #fff; background: var(--accent); cursor: pointer; }
.dialog-close { position: absolute; top: 10px; right: 10px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.dialog-close:hover { background: var(--accent-soft); }

.site-footer { width: min(96vw, 1400px); margin: 34px auto 26px; padding: 22px 0; text-align: center; }
.site-footer p { margin: 0; color: var(--muted); font-size: 12px; }

@media (max-width: 1200px) {
    .nav-list a { padding-inline: 10px; }
    .post-card { grid-template-columns: 250px minmax(0,1fr); }
}

@media (max-width: 960px) {
    body::before { height: 26px; }
    .site-header, .paper-shell, .site-footer { width: min(94vw, 760px); }
    .site-header { top: 10px; min-height: 62px; margin-top: 16px; padding: 9px 13px; grid-template-columns: minmax(0,1fr) auto; }
    .brand-text { font-size: 18px; }
    .site-nav { display: none; }
    .header-tools { gap: 6px; }
    .header-tools .accent-picker { display: none; }
    .paper-shell, .paper-shell--article { margin-top: 20px; grid-template-columns: minmax(0,1fr); }
    .paper-sidebar--profile {
        position: fixed; z-index: 50; top: 0; left: 0; width: min(84vw, 310px); height: 100dvh; padding: 74px 18px 28px; overflow-y: auto;
        background: var(--bg); box-shadow: var(--shadow); transform: translateX(-105%); transition: transform .25s ease;
    }
    body.sidebar-open { overflow: hidden; }
    body.sidebar-open .paper-sidebar--profile { transform: translateX(0); }
    .drawer-close { position: absolute; top: 18px; right: 18px; display: inline-grid; background: var(--paper); }
    .drawer-overlay { position: fixed; z-index: 49; inset: 0; visibility: hidden; background: rgba(31,35,32,.48); opacity: 0; transition: opacity .25s, visibility 0s linear .25s; }
    body.sidebar-open .drawer-overlay { visibility: visible; opacity: 1; transition-delay: 0s; }
    .featured-paper { grid-template-columns: minmax(0,1fr) 40%; min-height: 280px; }
    .featured-copy { padding: 28px 23px; }
    .featured-paper h2 { font-size: 20px; }
    .article-paper { padding: 34px 28px; }
    .article-top-img { width: calc(100% + 56px); margin: -34px -28px 26px; }
    .article-title { font-size: 25px; }
}

@media (max-width: 620px) {
    .icon-button, .brand-mark { width: 38px; height: 38px; }
    .header-tools { gap: 4px; }
    .featured-paper { display: flex; min-height: 0; flex-direction: column-reverse; }
    .featured-thumb { width: 100%; height: 190px; clip-path: none; }
    .featured-copy { padding: 24px 20px; }
    .featured-copy > p { -webkit-line-clamp: 2; }
    .featured-paper .meta-line .paper-button { width: 100%; margin: 8px 0 0; }
    .post-card { grid-template-columns: 1fr; padding: 12px; }
    .paper-thumb { height: auto; aspect-ratio: 16/9; }
    .post-card-copy { padding: 12px 4px 4px; }
    .post-card h2, .post-card h3 { font-size: 16px; }
    .article-paper { padding: 28px 18px; }
    .article-top-img { width: calc(100% + 36px); margin: -28px -18px 24px; }
    .article-title { font-size: 22px; }
    .article-nav { grid-template-columns: 1fr; }
    .article-nav .nav-next { text-align: left; }
    .search-dialog { padding: 25px 18px 20px; }
    .search-dialog form { flex-direction: column; }
    .search-dialog form button { justify-content: center; }
}

/* Single-column reading layout */
.site-header, .paper-shell, .site-footer { width: min(96vw, 960px); }
.paper-shell, .paper-shell--article { grid-template-columns: minmax(0, 1fr); gap: 0; }
.paper-main { width: 100%; gap: 28px; }
.paper-sidebar--profile {
    position: fixed; z-index: 50; top: 0; left: 0; width: min(84vw, 310px); height: 100dvh; padding: 74px 18px 28px;
    overflow-y: auto; background: var(--paper); box-shadow: var(--shadow); transform: translateX(-105%); transition: transform .25s ease;
}
body.sidebar-open { overflow: hidden; }
body.sidebar-open .paper-sidebar--profile { transform: translateX(0) !important; }
.drawer-close { position: absolute; top: 18px; right: 18px; display: inline-grid; background: var(--paper); }
.drawer-overlay { position: fixed; z-index: 49; inset: 0; visibility: hidden; background: rgba(31,35,32,.48); opacity: 0; transition: opacity .25s, visibility 0s linear .25s; }
body.sidebar-open .drawer-overlay { visibility: visible; opacity: 1; transition-delay: 0s; }

.featured-paper { display: flex; min-height: 0; flex-direction: column-reverse; border-radius: 8px; }
.featured-thumb { width: 100%; height: 220px; clip-path: none; }
.featured-copy { padding: 30px 32px 32px; }
.featured-paper h2 { font-size: 27px; line-height: 1.42; }
.featured-copy > p { font-size: 15px; line-height: 1.9; -webkit-line-clamp: 4; }

.section-head { margin: 8px 0 0; padding: 0 0 16px; }
.section-head h1, .section-head h2 { font-size: 22px; }
.post-list { gap: 42px; }
.post-card {
    display: block; min-height: 0; padding: 30px; border-radius: 8px; box-shadow: 0 0 8px rgba(0,0,0,.16);
}
.post-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(43,55,68,.12); }
.post-card-copy { display: block; padding: 0; }
.post-card h2, .post-card h3 { margin: 0 0 22px; font-size: 23px; line-height: 1.45; }
.post-card-copy > p { margin: 0 0 22px; font-size: 15px; line-height: 1.95; -webkit-line-clamp: 4; }
.meta-tags { margin-bottom: 18px; }
.meta-line { margin-top: 0; font-size: 12px; }

.article-paper { padding: 56px 72px; border-radius: 8px; }
.article-top-img { width: calc(100% + 144px); margin: -56px -72px 34px; }

@media (max-width: 960px) {
    .site-header, .paper-shell, .site-footer { width: min(94vw, 760px); }
    .paper-shell, .paper-shell--article { grid-template-columns: minmax(0,1fr); }
    .paper-sidebar--profile { width: min(84vw, 310px); }
    .featured-paper h2 { font-size: 22px; }
    .featured-copy { padding: 28px 24px; }
    .article-paper { padding: 34px 28px; }
    .article-top-img { width: calc(100% + 56px); margin: -34px -28px 26px; }
}

@media (max-width: 620px) {
    .featured-thumb { height: 190px; }
    .post-card { padding: 24px 20px; }
    .post-card h2, .post-card h3 { font-size: 20px; }
    .article-paper { padding: 28px 18px; }
    .article-top-img { width: calc(100% + 36px); margin: -28px -18px 24px; }
}

/* FlatPaper-style desktop sidebar and article thumbnails. */
@media (min-width: 961px) {
    .site-header, .paper-shell, .site-footer { width: min(96vw, 1400px); }
    .paper-shell, .paper-shell--article { grid-template-columns: 300px minmax(0, 1fr); gap: 28px; }
    body.home .site-header, body.home .paper-shell--home, body.home .site-footer { width: min(96vw, 1400px); }
    body.home .paper-shell--home { grid-template-columns: 300px minmax(0, 1fr); gap: 28px; }
    .paper-sidebar--profile {
        position: sticky; top: var(--sidebar-sticky-top, 18px); align-self: start; width: auto; height: auto; max-height: none; padding: 0; overflow: visible;
        background: transparent; box-shadow: none; transform: none; transition: top .28s cubic-bezier(.22,.61,.36,1);
    }
    .site-header.is-header-hidden {
        opacity: 0; pointer-events: none; transform: translateY(calc(-100% - 48px));
    }
    .drawer-close, .drawer-overlay { display: none; }
    .featured-paper {
        display: grid; grid-template-columns: minmax(0, 1fr) 270px; min-height: 310px;
        overflow: visible; background: transparent; box-shadow: none;
    }
    .featured-copy { min-width: 0; padding: 28px; background: var(--paper); border-radius: 8px 0 0 8px; }
    .featured-paper h2 { font-size: 27px; line-height: 1.42; }
    .featured-copy > p { font-size: 14px; line-height: 1.8; -webkit-line-clamp: 3; }
    .featured-thumb {
        width: 270px; height: 310px; clip-path: polygon(7% 0,100% 0,100% 100%,7% 100%,2% 91%,7% 82%,2% 72%,7% 62%,2% 52%,7% 42%,2% 31%,7% 21%,2% 11%);
        border-radius: 0 4px 4px 0;
    }
    .post-card { display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: 236px; padding: 16px; }
    .paper-thumb { height: 204px; }
    .post-card-copy { display: flex; padding: 4px 8px 2px 22px; }
    .post-card h2, .post-card h3 { margin-bottom: 12px; font-size: 22px; }
    .post-card-copy > p { margin-bottom: 12px; line-height: 1.8; -webkit-line-clamp: 3; }
    .meta-tags { margin-bottom: 8px; }
    .meta-line { margin-top: auto; }
}

/* Article reading surface and semantic navigation. */
.site-info { display: none !important; }
.article-content .wp-wechat-publisher-site-daily,
.article-content .wp-wechat-publisher-site-dayline,
.article-content .post-views { display: none !important; }
.article-summary { margin: -2px 0 20px; color: var(--muted); font-size: 15px; line-height: 1.85; }
.article-toc { margin: 0 0 30px; padding: 17px 20px 16px; border: 1px dashed var(--dash); border-radius: 6px; background: var(--paper-warm); }
.article-toc h2 { margin: 0 0 9px; color: var(--ink); font-size: 17px; line-height: 1.5; }
.article-toc ol { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.article-toc li { min-width: 0; padding-left: 16px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.article-toc li::before { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 8px 2px -14px; border-radius: 2px; background: var(--accent); transform: rotate(-8deg); }
.article-toc li.toc-level-3 { padding-left: 32px; font-size: 12px; }
.article-toc li.toc-level-3::before { margin-left: -30px; background: var(--blue); }
.article-toc a:hover { color: var(--accent-strong); }
.article-paper--single .article-content { font-size: 16px; line-height: 2; }
.article-paper--single .article-content > p:first-child { font-size: 17px; }

@media (min-width: 961px) {
    .article-paper--single { padding: 44px 64px 34px; }
    .article-paper--single .article-top-img { width: calc(100% + 128px); max-height: 360px; margin: -44px -64px 34px; }
    .article-paper--single .article-top-img img { max-height: 360px; }
    .article-paper--single .article-title { font-size: 32px; line-height: 1.42; }
    .article-paper--single .article-header { margin-bottom: 28px; padding-bottom: 22px; }
}

@media (max-width: 620px) {
    .article-summary { font-size: 14px; }
    .article-paper--single .article-content > p:first-child { font-size: 16px; }
    .related-posts__grid { grid-template-columns: 1fr; }
    .breadcrumbs [aria-current="page"] { max-width: 28ch; }
    .archive-intro { padding: 0 20px 20px; }
}

/* XPoet-style text cards on the home feed. */
.paper-shell--home .post-thumb-link { display: none; }
.paper-shell--home .post-list { gap: 42px; }
.paper-shell--home .post-card { display: flex; min-height: 280px; padding: 34px 30px; }
.paper-shell--home .post-card-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 0; padding: 0; }
.paper-shell--home .post-card h2, .paper-shell--home .post-card h3 { margin: 0 0 18px; font-size: 23px; line-height: 1.45; }
.paper-shell--home .post-card-copy > p { margin: 0; font-size: 16px; line-height: 1.9; -webkit-line-clamp: 4; }
.paper-shell--home .meta-tags { margin-bottom: 0; }
.paper-shell--home .meta-line { margin-top: auto; padding-top: 14px; }
@media (min-width: 961px) {
    .paper-shell--home .featured-paper--text {
        display: block; width: 100%; min-height: 310px; overflow: hidden;
        background: var(--paper); box-shadow: var(--paper-shadow);
    }
    .paper-shell--home .featured-paper--text .featured-copy {
        width: 100%; min-height: 310px; border-radius: 8px;
    }
    .paper-shell--home .featured-paper--text h2 {
        font-size: 23px; line-height: 1.45;
    }
    .paper-shell--home .featured-paper--text .featured-copy > p {
        font-size: 16px; line-height: 1.9; -webkit-line-clamp: 4;
    }
}
@media (max-width: 620px) {
    .paper-shell--home .post-card { min-height: 0; padding: 24px 20px; }
    .paper-shell--home .post-card h2, .paper-shell--home .post-card h3 { font-size: 20px; }
    .paper-shell--home .meta-line { padding-top: 12px; }
}
