:root {
  --bg: #ffffff;
  --surface: #f7f7f5;
  --surface-strong: #efefec;
  --text: #202124;
  --muted: #67656a;
  --faint: #8b878d;
  --border: #e4e4e0;
  --accent: #a83368;
  --accent-hover: #7f244d;
  --accent-soft: rgba(168, 51, 104, 0.09);
  --shadow: 0 16px 42px rgba(34, 24, 29, 0.08);
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #171518;
  --surface: #201d21;
  --surface-strong: #29252a;
  --text: #f1edf0;
  --muted: #b7afb5;
  --faint: #918990;
  --border: #383239;
  --accent: #e383ad;
  --accent-hover: #f0a2c3;
  --accent-soft: rgba(227, 131, 173, 0.11);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.24);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg) !important;
}

body,
#main,
.page,
.page__inner-wrap,
.page__content,
.archive,
.initial-content,
.page__footer {
  background: var(--bg) !important;
  color: var(--text) !important;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
  font-size: 16px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 180ms ease, color 180ms ease;
}

/* Keep the old Academic Pages chrome out of the way. */
.masthead,
.sidebar,
.author__avatar,
.author__content,
.author__urls-wrapper {
  display: none !important;
}

#main {
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.page,
.archive {
  width: 100% !important;
  max-width: 980px !important;
  margin: 0 auto !important;
  padding: 68px 28px 72px !important;
  float: none !important;
}

.page__inner-wrap,
.page__content {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  float: none !important;
}

.page__footer {
  border-top: 1px solid var(--border) !important;
}

.page__footer footer {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 28px 42px;
  color: var(--muted) !important;
}

h1,
h2,
h3,
h4,
h5,
h6,
.page__title {
  color: var(--text) !important;
  font-family: inherit !important;
}

p,
li,
dd,
dt {
  color: var(--text);
}

a {
  color: var(--accent) !important;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  text-underline-offset: 0.16em;
  text-decoration-thickness: 1px;
  transition: color 140ms ease, text-decoration-color 140ms ease;
}

a:hover,
a:focus-visible {
  color: var(--accent-hover) !important;
  text-decoration-color: currentColor;
}

strong {
  color: var(--text) !important;
  font-weight: 650;
}

/* Global light/dark control, injected by theme.js. */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 18px;
  z-index: 10000;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  color: var(--muted);
  box-shadow: 0 6px 22px rgba(20, 16, 18, 0.08);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.theme-toggle:hover {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
  transform: translateY(-1px);
}

.theme-toggle:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
}

.theme-toggle__sun,
.theme-toggle__moon {
  width: 18px;
  text-align: center;
  font-size: 1rem;
  line-height: 1;
  transition: opacity 160ms ease, color 160ms ease;
}

.theme-toggle__track {
  position: relative;
  width: 34px;
  height: 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-strong);
}

.theme-toggle__thumb {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  transition: transform 180ms ease;
}

html[data-theme="light"] .theme-toggle__sun {
  color: var(--accent);
  opacity: 1;
}

html[data-theme="light"] .theme-toggle__moon {
  opacity: 0.35;
}

html[data-theme="dark"] .theme-toggle__sun {
  opacity: 0.35;
}

html[data-theme="dark"] .theme-toggle__moon {
  color: var(--accent);
  opacity: 1;
}

html[data-theme="dark"] .theme-toggle__thumb {
  transform: translateX(16px);
}

/* Homepage */
.home-shell {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
}

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 54px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.home-name {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.home-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  flex: 1;
}

.home-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.home-nav a {
  color: var(--muted) !important;
  font-size: 0.9rem;
  font-weight: 550;
  text-decoration: none;
}

.home-nav a:hover,
.home-nav a:focus-visible {
  color: var(--accent) !important;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 178px;
  gap: 52px;
  align-items: center;
  padding: 6px 0 66px;
}

.hero-copy {
  max-width: 660px;
}

.eyebrow {
  margin: 0 0 13px;
  color: var(--accent) !important;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(2.35rem, 7vw, 4.15rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
  font-weight: 720;
}

.hero-lede {
  margin: 0;
  max-width: 640px;
  color: var(--muted) !important;
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  line-height: 1.62;
}

.profile-pic {
  width: 178px;
  height: 218px;
  display: block;
  object-fit: cover;
  object-position: center;
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.profile-links {
  display: flex;
  gap: 10px 16px;
  flex-wrap: wrap;
  margin-top: 23px;
}

.profile-links a,
.contact-links a {
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}

.profile-links a::after,
.contact-links a::after {
  content: " ↗";
  font-size: 0.78em;
}

.content-section {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 42px;
  padding: 50px 0;
  border-top: 1px solid var(--border);
  scroll-margin-top: 40px;
}

.section-label h2 {
  position: sticky;
  top: 28px;
  margin: 2px 0 0;
  color: var(--muted) !important;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.section-body > :first-child {
  margin-top: 0;
}

.section-body > :last-child {
  margin-bottom: 0;
}

.section-body p {
  max-width: 700px;
  margin: 0 0 18px;
}

.publications-intro {
  margin-bottom: 25px !important;
  color: var(--muted) !important;
}

.pub-list {
  display: grid;
  gap: 0;
}

.pub {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 18px;
  padding: 21px 0;
  border-top: 1px solid var(--border);
}

.pub:first-child {
  border-top: 0;
  padding-top: 0;
}

.pub-year {
  padding-top: 2px;
  color: var(--faint);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}

.pub-title {
  margin: 0 0 4px;
  color: var(--text) !important;
  font-size: 1.02rem;
  line-height: 1.48;
  font-weight: 670;
}

.pub-authors,
.pub-venue {
  margin: 0 !important;
  color: var(--muted) !important;
  font-size: 0.91rem;
  line-height: 1.55;
}

.pub-venue {
  margin-top: 3px !important;
}

.pub-venue.accepted {
  display: inline-block;
  width: fit-content;
  margin-top: 6px !important;
  padding: 2px 9px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  border-radius: 999px;
  background: var(--accent-soft);
  font-style: normal;
}

.pub-venue.accepted strong {
  color: var(--accent) !important;
  font-weight: 800;
}

.pub-venue.preprint {
  font-style: italic;
}

.pub-group-label {
  margin: 0 0 16px;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.pub-group-spaced {
  margin-top: 34px;
}

.experience-list {
  display: grid;
  gap: 0;
}

.experience-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
}

.experience-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.experience-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 680;
}

.experience-subtitle {
  margin: 3px 0 7px;
  color: var(--muted);
  font-size: 0.92rem;
}

.experience-description {
  margin: 0 !important;
  color: var(--muted) !important;
  font-size: 0.94rem;
}

.experience-date {
  color: var(--faint);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 34px;
}

.mini-heading {
  margin: 0 0 12px;
  font-size: 0.94rem;
  font-weight: 750;
}

.compact-list {
  margin: 0;
  padding-left: 1.15rem;
}

.compact-list li {
  margin-bottom: 0.6rem;
  color: var(--muted);
}

.muted-copy {
  color: var(--muted) !important;
}

.contact-card {
  padding: 26px 28px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}

.contact-card p {
  color: var(--muted) !important;
}

.contact-links {
  display: flex;
  gap: 11px 20px;
  flex-wrap: wrap;
  margin-top: 18px;
}

/* Standalone archive/pages */
.archive h1,
.page__title {
  margin-top: 24px;
  margin-bottom: 32px;
  font-size: clamp(2rem, 5vw, 3rem) !important;
  letter-spacing: -0.035em;
}

.archive h2,
.page__content h2 {
  margin-top: 44px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--border) !important;
  color: var(--text) !important;
  font-size: 0.82rem !important;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.archive li,
.page__content li {
  margin-bottom: 0.65em;
}

@media (max-width: 760px) {
  .page,
  .archive {
    padding: 34px 20px 58px !important;
  }

  .theme-toggle {
    top: 12px;
    right: 12px;
  }

  .mini-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .home-header {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 42px;
    padding-right: 76px;
  }

  .home-nav {
    justify-content: flex-start;
    gap: 12px 18px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 28px;
    padding-bottom: 52px;
  }

  .profile-pic {
    width: 132px;
    height: 162px;
    grid-row: 1;
  }

  .hero-copy {
    grid-row: 2;
  }

  .content-section {
    grid-template-columns: 1fr;
    gap: 19px;
    padding: 40px 0;
  }

  .section-label h2 {
    position: static;
  }

  .pub {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 12px;
  }
}

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

  .theme-toggle {
    gap: 5px;
    padding: 6px 7px;
  }

  .theme-toggle__sun,
  .theme-toggle__moon {
    width: 16px;
    font-size: 0.92rem;
  }

  .experience-item {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .experience-date {
    grid-row: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}


/* Keep the homepage theme switch visibly inside the header. */
.home-header .theme-toggle {
  position: static;
  top: auto;
  right: auto;
  flex: 0 0 auto;
  box-shadow: none;
  background: var(--surface);
}

@media (max-width: 760px) {
  .home-controls {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .home-header {
    padding-right: 0;
  }

  .home-header .theme-toggle {
    order: -1;
  }
}
