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

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

:root {
  --font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bg-color: #ffffff;
  --text-color: #111111;
  --heading-color: #111111;
  --muted-color: #4f4f4f;
  --link-color: #1772d0;
  --link-hover-color: #f09228;
  --surface-color: #ffffff;
  --surface-muted-color: #f7f7f7;
  --border-color: #dddddd;
  --highlight-color: #ffffd0;
  --news-badge-bg: #f2f2f2;
  --news-badge-text: #111111;
  --shadow-color: rgba(0, 0, 0, 0.12);
  --toggle-bg: rgba(255, 255, 255, 0.96);
  --toggle-border: rgba(17, 17, 17, 0.2);
  --toggle-text: #111111;
  --toggle-icon-bg: #111111;
  --toggle-icon-color: #ffffff;
  --teaching-bg: #edd892;
  --supervisor-bg: #c6b89e;
  --talks-bg: #aaba9e;
  --short-papers-bg: #fcb97d;
  --misc-label-text: #111111;
  --button-bg: #0969da;
  --button-hover-bg: #f09228;
  --button-success-bg: #1a7f37;
}

body.dark-mode {
  --bg-color: #1e1e1e;
  --text-color: #dddddd;
  --heading-color: #f0f0f0;
  --muted-color: #b5b5b5;
  --link-color: #7bb7ff;
  --link-hover-color: #f0b070;
  --surface-color: #2a2a2a;
  --surface-muted-color: #353535;
  --border-color: #4a4a4a;
  --highlight-color: #544d2a;
  --news-badge-bg: #3b3b3b;
  --news-badge-text: #e8e8e8;
  --shadow-color: rgba(1, 4, 9, 0.45);
  --toggle-bg: rgba(42, 42, 42, 0.95);
  --toggle-border: rgba(240, 246, 252, 0.15);
  --toggle-text: #f0f0f0;
  --toggle-icon-bg: #f0f0f0;
  --toggle-icon-color: #1e1e1e;
  --teaching-bg: #8b7741;
  --supervisor-bg: #6c5f4d;
  --talks-bg: #60735a;
  --short-papers-bg: #9a6844;
  --misc-label-text: #f3efe6;
  --button-bg: #238636;
  --button-hover-bg: #2ea043;
  --button-success-bg: #2ea043;
}

html {
  color-scheme: light;
}

body.dark-mode {
  color-scheme: dark;
}

body,
td,
th,
tr,
p {
  font-family: var(--font-family);
  font-size: 14px;
  color: var(--text-color);
}

body {
  margin: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: background-color 0.25s ease, color 0.25s ease;
  line-height: 1.55;
}

strong {
  font-family: var(--font-family);
  font-size: 14px;
}

heading {
  font-family: var(--font-family);
  font-size: 22px;
  color: var(--heading-color);
}

.papertitle {
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 700;
  color: inherit;
}

a .papertitle {
  color: var(--link-color);
}

a:hover .papertitle,
a:focus .papertitle {
  color: var(--link-hover-color);
}

name {
  font-family: var(--font-family);
  font-size: 32px;
  font-weight: 700;
  color: var(--heading-color);
}

h2 {
  margin: 0;
  font-weight: 400;
  font-size: 22px;
  font-family: var(--font-family);
  color: var(--heading-color);
}

h3,
font {
  font-family: var(--font-family);
  color: var(--heading-color);
}

.mobile-intro-heading,
.mobile-profile-link,
.mobile-profile-photo {
  display: none;
}

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

ul {
  padding-left: 20px;
}

.one {
  width: 160px;
  height: 160px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.two {
  width: 160px;
  height: 160px;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .2s ease-in-out;
  -moz-transition: opacity .2s ease-in-out;
  -webkit-transition: opacity .2s ease-in-out;
  opacity: 0;
  background-color: var(--publication-image-bg, var(--surface-color));
  z-index: 2;
}

.one > img,
.two > img {
  display: block;
  width: auto !important;
  height: auto !important;
  max-width: 100%;
  max-height: 100%;
  margin: auto;
}

.one > img {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.two > img {
  position: relative;
  z-index: 2;
}

.fade {
  transition: opacity .2s ease-in-out;
  -moz-transition: opacity .2s ease-in-out;
  -webkit-transition: opacity .2s ease-in-out;
}

span.highlight {
  background-color: var(--highlight-color);
}

.publication-card {
  --publication-image-bg: var(--bg-color);
  background-color: transparent;
  transition: background-color 0.25s ease;
}

.publication-highlight {
  --publication-image-bg: var(--highlight-color);
  background-color: var(--highlight-color);
}

.news-date {
  background: var(--news-badge-bg);
  color: var(--news-badge-text);
  border-radius: 12px;
  padding: 2px 10px;
  margin-right: 8px;
  font-weight: 700;
  display: inline-block;
}

.news-section {
  margin-bottom: 32px;
}

.misc-label {
  border-radius: 12px;
  color: var(--misc-label-text);
}

.misc-label h2 {
  margin: 0;
  color: var(--misc-label-text);
}

.misc-label--teaching {
  background-color: var(--teaching-bg);
}

.misc-label--supervisor {
  background-color: var(--supervisor-bg);
}

.misc-label--talks {
  background-color: var(--talks-bg);
}

.misc-label--short-papers {
  background-color: var(--short-papers-bg);
}

.theme-toggle {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 1100;
}

.theme-toggle-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 1px solid var(--toggle-border);
  border-radius: 50%;
  background: var(--toggle-bg);
  color: var(--toggle-text);
  cursor: pointer;
  font: inherit;
  font-family: var(--font-family);
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
}

.theme-toggle-button:hover {
  transform: translateY(-1px);
}

.theme-toggle-button:focus-visible {
  outline: 2px solid var(--link-color);
  outline-offset: 3px;
}

.theme-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--toggle-text);
}

.theme-toggle-icon svg {
  width: 24px;
  height: 24px;
  display: block;
}

/* BibTeX Modal Styles */
.bibtex-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.bibtex-overlay.active {
  display: flex;
}

.bibtex-modal {
  background: var(--surface-color);
  border-radius: 8px;
  padding: 20px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  position: relative;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 20px var(--shadow-color);
}

.bibtex-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.bibtex-modal-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--heading-color);
}

.bibtex-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted-color);
  padding: 0;
  line-height: 1;
}

.bibtex-close:hover {
  color: var(--heading-color);
}

.bibtex-content {
  background: var(--surface-muted-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 15px;
  font-family: var(--font-family);
  font-size: 12px;
  color: var(--text-color);
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-y: auto;
  max-height: 50vh;
}

.bibtex-copy-btn {
  margin-top: 15px;
  padding: 10px 20px;
  background-color: var(--button-bg);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-family: var(--font-family);
  transition: background-color 0.2s;
}

.bibtex-copy-btn:hover {
  background-color: var(--button-hover-bg);
}

.bibtex-copy-btn.copied {
  background-color: var(--button-success-bg);
}

.bibtex-link {
  cursor: pointer;
}

.footer-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.footer-update {
  margin: 0;
  text-align: right;
  justify-self: end;
}

.footer-source {
  margin: 0;
  text-align: left;
  justify-self: start;
}

#mobile-theme-toggle-anchor {
  display: none;
}

@media (max-width: 900px) and (pointer: coarse) {
  body,
  td,
  th,
  tr,
  p,
  a,
  strong,
  .papertitle {
    font-size: 15px;
  }

  name {
    display: block;
    font-size: 28px;
  }

  h2 {
    font-size: 22px;
    margin: 0 0 12px;
  }

  .page-shell {
    width: 100% !important;
    background-color: var(--publication-image-bg, var(--surface-color));
    margin: 0 !important;
    padding: 0 16px 28px;
    box-sizing: border-box;
  }

  .intro-table,
  .intro-table tbody,
  .intro-table tr,
  .intro-text,
  .intro-photo,
  .publications-table,
  .publications-table tbody,
  .publication-card,
  .publication-card > td,
  .misc-table,
  .misc-table tbody,
  .misc-table tr,
  .misc-table td,
  .section-table,
  .section-table tbody,
  .section-table tr,
  .section-table td,
  .misc-heading-table,
  .misc-heading-table tbody,
  .misc-heading-table tr,
  .misc-heading-table td,
  .footer-table,
  .footer-table tbody,
  .footer-table tr,
  .footer-table td {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  .intro-table {
    margin-top: 10px;
  }

  .intro-table tr {
    display: block;
  }

  .intro-photo {
    display: none;
  }

  .profile-photo {
    width: min(260px, 72vw) !important;
    max-width: 100% !important;
  }

  .mobile-intro-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
  }

  .mobile-intro-name-wrap {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  .mobile-profile-link {
    display: block;
    flex: 0 0 auto;
  }

  .mobile-profile-photo {
    display: block;
    width: 92px;
    height: 92px;
    border-radius: 50%;
    object-fit: cover;
  }

  .intro-name-desktop {
    display: none;
  }

  .intro-text p {
    text-align: left !important;
  }

  .intro-email,
  .intro-links {
    text-align: center !important;
  }

  .intro-links {
    line-height: 1.9;
  }

  .intro-email a,
  .intro-links a {
    display: inline-block;
  }

  .intro-bio {
    text-align: left !important;
  }

  .intro-text,
  .section-table td,
  .publication-card > td,
  .misc-table td,
  .footer-table td {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .intro-text p,
  .section-table p,
  .publication-card p,
  .misc-table p,
  .misc-table td,
  .footer-table p {
    line-height: 1.65;
  }

  .publication-card {
    --publication-image-bg: var(--surface-color);
    display: flex;
    flex-direction: column;
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background-color: var(--surface-color);
  }

  .publication-highlight {
    background-color: var(--highlight-color);
  }

  .publication-card > td:first-child {
    order: 1;
    padding-top: 0 !important;
    padding-bottom: 12px !important;
    text-align: center;
  }

  .publication-card > td:last-child {
    order: 2;
    padding-bottom: 0 !important;
  }

  .one,
  .two {
    width: min(220px, 100%);
    height: min(220px, 100vw - 64px);
    margin: 0 auto;
  }

  .misc-label {
    display: block;
    margin-bottom: 10px;
  }

  .misc-table tr {
    display: flex;
    flex-direction: column;
    margin-bottom: 18px;
    padding: 14px 16px 16px;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: var(--surface-color);
  }

  .misc-table td:last-child {
    padding-bottom: 0 !important;
  }

  .misc-table td:first-child {
    order: 1;
  }

  .misc-table td:last-child {
    order: 2;
  }

  .news-date {
    margin-bottom: 6px;
  }

  .bibtex-modal {
    width: calc(100% - 24px);
    padding: 16px;
  }

  .footer-table {
    padding-bottom: 12px;
  }

  .footer-table p {
    text-align: left;
  }

}

@media (max-width: 980px) {
  .footer-table br {
    display: none;
  }

  .footer-meta {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 10px;
    min-height: 0;
    width: 100%;
  }

  #mobile-theme-toggle-anchor {
    display: block;
  }

  .footer-update {
    text-align: right !important;
  }

  .footer-source {
    text-align: right !important;
  }

  #mobile-theme-toggle-anchor {
    position: static;
    align-self: center;
    transform: none;
  }

  .theme-toggle {
    position: static;
    right: auto;
    top: auto;
    display: flex;
    justify-content: center;
    margin: 0;
  }
}
