/* 文章页 / 归档页共用样式（与首页同一套设计） */
:root {
  --bg: #fbf8f1; --band: #efe8d9; --ink: #24344d; --ink-soft: #5d6878; --accent: #c8553d; --on-ink: #fbf8f1;
  --logo-bg: #f4efe4; --logo-ink: #24344d; --logo-dot: #c8553d;
  --c1: #efe5cf; --c2: #f3d8cc; --c3: #d9e0ea; --c4: #e1e8d4;
  --code: #f1ebdf;
  --rule: 3px; --line: 2px;
  --display: "Outfit", "Noto Sans SC", sans-serif;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b2638; --band: #22304a; --ink: #f4ead6; --ink-soft: #a9b3c3; --accent: #e98a6a; --on-ink: #1b2638;
    --logo-bg: #24344d; --logo-ink: #f4ead6; --logo-dot: #e98a6a;
    --c1: #2b3a55; --c2: #4a3a3e; --c3: #2a3f5c; --c4: #34443e; --code: #22304a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1b2638; --band: #22304a; --ink: #f4ead6; --ink-soft: #a9b3c3; --accent: #e98a6a; --on-ink: #1b2638;
  --logo-bg: #24344d; --logo-ink: #f4ead6; --logo-dot: #e98a6a;
  --c1: #2b3a55; --c2: #4a3a3e; --c3: #2a3f5c; --c4: #34443e; --code: #22304a;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: clip; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.9;
  letter-spacing: .03em; -webkit-font-smoothing: antialiased; transition: background .4s, color .4s;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 40px; }

/* 顶栏 */
header.top { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: var(--rule) solid var(--ink); transition: background .4s; }
.top-in { display: flex; align-items: center; gap: 28px; height: 84px; padding: 0 40px; }
.brand { display: flex; align-items: center; gap: 12px; flex: none; white-space: nowrap; }
.brand svg { width: 44px; height: 44px; flex: none; transition: transform .5s cubic-bezier(.34,1.56,.64,1); }
.brand:hover svg { transform: rotate(-8deg) scale(1.06); }
.brand-txt small { display: block; font-family: var(--display); font-weight: 700; font-size: 11px; letter-spacing: .12em; line-height: 1; }
.brand-txt b { display: block; font-family: var(--display); font-weight: 800; font-size: 30px; letter-spacing: .06em; line-height: 1.05; }
nav { margin-left: auto; display: flex; align-items: center; gap: 30px; }
nav a { font-family: var(--display); font-weight: 700; font-size: 14px; letter-spacing: .08em; position: relative; }
nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 2px; background: var(--accent); transform: scaleX(0); transform-origin: right; transition: transform .3s; }
nav a:hover::after { transform: scaleX(1); transform-origin: left; }
.theme-btn { width: 34px; height: 34px; border: var(--line) solid var(--ink); border-radius: 50%; display: grid; place-items: center; transition: transform .4s; }
.theme-btn:hover { transform: rotate(40deg); }
.theme-btn svg { width: 15px; height: 15px; }
.progress { position: fixed; top: 0; left: 0; height: 4px; width: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); z-index: 30; }

/* 插画 */
svg.ill { stroke: var(--ink); fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.k-red { fill: #e0674c; } .k-yel { fill: #f2c14e; } .k-sage { fill: #9cc08f; } .k-sky { fill: #8db8e0; }
.k-peach { fill: #f4b49a; } .k-white { fill: #fffdf8; } .k-navy { fill: #24344d; } .ns { stroke: none; }
.bg1 { background: var(--c1); } .bg2 { background: var(--c2); } .bg3 { background: var(--c3); } .bg4 { background: var(--c4); }

/* 文章头 */
.post-head { border-bottom: var(--rule) solid var(--ink); padding: 72px 0 0; position: relative; }
.back { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: .1em; }
.back svg { width: 20px; height: 11px; transition: transform .3s; }
.back:hover svg { transform: translateX(-5px); }
.post-meta { margin-top: 36px; display: flex; gap: 12px; font-size: 13px; font-weight: 700; }
.post-meta .cat { color: var(--accent); }
.post-meta span + span::before { content: ""; display: inline-block; width: 1px; height: 11px; background: var(--ink); opacity: .35; margin-right: 12px; }
.post-meta time, .post-meta .rt { font-family: var(--display); color: var(--ink-soft); }
.post-head h1 { margin: 14px 0 0; font-weight: 700; font-size: clamp(28px, 4.4vw, 44px); line-height: 1.4; letter-spacing: .02em; max-width: 20em; }
.post-head .lede { margin-top: 18px; color: var(--ink-soft); max-width: 36em; }
.cover {
  margin: 48px 0 -1px; height: 340px; border: var(--rule) solid var(--ink); border-bottom: 0;
  border-radius: 24px 24px 0 0; display: grid; place-items: center; overflow: hidden;
}
.cover svg.ill { width: 260px; height: auto; animation: float 5s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px) rotate(-1.5deg); } }

.anim { opacity: 0; transform: translateY(20px); animation: rise .8s cubic-bezier(.2,.8,.2,1) forwards; }
.anim.d1 { animation-delay: .1s; } .anim.d2 { animation-delay: .2s; } .anim.d3 { animation-delay: .3s; } .anim.d4 { animation-delay: .45s; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* 目录 + 正文 */
.post-body { display: grid; grid-template-columns: 1fr 200px; gap: 64px; padding-top: 72px; padding-bottom: 96px; }
.toc { position: sticky; top: 120px; align-self: start; font-size: 13px; border-left: var(--line) solid var(--ink); padding-left: 18px; }
.toc b { display: block; font-family: var(--display); font-weight: 800; letter-spacing: .12em; margin-bottom: 10px; }
.toc a { display: block; padding: 4px 0; color: var(--ink-soft); transition: color .2s, transform .2s; }
.toc a:hover, .toc a.on { color: var(--accent); transform: translateX(4px); }

.prose { max-width: 680px; min-width: 0; }
.prose > * + * { margin-top: 1.3em; }
.prose h2 { margin-top: 2.6em; font-size: 24px; font-weight: 700; line-height: 1.5; display: flex; align-items: center; gap: 14px; scroll-margin-top: 110px; }
.prose h2::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); flex: none; }
.prose h3 { margin-top: 2em; font-size: 18px; font-weight: 700; }
.prose a { border-bottom: 2px solid var(--accent); }
.prose a:hover { color: var(--accent); }
.prose strong { font-weight: 700; background: linear-gradient(transparent 62%, color-mix(in srgb, var(--accent) 28%, transparent) 62%); }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: .4em; }
.prose li::marker { color: var(--accent); font-weight: 700; }
.prose blockquote { border: var(--line) solid var(--ink); border-radius: 14px; padding: 18px 22px; background: var(--band); font-weight: 500; }
.prose code { font-family: var(--mono); font-size: .88em; background: var(--code); padding: 2px 6px; border-radius: 5px; }
.prose pre { border: var(--line) solid var(--ink); border-radius: 14px; background: var(--code); overflow: auto; position: relative; }
.prose pre code { display: block; padding: 18px 20px; background: none; font-size: 13.5px; line-height: 1.7; letter-spacing: 0; }
.prose pre[data-lang]::before {
  content: attr(data-lang); position: absolute; right: 12px; top: 8px; font-family: var(--display); font-weight: 700;
  font-size: 11px; letter-spacing: .1em; color: var(--ink-soft); text-transform: uppercase;
}
.prose hr { border: 0; height: 2px; background: var(--ink); opacity: .15; margin: 2.4em 0; }
.prose .note { font-size: 14px; color: var(--ink-soft); }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; border: var(--line) solid var(--ink); }
.prose th, .prose td { padding: 10px 14px; border-bottom: 1px solid color-mix(in srgb, var(--ink) 25%, transparent); text-align: left; }
.prose th { background: var(--band); font-weight: 700; }

.end { margin-top: 3em; display: flex; align-items: center; gap: 14px; font-family: var(--display); font-weight: 800; letter-spacing: .14em; font-size: 13px; }
.end::before, .end::after { content: ""; flex: 1; height: 2px; background: var(--ink); }

/* 上一篇 / 下一篇 */
.pn { border-top: var(--rule) solid var(--ink); display: grid; grid-template-columns: 1fr 1fr; }
.pn a { padding: 40px; display: block; transition: background .3s; position: relative; min-height: 150px; }
.pn a + a { border-left: var(--rule) solid var(--ink); text-align: right; }
.pn a:hover { background: var(--band); }
.pn small { display: inline-flex; align-items: center; gap: 12px; font-family: var(--display); font-weight: 800; font-size: 16px; letter-spacing: .1em; }
.pn small svg { width: 24px; height: 13px; transition: transform .3s; }
.pn a:first-child:hover small svg { transform: translateX(-6px); }
.pn a + a:hover small svg { transform: translateX(6px); }
.pn b { display: block; margin-top: 10px; font-weight: 700; font-size: 17px; line-height: 1.6; }
.pn .empty { pointer-events: none; }

/* 归档页 */
.sec-title { text-align: center; padding: 96px 0 56px; }
.sec-title h1 {
  font-family: var(--display); font-weight: 800; font-size: clamp(44px, 7vw, 64px); line-height: 1;
  letter-spacing: .08em; color: #fffdf8; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill;
  text-shadow: 4px 4px 0 var(--ink);
}
.sec-title h1 span:nth-child(5n+1) { color: #e0674c; }
.sec-title h1 span:nth-child(5n+2) { color: #f2c14e; }
.sec-title h1 span:nth-child(5n+3) { color: #8db8e0; }
.sec-title h1 span:nth-child(5n+4) { color: #9cc08f; }
.sec-title h1 span:nth-child(5n+5) { color: #f4b49a; }
.sec-title h1 span { display: inline-block; opacity: 0; transform: translateY(40%); animation: rise .7s cubic-bezier(.2,.8,.2,1) forwards; transition: transform .3s; }
.sec-title h1 span:hover { transform: translateY(-10px) rotate(-6deg); }
.sec-title p { display: inline-block; margin-top: 16px; padding: 0 8px; font-size: 13px; font-weight: 700; letter-spacing: .2em; background: linear-gradient(transparent 55%, rgba(242, 193, 78, .65) 55%); }
.archive { max-width: 820px; margin: 0 auto 120px; list-style: none; border-top: var(--line) solid var(--ink); }
.archive a { display: grid; grid-template-columns: 110px 64px 1fr 26px; gap: 20px; align-items: center; padding: 22px 8px; border-bottom: var(--line) solid var(--ink); position: relative; isolation: isolate; }
.archive a::before { content: ""; position: absolute; inset: 0; background: var(--band); transform: scaleY(0); transform-origin: bottom; transition: transform .4s cubic-bezier(.7,0,.2,1); z-index: -1; }
.archive a:hover::before { transform: scaleY(1); }
.archive time { font-family: var(--display); font-weight: 700; }
.archive .thumb { width: 64px; height: 64px; border: var(--line) solid var(--ink); border-radius: 10px; display: grid; place-items: center; }
.archive .thumb svg { width: 70%; }
.archive .cat { font-size: 12px; font-weight: 700; color: var(--accent); }
.archive b { display: block; font-weight: 700; }
.archive svg.arrow { width: 22px; height: 12px; transition: transform .3s; }
.archive a:hover svg.arrow { transform: translateX(6px); }
.archive li { opacity: 0; transform: translateY(16px); animation: rise .6s cubic-bezier(.2,.8,.2,1) forwards; }

footer { border-top: var(--rule) solid var(--ink); padding: 44px 0 36px; }
.foot { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.foot nav { gap: 10px 24px; flex-wrap: wrap; }
.foot nav a { font-size: 13px; }
.copy { width: 100%; margin-top: 24px; display: flex; justify-content: space-between; font-family: var(--display); font-weight: 700; font-size: 12px; letter-spacing: .08em; color: var(--ink-soft); }
.copy button:hover { color: var(--accent); }

@media (max-width: 900px) {
  .post-body { grid-template-columns: 1fr; }
  .toc { display: none; }
}
@media (max-width: 600px) {
  .foot nav { margin-left: 0; width: 100%; gap: 10px 20px; }
  .wrap, .top-in { padding-left: 16px; padding-right: 16px; }
  .top-in { height: 68px; gap: 14px; }
  .brand svg { width: 36px; height: 36px; }
  .brand-txt b { font-size: 24px; }
  nav { gap: 16px; }
  nav a.hide-sm { display: none; }
  .post-head { padding-top: 40px; }
  .cover { height: 220px; margin-top: 32px; }
  .cover svg.ill { width: 170px; }
  .post-body { padding-top: 48px; padding-bottom: 64px; }
  .prose h2 { font-size: 20px; }
  .pn { grid-template-columns: 1fr; }
  .pn a { padding: 28px 16px; min-height: 0; }
  .pn a + a { border-left: 0; border-top: var(--rule) solid var(--ink); }
  .archive a { grid-template-columns: 52px 1fr 22px; gap: 4px 14px; }
  .archive time { grid-column: 2 / 4; font-size: 13px; order: -1; }
  .archive .thumb { width: 52px; height: 52px; grid-row: span 2; order: -2; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  .anim, .archive li { opacity: 1; transform: none; }
}

/* 深色模式：标题小字的马克笔底色换深一点 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sec-title p { background: linear-gradient(transparent 55%, rgba(233, 138, 106, .45) 55%); }
}
:root[data-theme="dark"] .sec-title p { background: linear-gradient(transparent 55%, rgba(233, 138, 106, .45) 55%); }

/* 悬浮胶囊顶栏：往下滑后顶栏收成居中的胶囊 */
header.top { height: 87px; transition: background .3s, border-color .3s; }
header.top .top-in {
  margin: 0 auto; width: 100%; border: 3px solid transparent; border-radius: 0;
  transition: width .5s cubic-bezier(.2,.8,.2,1), height .5s cubic-bezier(.2,.8,.2,1), margin .5s cubic-bezier(.2,.8,.2,1),
    padding .5s cubic-bezier(.2,.8,.2,1), border-radius .5s, box-shadow .4s, background .3s, border-color .3s;
}
header.top .brand svg { transition: width .4s, height .4s, transform .5s cubic-bezier(.34,1.56,.64,1); }
header.top .brand-txt b, header.top .brand-txt small { transition: font-size .4s; }
header.top nav a.on::after { transform: scaleX(1); }
header.top.float { background: transparent; border-bottom-color: transparent; pointer-events: none; }
header.top.float .top-in {
  pointer-events: auto; width: min(940px, calc(100% - 32px)); height: 62px; margin-top: 12px;
  padding: 0 12px 0 14px; gap: 18px; background: var(--bg); border-color: var(--ink); border-radius: 999px;
  box-shadow: 5px 5px 0 var(--ink);
}
header.top.float .brand svg { width: 36px; height: 36px; }
header.top.float .brand-txt small { font-size: 9px; }
header.top.float .brand-txt b { font-size: 22px; }
header.top.float .tagline { display: none; }
header.top.float nav { gap: 4px; }
header.top.float nav a { padding: 6px 13px; border-radius: 999px; transition: background .25s, color .25s; }
header.top.float nav a::after { display: none; }
header.top.float nav a:hover { background: var(--band); }
header.top.float nav a.on { background: var(--ink); color: var(--on-ink); }
header.top.float .theme-btn { margin-left: 6px; }
@media (max-width: 600px) {
  header.top { height: 71px; }
  header.top.float .top-in {
    width: calc(100% - 20px); height: 54px; margin-top: 8px; padding: 0 8px 0 10px; gap: 8px; box-shadow: 4px 4px 0 var(--ink);
  }
  header.top.float .brand svg { width: 30px; height: 30px; }
  header.top.float .brand-txt b { font-size: 19px; }
  header.top.float nav { gap: 2px; }
  header.top.float nav a { padding: 5px 10px; font-size: 13px; }
  header.top.float .theme-btn { margin-left: 2px; width: 32px; height: 32px; }
}
