:root {
  --ruc: #ae0b2a;
  --ruc-dark: #7f081e;
  --ruc-soft: #f8e9ed;
  --ink: #17181d;
  --ink-soft: color-mix(in srgb, var(--ink) 66%, transparent);
  --muted: #626873;
  --line: #dddcd7;
  --rule: color-mix(in srgb, var(--ink) 90%, transparent);
  --paper: #fffdf8;
  --paper-grain: color-mix(in srgb, var(--ruc) 4%, var(--paper));
  --surface: #ffffff;
  --surface-muted: #f5f2ec;
  --success: #176b52;
  --warning: #b06a0f;
  --focus: #255fc2;
  --shadow: 0 16px 42px rgba(23, 24, 29, .07);
  --shadow-soft: 0 8px 24px rgba(23, 24, 29, .06);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --content-max: 1180px;
  --stage-s1: #8a5a0a;
  --stage-s2: #0f766e;
  --stage-s3: #255fc2;
  --stage-s4: #ae0b2a;
  --stage-s5: #6b3fa0;
  --stage-s6: #176b52;
  --font-sans: var(--gh-font-body, "Noto Sans SC"), "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  --font-serif: var(--gh-font-heading, "Noto Serif SC"), "Songti SC", serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f3f1eb;
  --ink-soft: color-mix(in srgb, var(--ink) 78%, transparent);
  --muted: #b8bbc2;
  --line: #373a42;
  --rule: color-mix(in srgb, var(--ink) 80%, transparent);
  --paper: #121317;
  --paper-grain: color-mix(in srgb, var(--ruc) 6%, var(--paper));
  --surface: #1a1c21;
  --surface-muted: #22252b;
  --ruc-soft: #3a1821;
  --shadow: 0 16px 42px rgba(0, 0, 0, .3);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper-grain);
  font-family: var(--font-sans);
  line-height: 1.75;
  text-wrap: pretty;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 72%, transparent); outline-offset: 3px; }
::selection { background: var(--ruc-soft); color: var(--ruc-dark); }

/* ---- Kicker: mono uppercase eyebrow with short red rule ---- */
.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.kicker::before {
  content: "";
  width: 22px;
  height: 2px;
  background: var(--ruc);
  flex: 0 0 auto;
}

/* ---- Shell ---- */
.site-shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100dvh; }
.site-sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 24px 18px;
  background: var(--surface-muted);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); }
.brand-mark { width: 38px; height: 38px; border-radius: var(--radius-sm); display: grid; place-items: center; color: #fff; background: var(--ruc); font-family: var(--font-serif); font-weight: 700; box-shadow: 0 6px 16px color-mix(in srgb, var(--ruc) 32%, transparent); }
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); font-size: 12px; font-weight: 500; }
.side-nav, .ecosystem-nav { display: grid; gap: 4px; }
.side-nav a, .ecosystem-nav a, .theme-toggle { min-height: 42px; display: flex; align-items: center; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 0 11px; color: var(--muted); background: transparent; text-align: left; font-weight: 650; cursor: pointer; transition: background .15s, color .15s; }
.side-nav a:hover, .side-nav a[aria-current="page"], .ecosystem-nav a:hover, .theme-toggle:hover { color: var(--ruc-dark); background: var(--ruc-soft); }
.nav-status { min-height: 42px; display: flex; align-items: center; padding: 0 11px; color: var(--muted); font-size: 13px; font-weight: 650; }
.ecosystem-nav { padding-top: 16px; border-top: 1px solid var(--line); }
.ecosystem-nav a { min-height: 34px; font-size: 13px; font-weight: 550; }
.sidebar-panel { margin-top: auto; padding-top: 17px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; line-height: 1.6; }
.sidebar-panel strong { display: block; color: var(--ink); margin-bottom: 5px; }

.site-main { min-width: 0; }
.topbar { min-height: 66px; padding: 10px clamp(20px, 4vw, 48px); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 18px; position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--paper) 82%, transparent); backdrop-filter: blur(14px) saturate(1.4); }
.topbar-label { font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 10px 16px; border: 1px solid transparent; border-radius: var(--radius-sm); font-weight: 700; cursor: pointer; transition: background .15s, color .15s, border-color .15s, transform .1s; }
.button.primary { color: #fff; background: var(--ruc); }
.button.primary:hover { background: var(--ruc-dark); }
.button.ghost { color: var(--ink); background: var(--surface); border-color: var(--line); }
.button.ghost:hover { color: var(--ruc); border-color: var(--ruc); }
.button.disabled { color: var(--muted); background: var(--surface-muted); border-color: var(--line); cursor: default; }
.button:active { transform: translateY(1px); }
.button.disabled:active { transform: none; }
/* ---- Hero with spec-card ---- */
.hero { max-width: calc(var(--content-max) + 96px); margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr); gap: clamp(28px, 5vw, 64px); align-items: center; padding: clamp(42px, 7vw, 84px) clamp(20px, 4vw, 48px) clamp(38px, 6vw, 72px); border-bottom: 1px solid var(--line); }
.hero-copy { min-width: 0; }
.hero-copy .kicker { margin-bottom: 20px; }
.hero h1 { max-width: 13ch; margin: 0 0 20px; font-size: clamp(38px, 5vw, 70px); line-height: 1.12; letter-spacing: -.04em; font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--ruc); }
.hero p { max-width: 40ch; margin: 0 0 28px; color: var(--ink-soft); font-size: 18px; line-height: 1.65; }
.hero-actions, .article-footer { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-meta { margin-top: 26px; display: flex; gap: 26px; flex-wrap: wrap; }
.hero-meta div { display: grid; gap: 2px; }
.hero-meta b { font-family: var(--font-mono); font-size: 1.35rem; color: var(--ink); font-weight: 700; }
.hero-meta span { font-size: 12px; color: var(--muted); }

/* spec-card: pipeline rendered as a lab protocol slip */
.spec { border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-soft); overflow: hidden; transform: rotate(-.6deg); transition: transform .3s; }
.spec:hover { transform: rotate(0); }
.spec-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; background: var(--surface-muted); }
.spec-head .dot { width: 9px; height: 9px; border-radius: 999px; background: var(--ruc); box-shadow: 14px 0 0 color-mix(in srgb, var(--warning) 60%, transparent), 28px 0 0 color-mix(in srgb, var(--success) 60%, transparent); }
.spec-head span { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.spec-body { padding: 20px 18px; display: grid; gap: 14px; }
.spec-title { font-weight: 750; font-size: 1.08rem; line-height: 1.35; }
.spec-rows { display: grid; gap: 9px; margin: 0; }
.spec-row { display: grid; grid-template-columns: 84px 1fr; gap: 10px; font-size: 14px; align-items: baseline; margin: 0; }
.spec-row dt { font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; color: var(--muted); text-transform: uppercase; margin: 0; }
.spec-row dd { margin: 0; color: var(--ink-soft); }
.spec-code { font-family: var(--font-mono); font-size: 12px; background: #1b1d22; color: #f3ead0; padding: 11px 13px; border-radius: var(--radius-sm); overflow-x: auto; line-height: 1.55; }
.spec-code .k { color: #ff9b8a; }
.spec-code .c { color: #8ea0b5; }
.spec-foot { padding: 12px 18px; border-top: 1px dashed var(--line); display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--success); background: color-mix(in srgb, var(--success) 6%, transparent); }
.spec-foot svg { flex: 0 0 auto; }
/* ---- Section wrappers ---- */
.lifecycle-section, .content-section, .archive-header, .article-shell { max-width: calc(var(--content-max) + 96px); margin: 0 auto; padding-left: clamp(20px, 4vw, 48px); padding-right: clamp(20px, 4vw, 48px); }
.lifecycle-section, .content-section { padding-top: clamp(40px, 6vw, 72px); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.section-heading .kicker { margin-bottom: 6px; }
.lifecycle-section h2, .section-heading h2, .archive-header h1 { margin: 0; font-size: clamp(28px, 3vw, 40px); line-height: 1.2; letter-spacing: -.02em; }
.section-copy, .archive-header p { max-width: 62ch; margin: 0 0 24px; color: var(--muted); line-height: 1.6; }
.section-link { flex: 0 0 auto; font-family: var(--font-mono); font-size: 14px; color: var(--ruc); text-decoration: none; }
.section-link:hover { text-decoration: underline; }

/* ---- Lifecycle stage cards (6 stages) ---- */
.lifecycle-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stage-card { position: relative; padding: 18px 16px 16px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); text-align: left; overflow: hidden; transition: border-color .18s, transform .18s, box-shadow .18s; }
.stage-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--sc, var(--ruc)); }
.stage-card:hover { transform: translateY(-2px); border-color: var(--sc, var(--ruc)); box-shadow: var(--shadow-soft); }
.stage-card .st-idx { font-family: var(--font-mono); font-size: 11px; color: var(--sc, var(--ruc)); font-weight: 700; }
.stage-card .st-name { display: block; font-weight: 700; margin: 8px 0 3px; }
.stage-card small { color: var(--muted); font-size: 14px; }
.stage-card .st-count { position: absolute; top: 16px; right: 16px; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.stage-card[data-stage="选题与检索"] { --sc: var(--stage-s1); }
.stage-card[data-stage="研究设计"] { --sc: var(--stage-s3); }
.stage-card[data-stage="数据采集"] { --sc: var(--stage-s2); }
.stage-card[data-stage="分析复现"] { --sc: var(--stage-s4); }
.stage-card[data-stage="论文写作"] { --sc: var(--stage-s5); }
.stage-card[data-stage="投稿发布"] { --sc: var(--stage-s6); }
/* ---- Pipeline cards (rich .pl-card) ---- */
.content-section { padding-bottom: 72px; }
.post-grid { display: grid; gap: 14px; }
.pl-card { display: grid; grid-template-columns: 6px 1fr auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); overflow: hidden; transition: border-color .18s, box-shadow .18s, transform .18s; --sc: var(--ruc); }
.pl-card:hover { border-color: color-mix(in srgb, var(--sc) 55%, var(--line)); box-shadow: var(--shadow-soft); transform: translateY(-2px); }
.pl-accent { background: var(--sc); }
.pl-main { padding: 20px 22px; min-width: 0; }
.pl-chips { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.stage-chip { font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: .03em; padding: 3px 9px; border-radius: 999px; color: var(--sc, var(--ruc)); background: color-mix(in srgb, var(--sc, var(--ruc)) 12%, transparent); text-decoration: none; }
.stage-chip[data-stage="选题与检索"] { --sc: var(--stage-s1); }
.stage-chip[data-stage="研究设计"] { --sc: var(--stage-s3); }
.stage-chip[data-stage="数据采集"] { --sc: var(--stage-s2); }
.stage-chip[data-stage="分析复现"] { --sc: var(--stage-s4); }
.stage-chip[data-stage="论文写作"] { --sc: var(--stage-s5); }
.stage-chip[data-stage="投稿发布"] { --sc: var(--stage-s6); }
.method-chip { font-family: var(--font-mono); font-size: 11px; color: var(--muted); padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; }
.pl-title { display: block; font-size: 20px; font-weight: 700; line-height: 1.3; letter-spacing: -.01em; color: var(--ink); }
.pl-title:hover { color: var(--ruc); }
.pl-summary { margin: 8px 0 0; color: var(--ink-soft); max-width: 66ch; line-height: 1.6; }
.pl-media { margin: 12px 0 0; border-radius: var(--radius-sm); overflow: hidden; max-width: 100%; }
.pl-media img { width: 100%; height: auto; display: block; }
.pl-side { padding: 20px 22px; border-left: 1px solid var(--line); display: grid; gap: 10px; align-content: center; min-width: 156px; background: color-mix(in srgb, var(--surface-muted) 40%, transparent); }
.pl-side .repro { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--success); font-weight: 650; }
.pl-side .repro svg { flex: 0 0 auto; }
.pl-side .upd { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.pl-side .author { font-size: 12px; color: var(--muted); }
.pl-card[data-stage="选题与检索"] { --sc: var(--stage-s1); }
.pl-card[data-stage="研究设计"] { --sc: var(--stage-s3); }
.pl-card[data-stage="数据采集"] { --sc: var(--stage-s2); }
.pl-card[data-stage="分析复现"] { --sc: var(--stage-s4); }
.pl-card[data-stage="论文写作"] { --sc: var(--stage-s5); }
.pl-card[data-stage="投稿发布"] { --sc: var(--stage-s6); }
.pagination { margin-top: 28px; display: flex; justify-content: space-between; color: var(--muted); }
/* ---- Archive / author / tag headers ---- */
.archive-header { padding-top: 52px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.archive-header .kicker { margin-bottom: 12px; }
.archive-header .author-image { width: 80px; height: 80px; object-fit: cover; border-radius: 50%; margin-bottom: 12px; }

/* ---- Article shell (post detail) ---- */
.article-shell { padding-top: clamp(38px, 6vw, 68px); padding-bottom: 80px; }
.article-header { max-width: 840px; padding-bottom: 24px; border-bottom: 2px solid var(--rule); }
.article-header .stage-chip { display: inline-block; margin-bottom: 12px; }
.article-header h1 { margin: 14px 0 12px; font-size: clamp(30px, 5vw, 52px); line-height: 1.18; letter-spacing: -.03em; font-weight: 800; }
.article-header p { margin: 0 0 12px; color: var(--ink-soft); font-size: 18px; }
.article-header .article-meta { display: flex; gap: 14px; flex-wrap: wrap; font-family: var(--font-mono); font-size: 14px; color: var(--muted); }
.article-header .article-meta span { display: inline-flex; align-items: center; gap: 6px; }
.feature-image { max-width: 980px; margin: 32px 0; }
.feature-image img { border-radius: var(--radius-md); }
.article-layout { display: grid; grid-template-columns: minmax(0, 760px) 262px; gap: clamp(32px, 5vw, 64px); align-items: start; margin-top: 34px; }
.article-content { grid-column: 1; }
.article-aside { grid-column: 2; grid-row: 1; position: sticky; top: 92px; display: grid; gap: 22px; }
.aside-card { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); overflow: hidden; }
.aside-card > strong { display: block; padding: 12px 16px; font-size: 13px; font-family: var(--font-mono); letter-spacing: .04em; text-transform: uppercase; color: var(--ink); border-bottom: 1px solid var(--line); background: var(--surface-muted); font-weight: 700; }
.aside-card ul { list-style: none; margin: 0; padding: 14px 16px; display: grid; gap: 9px; }
.aside-card li { display: flex; gap: 9px; align-items: flex-start; font-size: 14px; color: var(--ink-soft); line-height: 1.55; }
.aside-card li::before { content: ""; flex: 0 0 auto; margin-top: 6px; width: 8px; height: 8px; border-radius: 2px; transform: rotate(45deg); background: var(--success); }
/* ---- Article body (serif with diamond h2 marker) ---- */
.gh-content { font-family: var(--font-serif); font-size: 1.09rem; line-height: 1.95; color: color-mix(in srgb, var(--ink) 92%, transparent); }
.gh-content > *:first-child { margin-top: 0; }
.gh-content h1, .gh-content h2, .gh-content h3 { font-family: var(--font-sans); line-height: 1.3; letter-spacing: -.01em; }
.gh-content h2 { margin: 2em 0 .6em; font-size: 1.4rem; display: flex; align-items: center; gap: 12px; }
.gh-content h2::before { content: ""; width: 8px; height: 8px; background: var(--ruc); border-radius: 2px; transform: rotate(45deg); flex: 0 0 auto; }
.gh-content h3 { margin-top: 1.8em; font-size: 1.2rem; }
.gh-content a { color: var(--ruc); text-decoration: underline; text-underline-offset: 3px; }
.gh-content ul, .gh-content ol { padding-left: 1.3em; }
.gh-content li { margin: .3em 0; }
.gh-content blockquote, .gh-content .callout { margin: 24px 0; padding: 14px 16px; border-left: 4px solid var(--ruc); background: var(--ruc-soft); color: var(--ruc-dark); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; line-height: 1.6; }
.gh-content pre { overflow: auto; padding: 18px 20px; margin: 1.4em 0; border-radius: var(--radius-md); background: #1b1d22; color: #f3ead0; font-family: var(--font-mono); font-size: 14px; line-height: 1.7; border: 1px solid #2a2d34; }
.gh-content code { font-family: var(--font-mono); }
.gh-content :not(pre) > code { padding: 2px 5px; border-radius: 4px; background: var(--surface-muted); }
.gh-content table { width: 100%; border-collapse: collapse; margin: 24px 0; font-family: var(--font-sans); font-size: 15px; }
.gh-content th, .gh-content td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; }

.tag-row { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.tag-row a { display: inline-flex; padding: 3px 10px; border-radius: 999px; color: var(--ruc-dark); background: var(--ruc-soft); font-weight: 700; font-family: var(--font-mono); font-size: 11px; letter-spacing: .03em; }

.comments-section { max-width: 760px; margin-top: 46px; padding-top: 18px; border-top: 2px solid var(--rule); }
.readonly-notice { padding: 14px 16px; border-left: 4px solid var(--ruc); background: var(--ruc-soft); color: var(--ruc-dark); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.readonly-notice strong { display: block; margin-bottom: 4px; }
.readonly-notice p { margin: 0; color: color-mix(in srgb, var(--ruc-dark) 78%, transparent); line-height: 1.6; }
.page-shell .article-content { max-width: 760px; margin-top: 30px; }
.eyebrow { color: var(--ruc); font-size: 12px; font-weight: 750; font-family: var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.kg-width-wide { width: min(100%, 980px); margin-left: auto; margin-right: auto; }
.kg-width-full { width: 100%; max-width: none; }
.author-image { width: 80px; height: 80px; object-fit: cover; border-radius: 50%; }
/* ---- Responsive ---- */
@media (max-width: 980px) {
  .site-shell { grid-template-columns: 1fr; }
  .site-sidebar { position: static; height: auto; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; align-items: center; overflow-x: auto; gap: 12px; }
  .site-sidebar .brand small, .site-sidebar .sidebar-panel, .site-sidebar .ecosystem-nav, .site-sidebar .theme-toggle { display: none; }
  .side-nav { display: flex; white-space: nowrap; }
  .topbar { position: static; }
  .hero, .article-layout { grid-template-columns: 1fr; }
  .spec { transform: none; max-width: 460px; }
  .article-aside { grid-column: 1; grid-row: auto; position: static; }
  .lifecycle-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pl-card { grid-template-columns: 6px 1fr; }
  .pl-side { border-left: 0; border-top: 1px solid var(--line); grid-column: 2; }
}

@media (max-width: 640px) {
  .topbar-label { display: none; }
  .topbar-actions .button.ghost { display: none; }
  .hero h1 { font-size: 38px; }
  .lifecycle-grid { grid-template-columns: 1fr; }
  .hero-meta { gap: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
  .spec { transform: none; }
}

