:root {
  --ink: #172033;
  --muted: #536174;
  --soft: #eef3f8;
  --line: #d8e1ec;
  --panel: #ffffff;
  --accent: #1f5f9f;
  --accent-soft: #e7f0fa;
  --success: #2d7a55;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--soft);
  line-height: 1.58;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
}

.site-header {
  width: min(1180px, calc(100% - 48px));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
}

nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

nav a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 18px;
}

.language-switch {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.language-switch a {
  min-width: 64px;
  padding: 6px 10px;
  border-radius: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.language-switch a[aria-current="true"] {
  color: #ffffff;
  background: var(--accent);
}

.page-controls {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}

.page-controls a,
.page-controls button {
  appearance: none;
  padding: 6px 8px;
  border: 0;
  border-radius: 4px;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.page-controls a:hover,
.page-controls button:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

main {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 72px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.96fr) minmax(360px, 0.78fr);
  gap: 44px;
  align-items: center;
  min-height: 430px;
  padding: 24px 0 40px;
  border-bottom: 1px solid var(--line);
}

.eyebrow,
.label {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(34px, 3.8vw, 44px);
  line-height: 1.12;
  letter-spacing: 0;
  font-weight: 760;
}

.brand-title {
  max-width: none;
  font-size: 66px;
  line-height: 1.06;
}

.brand-tagline {
  margin: 10px 0 0;
  color: var(--ink);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.35;
  white-space: nowrap;
}

.lead {
  max-width: 640px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 6px;
  font-weight: 800;
  text-decoration: none;
}

.primary-action {
  color: #ffffff;
  background: var(--accent);
}

.secondary-action {
  color: var(--accent);
  background: var(--accent-soft);
}

.trace-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(23, 32, 51, 0.07);
  overflow: hidden;
}

.trace-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-weight: 800;
}

.status-dot {
  color: var(--success);
  font-size: 13px;
  font-weight: 800;
}

.flow {
  padding: 10px 20px 20px;
}

.flow-item {
  position: relative;
  padding: 18px 0 18px 46px;
  border-bottom: 1px solid var(--line);
}

.flow-item.final {
  border-bottom: 0;
}

.step {
  position: absolute;
  left: 0;
  top: 18px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.flow strong {
  display: block;
  font-size: 16px;
}

.flow p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.research-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 28px;
}

article,
.section-panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px;
}

.l0-entry {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  column-gap: 28px;
  align-items: start;
  border-left: 5px solid var(--accent);
}

.l0-entry h2 {
  max-width: 700px;
  font-size: clamp(23px, 2.2vw, 28px);
  line-height: 1.22;
}

.l0-entry p {
  max-width: 720px;
}

.l0-entry .status {
  grid-column: 1;
}

.mini-actions {
  grid-column: 2;
  grid-row: 1 / span 3;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.mini-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 6px;
  color: #ffffff;
  background: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.mini-actions a + a {
  color: var(--accent);
  background: var(--accent-soft);
}

.video-note {
  grid-column: 2;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.linked-panel {
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.linked-panel:hover {
  border-color: rgba(31, 95, 159, 0.44);
  box-shadow: 0 12px 28px rgba(23, 32, 51, 0.08);
  transform: translateY(-2px);
}

.panel-link {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  text-decoration: none;
}

h2 {
  margin: 0 0 12px;
  font-size: 24px;
  line-height: 1.16;
  letter-spacing: 0;
  font-weight: 760;
}

p {
  margin: 0 0 12px;
}

.status {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.section-panel {
  margin-top: 18px;
}

.roadmap {
  display: grid;
  grid-template-columns: minmax(260px, 0.74fr) minmax(0, 1.26fr);
  gap: 24px;
  align-items: start;
}

ol {
  margin: 0;
  padding-left: 22px;
}

.boundary {
  border-left: 5px solid var(--accent);
}

.detail-hero {
  max-width: 880px;
  padding: 58px 0 40px;
  border-bottom: 1px solid var(--line);
}

.split-detail {
  max-width: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.48fr);
  gap: 28px;
  align-items: end;
}

.detail-hero h1 {
  font-size: clamp(34px, 4vw, 48px);
  line-height: 1.08;
}

.publication-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 16px 34px rgba(23, 32, 51, 0.07);
}

.publication-card p {
  color: var(--muted);
}

.publication-card p:last-child {
  margin-bottom: 0;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.62fr);
  gap: 18px;
  margin-top: 28px;
}

.detail-layout > .section-panel:first-child {
  grid-column: 1 / -1;
}

.detail-layout.compact > .section-panel:first-child {
  grid-column: auto;
}

.clean-list {
  margin: 0;
  padding-left: 20px;
}

.clean-list li + li {
  margin-top: 8px;
}

.theorem-strip,
.book-structure {
  margin-top: 18px;
}

.thesis-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.thesis-grid h3 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.22;
}

.thesis-grid p {
  color: var(--muted);
  font-size: 14px;
}

.structure-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 0;
  list-style: none;
  counter-reset: structure;
}

.structure-list li {
  min-height: 170px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  counter-increment: structure;
}

.structure-list li::before {
  content: "0" counter(structure);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-bottom: 12px;
  border-radius: 50%;
  color: #ffffff;
  background: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.structure-list strong {
  display: block;
  margin-bottom: 6px;
}

.toc-preview {
  margin-top: 18px;
}

.toc-preview details {
  border-top: 1px solid var(--line);
  padding: 14px 0;
}

.toc-preview details:first-of-type {
  margin-top: 14px;
}

.toc-preview summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 850;
}

.toc-list {
  margin: 12px 0 0;
  padding-left: 22px;
  color: var(--muted);
}

.toc-list li + li {
  margin-top: 6px;
}

.toc-note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.48;
}

.link-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

@media (max-width: 900px) {
  .site-header {
    width: min(100% - 28px, 1180px);
  }

  nav {
    display: none;
  }

  .header-tools {
    gap: 8px;
  }

  .language-switch a {
    min-width: 54px;
    padding: 6px 8px;
  }

  main {
    width: min(100% - 28px, 1180px);
    padding: 16px 0 42px;
  }

  .hero,
  .roadmap {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    gap: 24px;
    padding-top: 18px;
  }

  h1 {
    font-size: 34px;
  }

  .brand-title {
    font-size: 48px;
  }

  .brand-tagline {
    font-size: 13px;
  }

  .lead {
    font-size: 16px;
  }

  .research-grid {
    grid-template-columns: 1fr;
  }

  .l0-entry {
    grid-template-columns: 1fr;
  }

  .l0-entry .status,
  .mini-actions,
  .video-note {
    grid-column: auto;
    grid-row: auto;
  }

  .split-detail,
  .thesis-grid,
  .structure-list {
    grid-template-columns: 1fr;
  }

  .structure-list li {
    min-height: auto;
  }

  .detail-hero {
    padding: 32px 0 34px;
  }

  .detail-layout,
  .link-strip {
    grid-template-columns: 1fr;
    display: grid;
  }
}

/* Personal introduction and longform */
.about-section {
  display: grid;
  grid-template-columns: minmax(240px, 0.62fr) minmax(0, 1.38fr);
  gap: 36px;
  padding: 52px 0;
  border-bottom: 1px solid var(--line);
}

.about-heading h2 {
  max-width: 360px;
  font-size: 30px;
  line-height: 1.18;
}

.about-copy {
  max-width: 760px;
}

.about-copy p {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.78;
}

.story-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 8px;
  padding: 0 16px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.story-link:hover {
  color: #ffffff;
  background: var(--accent);
}

.story-page {
  width: min(100% - 48px, 1180px);
}

.story-hero {
  max-width: 860px;
  padding: 58px 0 36px;
  border-bottom: 1px solid var(--line);
}

.story-hero h1 {
  max-width: 760px;
  font-size: clamp(34px, 4.2vw, 48px);
  line-height: 1.08;
}

.story-intro {
  margin-top: 22px;
  color: var(--muted);
  font-size: 18px;
}

.longform {
  max-width: 780px;
  margin: 0 auto;
  padding: 54px 0 80px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.longform section + section {
  margin-top: 52px;
  padding-top: 48px;
  border-top: 1px solid var(--line);
}

.longform h2 {
  margin-bottom: 22px;
  font-size: 30px;
  line-height: 1.22;
}

.longform h3 {
  margin: 34px 0 14px;
  font-size: 21px;
}

.longform p {
  margin-bottom: 18px;
  font-family: "Noto Serif SC", "Songti SC", SimSun, serif;
  font-size: 18px;
  line-height: 1.95;
}

.longform blockquote {
  margin: 28px 0;
  padding: 18px 22px;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
}

.longform blockquote p {
  margin: 0;
  font-family: inherit;
  font-weight: 800;
}

.question-lines {
  margin: 26px 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.question-lines p {
  margin: 0;
  font-family: inherit;
  font-weight: 800;
}

.question-lines p + p {
  margin-top: 6px;
}

@media (max-width: 900px) {
  .about-section {
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 42px 0;
  }

  .about-heading h2 {
    font-size: 27px;
  }

  .about-copy p {
    font-size: 16px;
  }

  .story-page {
    width: min(100% - 28px, 1180px);
  }

  .story-hero {
    padding: 38px 0 28px;
  }

  .story-hero h1 {
    font-size: 34px;
  }

  .longform {
    padding: 36px 0 56px;
  }

  .longform section + section {
    margin-top: 38px;
    padding-top: 36px;
  }

  .longform h2 {
    font-size: 26px;
  }

  .longform p {
    font-size: 17px;
    line-height: 1.88;
  }
}
