:root {
  color-scheme: light;
  --global-bg-color: #f2f2f2;
  --global-text-color: #000000;
  --global-text-color-light: #6a6a6a;
  --global-theme-color: #0076df;
  --global-hover-color: #0057a5;
  --global-divider-color: rgba(0, 0, 0, 0.1);
  --global-card-bg: transparent;
  --global-muted-bg: transparent;
  --global-header-bg: rgba(242, 242, 242, 0.96);
  --global-icon-color: #1f2933;
  --theme-button-bg: #f2f2f2;
  --theme-button-border: rgba(0, 0, 0, 0.15);
  --theme-button-hover: #e8e8e8;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --global-bg-color: #111418;
  --global-text-color: #e8ecf2;
  --global-text-color-light: #a9b4c1;
  --global-theme-color: #6ab2ff;
  --global-hover-color: #9ecbff;
  --global-divider-color: rgba(255, 255, 255, 0.16);
  --global-card-bg: #181d23;
  --global-muted-bg: #161b20;
  --global-header-bg: rgba(17, 20, 24, 0.92);
  --global-icon-color: #e8ecf2;
  --theme-button-bg: #1b2028;
  --theme-button-border: rgba(255, 255, 255, 0.22);
  --theme-button-hover: #252d38;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    color-scheme: dark;
    --global-bg-color: #111418;
    --global-text-color: #e8ecf2;
    --global-text-color-light: #a9b4c1;
    --global-theme-color: #6ab2ff;
    --global-hover-color: #9ecbff;
    --global-divider-color: rgba(255, 255, 255, 0.16);
    --global-card-bg: #181d23;
    --global-muted-bg: #161b20;
    --global-header-bg: rgba(17, 20, 24, 0.92);
    --global-icon-color: #e8ecf2;
    --theme-button-bg: #1b2028;
    --theme-button-border: rgba(255, 255, 255, 0.22);
    --theme-button-hover: #252d38;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Roboto", sans-serif;
  color: var(--global-text-color);
  background: var(--global-bg-color);
  line-height: 1.55;
  font-weight: 300;
  transition: color 0.2s ease, background-color 0.2s ease;
}

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

a:hover {
  color: var(--global-hover-color);
  text-decoration: underline;
}

.container {
  width: min(95vw, 1600px);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  border-bottom: 1px solid var(--global-divider-color);
  background: var(--global-header-bg);
  backdrop-filter: blur(6px);
}

.navbar {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  font-family: "Roboto", sans-serif;
  font-size: 1.22rem;
  color: var(--global-text-color);
  font-weight: 300;
}

.brand:hover {
  text-decoration: none;
}

.brand-logos {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.brand-logo {
  display: block;
  width: auto;
}

.brand-logo-stanford {
  height: 2.45rem;
}

.brand-logo-imperial {
  height: 3.1rem;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-links {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links a {
  color: var(--global-text-color);
  font-size: 0.97rem;
  font-weight: 300;
}

.nav-links a.active {
  color: var(--global-theme-color);
  font-weight: 400;
}

.nav-links a:hover {
  color: var(--global-theme-color);
  text-decoration: none;
}

.theme-toggle {
  width: 2.35rem;
  height: 2.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.45rem;
  border: 1px solid var(--theme-button-border);
  background: var(--theme-button-bg);
  color: var(--global-icon-color);
  cursor: pointer;
  padding: 0;
}

.theme-toggle:hover {
  background: var(--theme-button-hover);
}

.theme-toggle svg {
  width: 1.08rem;
  height: 1.08rem;
  display: none;
}

.theme-toggle[data-mode="auto"] .icon-auto {
  display: block;
}

.theme-toggle[data-mode="light"] .icon-light {
  display: block;
}

.theme-toggle[data-mode="dark"] .icon-dark {
  display: block;
}

.page-main {
  padding: 2.4rem 0 2.8rem;
}

.about-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 2.5rem;
  align-items: center;
}

.profile-pane {
  position: static;
  margin-top: -10cm;
}

.profile-figure {
  margin: 0;
}

.profile-photo {
  width: 100%;
  max-width: 300px;
  border-radius: 0.35rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
  display: block;
}

.about-content h1 {
  margin: 0 0 0.8rem;
  font-family: "Roboto", sans-serif;
  font-size: clamp(2.4rem, 4.4vw, 3.25rem);
  font-weight: 300 !important;
  line-height: 1.06;
  color: var(--global-text-color);
}

.about-content p {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 300;
}

.paper-section {
  margin-top: 2rem;
}

.paper-section h2 {
  margin: 0 0 0.9rem;
  font-family: "Roboto", sans-serif;
  font-size: clamp(1.55rem, 2.05vw, 1.9rem);
  font-weight: 300;
  line-height: 1.08;
}

.group-title {
  margin-top: 1.35rem;
  margin-bottom: 0.65rem;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--global-text-color);
  display: inline-block;
  padding-bottom: 0.12rem;
  border-bottom: 1px solid var(--global-divider-color);
}

.paper-card {
  padding: 0;
  margin: 0 0 1.1rem;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.paper-card.compact {
  padding: 0;
}

.paper-card h3,
.paper-card h4 {
  margin: 0 0 0.28rem;
  font-size: 0.98rem;
  font-weight: 300;
}

.paper-card h4 {
  font-size: 0.95rem;
}

.paper-meta {
  margin: 0.12rem 0 0.42rem;
  color: var(--global-text-color-light);
  font-size: 0.96rem;
  font-weight: 300;
}

.paper-abstract {
  margin: 0.35rem 0 0.5rem;
  font-size: 0.96rem;
  font-weight: 300;
}

.paper-abstract-toggle {
  margin: 0.2rem 0 0.5rem;
}

.paper-abstract-toggle summary {
  list-style: none;
  cursor: pointer;
  display: inline;
  color: var(--global-theme-color);
  font-size: 0.96rem;
  font-weight: 300;
}

.paper-abstract-toggle summary::before {
  content: "> ";
}

.paper-abstract-toggle summary::-webkit-details-marker {
  display: none;
}

.paper-abstract-toggle summary:hover {
  color: var(--global-hover-color);
  text-decoration: underline;
}

.paper-abstract-toggle[open] summary {
  display: inline-block;
  margin-bottom: 0.12rem;
}

.paper-abstract-toggle .paper-abstract {
  margin: 0.15rem 0 0.5rem;
}

.paper-note {
  margin: 0.3rem 0 0;
  font-size: 0.95rem;
  font-weight: 300;
}

.social-footer {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

.social-footer a {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  border: 1px solid var(--global-divider-color);
  display: inline-flex;
  justify-content: center;
  align-items: center;
  color: var(--global-icon-color);
  font-size: 1.08rem;
  text-decoration: none;
}

.social-footer a:hover {
  color: var(--global-theme-color);
  border-color: var(--global-theme-color);
}

.social-icon-image {
  width: 2.05rem;
  height: 2.05rem;
  display: block;
  object-fit: contain;
}

.social-footer a.social-link-scholar {
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  padding: 0;
}

.social-footer a.social-link-scholar:hover {
  border: 0;
  opacity: 0.9;
}

.site-footer {
  margin-top: 1.8rem;
  border-top: 1px solid var(--global-divider-color);
  color: var(--global-text-color-light);
  font-size: 0.9rem;
  padding: 1rem 0 1.2rem;
}

.info-main {
  padding: 1.4rem 0 2.4rem;
}

.info-main h1 {
  margin: 0 0 1rem;
  font-family: "Roboto", sans-serif;
  font-size: clamp(1.55rem, 2.2vw, 1.95rem);
  font-weight: 300;
}

.info-block {
  margin-bottom: 1.4rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.info-block h2 {
  margin: 0 0 0.7rem;
  font-family: "Roboto", sans-serif;
  font-size: 1.35rem;
  font-weight: 300;
}

.info-block h3 {
  margin: 0.7rem 0 0.45rem;
  font-size: 0.98rem;
  font-weight: 300;
  color: var(--global-icon-color);
}

.info-block h3.inst-imperial {
  color: #10306e;
  font-weight: 700;
}

.info-block h3.inst-lancaster {
  color: #7b1e1e;
  font-weight: 700;
}

.info-list {
  margin: 0;
  padding-left: 1.1rem;
}

.info-list li {
  margin-bottom: 0.42rem;
  font-weight: 300;
}

.grants-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2.2rem;
  align-items: start;
}

.grants-column h2 {
  margin-bottom: 0.85rem;
}

.grant-item {
  margin-bottom: 0.85rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--global-divider-color);
}

.grant-item:last-child {
  margin-bottom: 0;
}

.grant-title {
  margin: 0 0 0.2rem;
  font-size: 0.98rem;
  font-weight: 300;
  line-height: 1.35;
}

.grant-meta {
  margin: 0;
  color: var(--global-text-color-light);
  font-size: 0.93rem;
  font-weight: 300;
  line-height: 1.42;
}

.chip {
  display: inline-block;
  margin-right: 0.45rem;
  padding: 0.08rem 0.48rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  vertical-align: middle;
}

.chip-grant {
  background: #e6f0ff;
  border-color: #bad2ff;
  color: #13489c;
}

.chip-award {
  background: #fff4de;
  border-color: #f4d49d;
  color: #8d5b00;
}

.chip-travel {
  background: #e7f8f7;
  border-color: #a7dcd8;
  color: #0a6660;
}

.chip-scholarship {
  background: #e9f8eb;
  border-color: #b4dfba;
  color: #1f6934;
}

html[data-theme="dark"] .chip-grant {
  background: rgba(106, 178, 255, 0.16);
  border-color: rgba(106, 178, 255, 0.38);
  color: #9ecbff;
}

html[data-theme="dark"] .chip-award {
  background: rgba(230, 173, 79, 0.18);
  border-color: rgba(230, 173, 79, 0.45);
  color: #ffd591;
}

html[data-theme="dark"] .chip-travel {
  background: rgba(77, 188, 178, 0.18);
  border-color: rgba(77, 188, 178, 0.44);
  color: #8de7df;
}

html[data-theme="dark"] .chip-scholarship {
  background: rgba(92, 184, 107, 0.18);
  border-color: rgba(92, 184, 107, 0.44);
  color: #a8e5b2;
}

@media (max-width: 768px) {
  .about-layout {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .profile-pane {
    margin-top: 0;
  }

  .profile-photo {
    max-width: 240px;
  }

  .navbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 0.55rem 0;
  }

  .nav-right {
    width: 100%;
    justify-content: space-between;
  }

  .nav-links {
    justify-content: flex-start;
  }

  .grants-columns {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }
}
