:root {
  color-scheme: light;
  --background: #fff;
  --text: #282828;
  --muted: #666;
  --link: #245aa0;
  --line: #e3e3e3;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #191b1e;
  --text: #e4e5e7;
  --muted: #b1b4ba;
  --link: #94bfff;
  --line: #383b40;
}

* { box-sizing: border-box; }

html { scroll-padding-top: 24px; }

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

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 5px;
}

p { margin: 0 0 16px; }
strong, b { font-weight: 600; }

.site-shell { max-width: 880px; margin: 0 auto; padding: 0 32px; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  padding-top: 28px;
  margin-bottom: 32px;
  font-size: 14px;
}

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

.theme-toggle {
  display: grid;
  place-items: center;
  margin-left: auto;
  padding: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: block; }
[data-theme="dark"] .theme-toggle .moon { display: none; }

.profile-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  align-items: center;
  gap: 14px 36px;
  margin-bottom: 28px;
}

h1 {
  font-size: 34px;
  line-height: 1.2;
  letter-spacing: -0.8px;
  font-weight: 600;
  margin: 0 0 10px;
}

.affiliation { margin: 0; color: var(--muted); font-size: 15px; }
.profile-details { grid-column: 1; }
.contact { margin: 0 0 12px; font-size: 14px; line-height: 1.7; color: var(--muted); }
.profile-links { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; }
.portrait { grid-column: 2; grid-row: 1 / span 2; width: 150px; height: 150px; object-fit: cover; border-radius: 4px; }
.bio { margin-bottom: 32px; }

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-bottom: 16px;
}

h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.3px; line-height: 1.3; margin: 0; }
.section-heading > a { font-size: 14px; }
.research-area { margin-bottom: 24px; }
.research-area h3 { display: inline; font-size: 16px; font-weight: 600; margin: 0; }
.area-description { display: inline; }

.paper-links { display: flex; flex-wrap: wrap; gap: 2px 0; list-style: none; padding: 0; margin: 6px 0 0; font-size: 14px; line-height: 1.9; }
.paper-links li { max-width: 100%; }
.paper-links li:not(:last-child)::after { content: "\00a0·\00a0"; color: var(--muted); white-space: nowrap; }
.paper-links .venue { font-size: 12px; color: var(--muted); white-space: nowrap; }

.page-title { margin-bottom: 12px; }
.page-intro { color: var(--muted); font-size: 14px; margin-bottom: 30px; }
.publication-group { margin-bottom: 34px; }
.publication-group > h2 { margin-bottom: 20px; }
.publication-year { font-size: 15px; font-weight: 600; margin: 26px 0 16px; color: var(--muted); }
.publication { margin-bottom: 24px; }
.publication h3 { font-size: 16px; line-height: 1.5; font-weight: 600; margin: 0 0 3px; }
.publication-authors { font-size: 14px; line-height: 1.6; margin-bottom: 3px; }
.publication-meta { font-size: 14px; color: var(--muted); margin: 0; }
.publication-meta .resource-link { margin-left: 12px; }

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 20px;
  border-top: 1px solid var(--line);
  margin-top: 40px;
  padding: 18px 0 28px;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 600px) {
  .site-shell { padding: 0 22px; }
  .site-nav { padding-top: 18px; margin-bottom: 24px; }
  .profile-header { grid-template-columns: minmax(0, 1fr) 94px; gap: 16px; align-items: start; }
  .portrait { grid-row: 1; width: 94px; height: 94px; margin-top: 3px; }
  .profile-details { grid-column: 1 / -1; }
  h1 { font-size: 29px; }
  .affiliation { font-size: 14px; }
  .contact { font-size: 14px; overflow-wrap: anywhere; }
  .profile-links { gap: 6px 14px; }
  .research-area { margin-bottom: 24px; }
}

@media (max-width: 380px) {
  .profile-header { grid-template-columns: minmax(0, 1fr) 76px; gap: 12px; }
  .portrait { width: 76px; height: 76px; }
  h1 { font-size: 26px; }
}

@media print {
  :root, :root[data-theme="dark"] { --background: #fff; --text: #222; --muted: #555; --link: #245aa0; --line: #ddd; }
  .site-nav, footer { display: none; }
  .site-shell { max-width: none; padding: 0; }
  .profile-header { margin-top: 20px; }
  .publication, .research-area { break-inside: avoid; }
}
