:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --ink: #262b33;
  --muted: #878d99;
  --accent: #0e7490;
  --gold: #d97706;
  --border: #e6e1d8;
  --radius: 14px;
  --maxw: 1240px;
  --shadow: 0 1px 2px rgba(38,43,51,.04), 0 10px 28px rgba(38,43,51,.07);
  --shadow-lg: 0 2px 4px rgba(38,43,51,.05), 0 18px 44px rgba(38,43,51,.10);
  --font-sans: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Noto Sans CJK SC", system-ui, -apple-system, sans-serif;
  --font-serif: Georgia, "Songti SC", "STSong", "SimSun", serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.85;
  font-size: 16px;
}
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* header */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 62px; gap: 16px; }
.site-title { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: .5px; }
.logo { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, #0f766e, #14b8a6); color: #fff; font-size: 16px; font-weight: 800; box-shadow: 0 4px 10px rgba(20,184,166,.35); }
.site-header nav { display: flex; gap: 6px; flex-wrap: wrap; }
.site-header nav a { color: var(--muted); text-decoration: none; font-size: 14.5px; padding: 6px 12px; border-radius: 999px; transition: all .18s ease; }
.site-header nav a:hover { color: var(--accent); background: #e8f4f6; }

/* hero - minimal */
.hero { position: relative; overflow: hidden; background: linear-gradient(135deg, #0b2e3b 0%, #134e5e 55%, #16697a 100%); color: #fff; padding: 50px 20px 44px; text-align: center; }
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; filter: blur(70px); opacity: .4; }
.hero::before { width: 320px; height: 320px; background: #2dd4bf; top: -150px; right: 8%; }
.hero::after { width: 280px; height: 280px; background: #f59e0b; bottom: -140px; left: 6%; opacity: .25; }
.hero-inner { max-width: 900px; margin: 0 auto; position: relative; z-index: 1; }
.hero h1 { font-family: var(--font-serif); font-size: 44px; margin: 0 0 8px; letter-spacing: 3px; }
.hero-sub { color: #c8dbe0; margin: 0; font-size: 16px; }

/* home layout: single-column posts + right category sidebar */
.home-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: start; padding: 30px 0 64px; }
.post-list-wrap { min-width: 0; }
.filter-hint { font-size: 13px; color: var(--muted); margin: 0 0 14px; letter-spacing: 1px; }
.post-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.card { position: relative; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 26px; box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease; overflow: hidden; }
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(180deg, var(--cat, var(--accent)), transparent); opacity: 0; transition: opacity .2s ease; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card:hover::before { opacity: 1; }
.card h2 { margin: 0 0 10px; font-size: 20px; }
.card h2 a { color: var(--ink); text-decoration: none; }
.card h2 a:hover { color: var(--accent); }
.meta { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); margin-bottom: 10px; flex-wrap: wrap; }
.cat { --cat: var(--accent); background: color-mix(in srgb, var(--cat) 12%, white); color: var(--cat); padding: 2px 12px; border-radius: 999px; font-size: 12.5px; text-decoration: none; font-weight: 500; }
.cat:hover { background: var(--cat); color: #fff; }
.excerpt { margin: 0; color: #5d6673; font-size: 14.5px; }

/* category sidebar */
.cat-sidebar { position: sticky; top: 84px; }
.sidebar-title { font-size: 15px; font-weight: 700; color: var(--ink); margin: 0 0 14px; letter-spacing: 3px; display: flex; align-items: center; gap: 8px; }
.sidebar-title::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); display: inline-block; }
.cat-tree { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.cat-tree ul { list-style: none; margin: 0; padding: 0; }
.cat-tree li { border-top: 1px solid var(--border); }
.cat-tree li:first-child { border-top: none; }
.cat-tree a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 16px; color: var(--ink); text-decoration: none; font-size: 14.5px; transition: background .15s ease, color .15s ease; }
.cat-tree a:hover { background: #f2f7f7; color: var(--accent); }
.cat-tree a.active { background: color-mix(in srgb, var(--accent) 10%, white); color: var(--accent); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.cat-tree .count { font-size: 12px; color: var(--muted); background: #f0eee8; border-radius: 999px; padding: 1px 9px; }
.cat-tree a.active .count { background: var(--accent); color: #fff; }
.cat-tree li.parent > a { font-weight: 600; }
.cat-tree li ul a { padding-left: 30px; font-size: 13.5px; color: #55606e; font-weight: 400; }
.cat-tree li ul li { border-top: 1px dashed var(--border); }
.sidebar-note { font-size: 12px; color: var(--muted); margin: 12px 2px 0; line-height: 1.6; }

/* article layout: left toc sidebar + content */
.breadcrumb { display: flex; gap: 8px; font-size: 13px; color: var(--muted); padding: 26px 0 0; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.article-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 30px; align-items: start; padding: 18px 0 64px; }
.article { background: var(--card); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); padding: 40px 46px; }
.article-main { min-width: 0; }
.article-head { border-bottom: 1px solid var(--border); padding-bottom: 20px; margin-bottom: 26px; }
.article-head h1 { font-family: var(--font-serif); font-size: 32px; margin: 0 0 14px; line-height: 1.4; letter-spacing: 1px; }
.reading::before { content: "☕"; font-size: 12px; margin-right: 5px; }

/* toc sidebar */
.toc-sidebar { position: sticky; top: 84px; max-height: calc(100vh - 110px); overflow-y: auto; scrollbar-width: thin; }
.toc { background: var(--card); border: 1px solid var(--border); border-top: 3px solid var(--accent); border-radius: 14px; box-shadow: var(--shadow); padding: 18px 16px 20px; }
.toc-title { font-weight: 700; font-size: 14px; color: var(--accent); margin: 0 8px 10px; letter-spacing: 3px; display: flex; align-items: center; gap: 7px; }
.toc-title::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; }
.toc ol { margin: 0; padding: 0; list-style: none; }
.toc li { margin: 1px 0; }
.toc li.sub a { padding-left: 26px; }
.toc a { display: block; color: #55606e; text-decoration: none; font-size: 13.5px; padding: 5px 8px; border-left: 2px solid transparent; border-radius: 0 8px 8px 0; line-height: 1.55; }
.toc a:hover { color: var(--accent); background: #f2f7f7; }
.toc a.active { color: var(--accent); font-weight: 600; border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, white); }

/* content typography */
.post-content h2, .post-content h3, .post-content h4 { margin: 1.7em 0 .6em; line-height: 1.5; scroll-margin-top: 84px; }
.post-content h2 { font-size: 24px; padding-left: 12px; border-left: 4px solid var(--accent); }
.post-content h3 { font-size: 20px; }
.post-content h4 { font-size: 17px; color: #3d4653; }
.post-content p { margin: .85em 0; }
.post-content a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 3px; }
.post-content a:hover { text-decoration-color: var(--accent); }
.post-content img { max-width: 100%; height: auto; border-radius: 12px; display: block; margin: 18px auto; box-shadow: var(--shadow); }
.post-content figure { margin: 20px 0; text-align: center; }
.post-content figcaption { color: var(--muted); font-size: 13px; margin-top: 8px; }
.post-content ul, .post-content ol { padding-left: 26px; margin: .85em 0; }
.post-content li { margin: .4em 0; }
.post-content blockquote { margin: 1.2em 0; padding: 12px 20px; border-left: 4px solid var(--gold); background: #fdf6ec; border-radius: 0 10px 10px 0; color: #574c3f; }
.post-content pre { background: #1f2430; color: #e8ecf3; padding: 18px 22px; border-radius: 12px; overflow-x: auto; font-size: 13.5px; line-height: 1.7; }
.post-content code { font-family: Consolas, "Courier New", monospace; font-size: .92em; }
.post-content :not(pre) > code { background: #eef1f6; color: #c7254e; padding: 2px 7px; border-radius: 5px; }
.post-content table { border-collapse: collapse; width: 100%; margin: 1.2em 0; font-size: 14.5px; }
.post-content th, .post-content td { border: 1px solid var(--border); padding: 9px 13px; text-align: left; }
.post-content th { background: #eef4f5; color: var(--accent); font-weight: 600; }
.post-content tr:nth-child(even) td { background: #faf9f6; }
.post-content hr { border: none; border-top: 1px dashed var(--border); margin: 2.2em 0; }
.post-content .wp-block-columns { display: flex; gap: 18px; flex-wrap: wrap; }
.post-content .wp-block-column { flex: 1; min-width: 220px; }

/* article foot */
.article-foot { border-top: 1px solid var(--border); margin-top: 34px; padding-top: 22px; display: flex; justify-content: center; }
.btn-back { text-decoration: none; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); padding: 8px 22px; border-radius: 999px; font-size: 14px; transition: all .15s ease; }
.btn-back:hover { background: var(--accent); color: #fff; }

/* categories page */
.page-head { text-align: center; padding: 46px 0 22px; }
.page-head h1 { font-family: var(--font-serif); font-size: 36px; margin: 0 0 8px; letter-spacing: 2px; }
.page-head .hero-sub { color: var(--muted); margin: 0; }
.cat-blocks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; padding-bottom: 64px; }
.cat-block { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 26px; box-shadow: var(--shadow); scroll-margin-top: 84px; }
.cat-block h2 { margin: 0 0 12px; font-size: 19px; display: flex; align-items: center; gap: 10px; }
.cat-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--cat, var(--accent)); display: inline-block; box-shadow: 0 0 0 4px color-mix(in srgb, var(--cat, var(--accent)) 18%, transparent); }
.cat-block h2 small { color: var(--muted); font-weight: 400; font-size: 13px; }
.cat-block ul { margin: 0; padding-left: 22px; }
.cat-block li { margin: 8px 0; display: flex; align-items: center; gap: 12px; }
.cat-block a { color: var(--ink); text-decoration: none; }
.cat-block a:hover { color: var(--accent); }
.cat-block .date { color: var(--muted); font-size: 13px; margin-left: auto; }
.cat-sub { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); }
.cat-sub h3 { font-size: 15px; margin: 0 0 8px; color: var(--accent); display: flex; align-items: center; gap: 8px; }
.cat-sub h3::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--cat, var(--accent)); display: inline-block; }
.cat-sub h3 small { color: var(--muted); font-weight: 400; font-size: 12.5px; }

/* footer & top button */
.site-footer { border-top: 1px solid var(--border); padding: 30px 0; color: var(--muted); font-size: 13.5px; text-align: center; }
.site-footer .sep { margin: 0 8px; }
.to-top { position: fixed; right: 26px; bottom: 30px; width: 44px; height: 44px; border: none; border-radius: 50%; background: var(--accent); color: #fff; font-size: 20px; cursor: pointer; box-shadow: 0 8px 20px rgba(14,116,144,.35); transition: transform .15s ease; z-index: 60; }
.to-top:hover { transform: translateY(-3px); }

/* responsive */
@media (max-width: 1020px) {
  .home-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .cat-sidebar { position: static; }
  .article-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .toc-sidebar { position: static; max-height: 320px; overflow-y: auto; }
  .cat-blocks { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .site-header .wrap { height: auto; padding: 12px 16px; flex-direction: column; gap: 8px; }
  .hero { padding: 42px 20px 38px; }
  .hero h1 { font-size: 32px; }
  .article { padding: 24px 18px; }
  .article-head h1 { font-size: 24px; }
  .article-layout { padding-top: 10px; }
  .cat-block li { flex-direction: column; align-items: flex-start; gap: 2px; }
  .cat-block .date { margin-left: 0; }
}

/* nav search */
.nav-search { position: relative; display: inline-flex; align-items: center; margin-left: 4px; }
.search-toggle { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: none; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; transition: all .18s ease; }
.search-toggle:hover { color: var(--accent); background: #e8f4f6; }
.search-input { width: 0; opacity: 0; padding: 0; border: 1px solid var(--border); border-radius: 999px; font-size: 13.5px; outline: none; transition: all .22s ease; }
.nav-search.open .search-input { width: 170px; opacity: 1; padding: 6px 14px; margin-left: 6px; }
.search-input:focus { border-color: var(--accent); }

/* 预览文章后返回管理页 */
.back-admin { position: fixed; top: 74px; right: 22px; z-index: 60; background: var(--accent); color: #fff; text-decoration: none; font-size: 13.5px; padding: 8px 16px; border-radius: 999px; box-shadow: 0 8px 20px rgba(14,116,144,.35); transition: transform .15s ease; }
.back-admin:hover { transform: translateY(-2px); }

/* 底部备案号 */
.site-footer .icp { margin-top: 8px; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.site-footer .icp a { color: var(--muted); text-decoration: none; }
.site-footer .icp a:hover { color: var(--accent); }

/* 搜索页 */
.search-page { max-width: 720px; margin: 0 auto 64px; }
.search-box { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 12px 20px; box-shadow: var(--shadow); color: var(--muted); }
.search-box svg { flex-shrink: 0; }
.search-box input { flex: 1; border: none; outline: none; font-size: 15px; background: transparent; color: var(--ink); }
.search-result { margin-bottom: 14px; }
@media (max-width: 640px) {
  .back-admin { top: auto; bottom: 20px; right: 16px; }
}