:root {
  --text: #2C2C2B;
  --muted: #7D7A75;
  --canvas: #FFFFFF;
  --soft: #F9F8F7;
  --border: #E6E5E3;
  --accent: #2783DE;
  --maxw: 760px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #FFFFFF;
    --muted: rgba(255,255,255,0.65);
    --canvas: #191919;
    --soft: #202020;
    --border: rgba(255,255,255,0.20);
    --accent: #5E9FE8;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* Header */

.masthead { padding: 48px 0 0; }

.masthead-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
}

.name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  line-height: 1.15;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 0;
}

.name .zh {
  font-size: 0.62em;
  color: var(--muted);
  margin-left: 8px;
  letter-spacing: 0.02em;
}

.masthead-contact {
  font-size: 14px;
  color: var(--muted);
}

.role {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
}

/* Navigation */

nav.menu {
  margin-top: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  font-size: 15px;
}

nav.menu a {
  color: var(--text);
  padding: 10px 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-bottom: 2px solid transparent;
}

nav.menu a:hover { text-decoration: none; border-bottom-color: var(--border); }
nav.menu a[aria-current="page"] { border-bottom-color: var(--accent); }

/* Sections */

main { padding: 40px 0 0; }

section { padding: 0 0 40px; }
section + section { border-top: 1px solid var(--border); padding-top: 32px; }

h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-weight: 400;
  margin: 0 0 16px;
}

h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 24px 0 4px;
}

h3:first-of-type { margin-top: 0; }

p { margin: 0 0 16px; }
p:last-child { margin-bottom: 0; }

.lead { font-size: 17px; }

.meta { color: var(--muted); font-size: 14px; margin: 0 0 8px; }

/* Bio row */

.bio {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.bio img {
  width: 160px;
  height: 160px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--soft);
  flex: 0 0 auto;
}

.bio-text { flex: 1 1 auto; min-width: 0; }

@media (max-width: 560px) {
  .bio { flex-direction: column; gap: 20px; }
  .bio img { width: 128px; height: 128px; }
  .name { font-size: 28px; }
  .masthead { padding-top: 32px; }
}

/* Lists */

ul.plain, ol.plain {
  margin: 0;
  padding: 0;
  list-style: none;
}

ul.plain > li, ol.plain > li {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

ul.plain > li:first-child, ol.plain > li:first-child { border-top: 0; padding-top: 0; }

.item-title { font-weight: 600; }
.item-note { color: var(--muted); font-size: 14px; }

ul.compact { margin: 0; padding-left: 20px; }
ul.compact li { margin-bottom: 6px; }

/* Callout for the work-in-progress entries */

.entry { padding: 16px 0; border-top: 1px solid var(--border); }
.entry:first-of-type { border-top: 0; padding-top: 0; }
.entry h3 { margin-top: 0; }
.entry p { margin-bottom: 8px; }

/* Course table */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

th, td {
  text-align: left;
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th { font-weight: 600; color: var(--muted); font-size: 14px; }
td.code { white-space: nowrap; color: var(--muted); }

/* Footer */

footer {
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding: 24px 0 64px;
  color: var(--muted);
  font-size: 14px;
}

footer p { margin: 0 0 4px; }

@media print {
  nav.menu, footer { display: none; }
  body { font-size: 11pt; color: #000; background: #fff; }
}
