:root {
  color-scheme: light;
  --primary: #0065c0;
  --accent: #e87918;
  --text: #172033;
  --muted: #667085;
  --faint: #98a2b3;
  --background: #ffffff;
  --surface: #f8fafc;
  --border: #e4e7ec;
  --hover: rgba(0, 101, 192, 0.07);
  --shadow: rgba(16, 24, 40, 0.12);
  --content-width: 820px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --primary: #79b7ff;
  --accent: #ffb067;
  --text: #e6eaf0;
  --muted: #adb5c3;
  --faint: #7c8798;
  --background: #17191d;
  --surface: #202329;
  --border: #353a44;
  --hover: rgba(121, 183, 255, 0.1);
  --shadow: rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--text);
  background: var(--background);
  font-family: Lato, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  transition: color 180ms ease, background-color 180ms ease;
}

a {
  color: var(--primary);
  text-decoration: none;
  text-underline-offset: 0.18em;
  transition: color 160ms ease, background-color 160ms ease;
}

a:hover { color: var(--accent); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
p { margin: 0 0 1rem; }

.page-width {
  width: min(100% - 48px, var(--content-width));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 8px;
  padding: 8px 12px;
  color: #fff;
  background: var(--primary);
  border-radius: 5px;
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }
.site-header { border-bottom: 1px solid transparent; }

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  gap: 24px;
}

.site-name {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.site-name:hover { color: var(--primary); }

.nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.nav-links > a {
  position: relative;
  padding: 7px 10px;
  border-radius: 5px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 500;
}

.nav-links > a:hover { color: var(--accent); background: var(--hover); }
.nav-links > a[aria-current="page"] { color: var(--accent); font-weight: 700; }

.nav-links > a[aria-current="page"]::after {
  position: absolute;
  right: 10px;
  bottom: 2px;
  left: 10px;
  height: 2px;
  content: "";
  background: currentColor;
  border-radius: 999px;
}

.theme-toggle {
  display: grid;
  width: 36px;
  height: 36px;
  margin-left: 2px;
  padding: 0;
  place-items: center;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

.theme-toggle:hover { color: var(--accent); background: var(--hover); }
.theme-icon { font-size: 20px; line-height: 1; }
.homepage, .publications-page { padding-top: 42px; padding-bottom: 36px; }

.profile-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 176px;
  align-items: start;
  gap: 42px;
  margin-bottom: 48px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
}

.profile-copy h1, .page-intro h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.9rem, 4vw, 2.35rem);
  line-height: 1.16;
  letter-spacing: -0.025em;
}

.profile-copy h1 span {
  color: var(--muted);
  font-size: 0.72em;
  font-weight: 500;
  letter-spacing: 0;
}

.role {
  margin: 7px 0 21px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}

.profile-copy > p:not(.eyebrow):not(.role) { color: var(--text); }

.profile-links, .page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 9px;
  margin-top: 18px;
  color: var(--faint);
  font-size: 14px;
}

.profile-photo {
  display: block;
  width: 176px;
  height: 176px;
  object-fit: cover;
  object-position: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  box-shadow: 0 7px 22px var(--shadow);
}

.homepage-section, .publication-group { margin: 0 0 38px; }

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 15px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
}

.section-heading h2 {
  margin: 0;
  color: var(--text);
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
}

.section-link, .section-count { color: var(--muted); font-size: 13px; }
.section-link:hover { color: var(--accent); }
.news-list, .experience-list, .publication-list { margin: 0; padding: 0; list-style: none; }

.news-list li {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 8px;
}

.news-list time, .experience-list time {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.publication-list > li {
  position: relative;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 19px;
}

.publication-year {
  padding-top: 2px;
  color: var(--faint);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.publication-title {
  margin: 0 0 2px;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.38;
}

a.publication-title:hover { color: var(--primary); }

.publication-authors, .publication-meta {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.52;
}

.publication-authors strong { color: var(--text); font-weight: 700; }

.publication-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 10px;
  margin-top: 3px;
}

.venue { color: var(--faint); font-style: italic; }
.paper-link { color: var(--primary); font-size: 13px; font-style: normal; font-weight: 600; }
.paper-link::before { margin-right: 7px; color: var(--border); content: "·"; }

.status-badge {
  display: inline-block;
  margin-right: 7px;
  padding: 1px 6px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 0.12em;
}

.experience-list li {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 17px;
}

.experience-list div { display: grid; gap: 1px; }
.experience-list strong { color: var(--text); font-size: 15px; }
.experience-list span { color: var(--muted); font-size: 14px; }
.experience-list small { color: var(--faint); font-size: 12.5px; }
.page-intro { max-width: 650px; margin-bottom: 42px; }

.page-intro > p:not(.eyebrow) {
  max-width: 600px;
  margin-top: 12px;
  color: var(--muted);
}

.publications-page .publication-group { margin-bottom: 44px; }

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 26px;
  padding-bottom: 34px;
  color: var(--faint);
  border-top: 1px solid var(--border);
  font-size: 12.5px;
}

.site-footer p { margin: 0; }

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  color: #fff;
  background: var(--primary);
  border: 0;
  border-radius: 50%;
  box-shadow: 0 5px 16px var(--shadow);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  visibility: hidden;
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease, background-color 180ms ease;
}

.back-to-top.visible { opacity: 1; transform: translateY(0); visibility: visible; }
.back-to-top:hover { background: var(--accent); }

@media (max-width: 680px) {
  .page-width { width: min(100% - 32px, var(--content-width)); }
  .site-nav { align-items: flex-start; min-height: auto; padding-top: 14px; padding-bottom: 14px; }
  .site-name { padding-top: 7px; }
  .nav-links { flex-wrap: wrap; gap: 2px; }
  .nav-links > a { padding-inline: 7px; }
  .profile-section { grid-template-columns: 1fr; gap: 24px; }
  .profile-copy { order: 2; }
  .profile-photo { order: 1; width: 150px; height: 150px; }
  .homepage, .publications-page { padding-top: 28px; }
  .news-list li, .experience-list li { grid-template-columns: 78px minmax(0, 1fr); gap: 12px; }
  .publication-list > li { grid-template-columns: 44px minmax(0, 1fr); gap: 11px; }
  .site-footer { align-items: flex-start; flex-direction: column; gap: 5px; }
}

@media (max-width: 420px) {
  body { font-size: 15px; }
  .site-nav { display: block; }
  .site-name { display: inline-block; padding: 4px 0 8px; }
  .nav-links { justify-content: flex-start; }
  .publication-list > li { grid-template-columns: 1fr; gap: 2px; }
  .publication-year { padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}

@media print {
  .site-header, .back-to-top, .site-footer { display: none; }
  .page-width { width: 100%; }
  body { color: #000; background: #fff; }
}
