/* Yellow River Frontier — loess paper · ecological-historical */
:root {
  /* light (default) — loess paper */
  --bg: #ede0b4;
  --bg-deep: #ddcd9a;
  --bg-elev: #f5ecc8;
  --surface: #fcf6dc;
  --surface-2: #f0e6c4;
  --paper: #fcf6dc;
  --ink: #1a1612;
  --ink-soft: #4a4030;
  --ink-mute: #847a64;
  --hairline: #1a16120e;
  --hairline-strong: #1a161222;
  --rule: #1a16123a;
  --silt: #b8943a;       /* loess gold */
  --silt-deep: #8a6e26;
  --river: #3a6a85;       /* silty blue */
  --river-deep: #285266;
  --cinnabar: #8c2c2a;    /* dynasty red, deeper than civ-waves */
  --cinnabar-deep: #6a1f1c;
  --steppe: #6a6855;      /* steppe sage */
  --jade: #4a7a5a;
  --shadow: 0 1px 0 #fff inset, 0 2px 10px #1a16120c;
  --max: 1320px;
  --font-display: "Vollkorn", "Source Han Serif SC", Georgia, serif;
  --font-body: "Crimson Pro", "PingFang SC", "Hiragino Sans GB", system-ui, serif;
  --font-mono: "Space Mono", ui-monospace, monospace;
}

html[data-theme="dark"] {
  --bg: #161310;
  --bg-deep: #0c0a08;
  --bg-elev: #1f1a14;
  --surface: #28221a;
  --surface-2: #322b21;
  --paper: #ede0b4;
  --ink: #ede0b4;
  --ink-soft: #b8aa84;
  --ink-mute: #847a64;
  --hairline: #ede0b40e;
  --hairline-strong: #ede0b41e;
  --rule: #ede0b432;
  --silt: #d4b865;
  --silt-deep: #b89538;
  --river: #6a9eb8;
  --river-deep: #4a8298;
  --cinnabar: #c8504a;
  --cinnabar-deep: #a83a30;
  --steppe: #98967e;
  --jade: #7a9c84;
  --shadow: 0 1px 0 #ede0b405 inset, 0 8px 28px #0008;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "liga", "kern";
  transition: background .25s, color .25s;
}

a { color: var(--cinnabar); text-decoration: none; border-bottom: 1px solid var(--rule); transition: color .15s, border-color .15s; }
a:hover { color: var(--river); border-bottom-color: var(--river); }

.container { max-width: var(--max); margin: 0 auto; padding: 0 36px; }

/* ----- Topbar ----- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--hairline-strong);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 36px; max-width: var(--max); margin: 0 auto; gap: 16px;
}
.brand {
  display: flex; align-items: baseline; gap: 12px;
  font-family: var(--font-display); font-weight: 600;
  font-size: 26px; letter-spacing: -.005em; line-height: 1;
  color: var(--ink); border: 0;
}
.brand em { font-style: italic; color: var(--silt); }
.nav { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.nav a {
  font-size: 12px; color: var(--ink-soft); border: 0;
  font-weight: 500; font-family: var(--font-mono);
  letter-spacing: .02em;
}
.nav a:hover { color: var(--cinnabar); }

.toolbar { display: flex; gap: 10px; align-items: center; }
.lang-toggle, .theme-toggle {
  display: inline-flex; border: 1px solid var(--hairline-strong);
  overflow: hidden; background: var(--surface);
}
.lang-toggle button, .theme-toggle button {
  background: transparent; border: 0; color: var(--ink-soft);
  padding: 6px 12px; cursor: pointer; font: inherit;
  letter-spacing: .04em;
  font-family: var(--font-mono); font-size: 11px;
}
.lang-toggle button.active, .theme-toggle button.active {
  background: var(--ink); color: var(--bg);
}

/* ----- Hero ----- */
.hero {
  padding: 90px 0 70px;
  position: relative; overflow: hidden;
  border-bottom: 2px solid var(--ink);
}
.hero-marker {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em;
  color: var(--cinnabar); text-transform: uppercase; margin-bottom: 28px;
  display: flex; align-items: center; gap: 12px;
}
.hero-marker::before { content: ""; width: 24px; height: 1px; background: var(--cinnabar); }
.hero-marker::after  { content: ""; flex: 1; height: 1px; background: var(--hairline-strong); max-width: 320px; }

.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(48px, 7vw, 100px);
  line-height: 0.96;
  letter-spacing: -.02em;
  margin: 0 0 32px;
}
.hero h1 em { font-style: italic; color: var(--silt); font-weight: 600; }
.hero h1 .alt { font-style: italic; color: var(--river); }

.hero-thesis {
  display: grid; grid-template-columns: 1fr 1fr; gap: 60px;
  margin: 56px 0;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  padding: 30px 0;
}
.hero-thesis .label {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em;
  color: var(--ink-mute); text-transform: uppercase;
  margin-bottom: 14px;
}
.hero-thesis .formula {
  font-family: var(--font-display); font-style: italic; font-size: 22px;
  line-height: 1.4; color: var(--ink); letter-spacing: -.005em; font-weight: 500;
}
.hero-thesis .formula em { font-style: normal; color: var(--cinnabar); }
.hero-thesis .formula b { color: var(--river); font-weight: 500; font-style: italic; }
.hero-thesis blockquote {
  margin: 0;
  font-family: var(--font-display); font-style: italic; font-weight: 500;
  font-size: 22px; line-height: 1.4; color: var(--ink);
  letter-spacing: -.005em;
}
.hero-thesis blockquote em { font-style: normal; color: var(--silt); }

.hero-lede {
  font-size: 19px; line-height: 1.65; color: var(--ink-soft);
  max-width: 800px; margin: 0 0 36px;
}

.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 56px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 26px;
  font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .15s;
  font-family: var(--font-mono); letter-spacing: .06em;
  text-transform: uppercase; border: 1px solid var(--ink);
}
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--cinnabar); border-color: var(--cinnabar); color: var(--bg); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--bg); }
a.btn { border-style: solid; }

/* River-courses hero map */
.courses-wrap {
  border: 1px solid var(--rule); padding: 28px;
  background: var(--surface);
}
.courses-head {
  display: flex; justify-content: space-between; align-items: end;
  border-bottom: 1px solid var(--hairline-strong); padding-bottom: 12px; margin-bottom: 18px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase;
}
.courses-head .id { color: var(--cinnabar); }
.courses-head .ttl { color: var(--ink); font-weight: 500; font-family: var(--font-display); font-style: italic; font-size: 17px; letter-spacing: -.005em; text-transform: none; }
.courses-head .rev { color: var(--ink-mute); }
.courses-svg { width: 100%; aspect-ratio: 2.0; max-height: 480px; }

/* ----- Section ----- */
.section { padding: 110px 0; border-bottom: 1px solid var(--rule); position: relative; }
.section.alt { background: var(--bg-elev); }

.section-head {
  display: grid; grid-template-columns: 280px 1fr; gap: 60px;
  margin-bottom: 56px; align-items: start;
}
.section-num {
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-mute);
  letter-spacing: .14em; font-weight: 500;
  border-top: 1px solid var(--ink); padding-top: 16px;
}
.section-num .big {
  font-family: var(--font-display); font-style: italic; font-size: 56px;
  font-weight: 600; color: var(--cinnabar); line-height: 1;
  display: block; margin-top: 12px; letter-spacing: -.02em;
}
.section-num .desc {
  display: block; color: var(--ink-mute); margin-top: 14px;
  font-weight: 400; letter-spacing: .04em; line-height: 1.55;
  font-size: 13.5px;
}
.section-title {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(36px, 5vw, 70px); line-height: 1.0;
  letter-spacing: -.02em; margin: 0 0 18px;
}
.section-title em { font-style: italic; color: var(--cinnabar); }
.section-title .alt { font-style: italic; color: var(--river); }
.section-lede {
  font-size: 18px; color: var(--ink-soft); max-width: 740px; line-height: 1.65;
}
.section-lede em { color: var(--ink); font-style: italic; }

/* ----- Module 1 — Ecology ----- */
.eco-shell { display: grid; grid-template-columns: 1.3fr 1fr; gap: 48px; align-items: start; }
.eco-card { border: 1px solid var(--rule); background: var(--surface); padding: 36px; box-shadow: var(--shadow); }
.eco-card h3 { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 28px; margin: 0 0 6px; letter-spacing: -.01em; }
.eco-card .sub { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); letter-spacing: .12em; margin-bottom: 22px; text-transform: uppercase; }
.eco-svg { width: 100%; aspect-ratio: 1.2; }
.eco-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 22px; }
.eco-stat { padding: 16px 18px; background: var(--bg-elev); border-left: 3px solid var(--silt); }
.eco-stat .k { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em; color: var(--ink-mute); text-transform: uppercase; }
.eco-stat .v { font-family: var(--font-display); font-style: italic; font-size: 26px; color: var(--ink); margin: 4px 0 2px; line-height: 1.1; font-weight: 500; }
.eco-stat .note { font-size: 12.5px; color: var(--ink-soft); }

.eco-list { display: flex; flex-direction: column; gap: 16px; }
.eco-feature {
  border-left: 2px solid var(--rule); padding: 8px 0 8px 22px;
  transition: border-color .15s, padding-left .15s;
}
.eco-feature:hover { border-left-color: var(--cinnabar); padding-left: 26px; }
.eco-feature .id {
  font-family: var(--font-mono); font-size: 11px; color: var(--cinnabar);
  letter-spacing: .12em; margin-bottom: 6px; text-transform: uppercase; font-weight: 500;
}
.eco-feature h4 { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 22px; margin: 0 0 6px; letter-spacing: -.005em; line-height: 1.2; }
.eco-feature p { color: var(--ink-soft); font-size: 14.5px; margin: 0; line-height: 1.65; }
.eco-feature p em { color: var(--ink); font-style: italic; }

/* ----- Module 2 — Population & Agriculture ----- */
.pop-shell { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; }
.pop-card { border: 1px solid var(--rule); background: var(--surface); padding: 36px; }
.pop-card h3 { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 28px; margin: 0 0 6px; letter-spacing: -.01em; }
.pop-card .sub { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); letter-spacing: .12em; margin-bottom: 22px; text-transform: uppercase; }
.pop-svg { width: 100%; aspect-ratio: 1.7; }

.crops-card { border: 1px solid var(--rule); background: var(--surface); padding: 36px; }
.crops-card h3 { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 26px; margin: 0 0 6px; letter-spacing: -.01em; }
.crops-card .sub { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); letter-spacing: .12em; margin-bottom: 24px; text-transform: uppercase; }
.crop {
  display: grid; grid-template-columns: 110px 1fr;
  gap: 16px; padding: 16px 0; border-top: 1px dashed var(--hairline-strong);
}
.crop:first-of-type { border-top: 0; padding-top: 4px; }
.crop .era {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--silt-deep);
  letter-spacing: .04em; padding-top: 4px; font-weight: 600;
  text-transform: uppercase;
}
.crop h5 { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 20px; margin: 0 0 6px; letter-spacing: -.005em; }
.crop p { color: var(--ink-soft); font-size: 14.5px; margin: 0; line-height: 1.6; }
.crop p em { color: var(--ink); font-style: italic; }

/* ----- Module 3 — State Formation ----- */
.state-shell { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--rule); }
.state-cell {
  background: var(--surface); padding: 36px;
  border-right: 1px solid var(--rule);
}
.state-cell:last-child { border-right: 0; }
.state-cell .label {
  display: inline-block; font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: .12em; padding: 3px 10px; text-transform: uppercase; font-weight: 600;
  margin-bottom: 14px;
}
.state-cell.thesis .label { color: var(--cinnabar); border: 1px solid var(--cinnabar); }
.state-cell.critique .label { color: var(--jade); border: 1px solid var(--jade); }
.state-cell h4 { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 28px; margin: 0 0 10px; letter-spacing: -.01em; }
.state-cell > p { color: var(--ink-soft); font-size: 15px; margin: 0 0 18px; line-height: 1.7; }
.state-cell > p em { color: var(--ink); font-style: italic; }
.state-list { list-style: none; padding: 0; margin: 0; }
.state-list li {
  padding: 14px 0; border-top: 1px dashed var(--hairline-strong);
  font-size: 14.5px; line-height: 1.65;
}
.state-list li:first-child { border-top: 0; padding-top: 6px; }
.state-list li b { font-family: var(--font-display); font-style: italic; font-weight: 500; color: var(--ink); display: block; margin-bottom: 4px; font-size: 16px; }
.state-list li span { color: var(--ink-soft); }

/* ----- Module 4 — Frontier ----- */
.frontier-shell { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; align-items: start; }
.wall-card { border: 1px solid var(--rule); background: var(--surface); padding: 36px; }
.wall-card h3 { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 26px; margin: 0 0 6px; letter-spacing: -.01em; }
.wall-card .sub { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); letter-spacing: .12em; margin-bottom: 22px; text-transform: uppercase; }
.wall-svg { width: 100%; aspect-ratio: 1.7; }

.frontier-side h3 { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 30px; margin: 0 0 6px; letter-spacing: -.01em; }
.frontier-side .sub { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); letter-spacing: .12em; margin-bottom: 22px; text-transform: uppercase; }
.dyn {
  display: grid; grid-template-columns: 90px 1fr; gap: 16px;
  padding: 14px 0; border-top: 1px solid var(--hairline-strong);
}
.dyn:first-of-type { border-top: 0; padding-top: 4px; }
.dyn .marker {
  font-family: var(--font-mono); font-size: 11px; color: var(--cinnabar);
  letter-spacing: .04em; padding-top: 5px; font-weight: 500;
  text-transform: uppercase;
}
.dyn h5 { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 20px; margin: 0 0 4px; letter-spacing: -.005em; }
.dyn p { color: var(--ink-soft); font-size: 14px; margin: 0; line-height: 1.6; }

/* ----- Module 5 — Dynastic Cycle ----- */
.cycle-shell { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.cycle-svg-card { border: 1px solid var(--rule); background: var(--surface); padding: 36px; }
.cycle-svg-card h3 { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 26px; margin: 0 0 6px; letter-spacing: -.01em; }
.cycle-svg-card .sub { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); letter-spacing: .12em; margin-bottom: 22px; text-transform: uppercase; }
.cycle-svg { width: 100%; aspect-ratio: 1.05; }
.phases-side h3 { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 28px; margin: 0 0 6px; letter-spacing: -.01em; }
.phases-side .sub { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); letter-spacing: .12em; margin-bottom: 22px; text-transform: uppercase; }
.phase {
  display: grid; grid-template-columns: 100px 1fr; gap: 16px;
  padding: 14px 0; border-top: 1px solid var(--hairline-strong);
}
.phase:first-of-type { border-top: 0; padding-top: 4px; }
.phase .ph {
  font-family: var(--font-mono); font-size: 11px; color: var(--cinnabar);
  letter-spacing: .04em; padding-top: 5px; font-weight: 500;
  text-transform: uppercase;
}
.phase h5 { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 21px; margin: 0 0 4px; letter-spacing: -.005em; }
.phase p { color: var(--ink-soft); font-size: 14.5px; margin: 0; line-height: 1.6; }

/* ----- Module 6 — Migration link ----- */
.link-card {
  border: 1px solid var(--rule); background: var(--surface);
  padding: 40px; display: grid; grid-template-columns: 1fr 1fr; gap: 40px;
}
.link-card .text h3 { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 30px; margin: 0 0 8px; letter-spacing: -.01em; }
.link-card .text .sub { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); letter-spacing: .12em; margin-bottom: 22px; text-transform: uppercase; }
.link-card .text p { color: var(--ink-soft); font-size: 16px; margin: 0 0 16px; line-height: 1.7; }
.link-card .text p em { color: var(--ink); font-style: italic; }
.link-card .pull {
  margin: 24px 0 0; padding: 22px 26px;
  border-left: 3px solid var(--cinnabar);
  background: var(--bg-elev);
  font-family: var(--font-display); font-style: italic; font-size: 22px;
  line-height: 1.4; color: var(--ink); letter-spacing: -.005em; font-weight: 500;
}
.link-card .visual { display: flex; flex-direction: column; gap: 14px; }
.link-feature {
  background: var(--bg-elev); border: 1px solid var(--hairline-strong);
  padding: 20px 22px;
}
.link-feature .id {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--silt-deep);
  letter-spacing: .12em; margin-bottom: 8px; text-transform: uppercase; font-weight: 600;
}
.link-feature h5 { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 19px; margin: 0 0 6px; letter-spacing: -.005em; }
.link-feature p { color: var(--ink-soft); font-size: 14px; margin: 0; line-height: 1.6; }
.link-feature p em { color: var(--ink); font-style: italic; }

/* ----- Module 7 — Cultural ----- */
.culture-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 0;
  border: 1px solid var(--rule);
}
.culture-cell {
  background: var(--surface); padding: 32px;
  border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.culture-cell:nth-child(2n) { border-right: 0; }
.culture-cell:nth-last-child(-n+2) { border-bottom: 0; }
.culture-cell .domain {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em;
  color: var(--cinnabar); text-transform: uppercase; font-weight: 600; margin-bottom: 14px;
}
.culture-cell h4 { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 26px; margin: 0 0 12px; letter-spacing: -.01em; line-height: 1.15; }
.culture-cell h4 em { font-style: normal; color: var(--silt); }
.culture-cell p { color: var(--ink-soft); font-size: 14.5px; margin: 0 0 14px; line-height: 1.7; }
.culture-cell p em { color: var(--ink); font-style: italic; }
.culture-cell .pull {
  margin-top: 14px; padding: 12px 16px;
  background: var(--bg-elev); border-left: 2px solid var(--silt);
  font-family: var(--font-display); font-style: italic; font-size: 16px;
  line-height: 1.45; color: var(--ink-soft);
}

/* ----- Module 8 — Comparative River ----- */
.compare-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  border: 1px solid var(--rule);
}
.compare-cell {
  background: var(--surface); padding: 28px;
  border-right: 1px solid var(--rule);
}
.compare-cell:last-child { border-right: 0; }
.compare-cell .flag {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em;
  color: var(--cinnabar); text-transform: uppercase; font-weight: 600; margin-bottom: 12px;
}
.compare-cell h4 { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 24px; margin: 0 0 12px; letter-spacing: -.01em; line-height: 1.15; }
.compare-cell .pattern {
  font-family: var(--font-display); font-style: italic; font-size: 15px;
  color: var(--ink); padding: 10px 0 10px 14px; border-left: 2px solid var(--cinnabar);
  margin: 12px 0; line-height: 1.4; font-weight: 500;
}
.compare-cell p { color: var(--ink-soft); font-size: 13.5px; margin: 0 0 10px; line-height: 1.6; }
.compare-cell p em { color: var(--ink); font-style: italic; }

/* ----- Module 9 — Guardrails ----- */
.guardrails {
  border: 1px solid var(--cinnabar); background: var(--surface);
  padding: 40px;
}
.guardrails-head {
  display: flex; gap: 16px; align-items: center;
  margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--cinnabar);
}
.guardrails-head .seal {
  display: inline-block; width: 48px; height: 48px;
  background: var(--cinnabar); color: var(--paper);
  font-family: var(--font-display); font-style: italic; font-size: 26px;
  display: grid; place-items: center; line-height: 1; font-weight: 600;
}
.guardrails-head h3 { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 30px; margin: 0; letter-spacing: -.01em; }
.guardrails-head .sub { font-family: var(--font-mono); font-size: 11px; color: var(--cinnabar); letter-spacing: .12em; text-transform: uppercase; margin-top: 4px; }
.guardrails-list { list-style: none; padding: 0; margin: 0; counter-reset: gr; }
.guardrails-list li {
  padding: 16px 0 16px 60px; position: relative;
  border-top: 1px dashed var(--hairline-strong);
  counter-increment: gr;
}
.guardrails-list li:first-child { border-top: 0; padding-top: 4px; }
.guardrails-list li::before {
  content: "§ " counter(gr, decimal);
  position: absolute; left: 0; top: 18px;
  font-family: var(--font-mono); font-size: 11px; color: var(--cinnabar);
  letter-spacing: .04em; font-weight: 600;
}
.guardrails-list li:first-child::before { top: 6px; }
.guardrails-list h5 { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 22px; margin: 0 0 6px; letter-spacing: -.005em; }
.guardrails-list p { color: var(--ink-soft); font-size: 15px; margin: 0; line-height: 1.65; }
.guardrails-list p em { color: var(--ink); font-style: italic; }

/* ----- Module 10 — Historian ----- */
.historian {
  border: 1px solid var(--rule); background: var(--surface);
  display: grid; grid-template-columns: 320px 1fr; min-height: 580px;
  box-shadow: var(--shadow);
}
.historian-side {
  background: var(--bg-elev); border-right: 1px solid var(--rule);
  padding: 28px;
}
.historian-side h4 {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-mute); margin: 0 0 16px; font-weight: 600;
}
.historian-pill {
  background: transparent; border: 1px solid var(--hairline-strong);
  padding: 11px 14px; font: inherit; font-size: 13.5px;
  cursor: pointer; width: 100%; text-align: left; margin-bottom: 8px;
  color: var(--ink-soft); transition: all .15s; line-height: 1.4;
  font-family: var(--font-body);
}
.historian-pill:hover { background: var(--surface); color: var(--ink); border-color: var(--cinnabar); }
.historian-main { display: flex; flex-direction: column; }
.historian-stream { flex: 1; padding: 32px; overflow-y: auto; max-height: 580px; }
.msg { margin-bottom: 24px; max-width: 90%; }
.msg.user { margin-left: auto; }
.msg .role {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-mute); margin-bottom: 6px; font-weight: 600;
}
.msg .bubble {
  background: var(--bg-elev); border: 1px solid var(--hairline-strong);
  padding: 16px 20px; font-size: 15.5px; line-height: 1.65; font-family: var(--font-body);
}
.msg.user .bubble { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.msg .bubble p { margin: 0 0 10px; }
.msg .bubble p:last-child { margin-bottom: 0; }
.msg .bubble strong { color: var(--cinnabar); font-weight: 600; }
.msg.user .bubble strong { color: var(--silt); }
.msg .bubble .quoted {
  margin: 8px 0 6px; padding: 6px 0 6px 14px;
  border-left: 2px solid var(--cinnabar);
  font-family: var(--font-display); font-style: italic;
  font-size: 17px; line-height: 1.45; color: var(--ink-soft); font-weight: 500;
}
.historian-input {
  border-top: 1px solid var(--hairline-strong); padding: 18px;
  display: flex; gap: 10px; background: var(--bg-elev);
}
.historian-input input {
  flex: 1; border: 1px solid var(--hairline-strong); background: var(--surface); color: var(--ink);
  padding: 12px 18px; font: inherit; font-size: 15px; font-family: var(--font-body);
}
.historian-input input:focus { outline: 2px solid var(--cinnabar); outline-offset: -1px; }
.historian-input input::placeholder { color: var(--ink-mute); font-style: italic; }

/* ----- Footer ----- */
.footer {
  background: var(--ink); color: #b8aa84;
  padding: 80px 0 40px;
}
html[data-theme="dark"] .footer { background: var(--bg-deep); color: #847a64; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 56px; }
.footer h5 {
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: .12em; color: var(--silt); margin: 0 0 18px; font-weight: 600;
}
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { margin-bottom: 8px; font-size: 14.5px; }
.footer a { color: #b8aa84; border: 0; }
.footer a:hover { color: var(--silt); }
.footer-brand {
  font-family: var(--font-display); font-style: italic; font-weight: 600; font-size: 38px;
  color: var(--bg); letter-spacing: -.01em; margin-bottom: 14px; line-height: 1;
}
.footer-brand em { font-style: normal; color: var(--silt); }
html[data-theme="dark"] .footer-brand { color: var(--ink); }
.footer-tag { color: #847a64; font-size: 14.5px; max-width: 380px; line-height: 1.65; font-style: italic; }
.footer-bottom {
  border-top: 1px solid #ffffff14; padding-top: 24px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: #847a64; font-family: var(--font-mono);
  letter-spacing: .04em;
}
.footer-bottom a { color: #847a64; border: 0; }
.footer-bottom a:hover { color: var(--silt); }

/* ----- i18n ----- */
html[data-lang="en"] [lang="zh"] { display: none !important; }
html[data-lang="zh"] [lang="en"] { display: none !important; }
html[data-lang="en"][lang="zh"], html[data-lang="zh"][lang="en"] { display: block !important; }

/* ----- Responsive ----- */
@media (max-width: 1000px) {
  .nav { display: none; }
  .hero { padding: 50px 0 50px; }
  .hero-thesis { grid-template-columns: 1fr; gap: 24px; padding: 24px 0; }
  .section { padding: 70px 0; }
  .section-head { grid-template-columns: 1fr; gap: 20px; margin-bottom: 36px; }
  .eco-shell, .pop-shell, .frontier-shell, .cycle-shell { grid-template-columns: 1fr; gap: 24px; }
  .state-shell { grid-template-columns: 1fr; }
  .state-cell:not(:last-child) { border-right: 0; border-bottom: 1px solid var(--rule); }
  .culture-grid { grid-template-columns: 1fr; }
  .culture-cell { border-right: 0 !important; border-bottom: 1px solid var(--rule) !important; }
  .culture-cell:last-child { border-bottom: 0 !important; }
  .compare-grid { grid-template-columns: 1fr 1fr; }
  .compare-cell { border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
  .compare-cell:nth-child(2n) { border-right: 0; }
  .compare-cell:nth-last-child(-n+2) { border-bottom: 0; }
  .link-card { grid-template-columns: 1fr; }
  .historian { grid-template-columns: 1fr; min-height: 0; }
  .historian-side { border-right: 0; border-bottom: 1px solid var(--rule); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 30px; }
  .toolbar { gap: 6px; }
  .lang-toggle button, .theme-toggle button { padding: 5px 8px; font-size: 10px; }
}
@media (max-width: 600px) {
  .compare-grid { grid-template-columns: 1fr; }
  .compare-cell { border-right: 0 !important; }
}

/* ----- utility ----- */
.fade-in { opacity: 0; transform: translateY(8px); transition: opacity .5s, transform .5s; }
.fade-in.in { opacity: 1; transform: none; }
