* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: #fafafa;
  color: #252525;
  font-family: Georgia, "Times New Roman", "Noto Serif SC", "Songti SC", serif;
  font-size: 17px;
  line-height: 1.78;
}

.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 42px 22px 56px;
}

.site-header {
  display: flex;
  gap: 24px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 2px solid #d9d9d9;
  margin-bottom: 28px;
}

.profile-photo {
  width: 168px;
  height: 210px;
  object-fit: cover;
  border: 1px solid #d2d2d2;
}

.identity h1 {
  margin: 0;
  color: #181818;
  font-size: 2rem;
  font-weight: 400;
  line-height: 1.25;
}

.identity p {
  margin: 6px 0 0;
  color: #5f5f5f;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 16px;
  font-size: 0.94rem;
}

a {
  color: #215ca8;
  text-decoration: none;
}

a:hover,
a:focus {
  text-decoration: underline;
}

section {
  margin: 0 0 32px;
}

h2 {
  margin: 0 0 14px;
  padding-bottom: 5px;
  border-bottom: 1px solid #d8d8d8;
  color: #3e3e3e;
  font-size: 1.22rem;
  font-weight: 600;
}

h3 {
  margin: 22px 0 8px;
  color: #2f2f2f;
  font-size: 1.05rem;
  line-height: 1.45;
}

p {
  margin: 0 0 12px;
}

ul,
ol {
  margin: 0;
  padding-left: 1.35rem;
}

li {
  margin: 0 0 9px;
}

.muted {
  color: #666;
}

.compact-list li {
  margin-bottom: 6px;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.46fr);
  gap: 24px;
  align-items: start;
}

.cv-line {
  margin-bottom: 12px;
}

.cv-line strong {
  display: block;
}

.cv-line span {
  display: block;
  color: #666;
  font-size: 0.95rem;
}

.tree {
  margin-top: 8px;
}

.tree details {
  margin: 8px 0 8px 0;
  padding-left: 16px;
  border-left: 1px solid #ddd;
}

.tree summary {
  cursor: pointer;
  color: #1f1f1f;
  font-weight: 600;
}

.tree summary:hover {
  color: #215ca8;
}

.tree ul {
  margin-top: 7px;
}

.publication {
  margin-bottom: 16px;
}

.publication-title {
  font-weight: 700;
}

.publication-authors,
.publication-venue {
  color: #595959;
}

.publication-venue {
  font-style: italic;
}

.author-self {
  color: #b85b00;
  font-weight: 700;
}

.project-note {
  margin-top: -4px;
  color: #555;
}

.article-meta {
  margin: -4px 0 18px;
  color: #666;
  font-size: 0.94rem;
}

.placeholder {
  color: #888;
}

.step-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 22px;
}

.step-card {
  padding: 14px 15px;
  border: 1px solid #d8d8d8;
  background: #fff;
}

.step-card strong,
.step-card span {
  display: block;
}

.step-card span {
  margin-top: 3px;
  color: #666;
  font-size: 0.9rem;
  line-height: 1.55;
}

.derivation-note {
  margin: 18px 0;
  padding: 12px 15px;
  border-left: 3px solid #215ca8;
  background: #f3f6fa;
}

.equation-scroll {
  overflow-x: auto;
  margin: 10px 0 16px;
  padding: 2px 0;
}

.next-panel {
  padding: 15px 17px;
  border: 1px solid #d8d8d8;
  background: #fff;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr));
  gap: 22px;
}

figure {
  margin: 0;
}

video,
img.media {
  display: block;
  width: 100%;
  height: auto;
  background: #050505;
  border: 1px solid #d5d5d5;
}

video {
  aspect-ratio: 16 / 9;
  object-fit: contain;
}

figcaption {
  margin-top: 7px;
  color: #4d4d4d;
  font-size: 0.95rem;
  line-height: 1.6;
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 20px;
  margin: 12px 0 18px;
}

.comparison-grid figcaption {
  margin: 0 0 7px;
  color: #333;
  font-weight: 700;
  text-align: center;
}

pre {
  overflow-x: auto;
  padding: 12px 14px;
  background: #f2f2f2;
  border: 1px solid #d8d8d8;
  font-family: Menlo, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.55;
}

.math-block {
  background: #fff;
}

.table-wrap {
  overflow-x: auto;
  margin: 12px 0 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
  line-height: 1.5;
}

th,
td {
  padding: 7px 9px;
  border: 1px solid #d8d8d8;
  vertical-align: top;
}

th {
  background: #f1f1f1;
  font-weight: 700;
}

.footer {
  margin-top: 40px;
  padding-top: 14px;
  border-top: 1px solid #ddd;
  color: #888;
  font-size: 0.88rem;
}

/* Homepage: academic profile and project index */
.home-page .page {
  max-width: 1040px;
}

.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(245px, 1fr);
  gap: 52px;
  align-items: start;
}

.home-primary,
.home-sidebar {
  min-width: 0;
}

.project-index {
  border-top: 1px solid #d8d8d8;
}

.project-entry {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 18px 0 17px;
  border-bottom: 1px solid #e1e1e1;
}

.project-number {
  padding-top: 3px;
  color: #999;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.project-entry h3 {
  margin: 0 0 4px;
  color: #252525;
  font-size: 1.04rem;
}

.project-entry p {
  margin: 0;
  color: #555;
  font-size: 0.94rem;
  line-height: 1.65;
}

.project-entry .project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 8px;
  margin-top: 5px;
  color: #aaa;
  font-size: 0.9rem;
}

.home-sidebar {
  padding-left: 24px;
  border-left: 1px solid #ddd;
}

.sidebar-section {
  margin-bottom: 28px;
}

.sidebar-section h2 {
  font-size: 1.08rem;
}

.education-entry {
  margin-bottom: 17px;
}

.education-entry:last-child {
  margin-bottom: 0;
}

.education-time {
  display: block;
  margin-bottom: 1px;
  color: #888;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.education-entry strong {
  display: block;
  color: #333;
  font-size: 0.94rem;
  line-height: 1.45;
}

.education-entry p {
  margin: 2px 0 0;
  color: #666;
  font-size: 0.84rem;
  line-height: 1.55;
}

.research-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 8px;
  padding: 0;
  list-style: none;
}

.research-tags li {
  margin: 0;
  padding: 2px 8px;
  border: 1px solid #d8d8d8;
  color: #555;
  font-size: 0.8rem;
  line-height: 1.55;
}

.publication-preview {
  padding-left: 1.15rem;
}

.publication-preview li {
  margin-bottom: 15px;
  padding-left: 2px;
  font-size: 0.84rem;
  line-height: 1.52;
}

.publication-preview .publication-title,
.publication-preview .publication-venue {
  display: block;
}

.publication-preview .publication-title {
  font-weight: 600;
}

.publication-preview .publication-venue {
  margin-top: 3px;
  font-size: 0.8rem;
}

.sidebar-link {
  margin: 2px 0 0;
  font-size: 0.86rem;
}

@media (max-width: 820px) {
  .home-layout {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .home-sidebar {
    padding-left: 0;
    border-left: 0;
  }
}

@media (max-width: 700px) {
  .page {
    padding-top: 28px;
  }

  .site-header,
  .two-column {
    grid-template-columns: 1fr;
  }

  .site-header {
    align-items: flex-start;
  }

  .profile-photo {
    width: 132px;
    height: 165px;
  }

  .nav {
    justify-content: flex-start;
  }

  .step-grid {
    grid-template-columns: 1fr;
  }

  .project-entry {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .research-tags {
    gap: 6px;
  }
}
