/* KK Blog — 共享样式(index + 文章页)。暖灰 + 琥珀,区别于 TDV Pro 的冷蓝。 */
:root {
  --bg: #0c0a09; --bg-2: #131110; --surface: #1c1917; --card: #211d1b;
  --border: #2a2422; --border-2: #3b3431;
  --text: #f5f1ea; --text-2: #c0b6ab; --muted: #786d63; --muted-2: #5a5048;
  --accent: #d97757; --accent-2: #e89876; --link: #f5f1ea; --link-hover: #d97757;
  --ok: #22c55e;
  /* 图表:分类色(已过 CVD 校验)与单色阶 */
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #9085e9;
  --o1: #cde2fb; --o2: #9ec5f4; --o3: #6da7ec; --o4: #3987e5; --o5: #256abf;
}
[data-theme="light"] {
  --bg: #faf8f4; --bg-2: #f3efe8; --surface: #ffffff; --card: #ffffff;
  --border: #e8e1d4; --border-2: #d6cdb9;
  --text: #1a1715; --text-2: #4a4541; --muted: #847b6f; --muted-2: #a39a8d;
  --accent: #c25a31; --accent-2: #b34d20; --link: #1a1715; --link-hover: #c25a31;
  --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #4a3aa7;
  --o1: #86b6ef; --o2: #5598e7; --o3: #2a78d6; --o4: #1c5cab; --o5: #0d366b;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--text);
  font-family: 'Inter', -apple-system, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  font-feature-settings: 'cv11', 'ss03', 'calt';
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-size: 16px; line-height: 1.65;
  transition: background 0.3s, color 0.3s;
  overflow-x: hidden;
}
.serif { font-family: 'Instrument Serif', Georgia, 'Songti SC', 'Noto Serif SC', serif; font-weight: 400; }
.mono { font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace; font-feature-settings: 'zero', 'ss01'; }
::selection { background: var(--accent); color: var(--bg); }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; border: 2px solid var(--bg); }
a { color: var(--link); }

/* ============ 布局 ============ */
.wrap { max-width: 720px; margin: 0 auto; padding: 0 28px; }
.wrap.wide { max-width: 780px; }

/* ============ 顶栏 ============ */
.topbar {
  padding: 28px 28px; max-width: 720px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topbar.wide { max-width: 780px; }
.topbar-brand {
  font-family: 'Instrument Serif', Georgia, serif; font-size: 22px; letter-spacing: -0.01em;
  text-decoration: none; color: var(--text); display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.topbar-brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; }
.topbar-nav { display: flex; gap: 22px; margin-left: auto; }
.topbar-nav a {
  font-family: 'JetBrains Mono', monospace; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-2); text-decoration: none; transition: color 0.15s;
}
.topbar-nav a:hover { color: var(--accent); }
.theme-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text-2);
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center; transition: all 0.15s; flex-shrink: 0;
}
.theme-btn:hover { border-color: var(--border-2); color: var(--text); }
@media (max-width: 560px) { .topbar-nav { display: none; } }

/* ============ 首页 Hero ============ */
.hero { padding: 40px 0 24px; }
.hero-eyebrow {
  font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--accent);
  letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 14px;
}
.hero-title {
  font-family: 'Instrument Serif', Georgia, 'Songti SC', serif; font-weight: 400;
  font-size: clamp(36px, 6vw, 56px); line-height: 1.08; letter-spacing: -0.01em; margin-bottom: 20px;
}
.hero-title em { font-style: italic; color: var(--accent); }
.hero-bio { font-size: 17px; color: var(--text-2); line-height: 1.7; max-width: 600px; }
.hero-bio a, .about-text a, .paper a { color: var(--link); border-bottom: 1px solid var(--border-2); text-decoration: none; transition: all 0.15s; }
.hero-bio a:hover, .about-text a:hover, .paper a:hover { color: var(--link-hover); border-bottom-color: var(--accent); }

/* ============ 区块 ============ */
section { padding: 44px 0; }
.section-h { display: flex; align-items: baseline; gap: 14px; margin-bottom: 24px; }
.section-h .num { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); letter-spacing: 0.05em; width: 36px; }
.section-h h2 { font-family: 'Instrument Serif', Georgia, 'Songti SC', serif; font-size: 30px; font-weight: 400; letter-spacing: -0.01em; flex: 1; }
.section-h .meta { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); }

/* ============ 文章列表 ============ */
.posts { display: flex; flex-direction: column; }
.post {
  display: grid; grid-template-columns: 92px 1fr; gap: 6px 20px; align-items: baseline;
  padding: 20px 0; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); transition: all 0.15s;
}
.post:last-child { border-bottom: none; }
.post:hover .post-title { color: var(--accent); }
.post-date { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); padding-top: 4px; }
.post-title { font-family: 'Instrument Serif', Georgia, 'Songti SC', serif; font-size: 22px; line-height: 1.3; transition: color 0.15s; }
.post-desc { grid-column: 2; font-size: 14.5px; color: var(--text-2); line-height: 1.6; }
.post-tags { grid-column: 2; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.post-tag {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted);
  padding: 2px 8px; background: var(--bg-2); border-radius: 4px;
}
@media (max-width: 560px) {
  .post { grid-template-columns: 1fr; }
  .post-desc, .post-tags { grid-column: 1; }
}

/* ============ 项目 ============ */
.projects { display: flex; flex-direction: column; gap: 14px; }
.project {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 24px 26px 20px;
  text-decoration: none; color: var(--text); display: block; position: relative; overflow: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.project:hover { transform: translateY(-2px); border-color: var(--border-2); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18); }
[data-theme="light"] .project:hover { box-shadow: 0 16px 40px rgba(26, 23, 21, 0.06); }
.project-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 10px; }
.project-name { font-family: 'Instrument Serif', Georgia, 'Songti SC', serif; font-size: 24px; line-height: 1.15; letter-spacing: -0.01em; font-weight: 400; }
.project-name em { font-style: italic; color: var(--accent); }
.project-arrow { font-family: 'JetBrains Mono', monospace; color: var(--muted); transition: all 0.2s; flex-shrink: 0; }
.project:hover .project-arrow { color: var(--accent); transform: translate(4px, -4px); }
.project-desc { color: var(--text-2); line-height: 1.6; margin-bottom: 16px; font-size: 14.5px; }
.project-meta {
  display: flex; gap: 12px; flex-wrap: wrap; font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted);
  letter-spacing: 0.04em; padding-top: 12px; border-top: 1px dashed var(--border);
}
.project-meta .tag { padding: 2px 8px; background: var(--bg-2); border-radius: 4px; color: var(--text-2); }
.project-meta .status { display: inline-flex; align-items: center; gap: 6px; }
.project-meta .status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.project-meta .status.live::before { background: var(--ok); animation: pulse 2s infinite; }
.project-meta .status.wip::before { background: var(--accent); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); } 50% { box-shadow: 0 0 0 5px rgba(34, 197, 94, 0); } }

/* ============ About / Contact ============ */
.about-text { font-size: 16px; color: var(--text-2); line-height: 1.8; }
.about-text p { margin-bottom: 14px; }
.about-text p:last-child { margin-bottom: 0; }
.about-text strong { color: var(--text); font-weight: 500; }
.contact { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 600px) { .contact { grid-template-columns: 1fr; } }
.contact-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px;
  text-decoration: none; color: var(--text); display: flex; align-items: center; gap: 12px; transition: all 0.2s;
}
.contact-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.contact-icon {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; background: var(--bg-2);
  border-radius: 7px; font-size: 13px; font-weight: 600; font-family: 'JetBrains Mono', monospace; color: var(--accent);
}
.contact-info { flex: 1; min-width: 0; }
.contact-label { font-size: 11px; color: var(--muted); font-family: 'JetBrains Mono', monospace; text-transform: uppercase; letter-spacing: 0.06em; }
.contact-handle { font-size: 14px; font-weight: 500; font-family: 'JetBrains Mono', monospace; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ 页脚 ============ */
footer { padding: 36px 0 56px; border-top: 1px solid var(--border); margin-top: 40px; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); }
.footer-inner a { color: var(--text-2); text-decoration: none; transition: color 0.15s; }
.footer-inner a:hover { color: var(--accent); }

.reveal { opacity: 0; transform: translateY(14px); transition: all 0.7s cubic-bezier(0.16, 1, 0.3, 1); }
.reveal.in { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ============ 文章页(论文体) ============ */
.paper { padding: 16px 0 40px; }
.paper-head { padding: 12px 0 28px; border-bottom: 1px solid var(--border); margin-bottom: 32px; }
.paper-kicker { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--accent); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 14px; }
.paper h1 { font-family: 'Instrument Serif', Georgia, 'Songti SC', serif; font-weight: 400; font-size: clamp(28px, 4.6vw, 40px); line-height: 1.22; letter-spacing: -0.01em; margin-bottom: 10px; }
.paper .subtitle { font-family: 'Instrument Serif', Georgia, serif; font-style: italic; font-size: 19px; color: var(--text-2); line-height: 1.4; margin-bottom: 20px; }
.paper .byline { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px 18px; }
.paper .byline b { color: var(--text-2); font-weight: 500; }
.abstract { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 22px 24px; margin: 0 0 18px; }
.abstract h3 { font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; font-weight: 500; }
.abstract p { font-size: 15px; line-height: 1.75; color: var(--text-2); }
.abstract p + p { margin-top: 10px; }
.abstract.en p { font-size: 14.5px; }
.keywords { font-size: 13.5px; color: var(--muted); margin-bottom: 8px; }
.keywords b { color: var(--text-2); font-weight: 500; }
.toc { margin: 28px 0 36px; padding: 18px 22px; border-left: 2px solid var(--accent); }
.toc h4 { font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; font-weight: 500; }
.toc ol { list-style: none; columns: 2; column-gap: 24px; }
.toc li { font-size: 14px; line-height: 1.9; break-inside: avoid; }
.toc a { color: var(--text-2); text-decoration: none; }
.toc a:hover { color: var(--accent); }
.toc .n { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted); margin-right: 6px; }
@media (max-width: 560px) { .toc ol { columns: 1; } }

.paper h2 { font-family: 'Instrument Serif', Georgia, 'Songti SC', serif; font-weight: 400; font-size: 27px; line-height: 1.25; margin: 48px 0 14px; letter-spacing: -0.01em; display: flex; gap: 12px; align-items: baseline; }
.paper h2 .n, .paper h3 .n { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); letter-spacing: 0.05em; }
.paper h3 { font-size: 17px; font-weight: 600; margin: 28px 0 10px; display: flex; gap: 10px; align-items: baseline; }
.paper p { font-size: 16px; line-height: 1.85; color: var(--text); margin-bottom: 14px; text-align: justify; }
.paper p.lead { font-size: 17px; }
.paper ul, .paper ol { margin: 0 0 16px 22px; }
.paper li { font-size: 15.5px; line-height: 1.8; margin-bottom: 6px; color: var(--text); }
.paper li::marker { color: var(--muted); }
.paper strong { font-weight: 600; }
.paper em { font-style: italic; }
.paper code, .paper .m { font-family: 'JetBrains Mono', monospace; font-size: 0.88em; background: var(--bg-2); padding: 1px 5px; border-radius: 4px; color: var(--text-2); }
.paper .math { font-family: 'Instrument Serif', 'Times New Roman', serif; font-style: italic; font-size: 1.05em; }
.paper .eq { font-family: 'Instrument Serif', 'Times New Roman', serif; font-size: 18px; text-align: center; margin: 14px 0 18px; color: var(--text); font-style: italic; }
.paper .eq .tag { float: right; font-style: normal; font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); }
.note { background: var(--bg-2); border-left: 2px solid var(--accent); padding: 12px 16px; margin: 16px 0 20px; border-radius: 0 8px 8px 0; }
.note p { font-size: 14.5px; line-height: 1.7; color: var(--text-2); margin: 0; text-align: left; }
.note p + p { margin-top: 8px; }
.finding { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px 22px; margin: 18px 0 22px; }
.finding h4 { font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; font-weight: 500; }
.finding p { font-size: 15px; line-height: 1.75; margin: 0; text-align: left; }
.finding p + p { margin-top: 8px; }

/* 图 */
figure { margin: 22px 0 30px; }
figure .fig { width: 100%; height: auto; display: block; font-family: 'Inter', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif; font-size: 12px; }
.fig-row { display: flex; gap: 12px; }
.fig-row .fig.small { width: calc((100% - 24px) / 3); }
@media (max-width: 620px) { .fig-row { flex-direction: column; } .fig-row .fig.small { width: 100%; } }
figcaption { font-size: 13.5px; line-height: 1.65; color: var(--text-2); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
figcaption b { color: var(--text); font-weight: 600; }
.fig .ax { stroke: var(--border); stroke-width: 1; }
.fig .ax0 { stroke: var(--muted-2); stroke-width: 1; }
.fig .tx { fill: var(--muted); font-size: 11.5px; }
.fig .tx2 { fill: var(--text); }
.fig .ttl { font-weight: 600; }
.fig .ring { fill: var(--card); }
.fig .err { stroke: var(--text-2); stroke-width: 1.2; }
.fig .s1 { stroke: var(--c1); } .fig .s2 { stroke: var(--c2); } .fig .s3 { stroke: var(--c3); } .fig .s4 { stroke: var(--c4); }
.fig .o1 { stroke: var(--o1); } .fig .o2 { stroke: var(--o2); } .fig .o3 { stroke: var(--o3); } .fig .o4 { stroke: var(--o4); } .fig .o5 { stroke: var(--o5); }
.fig .mk, .fig .bar { stroke: none; }
.fig .s1.mk, .fig .s1.bar { fill: var(--c1); } .fig .s2.mk, .fig .s2.bar { fill: var(--c2); }
.fig .s3.mk, .fig .s3.bar { fill: var(--c3); } .fig .s4.mk, .fig .s4.bar { fill: var(--c4); }
.fig .o1.mk, .fig .o1.bar { fill: var(--o1); } .fig .o2.mk, .fig .o2.bar { fill: var(--o2); } .fig .o3.mk, .fig .o3.bar { fill: var(--o3); }
.fig .o4.mk, .fig .o4.bar { fill: var(--o4); } .fig .o5.mk, .fig .o5.bar { fill: var(--o5); }
.fig .bar:hover, .fig .mk:hover { opacity: 0.75; }

/* 表 */
.tbl-wrap { overflow-x: auto; margin: 18px 0 8px; -webkit-overflow-scrolling: touch; }
table.tbl { border-collapse: collapse; width: 100%; font-size: 13.5px; line-height: 1.5; }
table.tbl caption { text-align: left; font-size: 13.5px; color: var(--text-2); padding: 0 0 8px; caption-side: top; }
table.tbl caption b { color: var(--text); font-weight: 600; }
table.tbl th, table.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.tbl th { font-weight: 500; color: var(--muted); font-size: 12px; text-align: right; border-bottom: 1px solid var(--border-2); }
table.tbl th:first-child, table.tbl td:first-child { text-align: left; }
table.tbl td { text-align: right; font-family: 'JetBrains Mono', monospace; font-size: 12.5px; font-feature-settings: 'tnum', 'zero'; color: var(--text); }
table.tbl td:first-child { font-family: inherit; font-size: 13.5px; }
table.tbl tr:hover td { background: var(--bg-2); }
table.tbl td.hi { color: var(--accent); font-weight: 500; }
table.tbl td.neg { color: var(--muted); }
.tbl-note { font-size: 12.5px; color: var(--muted); line-height: 1.6; margin-bottom: 20px; }

/* 参考文献 / 附录 */
.refs { list-style: none; margin: 0; counter-reset: ref; }
.refs li { font-size: 14px; line-height: 1.7; color: var(--text-2); padding-left: 32px; position: relative; margin-bottom: 8px; }
.refs li::before { counter-increment: ref; content: "[" counter(ref) "]"; position: absolute; left: 0; font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); }
.refs em { font-style: italic; }
.paper-foot { margin-top: 44px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 13.5px; color: var(--muted); line-height: 1.7; }
.back { display: inline-flex; align-items: center; gap: 8px; font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-2); text-decoration: none; margin-bottom: 8px; }
.back:hover { color: var(--accent); }
sup.fn { font-size: 0.7em; color: var(--accent); }

@media print {
  .topbar, footer, .theme-btn, .toc { display: none; }
  body { background: #fff; color: #000; }
  .paper p { text-align: left; }
}

/* ============ Post: 折叠的附表 ============ */
.paper details { margin: 28px 0; border: 1px solid var(--border); border-radius: 10px; padding: 0 18px; background: var(--card); }
.paper details[open] { padding-bottom: 8px; }
.paper summary { cursor: pointer; padding: 14px 0; font-family: 'JetBrains Mono', monospace; font-size: 12px; letter-spacing: 0.04em; color: var(--text-2); list-style: none; }
.paper summary::-webkit-details-marker { display: none; }
.paper summary::before { content: '+'; display: inline-block; width: 16px; color: var(--accent); }
.paper details[open] summary::before { content: '−'; }
.paper details .tbl { margin: 8px 0 18px; }
