:root {
  --text: #1f2933;
  --muted: #66727e;
  --link: #1f5f99;
  --rule: #d9e1e8;
  --subtle: #f6f9fb;
  --white: #ffffff;
  --heading: #15202b;
  --link-underline: #a8bfd3;
  --media-background: #f6f9fb;
  --dialog-backdrop: rgba(15, 23, 31, 0.68);
  --max-width: 1060px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --text: #d7e0e8;
  --muted: #9dabb8;
  --link: #80b9e6;
  --rule: #34424e;
  --subtle: #16212a;
  --white: #0d151c;
  --heading: #eef4f8;
  --link-underline: #557a98;
  --media-background: #f3f6f8;
  --dialog-backdrop: rgba(0, 0, 0, 0.78);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 1rem;
}

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

img {
  display: block;
  max-width: 100%;
  border-radius: 3px;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

button,
summary {
  font: inherit;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--heading);
  line-height: 1.25;
}

.container {
  width: min(calc(100% - 3rem), var(--max-width));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.5rem 0.75rem;
  background: var(--text);
  color: var(--white);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}

/* Header */

.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--white);
}

.header-inner {
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.site-name {
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 650;
  text-decoration: none;
}

.site-name:hover {
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1.6rem;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.primary-nav a {
  color: var(--text);
  font-size: 0.96rem;
}

.primary-nav a:last-child {
  color: var(--link);
}

.theme-toggle,
.menu-button {
  border: 0;
  padding: 0.25rem 0;
  background: transparent;
  color: var(--link);
  cursor: pointer;
}

.theme-toggle:hover,
.menu-button:hover {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.menu-button {
  display: none;
}

/* Introduction */

.intro {
  padding: 3.75rem 0 3.25rem;
}

.intro h1 {
  margin-bottom: 0.45rem;
  font-size: clamp(2.35rem, 5vw, 3.35rem);
  font-weight: 700;
  letter-spacing: -0.035em;
}

.intro-role {
  margin-bottom: 0.75rem;
  font-size: 1.18rem;
}

.intro-focus {
  margin-bottom: 1.25rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.profile-links,
.item-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
}

.profile-links a,
.item-links a {
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-underline-offset: 0.2em;
}

/* General sections */

.page-section {
  padding: 2.35rem 0 2.65rem;
  border-top: 1px solid var(--rule);
}

.page-section h2 {
  margin-bottom: 1.35rem;
  font-size: 1.75rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.prose {
  max-width: 910px;
}

.prose p {
  margin-bottom: 1rem;
}

.page-section > p {
  max-width: 950px;
  margin-bottom: 0;
}

/* News */

.news-list {
  border-top: 1px solid var(--rule);
}

.news-item {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 1.5rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--rule);
}

.news-item time {
  color: var(--muted);
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

.news-item p {
  margin: 0;
}

.news-year {
  border-top: 1px solid var(--rule);
}

.news-year:last-child {
  border-bottom: 1px solid var(--rule);
}

.news-year summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  color: var(--text);
  cursor: pointer;
  list-style: none;
}

.news-year summary::-webkit-details-marker {
  display: none;
}

.news-year summary::after {
  content: "+";
  color: var(--link);
  font-size: 1.1rem;
}

.news-year[open] summary::after {
  content: "-";
}

.news-year-title {
  min-width: 4rem;
  color: var(--heading);
  font-size: 1.05rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.news-year-count {
  margin-left: auto;
  margin-right: 0.5rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.news-year .news-list {
  border-top: 0;
  padding-bottom: 0.35rem;
}

.news-year .news-item:first-child {
  border-top: 1px solid var(--rule);
}

.news-year .news-item:last-child {
  border-bottom: 0;
}

/* Publications and projects */

.publication-list {
  border-top: 1px solid var(--rule);
}

.publication {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--rule);
}

.publication img {
  width: 180px;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: var(--media-background);
}

.paper-figure-button {
  width: 180px;
  border: 0;
  padding: 0;
  background: var(--media-background);
  cursor: zoom-in;
  overflow: hidden;
  border-radius: 3px;
}

.paper-figure-button:hover img {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.text-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--link);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-underline-offset: 0.2em;
}

.publication h3 {
  margin-bottom: 0.18rem;
  font-size: 1.08rem;
  font-weight: 650;
}

.venue {
  margin-bottom: 0.2rem;
  color: var(--link);
  font-size: 0.92rem;
  font-weight: 600;
}

.authors {
  margin-bottom: 0.3rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.item-links {
  margin: 0;
  gap: 0.25rem 1rem;
  font-size: 0.9rem;
}

/* Experience */

.experience-list {
  border-top: 1px solid var(--rule);
}

.experience-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 130px;
  gap: 1.25rem;
  align-items: center;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--rule);
}

.experience-item img {
  width: 52px;
  height: 52px;
  padding: 0.2rem;
  object-fit: contain;
}

.experience-item h3 {
  margin-bottom: 0.1rem;
  font-size: 1.05rem;
  font-weight: 650;
}

.experience-item p {
  margin-bottom: 0.05rem;
}

.experience-item .description {
  color: var(--muted);
  font-size: 0.9rem;
}

.experience-item time,
.experience-item .experience-date {
  align-self: start;
  padding-top: 0.15rem;
  color: var(--muted);
  font-size: 0.92rem;
  text-align: right;
}

/* Teaching */

.teaching-list {
  border-top: 1px solid var(--rule);
}

.teaching-list article {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) minmax(250px, 0.7fr);
  gap: 1.5rem;
  align-items: baseline;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--rule);
}

.teaching-list p,
.teaching-list h3 {
  margin: 0;
  font-size: 0.97rem;
}

.teaching-list h3 {
  font-weight: 600;
}

.teaching-list .course {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.teaching-list article > p:last-child {
  color: var(--muted);
}

/* Footer */

.site-footer {
  margin-top: 1rem;
  border-top: 1px solid var(--rule);
}

.site-footer .container {
  padding-block: 1.75rem 2.5rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}


/* Dialogs */

.modal {
  width: min(calc(100% - 2rem), 860px);
  max-height: calc(100vh - 2rem);
  border: 1px solid var(--rule);
  padding: 0;
  overflow: hidden;
  border-radius: 3px;
  background: var(--white);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}

.modal::backdrop {
  background: var(--dialog-backdrop);
}

.dialog-panel {
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding: 1.25rem;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}

.dialog-header h2 {
  margin-bottom: 0.25rem;
  font-size: 1.35rem;
}

.dialog-subtitle {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.dialog-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 0.5rem;
}

.dialog-button {
  border: 1px solid var(--rule);
  padding: 0.35rem 0.65rem;
  background: transparent;
  color: var(--link);
  cursor: pointer;
}

.dialog-button:hover {
  border-color: var(--link);
}

.bibtex-code {
  margin: 1rem 0 0;
  overflow: auto;
  padding: 1rem;
  background: var(--subtle);
  color: var(--text);
  font: 0.88rem/1.55 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  white-space: pre;
}

.copy-status {
  min-height: 1.4rem;
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.paper-dialog {
  width: min(calc(100% - 2rem), 980px);
}

.paper-dialog-content {
  padding-top: 1.25rem;
}

.paper-dialog-image {
  width: 100%;
  max-height: 58vh;
  object-fit: contain;
  background: var(--media-background);
  border-radius: 3px;
}

.abstract-block {
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
}

.abstract-block h3 {
  margin-bottom: 0.6rem;
  font-size: 1.05rem;
}

.abstract-block p {
  margin-bottom: 0;
  line-height: 1.65;
}

/* Responsive */

@media (max-width: 760px) {
  .container {
    width: min(calc(100% - 2rem), var(--max-width));
  }

  .header-inner {
    position: relative;
    min-height: 62px;
  }

  .header-actions {
    gap: 1rem;
  }

  .menu-button {
    display: block;
    padding: 0.25rem 0;
  }

  .primary-nav {
    position: absolute;
    z-index: 10;
    top: 100%;
    right: 0;
    left: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.4rem 1rem;
    border: 1px solid var(--rule);
    background: var(--white);
  }

  .primary-nav.is-open {
    display: flex;
  }

  .primary-nav a {
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--rule);
  }

  .primary-nav a:last-child {
    border-bottom: 0;
  }

  .intro {
    padding: 2.75rem 0 2.4rem;
  }

  .intro h1 {
    font-size: 2.45rem;
  }

  .page-section {
    padding: 2rem 0 2.25rem;
  }

  .page-section h2 {
    font-size: 1.55rem;
  }

  .news-item {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .publication {
    grid-template-columns: 135px minmax(0, 1fr);
    gap: 1rem;
  }

  .publication img,
  .paper-figure-button {
    width: 135px;
  }

  .publication h3 {
    font-size: 1rem;
  }

  .experience-item {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 1rem;
  }

  .experience-item img {
    width: 44px;
    height: 44px;
  }

  .experience-item time,
  .experience-item .experience-date {
    grid-column: 2;
    padding-top: 0;
    text-align: left;
  }

  .teaching-list article {
    grid-template-columns: 90px 1fr;
    gap: 0.25rem 1rem;
  }

  .teaching-list article > p:last-child {
    grid-column: 2;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 15.5px;
  }

  .publication {
    grid-template-columns: 1fr;
  }

  .publication img,
  .paper-figure-button {
    width: 100%;
    max-width: 220px;
  }

  .dialog-panel {
    padding: 1rem;
  }

  .dialog-header {
    gap: 0.85rem;
  }

  .dialog-actions {
    flex-direction: column;
  }

  .paper-dialog-image {
    max-height: 44vh;
  }

  .teaching-list article {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .teaching-list article > p:last-child {
    grid-column: 1;
  }
}
