:root {
  color-scheme: light dark;
  --bg: #f7f6f2;
  --text: #20211f;
  --muted: #696b66;
  --line: #d7d6d0;
  --accent: #881c1c;
  --header: color-mix(in srgb, var(--bg) 92%, transparent);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  scroll-behavior: smooth;
}

:root[data-theme="dark"] {
  --bg: #171816;
  --text: #eeeee8;
  --muted: #aaa9a2;
  --line: #393a35;
  --accent: #881c1c;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171816;
    --text: #eeeee8;
    --muted: #aaa9a2;
    --line: #393a35;
    --accent: #881c1c;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.65;
}

a {
  color: inherit;
  text-decoration-color: var(--line);
  text-underline-offset: 0.2em;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header);
  backdrop-filter: blur(12px);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  width: min(90rem, calc(100% - 2rem));
  min-height: 3.75rem;
  margin: auto;
}

.site-name {
  flex: 0 0 auto;
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
}

.site-name:hover,
.site-name:focus-visible { color: var(--accent); }

.nav-links {
  display: flex;
  flex: 1 1 auto;
  align-self: center;
  align-items: center;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}

.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  display: inline-flex;
  align-items: center;
  height: 2.5rem;
  border: 1px solid transparent;
  border-radius: 0.35rem;
  color: var(--muted);
  font-size: 0.88rem;
  padding-inline: 0.85rem;
  text-decoration: none;
}
.nav-links a:hover, .nav-links a:focus-visible { color: var(--text); }

.nav-links a[aria-current="page"] {
  border-color: var(--line);
  border-top-color: var(--accent);
  background: var(--bg);
  color: var(--text);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  padding: 0.35rem 0;
}

main, footer {
  width: min(78rem, calc(100% - 3rem));
  margin-inline: auto;
}

.site-frame {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: clamp(2rem, 4vw, 4rem);
  width: min(90rem, calc(100% - 3rem));
  margin-inline: auto;
}

.site-frame > main {
  min-width: 0;
  width: 100%;
}

.profile-bar {
  position: sticky;
  top: 5.5rem;
  align-self: start;
  margin-top: 5rem;
}

.profile-photo {
  display: block;
  width: 10.5rem;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
  object-fit: cover;
}

.profile-name {
  display: block;
  position: relative;
  z-index: 1;
  margin: 1.1rem 0 0;
  font-size: 1.08rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  opacity: 1;
  visibility: visible;
  white-space: nowrap;
}

.profile-copy { min-width: 0; }

.site-header .profile-name { color: var(--accent); }

.profile-title {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
  margin: 0.35rem 0 0;
}

.profile-meta {
  margin: 1.2rem 0 0;
  padding: 0;
  list-style: none;
}

.profile-meta li {
  display: grid;
  grid-template-columns: 1rem minmax(0, 1fr);
  gap: 0.55rem;
  align-items: start;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.profile-meta li + li { margin-top: 0.55rem; }

.profile-meta svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
  margin-top: 0.05rem;
}

.profile-meta a { overflow-wrap: anywhere; }

.page-shell {
  min-height: calc(100vh - 10rem);
}

.inner-page {
  padding-block: clamp(3.5rem, 8vw, 6.5rem);
}

.page-heading {
  max-width: 46rem;
  margin-bottom: clamp(3rem, 7vw, 5rem);
}

.page-heading h1 {
  margin-bottom: 1rem;
  font-size: clamp(2.1rem, 4.5vw, 3.4rem);
}

.page-heading > :last-child { margin-bottom: 0; }

.page-content > section {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: 2rem;
  padding-block: 2.75rem;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28rem;
  gap: clamp(2rem, 8vw, 6rem);
  align-items: center;
  min-height: 68vh;
  padding-block: 5rem;
}

.kicker {
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1, h2 { font-weight: 600; letter-spacing: -0.025em; }
h1 { margin: 0 0 1.5rem; font-size: clamp(2rem, 5.25vw, 3.6rem); line-height: 1.06; }
h1 span { display: block; color: var(--muted); font-size: 0.42em; margin-top: 0.5rem; }
.intro-text { font-size: clamp(1.15rem, 2.5vw, 1.4rem); line-height: 1.5; }
.intro p { max-width: 38rem; }

.portrait {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  border: 1px solid var(--line);
  filter: grayscale(18%);
  object-fit: cover;
}

.home-photo { margin: 0; }

.home-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--line);
  object-fit: cover;
}

.home-photo figcaption {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
  margin-top: 0.55rem;
}

main > section:not(.intro) {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: 2rem;
  padding-block: 3.5rem;
  scroll-margin-top: 4.5rem;
}

h2 { margin: 0; font-size: 1rem; }
h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.section-body > :first-child { margin-top: 0; }
.section-body > :last-child { margin-bottom: 0; }
.empty-state, .section-note { color: var(--muted); }
.contact-list { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }

.document-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.document-links > * {
  border: 1px solid var(--line);
  padding: 0.55rem 0.8rem;
  text-decoration: none;
}

.cv-button {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 650;
  transition: background-color 120ms ease;
}

.cv-button:hover,
.cv-button:focus-visible {
  background-color: rgba(136, 28, 28, 0.16);
}

.document-updated {
  border: 0;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 0;
}

.research-section {
  display: grid;
  grid-template-columns: 10rem minmax(0, 1fr);
  gap: 2rem;
  padding-block: 1.25rem;
}

.research-section > h2 { font-size: 1rem; }

.research-page { font-size: 1.06rem; }
.research-page .page-heading { margin-bottom: 0.5rem; }
.research-page .research-section > h2 { font-size: 1.06rem; }
.research-page .project summary { font-size: 1.12rem; }
.research-page .project-outcomes { font-size: 0.94rem; }

.research-section a {
  text-decoration-color: var(--accent);
  text-decoration-thickness: 0.1em;
  text-underline-offset: 0.2em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: background-color 120ms ease;
}

.research-section a:hover,
.research-section a:focus-visible {
  background-color: rgba(136, 28, 28, 0.16);
  border-radius: 0.15rem;
  outline: none;
}

.dot-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dot-list li {
  position: relative;
  display: block;
  padding-left: 1.35rem;
}
.dot-list li + li { margin-top: 0.3rem; }

.dot-list li::before {
  content: "·";
  position: absolute;
  left: 0;
  top: 0;
  width: 1rem;
  color: var(--accent);
  font-weight: 700;
  text-align: center;
}

.project-list { min-width: 0; }

.project {
  padding-block: 1.25rem;
}

.project:first-child { padding-top: 0; }

.project details { margin: 0; }

.project summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 1.05rem;
  font-weight: 600;
  list-style: none;
}

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

.project summary::before {
  content: "+";
  display: inline-block;
  color: var(--accent);
  margin-right: 0.65rem;
  width: 0.8rem;
}

.project details[open] summary::before { content: "−"; }

.project-outline {
  border: 1px solid var(--line);
  margin: 1.25rem 0 0 1.45rem;
  padding: 1rem 1rem 1rem 2rem;
}

.project-outline li + li { margin-top: 0.8rem; }

.project-outcomes {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 1rem 0 0 1.45rem;
  padding-left: 1rem;
}

.project-outcomes li + li { margin-top: 0.4rem; }
.project-outcomes b { color: var(--text); }

.teaching-group + .teaching-group { margin-top: 3rem; }

.teaching-group > h2 {
  font-size: 1.08rem;
  margin-bottom: 1.15rem;
}

.teaching-place {
  border: 0;
}

.teaching-place + .teaching-place { margin-top: 1.4rem; }

.teaching-place h3 {
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.45rem;
}

.course-list { margin: 0; }

.course-list > div {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 1rem;
  border: 0;
  line-height: 1.35;
  padding-block: 0.08rem;
}

.course-list > div::before,
.course-list > div::after { content: none; }

.course-list dt {
  color: var(--muted);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}

.course-list dd { margin: 0; }

.course-meta {
  color: var(--muted);
  font-size: 0.82em;
}

.course-detail {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 1rem;
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 0.35rem;
}

.course-detail span {
  font-size: 0.76rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.course-detail p { margin: 0; }

.bare-course-list {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
}

.bare-course-list li + li { margin-top: 0.1rem; }

@media (min-width: 1280px) {
  .course-list > div > dd { white-space: nowrap; }
  .course-detail p { white-space: normal; }
}

.interest-bubbles {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.interest-bubbles details {
  flex: 0 1 auto;
  border: 1px solid var(--line);
  background: var(--bg);
}

.interest-bubbles details[open] {
  flex-basis: min(100%, 18rem);
  position: relative;
}

.interest-bubbles details[open]::after {
  content: "";
  position: absolute;
  left: 1.25rem;
  bottom: -0.55rem;
  width: 0.9rem;
  height: 0.9rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  transform: rotate(45deg);
}

.interest-bubbles summary {
  cursor: pointer;
  list-style: none;
  padding: 0.65rem 0.9rem;
  white-space: nowrap;
}

.interest-bubbles summary::-webkit-details-marker { display: none; }

.interest-bubbles summary::after {
  content: "+";
  color: var(--muted);
  margin-left: 0.75rem;
}

.interest-bubbles details[open] summary::after { content: "−"; }

.bubble-content {
  aspect-ratio: 1 / 1;
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 1rem;
}

.bubble-content p { margin: 0; }

footer {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 3rem;
  padding-block: 1.5rem 3rem;
}

@media (max-width: 700px) {
  main, footer { width: min(100% - 2rem, 78rem); }
  .site-frame { width: min(100% - 2rem, 90rem); }
  .nav { flex-wrap: wrap; gap: 0 1rem; padding-block: 0.65rem; }
  .site-name { flex: 1 1 auto; }
  .theme-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .nav-links { order: 3; flex-basis: 100%; padding-top: 0.45rem; }
  .nav-links a { height: 2.25rem; padding-inline: 0.7rem; }
  .intro { grid-template-columns: 1fr; min-height: auto; padding-block: 4rem; }
  .portrait { width: min(15rem, 65vw); }
  .home-photo { width: min(100%, 28rem); }
  .inner-page { padding-block: 3.5rem; }
  .page-content > section { grid-template-columns: 1fr; gap: 1rem; }
  main > section:not(.intro) { grid-template-columns: 1fr; gap: 1rem; padding-block: 2.75rem; scroll-margin-top: 6.5rem; }
  .research-section { grid-template-columns: 1fr; gap: 1rem; }
  .course-list > div { grid-template-columns: 6.5rem minmax(0, 1fr); gap: 0.8rem; }
  .course-detail { grid-template-columns: 1fr; gap: 0.35rem; }
  .interest-bubbles details[open] { flex-basis: 100%; }
}

@media (max-width: 900px) {
  .site-frame { grid-template-columns: 1fr; gap: 0; }
  .site-header .profile-bar {
    position: static;
    display: grid;
    grid-template-columns: var(--profile-photo-column, 5rem) minmax(0, 1fr);
    gap: var(--profile-card-gap, 1rem);
    width: min(100% - 2rem, 90rem);
    margin: 0 auto;
    padding-block: 0.8rem 0.45rem;
    visibility: visible;
  }
  .site-header .profile-photo {
    width: var(--profile-photo-size, 5rem);
    opacity: var(--profile-detail-opacity, 1);
  }
  .profile-name { margin-top: 0; }
  .site-header .profile-title {
    max-height: var(--profile-title-height, 4rem);
    margin-top: var(--profile-title-margin, 0.35rem);
    overflow: hidden;
    opacity: var(--profile-detail-opacity, 1);
  }
  .profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 1rem;
    max-height: var(--profile-meta-height, 5rem);
    margin-top: var(--profile-meta-margin, 0.8rem);
    overflow: hidden;
    opacity: var(--profile-detail-opacity, 1);
  }
  .profile-meta li + li { margin-top: 0; }

  .site-header .site-name { display: none; }

  .nav-links a,
  .nav-links a[aria-current="page"] {
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .nav-links a[aria-current="page"] { color: var(--accent); }

  .site-header:not(.is-compact) .nav { justify-content: flex-end; }

  .site-header.is-compact .profile-title,
  .site-header.is-compact .profile-meta {
    pointer-events: none;
  }
}

@media (max-width: 420px) {
  .course-list > div { grid-template-columns: 1fr; gap: 0.25rem; }
  .course-list dt br { display: none; }
}

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