/* ---------- Design tokens ---------- */
:root {
  --serif: "Source Serif 4", Charter, "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  --ink: #1a1a1a;
  --ink-muted: #555;
  --ink-faint: #888;
  --rule: #e3e3e0;
  --bg: #fdfcf8;
  --accent: #7a2e2e;
  --accent-hover: #5a1f1f;

  --page-max: 1180px;
  --sidebar-w: 260px;
  --gap: 64px;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "kern", "liga", "onum";
}

img {
  max-width: 100%;
  height: auto;
}

/* ---------- Links ---------- */
a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
  border-bottom-color: var(--accent-hover);
}

/* ---------- Top site header ---------- */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: rgba(253, 252, 248, 0.96);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(180%) blur(10px);
}

.site-header-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 18px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.site-name {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  border-bottom: none;
  white-space: nowrap;
}

.site-name:hover {
  color: var(--accent);
  border-bottom: none;
}

/* ---------- Top nav ---------- */
.page-nav {
  font-family: var(--sans);
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 26px;
  flex-wrap: wrap;
}

.page-nav a {
  color: var(--ink-muted);
  border-bottom: none;
  padding: 6px 0;
  position: relative;
  white-space: nowrap;
}

.page-nav a:hover {
  color: var(--accent);
  border-bottom: none;
}

.page-nav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
}

.page-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -19px;
  height: 2px;
  background: var(--accent);
}

/* ---------- Page grid ---------- */
.page {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 56px 36px 96px;

  display: grid;
  grid-template-columns: minmax(220px, var(--sidebar-w)) minmax(0, 1fr);
  gap: var(--gap);
  align-items: start;
}

.page--no-sidebar {
  display: block;
  max-width: 900px;
}

.content {
  min-width: 0;
  width: 100%;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: 96px;
  align-self: start;
  min-width: 0;
}

.headshot {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  object-fit: cover;
  background: #eee;
  display: block;
  margin: 0 0 22px;
}

.sidebar-name {
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0 0 8px;
}

.name-zh {
  font-family: "Kaiti SC", "STKaiti", "Kaiti TC", serif;
  font-size: 0.84em;
  font-weight: 600;
  letter-spacing: 0;
  margin-left: 0.15em;
  vertical-align: 0.06em;
}

.sidebar-institution {
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--ink);
  font-weight: 500;
  margin: 0 0 14px;
  line-height: 1.5;
}

.sidebar-meta {
  list-style: none;
  padding: 0;
  margin: 0;
  font-family: var(--sans);
  font-size: 0.95rem;
}

.sidebar-meta li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  color: var(--ink-muted);
  line-height: 1.4;
}

.sidebar-meta a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-muted);
  border-bottom: none;
}

.sidebar-meta a:hover {
  color: var(--accent);
  border-bottom: none;
}

.sidebar-meta .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--ink-faint);
}

.sidebar-meta a:hover .icon {
  color: var(--accent);
}

/* ---------- Content sections ---------- */
.content section {
  margin-bottom: 56px;
  scroll-margin-top: 96px;
}

.content section:last-child {
  margin-bottom: 0;
}

/* ---------- Page intro ---------- */
.intro-block {
  margin: 0 0 40px;
}

.intro-role {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 4px;
  line-height: 1.3;
}

.intro-dept {
  font-family: var(--sans);
  font-size: 0.98rem;
  color: var(--ink-muted);
  margin: 0;
  line-height: 1.5;
}

/* ---------- Headings ---------- */
h2 {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  margin: 0 0 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}

h3.subsection {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  margin: 32px 0 16px;
}

p {
  margin: 0 0 14px;
}

section p {
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

section p:last-child {
  margin-bottom: 0;
}

em {
  color: var(--ink);
}

/* ---------- Research interests list ---------- */
.research-list {
  font-family: var(--sans);
  font-size: 0.97rem;
  color: var(--ink-muted);
  padding-left: 1.2em;
  margin: 0;
  line-height: 1.7;
}

.research-list li {
  margin-bottom: 4px;
}

/* ---------- Papers ---------- */
.paper {
  margin: 0 0 30px;
}

.paper:last-child {
  margin-bottom: 0;
}

.paper-title {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 4px;
  line-height: 1.35;
}

.paper-meta {
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--ink-muted);
  margin: 0 0 8px;
}

.paper-meta .sep {
  color: var(--ink-faint);
  margin: 0 6px;
}

.paper-meta .status {
  font-style: italic;
}

.paper-abstract {
  font-size: 0.97rem;
  color: var(--ink-muted);
  line-height: 1.6;
  margin: 0;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

.paper-abstract p {
  margin: 0;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

.paper-abstract em {
  font-style: normal;
  font-weight: 600;
  color: var(--ink);
}

/* ---------- Lists ---------- */
.wip-list {
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--ink-muted);
  padding-left: 1.2em;
  margin: 0;
}

.wip-list li {
  margin-bottom: 8px;
  line-height: 1.55;
}

/* ---------- Section intro callout ---------- */
.section-intro {
  font-size: 0.95rem;
  color: var(--ink-muted);
  margin: 0 0 24px;
  padding: 10px 14px;
  background: rgba(122, 46, 46, 0.04);
  border-left: 2px solid var(--accent);
  border-radius: 0 3px 3px 0;
}

/* ---------- News list ---------- */
.news-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.97rem;
}

.news-list li {
  display: flex;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  line-height: 1.5;
}

.news-list li:last-child {
  border-bottom: none;
}

.news-date {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex: 0 0 88px;
  padding-top: 3px;
}

/* ---------- Talks / teaching ---------- */
.talk-list,
.teaching-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.talk,
.course {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 2px 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
}

.talk:last-child,
.course:last-child {
  border-bottom: none;
}

.talk-type,
.course-type {
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  grid-row: 1;
  grid-column: 1;
  padding-top: 4px;
}

.talk-title,
.course-title {
  font-family: var(--serif);
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--ink);
  grid-row: 1;
  grid-column: 2;
  line-height: 1.4;
}

.talk-meta,
.course-meta {
  font-family: var(--sans);
  font-size: 0.88rem;
  color: var(--ink-muted);
  grid-row: 2;
  grid-column: 2;
}

/* ---------- CV ---------- */
.cv-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.cv-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
}

.cv-item:last-child {
  border-bottom: none;
}

.cv-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.cv-title {
  font-family: var(--serif);
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
}

.cv-date {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cv-detail {
  font-family: var(--sans);
  font-size: 0.92rem;
  color: var(--ink-muted);
  margin-top: 2px;
  line-height: 1.55;
}

/* ---------- Footer ---------- */
footer {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 24px 36px 40px;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--ink-faint);
  text-align: center;
}

footer p {
  margin: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .site-header-inner {
    flex-direction: column;
    gap: 12px;
    padding: 14px 22px;
    align-items: flex-start;
  }

  .page-nav {
    justify-content: flex-start;
    gap: 18px;
  }

  .page-nav a[aria-current="page"]::after {
    display: none;
  }

  .page-nav a[aria-current="page"] {
    color: var(--accent);
  }

  .page {
    grid-template-columns: 1fr;
    gap: 36px;
    padding: 36px 22px 64px;
  }

  .sidebar {
    position: static;
    text-align: center;
  }

  .headshot {
    max-width: 160px;
    margin: 0 auto 16px;
  }

  .sidebar-name {
    font-size: 1.4rem;
  }

  .sidebar-meta li,
  .sidebar-meta a {
    justify-content: center;
  }
}

@media (max-width: 600px) {
  body {
    font-size: 17px;
  }

  .site-header-inner {
    padding: 14px 18px;
  }

  .page {
    padding: 30px 18px 56px;
  }

  .page-nav {
    gap: 14px;
    font-size: 0.88rem;
  }

  .news-list li {
    display: block;
  }

  .news-date {
    display: block;
    margin-bottom: 2px;
  }

  .talk,
  .course {
    grid-template-columns: 1fr;
  }

  .talk-type,
  .course-type,
  .talk-title,
  .course-title,
  .talk-meta,
  .course-meta {
    grid-column: 1;
  }

  .talk-type,
  .course-type {
    grid-row: auto;
    padding-top: 0;
    margin-bottom: 2px;
  }

  .talk-title,
  .course-title,
  .talk-meta,
  .course-meta {
    grid-row: auto;
  }

  .cv-line {
    display: block;
  }

  .cv-date {
    display: block;
    margin-top: 2px;
  }

  footer {
    padding: 20px 22px 32px;
  }
}
