:root {
  color-scheme: light;
  --bg: #ffffff;
  --panel: #f7f7f7;
  --text: #222222;
  --muted: #555555;
  --border: #dddddd;
  --link: #23527c;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101214;
  --panel: #15181b;
  --text: #e8eaed;
  --muted: #a8b0ba;
  --border: #30363d;
  --link: #8ab4f8;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  transition: background-color 180ms ease;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.58;
  overflow-x: hidden;
  transition: background-color 180ms ease, color 180ms ease;
}

a {
  color: var(--link);
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: color 180ms ease;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  transition: background-color 180ms ease, border-color 180ms ease;
}

.header-inner {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.menu-toggle {
  display: none;
}

.theme-toggle {
  appearance: none;
  position: relative;
  min-width: 58px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  background: color-mix(in srgb, var(--panel) 88%, var(--border));
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--muted);
}

main {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 20px 42px;
}

section {
  margin-top: 28px;
}

h1 {
  margin: 0 0 10px;
  font-size: 2rem;
  line-height: 1.2;
  font-weight: 650;
}

h1 span {
  color: var(--muted);
  font-size: 0.7em;
  font-weight: 500;
}

h2 {
  margin: 28px 0 8px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--border);
  font-size: 1.35rem;
  font-weight: 650;
  transition: border-color 180ms ease;
}

p {
  margin: 0 0 12px;
  overflow-wrap: anywhere;
}

ul {
  margin: 8px 0 0 22px;
  padding: 0;
}

li {
  margin-bottom: 8px;
}

.profile {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  margin-top: 0;
}

.portrait {
  width: 150px;
  height: 200px;
  object-fit: cover;
  border: 1px solid var(--border);
  transition: border-color 180ms ease;
}

.links a {
  margin-right: 6px;
}

.publications li {
  margin-bottom: 18px;
}

.paper-title {
  font-weight: 650;
}

.paper-links {
  margin-top: 2px;
}

footer {
  max-width: 920px;
  margin: 0 auto;
  padding: 16px 20px 34px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
  transition: border-color 180ms ease, color 180ms ease;
}

@media (max-width: 640px) {
  .header-inner {
    align-items: center;
    display: grid;
    grid-template-columns: auto auto;
    justify-content: start;
    gap: 12px;
    position: relative;
  }

  .menu-toggle {
    appearance: none;
    display: inline-grid;
    grid-column: 1;
    grid-row: 1;
    gap: 4px;
    width: 34px;
    height: 30px;
    align-content: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg);
    cursor: pointer;
    transition: background-color 180ms ease, border-color 180ms ease;
  }

  .menu-toggle span {
    display: block;
    width: 14px;
    height: 1.5px;
    border-radius: 999px;
    background: var(--text);
    transition: background-color 180ms ease, opacity 180ms ease, transform 180ms ease;
  }

  .nav-open .menu-toggle span:nth-child(1) {
    transform: translateY(5.5px) rotate(45deg);
  }

  .nav-open .menu-toggle span:nth-child(2) {
    opacity: 0;
  }

  .nav-open .menu-toggle span:nth-child(3) {
    transform: translateY(-5.5px) rotate(-45deg);
  }

  .site-header nav {
    grid-column: 1 / -1;
    grid-row: 2;
    display: none;
    gap: 2px;
    width: min(220px, calc(100vw - 40px));
    margin-top: 6px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel);
    box-shadow: 0 12px 28px rgb(0 0 0 / 16%);
    transition: background-color 180ms ease, border-color 180ms ease;
  }

  .nav-open .site-header nav {
    display: grid;
  }

  .site-header nav a {
    display: block;
    padding: 8px 10px;
    border-radius: 7px;
    color: var(--text);
    line-height: 1.25;
    text-decoration: none;
  }

  .site-header nav a + a {
    border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }

  .site-header nav a:hover {
    background: var(--bg);
    text-decoration: none;
  }

  .theme-toggle {
    grid-column: 2;
    grid-row: 1;
    justify-self: start;
  }

  .portrait {
    width: 128px;
    height: 170px;
  }

  .profile {
    grid-template-columns: 1fr;
    gap: 18px;
  }
}
