/* Southward Migration — dark ink-scroll · vertical flow */
:root {
  /* dark (default) — ink scroll at night */
  --bg: #0e0c08;
  --bg-deep: #070605;
  --bg-elev: #15120c;
  --surface: #1b1812;
  --surface-2: #221e16;
  --paper: #ebe2c8;
  --ink: #ebe2c8;
  --ink-soft: #b6ad97;
  --ink-mute: #847b6a;
  --hairline: #ebe2c80f;
  --hairline-strong: #ebe2c81e;
  --rule: #ebe2c834;
  --jade: #5fa890;
  --jade-deep: #3d806b;
  --ginkgo: #c8a04a;
  --ginkgo-deep: #9c7a30;
  --vermillion: #c84a3a;
  --slate: #6a7a8c;
  --plum: #a06a8c;
  --shadow: 0 1px 0 #ebe2c806 inset, 0 8px 32px #0009;
  --max: 1320px;
  --font-display: "Spectral", "Source Han Serif SC", Georgia, serif;
  --font-body: "Spectral", "PingFang SC", "Hiragino Sans GB", system-ui, serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

html[data-theme="light"] {
  --bg: #f0e9d8;
  --bg-deep: #e3dcc8;
  --bg-elev: #f8f3e3;
  --surface: #fffdf2;
  --surface-2: #f1ead7;
  --paper: #14110d;
  --ink: #14110d;
  --ink-soft: #4a443c;
  --ink-mute: #847a6a;
  --hairline: #14110d10;
  --hairline-strong: #14110d24;
  --rule: #14110d3a;
  --jade: #3d806b;
  --jade-deep: #285844;
  --ginkgo: #9c7a30;
  --ginkgo-deep: #745822;
  --vermillion: #a83a2c;
  --slate: #4a5a72;
  --plum: #804864;
  --shadow: 0 1px 0 #fff inset, 0 6px 22px #14110d12;
}

* { 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(--ginkgo); text-decoration: none; border-bottom: 1px solid var(--rule); transition: color .15s, border-color .15s; }
a:hover { color: var(--jade); border-bottom-color: var(--jade); }

.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: 500;
  font-size: 26px; letter-spacing: -.005em; line-height: 1;
  color: var(--ink); border: 0;
}
.brand em { font-style: italic; color: var(--ginkgo); }
.brand .arrow { font-style: italic; color: var(--jade); }
.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(--ginkgo); }

.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(--ginkgo); text-transform: uppercase; margin-bottom: 28px;
  display: flex; align-items: center; gap: 12px;
}
.hero-marker::before { content: ""; width: 24px; height: 1px; background: var(--ginkgo); }
.hero-marker::after  { content: ""; flex: 1; height: 1px; background: var(--hairline-strong); max-width: 320px; }

.hero h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(48px, 7vw, 102px);
  line-height: 0.96;
  letter-spacing: -.02em;
  margin: 0 0 36px;
}
.hero h1 em { font-style: italic; color: var(--ginkgo); }
.hero h1 .alt { font-style: italic; color: var(--jade); }

.hero-grid {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 60px;
  margin: 56px 0; align-items: start;
}

.hero-thesis-card {
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  padding: 30px 0;
  display: flex; flex-direction: column; gap: 28px;
}
.hero-thesis-card .label {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em;
  color: var(--ink-mute); text-transform: uppercase; margin-bottom: 12px;
}
.hero-thesis-card .formula {
  font-family: var(--font-display); font-style: italic; font-size: 22px;
  line-height: 1.4; color: var(--ink); letter-spacing: -.005em;
}
.hero-thesis-card .formula em { font-style: normal; color: var(--ginkgo); }
.hero-thesis-card .formula b { color: var(--jade); font-weight: 400; font-style: italic; }
.hero-thesis-card blockquote {
  margin: 0;
  font-family: var(--font-display); font-style: italic; font-weight: 400;
  font-size: 22px; line-height: 1.4; color: var(--ink);
  letter-spacing: -.005em;
}
.hero-thesis-card blockquote em { font-style: normal; color: var(--ginkgo); }

/* Hero vertical flow map */
.flow-map-wrap {
  border: 1px solid var(--rule); padding: 24px;
  background: var(--surface);
}
.flow-map-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;
}
.flow-map-head .id { color: var(--ginkgo); }
.flow-map-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; }
.flow-map-head .rev { color: var(--ink-mute); }
.flow-map-svg { width: 100%; aspect-ratio: 0.55; max-height: 720px; }

.hero-lede {
  font-size: 18px; line-height: 1.7; color: var(--ink-soft);
  max-width: 760px; margin: 0 0 32px;
}

.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.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(--ginkgo); border-color: var(--ginkgo); color: var(--bg); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--bg); }
a.btn { border-style: solid; }

/* ----- 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: 400; color: var(--ginkgo); 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: 400;
  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(--ginkgo); }
.section-title .alt { font-style: italic; color: var(--jade); }
.section-lede {
  font-size: 18px; color: var(--ink-soft); max-width: 720px; line-height: 1.7;
}
.section-lede em { color: var(--ink); font-style: italic; }

/* ----- Module 1 — Frontier Pressure ----- */
.frontier-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1px; background: var(--rule); border: 1px solid var(--rule);
}
.frontier-card { background: var(--surface); padding: 30px; position: relative; }
.frontier-card .num {
  position: absolute; top: 22px; right: 26px;
  font-family: var(--font-display); font-style: italic; font-size: 38px;
  color: var(--vermillion); line-height: 1; opacity: .8;
}
.frontier-card .id {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em;
  color: var(--vermillion); text-transform: uppercase; font-weight: 500;
  margin-bottom: 8px;
}
.frontier-card h4 {
  font-family: var(--font-display); font-style: italic; font-weight: 400;
  font-size: 24px; margin: 0 0 6px; letter-spacing: -.005em; line-height: 1.15;
  max-width: 88%;
}
.frontier-card .span {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute);
  letter-spacing: .04em; margin-bottom: 16px;
}
.frontier-card p { margin: 0 0 14px; color: var(--ink-soft); font-size: 14.5px; line-height: 1.65; }
.frontier-card p em { color: var(--ink); font-style: italic; }
.frontier-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 0; }
.frontier-tags .tag {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .04em;
  padding: 3px 10px; background: var(--bg-elev); color: var(--ink-soft);
  border: 1px solid var(--hairline-strong);
}

/* ----- Module 2 — Migration Waves Timeline ----- */
.waves-shell {
  border: 1px solid var(--rule); background: var(--surface);
  padding: 36px;
}
.waves-head {
  display: flex; justify-content: space-between; align-items: end;
  margin-bottom: 24px; padding-bottom: 14px; border-bottom: 1px solid var(--hairline-strong);
}
.waves-head h3 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 26px; margin: 0; letter-spacing: -.01em; }
.waves-head .meta { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); letter-spacing: .04em; }
.waves-tl { width: 100%; aspect-ratio: 3.4; max-height: 320px; }

.waves-list { margin-top: 28px; display: grid; grid-template-columns: 1fr; gap: 0; border: 1px solid var(--rule); }
.wave-row {
  display: grid; grid-template-columns: 100px 1fr 1fr 1fr;
  border-bottom: 1px solid var(--rule);
}
.wave-row:last-child { border-bottom: 0; }
.wave-row > div { padding: 18px 22px; border-right: 1px solid var(--rule); }
.wave-row > div:last-child { border-right: 0; }
.wave-row .era {
  font-family: var(--font-display); font-style: italic; font-size: 28px;
  color: var(--vermillion); display: flex; align-items: center; line-height: 1.1;
}
.wave-row .head-cell h5 {
  font-family: var(--font-display); font-style: italic; font-weight: 400;
  font-size: 22px; margin: 0 0 4px; letter-spacing: -.005em; line-height: 1.2;
}
.wave-row .head-cell .span { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-mute); letter-spacing: .04em; }
.wave-row .from-to {
  font-family: var(--font-display); font-style: italic; font-size: 18px;
  line-height: 1.3; color: var(--ink); display: flex; flex-direction: column; gap: 6px;
}
.wave-row .from-to .arr { font-family: var(--font-mono); font-style: normal; font-size: 11px; color: var(--ginkgo); letter-spacing: .12em; }
.wave-row .meaning { color: var(--ink-soft); font-size: 14px; line-height: 1.6; }
.wave-row .meaning em { color: var(--ink); font-style: italic; }
.wave-row.head { background: var(--ink); color: var(--bg); }
.wave-row.head > div { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; padding: 14px 22px; }

/* ----- Module 3 — Cultural Reconstruction ----- */
.recon-shell { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--rule); }
.recon-cell {
  background: var(--surface); padding: 36px;
  border-right: 1px solid var(--rule);
}
.recon-cell:last-child { border-right: 0; }
.recon-cell .label {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em;
  color: var(--jade); text-transform: uppercase; font-weight: 600;
  margin-bottom: 14px;
  display: inline-block; padding: 3px 10px; border: 1px solid var(--jade);
}
.recon-cell h4 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 28px; margin: 0 0 8px; letter-spacing: -.01em; }
.recon-cell .place { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-mute); letter-spacing: .04em; margin-bottom: 20px; }
.recon-cell > p { color: var(--ink-soft); font-size: 15px; margin: 0 0 18px; line-height: 1.7; }
.recon-cell > p em { color: var(--ink); font-style: italic; }
.recon-list { list-style: none; padding: 0; margin: 0; }
.recon-list li {
  padding: 14px 0; border-top: 1px dashed var(--hairline-strong);
  display: grid; grid-template-columns: 90px 1fr; gap: 14px; font-size: 14.5px; line-height: 1.55;
}
.recon-list li:first-child { border-top: 0; padding-top: 6px; }
.recon-list .k {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-mute); padding-top: 3px; font-weight: 600;
}
.recon-list .v { color: var(--ink-soft); }
.recon-list .v b { color: var(--ink); font-weight: 600; font-style: italic; font-family: var(--font-display); }

/* ----- Module 4 — Maritime ----- */
.maritime-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0;
  border: 1px solid var(--rule);
}
.maritime-cell {
  background: var(--surface); padding: 30px;
  border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.maritime-cell:nth-child(3n) { border-right: 0; }
.maritime-cell:nth-last-child(-n+3) { border-bottom: 0; }
.maritime-cell .anchor {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em;
  color: var(--jade); text-transform: uppercase; font-weight: 600; margin-bottom: 12px;
}
.maritime-cell h4 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 26px; margin: 0 0 8px; letter-spacing: -.01em; line-height: 1.15; }
.maritime-cell .role { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); letter-spacing: .04em; margin-bottom: 14px; }
.maritime-cell p { color: var(--ink-soft); font-size: 14px; margin: 0; line-height: 1.65; }
.maritime-cell p em { color: var(--ink); font-style: italic; }

/* ----- Module 5 — Folk & Martial ----- */
.folk-shell { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: start; }
.folk-list-card { border: 1px solid var(--rule); background: var(--surface); padding: 36px; }
.folk-list-card h3 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 28px; margin: 0 0 6px; letter-spacing: -.01em; }
.folk-list-card .sub { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); letter-spacing: .12em; margin-bottom: 26px; text-transform: uppercase; }
.folk-item {
  padding: 20px 0; border-top: 1px solid var(--hairline-strong);
}
.folk-item:first-of-type { border-top: 0; padding-top: 6px; }
.folk-item .glyph {
  display: inline-block; font-family: var(--font-display); font-style: italic;
  font-size: 32px; color: var(--vermillion); line-height: 1; margin-bottom: 8px;
}
.folk-item h5 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 22px; margin: 0 0 6px; letter-spacing: -.005em; }
.folk-item .badge {
  display: inline-block; font-family: var(--font-mono); font-size: 10px;
  padding: 2px 8px; background: var(--surface-2); color: var(--ginkgo);
  border: 1px solid var(--hairline-strong); letter-spacing: .04em; text-transform: uppercase;
  margin-left: 10px;
}
.folk-item p { color: var(--ink-soft); font-size: 14.5px; margin: 8px 0 0; line-height: 1.65; }
.folk-item p em { color: var(--ink); font-style: italic; }
.folk-item .caveat {
  margin-top: 12px; padding: 10px 14px;
  background: var(--bg-deep); border-left: 2px solid var(--ginkgo);
  font-family: var(--font-mono); font-size: 11.5px;
  color: var(--ink-mute); line-height: 1.55; letter-spacing: .02em;
}
.folk-item .caveat b { color: var(--ginkgo); font-weight: 600; }

.folk-narrative { border: 1px solid var(--rule); background: var(--surface); padding: 36px; }
.folk-narrative h3 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 26px; margin: 0 0 6px; letter-spacing: -.01em; }
.folk-narrative .sub { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); letter-spacing: .12em; margin-bottom: 22px; text-transform: uppercase; }
.folk-narrative p { color: var(--ink-soft); font-size: 15px; line-height: 1.7; margin: 0 0 16px; }
.folk-narrative p em { color: var(--ink); font-style: italic; }
.folk-narrative .pull {
  margin-top: 24px; padding: 22px 26px;
  border-left: 3px solid var(--vermillion);
  background: var(--bg-deep);
  font-family: var(--font-display); font-style: italic; font-size: 22px;
  line-height: 1.4; color: var(--ink); letter-spacing: -.005em;
}

/* ----- Module 6 — Reflow ----- */
.reflow-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 0;
  border: 1px solid var(--rule);
}
.reflow-cell {
  background: var(--surface); padding: 32px;
  border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.reflow-cell:nth-child(2n) { border-right: 0; }
.reflow-cell:nth-last-child(-n+2) { border-bottom: 0; }
.reflow-cell .channel {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em;
  color: var(--jade); text-transform: uppercase; font-weight: 600; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.reflow-cell .channel::before {
  content: "↑"; font-family: var(--font-display); font-style: italic;
  font-size: 18px; color: var(--jade); line-height: 1;
}
.reflow-cell h4 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 26px; margin: 0 0 10px; letter-spacing: -.01em; line-height: 1.15; }
.reflow-cell .era-tag { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); letter-spacing: .04em; margin-bottom: 14px; }
.reflow-cell p { color: var(--ink-soft); font-size: 14.5px; margin: 0 0 12px; line-height: 1.65; }
.reflow-cell p em { color: var(--ink); font-style: italic; }
.reflow-actors {
  margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--hairline-strong);
  font-size: 13px; color: var(--ink-soft); line-height: 1.6;
}
.reflow-actors b { color: var(--ink); font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; display: block; margin-bottom: 6px; }

/* ----- Module 7 — Geography ----- */
.geo-shell { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.geo-svg-card { border: 1px solid var(--rule); background: var(--surface); padding: 36px; }
.geo-svg-card h3 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 26px; margin: 0 0 6px; letter-spacing: -.01em; }
.geo-svg-card .sub { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); letter-spacing: .12em; margin-bottom: 22px; text-transform: uppercase; }
.geo-svg { width: 100%; aspect-ratio: 1.6; }
.geo-side h3 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 30px; margin: 0 0 6px; letter-spacing: -.01em; }
.geo-side .sub { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); letter-spacing: .12em; margin-bottom: 22px; text-transform: uppercase; }
.geo-side p { color: var(--ink-soft); font-size: 16px; line-height: 1.7; margin: 0 0 16px; }
.geo-side p em { color: var(--ink); font-style: italic; }

/* ----- Module 8 — Comparative ----- */
.compare-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0;
  border: 1px solid var(--rule);
}
.compare-cell {
  background: var(--surface); padding: 30px;
  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(--ginkgo); text-transform: uppercase; font-weight: 600;
  margin-bottom: 12px;
}
.compare-cell h4 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 26px; margin: 0 0 14px; letter-spacing: -.01em; line-height: 1.1; }
.compare-cell .pattern {
  font-family: var(--font-display); font-style: italic; font-size: 17px;
  color: var(--ink); padding: 10px 0 10px 14px; border-left: 2px solid var(--ginkgo);
  margin: 14px 0; line-height: 1.4;
}
.compare-cell p { color: var(--ink-soft); font-size: 14px; margin: 0 0 12px; line-height: 1.65; }

/* ----- Module 9 — Guardrails ----- */
.guardrails {
  border: 1px solid var(--vermillion); 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(--vermillion);
}
.guardrails-head .seal {
  display: inline-block; width: 48px; height: 48px;
  background: var(--vermillion); color: var(--paper);
  font-family: var(--font-display); font-style: italic; font-size: 26px;
  display: grid; place-items: center; line-height: 1;
}
.guardrails-head h3 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 30px; margin: 0; letter-spacing: -.01em; }
.guardrails-head .sub { font-family: var(--font-mono); font-size: 11px; color: var(--vermillion); 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(--vermillion);
  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: 400; 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(--ginkgo); }
.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(--ginkgo); font-weight: 600; }
.msg.user .bubble strong { color: var(--jade); }
.msg .bubble .quoted {
  margin: 8px 0 6px; padding: 6px 0 6px 14px;
  border-left: 2px solid var(--ginkgo);
  font-family: var(--font-display); font-style: italic;
  font-size: 17px; line-height: 1.45; color: var(--ink-soft);
}
.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(--ginkgo); outline-offset: -1px; }
.historian-input input::placeholder { color: var(--ink-mute); font-style: italic; }

/* ----- Footer ----- */
.footer {
  background: var(--ink); color: #c5beb1;
  padding: 80px 0 40px;
}
html[data-theme="light"] .footer { background: var(--bg-deep); color: #4a443c; }
html[data-theme="light"] .footer a { color: #4a443c; }
html[data-theme="light"] .footer-bottom a { color: #4a443c; }
html[data-theme="light"] .footer-tag { color: #847a6a; }
html[data-theme="light"] .footer-bottom { color: #847a6a; border-top-color: #14110d20; }
.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(--ginkgo); 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: #c5beb1; border: 0; }
.footer a:hover { color: var(--ginkgo); }
.footer-brand {
  font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 36px;
  color: var(--bg); letter-spacing: -.01em; margin-bottom: 14px; line-height: 1;
}
html[data-theme="light"] .footer-brand { color: var(--ink); }
.footer-brand em { font-style: normal; color: var(--ginkgo); }
.footer-brand .arrow { color: var(--jade); font-style: italic; }
.footer-tag { color: #968d80; 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: #968d80; font-family: var(--font-mono);
  letter-spacing: .04em;
}
.footer-bottom a { color: #968d80; border: 0; }

/* ----- 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-grid { grid-template-columns: 1fr; gap: 30px; }
  .flow-map-svg { aspect-ratio: 0.7; max-height: 500px; }
  .section { padding: 70px 0; }
  .section-head { grid-template-columns: 1fr; gap: 20px; margin-bottom: 36px; }
  .frontier-grid { grid-template-columns: 1fr; }
  .recon-shell { grid-template-columns: 1fr; }
  .recon-cell:not(:last-child) { border-right: 0; border-bottom: 1px solid var(--rule); }
  .maritime-grid { grid-template-columns: 1fr 1fr; }
  .maritime-cell { border-right: 1px solid var(--rule) !important; border-bottom: 1px solid var(--rule) !important; }
  .maritime-cell:nth-child(2n) { border-right: 0 !important; }
  .folk-shell { grid-template-columns: 1fr; gap: 24px; }
  .reflow-grid { grid-template-columns: 1fr; }
  .reflow-cell { border-right: 0 !important; border-bottom: 1px solid var(--rule) !important; }
  .reflow-cell:last-child { border-bottom: 0 !important; }
  .geo-shell { grid-template-columns: 1fr; gap: 24px; }
  .compare-grid { grid-template-columns: 1fr; }
  .compare-cell { border-right: 0; border-bottom: 1px solid var(--rule); }
  .compare-cell:last-child { border-bottom: 0; }
  .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; }
  .wave-row { grid-template-columns: 80px 1fr; }
  .wave-row > div:nth-child(3), .wave-row > div:nth-child(4) { display: none; }
  .wave-row.head > div:nth-child(3), .wave-row.head > div:nth-child(4) { display: none; }
}
@media (max-width: 600px) {
  .maritime-grid { grid-template-columns: 1fr; }
  .maritime-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; }
