:root {
  --bg: #ffffff;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e8e8e8;
  --accent: #1e3a8a;
  --accent-soft: #f3f4f6;
  --max: 720px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

/* ----- Top nav ----- */
header.site {
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
}
header.site .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  flex-shrink: 0;
}
nav.primary {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  justify-content: center;
}
nav.primary a {
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
}
nav.primary a:hover,
nav.primary a.active { color: var(--accent); }
nav.primary a.active { font-weight: 500; }
.lang-switch {
  display: flex;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  flex-shrink: 0;
}
.lang-switch button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font: inherit;
  padding: 4px 8px;
  border-radius: 4px;
}
.lang-switch button.active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 500;
}

/* ----- Hero (Home) ----- */
section.hero {
  padding: 96px 0 64px;
}
.hero-layout {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 40px;
  align-items: start;
}
.hero-portrait {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--accent-soft);
  margin-top: 4px;
}
.hero h1 {
  font-size: 32px;
  line-height: 1.3;
  letter-spacing: -0.015em;
  font-weight: 500;
  margin: 0 0 24px;
  max-width: 600px;
}
.hero .sub {
  color: var(--muted);
  font-size: 17px;
  max-width: 580px;
  margin: 0;
}
.hero .meta {
  margin-top: 32px;
  font-size: 14px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.hero .meta span::before {
  content: "·";
  margin-right: 16px;
  color: var(--line);
}
.hero .meta span:first-child::before { content: ""; margin-right: 0; }
.hero .meta a {
  color: inherit;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.hero .meta a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.hero .focus {
  margin-top: 28px;
  font-size: 15px;
  color: var(--muted);
  max-width: 580px;
}
.hero .focus a {
  color: inherit;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.hero .focus a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.track .body p a {
  color: inherit;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.track .body p a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ----- Featured project (Home) ----- */
section.featured {
  padding: 56px 0;
  border-top: 1px solid var(--line);
}
.featured-card {
  background: var(--accent-soft);
  padding: 28px 32px;
  border-radius: 6px;
}
.featured-card .label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 12px;
}
.featured-card h2 {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--ink);
}
.featured-card h2 a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.featured-card h2 a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.featured-card p {
  margin: 0 0 16px;
  color: var(--ink);
  font-size: 16px;
  max-width: 560px;
}
.featured-card .links {
  font-size: 15px;
  margin: 0 0 20px;
}
.featured-card .links a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  margin-right: 18px;
}
.featured-card .links a:hover { border-bottom-color: var(--accent); }
.featured-shot {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--bg);
}

/* ----- Project screenshots ----- */
.project-shot {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin-top: 16px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--bg);
}
.dissertation-cover {
  display: block;
  width: 100%;
  max-width: 420px;
  height: auto;
  margin: 8px 0 20px;
  border-radius: 4px;
}
.project-title a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.project-title a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ----- Inner page header ----- */
section.page-header {
  padding: 72px 0 40px;
}
.page-header h1 {
  font-size: 32px;
  line-height: 1.3;
  letter-spacing: -0.015em;
  font-weight: 500;
  margin: 0 0 12px;
}
.page-header .lede {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  max-width: 580px;
}

/* ----- Three tracks ----- */
section.tracks,
section.content,
section.writing {
  padding: 64px 0;
  border-top: 1px solid var(--line);
}
section.content:first-of-type,
section.page-header + section.content {
  border-top: none;
  padding-top: 0;
}
.tracks h2,
section h2,
.content h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 500;
  color: var(--muted);
  margin: 0 0 32px;
}
.track-list {
  display: grid;
  gap: 32px;
}
.track {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line);
}
.track:last-child { border-bottom: none; padding-bottom: 0; }
.track .label {
  font-size: 14px;
  color: var(--muted);
  padding-top: 4px;
}
.track .body h3 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.track .body h3 a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.track .body h3 a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.track .body p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

/* ----- Prose (inner pages) ----- */
.prose p {
  margin: 0 0 1.25em;
  color: var(--ink);
  max-width: 640px;
}
.prose p:last-child { margin-bottom: 0; }
.prose .muted { color: var(--muted); }
.prose ul {
  margin: 0 0 1.5em;
  padding-left: 1.2em;
  color: var(--muted);
  max-width: 640px;
}
.prose ul li { margin-bottom: 0.55em; }
.prose ul li:last-child { margin-bottom: 0; }
.prose a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.prose a:hover { border-bottom-color: var(--accent); }
.content-block {
  margin-bottom: 48px;
}
.content-block:last-child { margin-bottom: 0; }
.content-block h2 { margin-bottom: 20px; }
.stage {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 10px;
  font-weight: 500;
}
.project-title {
  margin: 12px 0 8px;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--ink);
}
body.zh .project-title { letter-spacing: 0; }

/* ----- Writing list ----- */
.writing-list {
  display: grid;
  gap: 20px;
}
.post {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 24px;
  align-items: baseline;
}
.post .date {
  font-size: 14px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.post a {
  color: var(--ink);
  text-decoration: none;
  font-size: 17px;
  border-bottom: 1px solid transparent;
}
.post a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.post .venue {
  color: var(--muted);
  font-size: 14px;
  margin-left: 6px;
}
.post .note {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  color: var(--muted);
}
.more-link {
  margin-top: 28px;
  font-size: 15px;
}
.more-link a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.more-link a:hover { border-bottom-color: var(--accent); }

/* ----- About ----- */
.about-layout {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 40px;
  align-items: start;
}
.about-portrait {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--accent-soft);
}
.about-meta {
  margin-top: 28px;
  font-size: 15px;
  color: var(--muted);
}
.about-meta dt {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 6px;
  font-weight: 500;
}
.about-meta dd {
  margin: 0 0 20px;
  color: var(--ink);
}
.about-meta dd:last-child { margin-bottom: 0; }
.about-meta a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.about-meta a:hover { border-bottom-color: var(--accent); }

/* ----- Footer ----- */
footer.site {
  padding: 48px 0 64px;
  border-top: 1px solid var(--line);
  margin-top: 48px;
}
footer.site .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 14px;
  color: var(--muted);
}
footer.site a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 18px;
}
footer.site a:first-child { margin-left: 0; }
footer.site a:hover { color: var(--accent); }

/* ----- ZH language adjustments ----- */
body.zh {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
}
body.zh .hero h1,
body.zh .page-header h1,
body.zh .featured-card h2 { letter-spacing: 0; }

/* Hide language-specific content */
body.en .zh-only,
body.zh .en-only { display: none; }

/* Responsive */
@media (max-width: 700px) {
  header.site .row {
    flex-wrap: wrap;
  }
  nav.primary {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    gap: 14px 18px;
    padding-top: 4px;
  }
  nav.primary a { font-size: 14px; }
}
@media (max-width: 600px) {
  .hero h1,
  .page-header h1 { font-size: 26px; }
  .hero-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .hero-portrait {
    width: 112px;
    height: 112px;
  }
  .featured-card { padding: 24px; }
  .featured-card h2 { font-size: 20px; }
  .track { grid-template-columns: 1fr; gap: 8px; }
  .track .label { padding-top: 0; }
  .post { grid-template-columns: 1fr; gap: 4px; }
  .about-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .about-portrait {
    width: 120px;
    height: 120px;
  }
}
