/* 王天悦 · 雾白、水墨、青瓷 */

:root {
  --paper: #f5f3ee; --paper-2: #edeae2; --card: #fbfaf7;
  --ink: #23272b; --ink-body: #33383d; --ink-2: #50565c; --ink-3: #646b70;
  --line: #dedbd2; --line-soft: #e8e5de;
  --qing: #3e7068; --qing-2: #5f9488; --qing-soft: #dce8e3;   /* 青瓷 */
  --rouge: #a9645a;                                     /* 胭脂，只给首屏人像的嘴唇和红花用 */
  --term: #1d2026; --term-fg: #c9d1d9; --term-dim: #7c858e; --term-pink: #e6a3c0;
  --shadow: 0 18px 40px -24px rgba(35, 39, 43, .35);

  /* 只用系统字体：打开就能显示，不等字体下载 */
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", system-ui, sans-serif;
  /* 标题用宋体；Windows 没有像样的宋体，退回黑体，也不会出现假粗体的宋体 */
  --serif: "Songti SC", "Noto Serif CJK SC", "Noto Serif SC", "Source Han Serif SC", "Source Han Serif CN", -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", "Cascadia Code", Menlo, Consolas, "Sarasa Mono SC", ui-monospace, monospace;

  --measure: 760px; --gutter: 24px; --header-h: 60px; --radius: 10px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

[data-color-scheme="dark"] {
  --paper: #16191d; --paper-2: #1c2025; --card: #1f2329;
  --ink: #e8e4da; --ink-body: #cfccc4; --ink-2: #aeaba4; --ink-3: #8b8f93;
  --line: #2e333a; --line-soft: #252a30;
  --qing: #86b7ab; --qing-2: #6aa092; --qing-soft: #20302d;
  --rouge: #c98a7f;
  --term: #0f1215;
  --shadow: 0 18px 40px -24px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--paper); color: var(--ink-body);
  font: 16px/1.8 var(--sans);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
/* 一层很淡的纸纹，固定在视口上，只栅格化一次 */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .32;
  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 type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .1 0 0 0 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
[data-color-scheme="dark"] body::before { filter: invert(1); opacity: .2; }

::selection { background: var(--qing-soft); color: var(--ink); }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--qing); outline-offset: 3px; border-radius: 4px; }
img, svg, canvas, video { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--serif); color: var(--ink); font-weight: 600; line-height: 1.4; margin: 0; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
.icon { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-fill { fill: currentColor; stroke: none; }
.icon-dot { fill: currentColor; stroke: none; }

.wrap { width: 100%; max-width: var(--measure); margin-inline: auto; padding-inline: var(--gutter); }
.main { flex: 1; }
.skip { position: absolute; left: 12px; top: -100px; z-index: 100; padding: 8px 14px; border-radius: 8px; background: var(--ink); color: var(--paper); }
.skip:focus { top: 12px; }
.empty { padding: 64px 0; text-align: center; color: var(--ink-3); }
/* 插件页面（链接、瞬间、图库…）套主题外壳时的版心和上下留白 */
.plugin-page { padding-block: 48px 24px; }
@media (max-width: 640px) { .plugin-page { padding-block: 32px 16px; } }

/* ───────── 导航 ───────── */
.site-header {
  position: sticky; top: 0; z-index: 30; view-transition-name: site-header;
  background: var(--paper); border-bottom: 1px solid transparent;
  transition: transform .4s var(--ease), border-color .3s, background-color .3s;
}
@supports (background: color-mix(in srgb, red 50%, blue)) {
  .site-header.is-stuck {
    background: color-mix(in srgb, var(--paper) 86%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
  }
}
.site-header.is-stuck { border-bottom-color: var(--line); }
.site-header.is-hidden { transform: translateY(-101%); }
.header-inner { display: flex; align-items: center; gap: 20px; height: var(--header-h); }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; color: var(--ink); font-family: var(--serif); font-weight: 600; font-size: 17px; letter-spacing: .14em; }
.brand-logo { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }

.nav-list { display: flex; align-items: center; gap: 4px; list-style: none; }
.nav-item { position: relative; }
.nav-item > a { position: relative; display: block; padding: 6px 10px; font-size: 14.5px; color: var(--ink-2); border-radius: 8px; transition: color .2s; }
.nav-item > a::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: 2px; height: 1.5px; border-radius: 2px;
  background: var(--qing); transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease-out);
}
.nav-item > a:hover { color: var(--ink); }
.nav-item > a:hover::after, .nav-item > a[aria-current="page"]::after { transform: scaleX(1); }
.nav-item > a[aria-current="page"] { color: var(--ink); }
.nav-sub {
  position: absolute; left: 0; top: 100%; min-width: 150px; padding: 6px; list-style: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(4px); transition: opacity .2s, transform .25s var(--ease), visibility .2s;
}
.nav-item:hover > .nav-sub, .nav-item:focus-within > .nav-sub { opacity: 1; visibility: visible; transform: none; }
.nav-sub a { display: block; padding: 7px 12px; border-radius: 8px; font-size: 14px; color: var(--ink-2); }
.nav-sub a:hover { background: var(--paper-2); color: var(--ink); }

.header-tools { display: flex; align-items: center; gap: 2px; }
.tool { position: relative; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--ink-2); transition: background-color .2s, color .2s; }
.tool:hover { background: var(--paper-2); color: var(--ink); }
.tool .icon { grid-area: 1 / 1; width: 19px; height: 19px; transition: transform .5s var(--ease-out), opacity .3s; }
/* 浅色时显示月亮（点了变深色），深色时显示太阳 */
.scheme-toggle .icon-sun { opacity: 0; transform: rotate(-90deg) scale(.5); }
[data-color-scheme="dark"] .scheme-toggle .icon-sun { opacity: 1; transform: none; }
[data-color-scheme="dark"] .scheme-toggle .icon-moon { opacity: 0; transform: rotate(90deg) scale(.5); }
.menu-toggle { display: none; }
.menu-toggle .icon:last-child { opacity: 0; transform: rotate(-45deg); }
.menu-toggle[aria-expanded="true"] .icon:first-child { opacity: 0; transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] .icon:last-child { opacity: 1; transform: none; }

@media (max-width: 720px) {
  .js .menu-toggle { display: grid; }
  .js .site-nav {
    position: absolute; left: 0; right: 0; top: 100%; padding: 8px var(--gutter) 18px;
    background: var(--paper); border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
    opacity: 0; visibility: hidden; transform: translateY(-8px); transition: opacity .25s, transform .3s var(--ease), visibility .25s;
  }
  .js .site-header.is-open .site-nav { opacity: 1; visibility: visible; transform: none; }
  .js .nav-list { flex-direction: column; align-items: stretch; gap: 0; }
  .js .nav-item > a { padding: 12px 4px; font-size: 16px; border-bottom: 1px solid var(--line-soft); border-radius: 0; }
  .js .nav-item > a::after { display: none; }
  .js .nav-item > a[aria-current="page"] { color: var(--qing); }
  .js .nav-sub { position: static; opacity: 1; visibility: visible; transform: none; border: 0; box-shadow: none; background: none; padding: 0 0 0 14px; }
  /* 没有脚本时，菜单就是一行能横向滑动的链接 */
  html:not(.js) .site-nav { overflow-x: auto; }
  html:not(.js) .brand-name { display: none; }
}

/* ───────── 首屏 ───────── */
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) var(--art-w); column-gap: 40px;
  grid-template-areas: ". visual" "text visual" "links visual" ". visual";
  grid-template-rows: 1fr auto auto 1fr;
  --art-w: 316px; padding-block: 56px 44px;
}
.hero-text { grid-area: text; }
.hero-links { grid-area: links; }
.hero-visual { grid-area: visual; }
.hero-kicker { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-size: 14px; letter-spacing: .3em; color: var(--qing); }
.hero-kicker::before { content: ""; width: 28px; height: 1px; background: currentColor; }
.hero-name { font-size: clamp(42px, 7.4vw, 64px); font-weight: 700; line-height: 1.12; letter-spacing: .1em; }
.hero-lead { margin-top: 18px; max-width: 26em; font-size: 16.5px; line-height: 1.85; color: var(--ink-2); }
.swap { display: inline-grid; }
.hero-lead .swap { display: grid; }
.swap > * { grid-area: 1 / 1; transition: opacity .5s var(--ease), transform .6s var(--ease-out), filter .5s; }
.swap > [aria-hidden="true"] { opacity: 0; transform: translateY(-.4em); filter: blur(4px); pointer-events: none; }

.hero-links { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 28px; list-style: none; }
.hero-links li:first-child .chip { height: 38px; padding-inline: 20px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); font-size: 14px; color: var(--ink-2);
  transition: border-color .25s, color .25s, background-color .25s, transform .3s var(--ease-out);
}
.chip:hover { border-color: var(--qing); color: var(--qing); transform: translateY(-1px); }
.chip .icon { width: 15px; height: 15px; }
.chip-icon { justify-content: center; width: 38px; height: 38px; padding: 0; }
.chip-icon .icon { width: 17px; height: 17px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hero-links li:first-child .chip { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.hero-links li:first-child .chip:hover { background: var(--qing); border-color: var(--qing); color: #fff; }

.hero-visual { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.hero-art {
  position: relative; width: 100%; aspect-ratio: 4 / 5; border-radius: 16px; overflow: hidden;
  transition: background-color .9s var(--ease), box-shadow .9s var(--ease);
}
.hero-art canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero[data-mode="code"] .hero-art { background: var(--term); box-shadow: 0 24px 50px -28px rgba(10, 14, 20, .7); }
.hero-frame { position: relative; width: 100%; }
/* 落款：人像左边竖写一行小字，说这幅像用了多少个字；写完才淡淡浮出来 */
.art-note {
  position: absolute; right: calc(100% + 12px); bottom: 2px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font: 12px/1 var(--serif); letter-spacing: .32em; color: var(--ink-3);
  opacity: 0; transform: translateY(8px); transition: opacity .8s var(--ease), transform 1s var(--ease-out);
  pointer-events: none;
}
.art-note::before { content: ""; width: 1px; height: 28px; background: var(--line); }
.art-note span { writing-mode: vertical-rl; }
.hero.is-written[data-mode="write"] .art-note { opacity: 1; transform: none; transition-delay: .25s; }
.hero-prompt {
  position: absolute; left: 0; right: 0; bottom: 15%; text-align: center;
  font: 13px/1 var(--mono); color: var(--qing-2); letter-spacing: .02em;
  opacity: 0; transform: translateY(6px); transition: opacity .5s, transform .6s var(--ease-out);
}
.hero-prompt span { color: var(--term-fg); }
.hero.is-written[data-mode="code"] .hero-prompt { opacity: 1; transform: none; transition-delay: .2s; }
.caret { display: inline-block; width: .55em; height: 1.05em; margin-left: 4px; vertical-align: -.2em; background: currentColor; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.mode-switch { position: relative; display: inline-flex; padding: 3px; border-radius: 999px; background: var(--paper-2); border: 1px solid var(--line-soft); }
.mode-switch::before {
  content: ""; position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 999px;
  background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, .1), 0 0 0 1px var(--line-soft);
  transition: transform .45s var(--ease-out);
}
.hero[data-mode="code"] .mode-switch::before { transform: translateX(100%); }
.mode-switch button { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 84px; padding: 6px 0; font-size: 13.5px; color: var(--ink-3); transition: color .3s; }
.mode-switch button[aria-pressed="true"] { color: var(--ink); }
.mode-switch .icon { width: 14px; height: 14px; }
html:not(.js) .hero-visual { display: none; }
html:not(.js) .hero { grid-template-columns: 1fr; grid-template-areas: "text" "links"; grid-template-rows: auto; }

@media (max-width: 640px) {
  .hero {
    --art-w: clamp(128px, 41vw, 220px); column-gap: 16px; padding-block: 28px 30px;
    grid-template-areas: "text visual" "links links"; grid-template-rows: auto auto; align-items: center;
  }
  .hero-kicker { margin-bottom: 8px; font-size: 12.5px; letter-spacing: .2em; }
  .hero-kicker::before { width: 16px; }
  .hero-name { font-size: clamp(32px, 9.6vw, 46px); letter-spacing: .06em; }
  .hero-lead { margin-top: 10px; font-size: 14.5px; line-height: 1.75; }
  .hero-links { margin-top: 22px; }
  .hero-visual { gap: 10px; }
  .art-note { display: none; }
  .hero-prompt { font-size: 10px; }
  .mode-switch button { width: calc((var(--art-w) - 6px) / 2); max-width: 84px; font-size: 12.5px; gap: 4px; }
  .mode-switch .icon { display: none; }
}

/* ───────── 文章列表 ───────── */
.posts { padding-bottom: 24px; }
.section-head { display: flex; align-items: baseline; gap: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.section-head h2 { display: flex; align-items: center; gap: 10px; font-size: 19px; letter-spacing: .12em; }
.section-head span { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.post-list { display: flex; flex-direction: column; }
.post-item { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; align-items: start; padding: 30px 0; border-bottom: 1px solid var(--line-soft); }
.post-item.has-cover { grid-template-columns: minmax(0, 1fr) 132px; }
.post-item:last-child { border-bottom: 0; }
.post-item-link { position: absolute; inset: 0; z-index: 1; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font: 12.5px/1.6 var(--mono); color: var(--ink-3); }
.post-meta a, .post-foot a { position: relative; z-index: 2; transition: color .2s; }
.post-meta a::before { content: "/"; margin-right: 10px; color: var(--line); }
.post-meta a:hover, .post-foot a:hover { color: var(--qing); }
.pin { padding: 0 6px; border: 1px solid var(--qing-2); border-color: color-mix(in srgb, var(--qing) 45%, transparent); border-radius: 4px; color: var(--qing); font: 500 11.5px/1.6 var(--sans); letter-spacing: .12em; }
.post-title { margin-top: 8px; font-size: clamp(20px, 2.6vw, 23px); line-height: 1.5; letter-spacing: .02em; }
.post-title a {
  background: linear-gradient(var(--qing), var(--qing)) no-repeat 0 100% / 0 1.5px;
  transition: background-size .45s var(--ease-out), color .25s;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.post-item:hover .post-title a { color: var(--qing); background-size: 100% 1.5px; }
.post-excerpt { margin-top: 10px; font-size: 15px; line-height: 1.85; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 14px; font-size: 13px; color: var(--ink-3); }
.post-stats { display: flex; gap: 12px; margin-left: auto; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.post-cover { position: relative; z-index: 2; display: block; aspect-ratio: 4 / 3; margin-top: 6px; border-radius: 8px; overflow: hidden; background: var(--paper-2); }
.post-cover img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.85); transition: transform .8s var(--ease-out), filter .5s; }
.post-item:hover .post-cover img { transform: scale(1.05); filter: none; }
@media (max-width: 640px) {
  .post-item { padding: 24px 0; gap: 16px; }
  .post-item.has-cover { grid-template-columns: minmax(0, 1fr) 92px; }
  .post-excerpt { font-size: 14.5px; }
}

/* ───────── 列表页页头 ───────── */
.page-head { padding-block: 64px 32px; }
.page-kicker { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; font-size: 13px; letter-spacing: .3em; color: var(--qing); }
.page-kicker::before { content: ""; width: 24px; height: 1px; background: currentColor; }
.page-kicker a:hover { text-decoration: underline; text-underline-offset: 4px; }
.page-title { font-size: clamp(30px, 5vw, 40px); letter-spacing: .08em; }
.page-sub { margin-top: 12px; color: var(--ink-3); font-size: 15px; }
.author-head { display: flex; align-items: center; gap: 22px; }
.author-avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }

/* ───────── 归档时间线 ───────── */
.timeline { padding-bottom: 24px; }
.tl-year { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 24px; padding: 28px 0; border-top: 1px solid var(--line-soft); }
.tl-year:first-child { border-top: 0; padding-top: 4px; }
.tl-year-title { position: sticky; top: calc(var(--header-h) + 20px); align-self: start; display: flex; flex-direction: column; }
.tl-year-title span { font-size: 40px; font-weight: 700; line-height: 1; letter-spacing: .02em; color: transparent; -webkit-text-stroke: 1px var(--ink-3); }
.tl-year-title small { margin-top: 8px; font-size: 12.5px; color: var(--ink-3); }
.tl-month + .tl-month { margin-top: 22px; }
.tl-month-title { margin-bottom: 6px; font: 600 13px var(--sans); letter-spacing: .2em; color: var(--qing); }
.tl-list { list-style: none; border-left: 1px solid var(--line); }
.tl-item { position: relative; display: flex; align-items: baseline; gap: 16px; padding: 9px 0 9px 20px; }
.tl-item::before { content: ""; position: absolute; left: -4px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--paper); border: 1.5px solid var(--line); transition: border-color .25s, background-color .25s, transform .3s var(--ease-out); }
.tl-item:hover::before { border-color: var(--qing); background: var(--qing); transform: scale(1.25); }
.tl-item time { flex: none; font: 12.5px var(--mono); color: var(--ink-3); }
.tl-title { display: block; min-width: 0; }
.tl-title a { color: var(--ink); transition: color .2s; }
.tl-title a:hover { color: var(--qing); }
@media (max-width: 640px) {
  .tl-year { grid-template-columns: 1fr; gap: 12px; }
  .tl-year-title { position: static; flex-direction: row; align-items: baseline; gap: 12px; }
  .tl-year-title span { font-size: 32px; }
}

/* ───────── 分页 ───────── */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }
.pager-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 18px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; color: var(--ink-2); transition: border-color .25s, color .25s; }
a.pager-btn:hover { border-color: var(--qing); color: var(--qing); }
.pager-btn .icon { width: 15px; height: 15px; transition: transform .3s var(--ease-out); }
a.pager-btn[rel="prev"]:hover .icon { transform: translateX(-3px); }
a.pager-btn[rel="next"]:hover .icon { transform: translateX(3px); }
.pager-btn.is-disabled { opacity: .4; }
.pager-count { font-size: 13.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pager-count b { color: var(--ink); font-weight: 500; }

/* ───────── 分类 / 标签 ───────── */
.cat-tree { list-style: none; display: grid; gap: 12px; }
.cat-sub { margin: 12px 0 0 22px; padding-left: 16px; border-left: 1px dashed var(--line); }
.cat-card {
  display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 4px 16px; padding: 16px 20px;
  border: 1px solid var(--line-soft); border-radius: 12px; background: var(--card);
  transition: border-color .25s, transform .35s var(--ease-out), box-shadow .35s;
}
.cat-card:hover { border-color: var(--qing); transform: translateY(-2px); box-shadow: var(--shadow); }
.cat-name { font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--ink); letter-spacing: .06em; }
.cat-count { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.cat-desc { grid-column: 1 / -1; font-size: 14px; color: var(--ink-2); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; }
.tag-cloud a {
  display: inline-flex; align-items: baseline; gap: 4px; padding: 6px 15px; border-radius: 999px;
  border: 1px solid var(--line-soft); background: var(--card); color: var(--ink-2);
  font-size: calc(14px + min(var(--n, 1), 10) * 1px);
  transition: border-color .25s, color .25s, transform .3s var(--ease-out);
}
.tag-cloud a:hover { border-color: var(--qing); color: var(--qing); transform: translateY(-2px); }
.tag-cloud sup { font: 11px var(--mono); color: var(--ink-3); }

/* ───────── 文章页 ───────── */
.article { padding-top: 56px; }
.article-head { padding-bottom: 28px; margin-bottom: 36px; border-bottom: 1px solid var(--line); }
.article-kicker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; font-size: 13px; letter-spacing: .24em; }
.article-kicker a { color: var(--qing); }
.article-kicker a + a::before { content: "·"; margin-right: 8px; color: var(--ink-3); }
.article-kicker a:hover { text-decoration: underline; text-underline-offset: 4px; }
.article-title { font-size: clamp(28px, 4.6vw, 38px); line-height: 1.38; letter-spacing: .04em; }
.article-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 18px; font-size: 13.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.article-meta a:hover { color: var(--qing); }
.article-cover { margin: -8px 0 40px; border-radius: 14px; overflow: hidden; background: var(--paper-2); }
.article-cover img { width: 100%; max-height: 420px; object-fit: cover; }

.article-layout { position: relative; }
.toc { position: absolute; top: 0; bottom: 0; left: calc(100% + 56px); width: 210px; }
.toc[hidden] { display: none; }
.toc-body { position: sticky; top: calc(var(--header-h) + 28px); max-height: calc(100vh - var(--header-h) - 56px); overflow: auto; overscroll-behavior: contain; }
.toc-title { margin-bottom: 10px; font-size: 12px; letter-spacing: .3em; color: var(--ink-3); }
.toc-list { list-style: none; border-left: 1px solid var(--line); }
.toc-list a { position: relative; display: block; padding: 5px 0 5px 14px; font-size: 13.5px; line-height: 1.55; color: var(--ink-3); transition: color .2s; }
.toc-list a::before { content: ""; position: absolute; left: -1px; top: 6px; bottom: 6px; width: 2px; border-radius: 2px; background: var(--qing); transform: scaleY(0); transition: transform .3s var(--ease-out); }
.toc-list a:hover { color: var(--ink); }
.toc-list a.is-active { color: var(--qing); }
.toc-list a.is-active::before { transform: none; }
.toc-list .lv-2 a { padding-left: 28px; font-size: 13px; }
.toc-list .lv-3 a { padding-left: 42px; font-size: 13px; }
@media (max-width: 1279px) { .toc { display: none; } }

/* 正文排版 */
.prose { font-size: 16.5px; line-height: 1.95; color: var(--ink-body); overflow-wrap: break-word; }
.prose > * + * { margin-top: 1.15em; }
.prose > :first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 { margin-top: 2em; margin-bottom: -.2em; letter-spacing: .03em; scroll-margin-top: calc(var(--header-h) + 20px); }
.prose h1 { font-size: 1.6em; }
.prose h2 { font-size: 1.42em; }
.prose h3 { font-size: 1.2em; }
.prose h4 { font-size: 1.05em; }
.prose a { color: var(--qing); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .22em; text-decoration-color: color-mix(in srgb, var(--qing) 40%, transparent); transition: text-decoration-color .2s; }
.prose a:hover { text-decoration-color: currentColor; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.5em; }
.prose li + li { margin-top: .4em; }
.prose li::marker { color: var(--qing); }
.prose mark { background: color-mix(in srgb, var(--qing) 22%, transparent); color: inherit; padding: 0 .15em; border-radius: 3px; }
.prose kbd { padding: .1em .45em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; font: .82em var(--mono); background: var(--card); }
.prose blockquote { margin-inline: 0; padding: 2px 0 2px 1.2em; border-left: 2px solid var(--qing); font-family: var(--serif); color: var(--ink-2); }
.prose blockquote cite { display: block; margin-top: .5em; font: normal .88em var(--sans); color: var(--ink-3); text-align: right; }
.prose hr { height: auto; margin-block: 2.6em; border: 0; text-align: center; overflow: visible; }
.prose hr::after { content: "◇  ◇  ◇"; color: var(--ink-3); font-size: 12px; letter-spacing: .5em; }

/* 代码：行内是淡底，块级是终端深色；Shiki 插件的高亮块只收边角，不改配色 */
.prose :not(pre) > code { padding: .12em .42em; border-radius: 5px; background: var(--paper-2); color: var(--ink); font: .86em var(--mono); overflow-wrap: anywhere; }
.prose shiki-code { display: block; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line-soft); }
.code-wrap { position: relative; }
.prose pre { margin: 0; padding: 18px 20px; overflow-x: auto; border-radius: var(--radius); background: var(--term); color: var(--term-fg); font: 13.5px/1.8 var(--mono); tab-size: 2; }
.prose > pre, .prose > .code-wrap { margin-top: 1.5em; margin-bottom: 1.5em; }
.prose pre code { font: inherit; background: none; padding: 0; color: inherit; }
.prose pre:has(code), .prose pre code { filter: none !important; }
.prose > style { display: none; }
.copy-btn {
  position: absolute; top: 8px; right: 8px; padding: 3px 10px; border-radius: 6px;
  font: 12px var(--mono); color: var(--term-dim); background: rgba(255, 255, 255, .06);
  opacity: 0; transition: opacity .2s, color .2s, background-color .2s;
}
.code-wrap:hover .copy-btn, .copy-btn:focus-visible, .copy-btn.is-done { opacity: 1; }
.copy-btn:hover { color: var(--term-fg); background: rgba(255, 255, 255, .12); }
.copy-btn.is-done { color: #9ccfbf; }
@media (hover: none) { .copy-btn { opacity: 1; } }

.prose img { margin-inline: auto; border-radius: 8px; }
/* 正文图片大多没写宽高，加载前是 0 高，会全挤在首屏让懒加载失效；加载前先占一个 4:3 的位置 */
.js .prose img[loading="lazy"]:not(.is-loaded) { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--paper-2); }
.js .prose img.zoomable { cursor: zoom-in; }
.prose figure { margin-inline: 0; }
.prose figcaption { margin-top: 10px; text-align: center; font-size: 13.5px; color: var(--ink-3); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.7; }
.prose th { text-align: left; font-weight: 600; color: var(--ink); border-bottom: 1.5px solid var(--ink-3); }
.prose th, .prose td { padding: 9px 14px 9px 0; vertical-align: top; }
.prose td { border-bottom: 1px solid var(--line-soft); }
.prose tbody tr { transition: background-color .2s; }
.prose tbody tr:hover { background: var(--paper-2); }

/* 文章底部 */
.article-foot { margin-top: 56px; }
.article-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.tag-chip { padding: 3px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--ink-2); transition: border-color .25s, color .25s; }
.tag-chip:hover { border-color: var(--qing); color: var(--qing); }
.copyright { position: relative; padding: 18px 22px; border-radius: 12px; background: var(--paper-2); font-size: 13.5px; line-height: 1.9; color: var(--ink-2); overflow: hidden; }
.copyright b { display: inline-block; min-width: 3.4em; font-weight: 600; color: var(--ink); }
.copyright a { overflow-wrap: anywhere; color: var(--qing); }
.copyright-note { margin-top: 6px; color: var(--ink-3); }
.article-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 40px; }
.nav-card { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border: 1px solid var(--line-soft); border-radius: 12px; transition: border-color .25s, transform .35s var(--ease-out), background-color .25s; }
.nav-card:hover { border-color: var(--qing); background: var(--card); transform: translateY(-2px); }
.nav-card.next { grid-column: 2; text-align: right; align-items: flex-end; }
.nav-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; letter-spacing: .15em; color: var(--ink-3); }
.nav-label .icon { width: 14px; height: 14px; transition: transform .3s var(--ease-out); }
.nav-card.prev:hover .icon { transform: translateX(-3px); }
.nav-card.next:hover .icon { transform: translateX(3px); }
.nav-title { font-family: var(--serif); font-size: 15.5px; font-weight: 600; color: var(--ink); line-height: 1.5; }
@media (max-width: 640px) {
  .article { padding-top: 36px; }
  .prose { font-size: 16px; }
  .article-nav { grid-template-columns: 1fr; }
  .nav-card.next { grid-column: auto; }
}
.comments { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--line); }
.comments-title { margin-bottom: 20px; font-size: 19px; letter-spacing: .12em; }

/* 评论插件的配色跟着主题走 */
.comments {
  --halo-cw-base-font-family: var(--sans); --halo-cw-base-font-size: 15px; --halo-cw-base-rounded: 10px;
  --halo-cw-text-1-color: var(--ink); --halo-cw-text-2-color: var(--ink-body); --halo-cw-text-3-color: var(--ink-3);
  --halo-cw-muted-1-color: var(--line); --halo-cw-muted-2-color: var(--line-soft); --halo-cw-muted-3-color: var(--paper-2);
  --halo-cw-primary-1-color: var(--qing); --halo-cw-primary-3-color: var(--qing-soft);
}
[data-color-scheme="dark"] .comments {
  --halo-cw-emoji-picker-rgb-color: 232, 228, 218; --halo-cw-emoji-picker-rgb-accent: 134, 183, 171;
  --halo-cw-emoji-picker-rgb-background: 31, 35, 41; --halo-cw-emoji-picker-rgb-input: 22, 25, 29;
  --halo-cw-emoji-picker-color-border: rgba(255, 255, 255, .06); --halo-cw-emoji-picker-color-border-over: rgba(255, 255, 255, .12);
}

/* ───────── 页脚 ───────── */
.site-footer { margin-top: 96px; padding: 36px 0 44px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--ink-3); }
.footer-inner { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 18px 24px; }
.footer-sign { display: flex; align-items: center; gap: 14px; }
.footer-sign::before { content: ""; width: 28px; height: 1px; background: var(--qing); }
.footer-sign p { font-family: var(--serif); font-size: 17px; color: var(--ink); letter-spacing: .16em; }
.footer-links { display: flex; gap: 4px; list-style: none; }
.footer-links a { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--ink-2); transition: background-color .2s, color .2s; }
.footer-links a:hover { background: var(--paper-2); color: var(--qing); }
.footer-links .icon { width: 18px; height: 18px; }
.footer-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 12.5px; }
.footer-meta a:hover { color: var(--qing); }
@media (max-width: 640px) { .site-footer { margin-top: 64px; } .footer-inner { grid-template-columns: 1fr; } }

/* ───────── 阅读进度 / 回到顶部 / 看大图 ───────── */
.progress { position: fixed; left: 0; top: 0; z-index: 40; width: 100%; height: 2px; background: var(--qing); transform-origin: 0 50%; transform: scaleX(var(--p, 0)); pointer-events: none; }
@supports (animation-timeline: scroll()) {
  .progress { animation: grow linear both; animation-timeline: scroll(root); }
  @keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}
.to-top {
  position: fixed; right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom)); z-index: 25;
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--line); color: var(--ink-2); box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(12px); transition: opacity .3s, transform .4s var(--ease-out), visibility .3s, color .2s;
}
.to-top.is-shown { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { color: var(--qing); }
.zoom-layer { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 4vmin; background: var(--paper); cursor: zoom-out; }
@supports (background: color-mix(in srgb, red 50%, blue)) { .zoom-layer { background: color-mix(in srgb, var(--paper) 94%, transparent); } }
.zoom-layer img { max-width: 100%; max-height: 92vh; border-radius: 8px; box-shadow: var(--shadow); }

/* ───────── 404 ───────── */
.error-page { padding-block: 96px 40px; text-align: center; }
.error-code { font: 700 clamp(84px, 18vw, 140px)/1 var(--serif); color: transparent; -webkit-text-stroke: 1.5px var(--ink-3); letter-spacing: .06em; }
.error-page .page-title { margin-top: 18px; }
.error-page .page-sub { margin-bottom: 28px; }
.error-page p:last-child { display: flex; justify-content: center; gap: 10px; }

/* ───────── 动效 ───────── */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  /* 跨页过渡：浏览器支持就用，不支持就正常跳转 */
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: vt-out .22s var(--ease) both; }
  ::view-transition-new(root) { animation: vt-in .42s var(--ease-out) both; }
  ::view-transition-group(*) { animation-duration: .5s; animation-timing-function: var(--ease-out); }
  @keyframes vt-out { to { opacity: 0; } }
  @keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }

  /* 直接打开页面时的入场；从别的页面过渡过来时不再叠一层 */
  html:not(.vt-nav) .reveal { animation: rise .7s var(--ease-out) backwards; animation-delay: calc(min(var(--i, 0), 8) * 60ms + 40ms); }
  @keyframes rise { from { opacity: 0; transform: translateY(14px); } }
}

/* 切换深浅色：新颜色从按钮处一圈晕开（动画在 main.js 里），期间不要别的过渡 */
html.scheme-switching *, html.scheme-switching *::before, html.scheme-switching *::after { transition: none !important; }
html.scheme-switching .site-header, html.scheme-switching [style*="view-transition-name"] { view-transition-name: none !important; }
html.scheme-switching::view-transition-old(root), html.scheme-switching::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
html.scheme-switching::view-transition-new(root) { z-index: 1; }
html.zooming::view-transition-old(root), html.zooming::view-transition-new(root) { animation: none; }
::view-transition-group(zoom) { animation-duration: .38s; animation-timing-function: var(--ease-out); z-index: 70; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .progress { animation-duration: auto !important; }
}
