:root {
  color-scheme: light;
  --page: #fdfbfc;
  --ink: #261b29;
  --muted: #645668;
  --accent: #7b317c;
  --accent-hover: #5c235e;
  --line: #eadfe9;
  --tint: #f5eaf4;
  font-family: "Source Serif 4", Georgia, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 1.75rem; }
body { margin: 0; background: var(--page); color: var(--ink); font-size: 1rem; line-height: 1.62; }
a { color: inherit; text-underline-offset: .23em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
img { display: block; max-width: 100%; }
h1, h2, h3, p, ul { margin: 0; }
h1 { font-size: clamp(1.75rem, 4.5vw, 2.55rem); letter-spacing: normal; line-height: 1.12; font-weight: 600; }
h2 { font-size: 1.3rem; line-height: 1.32; font-weight: 650; }
h3 { font-size: 1rem; line-height: 1.45; font-weight: 650; }
p { color: var(--muted); }
.skip:not(:focus) { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
.skip { position: fixed; z-index: 3; top: .5rem; left: .5rem; padding: .5rem 1rem; background: var(--page); }

.layout {
  display: grid;
  grid-template-columns: 11.25rem minmax(0, 1fr);
  width: min(100% - 4rem, 68.25rem);
  margin-inline: auto;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
  padding-block: clamp(2.5rem, 7vw, 5.25rem) 4rem;
}
.sidebar { position: sticky; top: 2.5rem; }
.sidebar nav { display: grid; gap: .35rem; border-left: 1px solid var(--line); }
.sidebar nav a {
  padding: .35rem .65rem .35rem .85rem;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: .9rem;
  text-decoration: none;
  transition: background-color .22s ease, border-color .22s ease, color .22s ease;
}
.sidebar nav a:hover, .sidebar nav a[aria-current="location"] { color: var(--accent); }
.sidebar nav a[aria-current="location"] { border-color: var(--accent); background: var(--tint); font-weight: 600; }
.nav-leaf { margin-inline-start: .15em; }

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(11rem, 21vw, 15.25rem);
  grid-template-areas: "copy portrait";
  column-gap: clamp(1rem, 4.5vw, 3rem);
  row-gap: 1.15rem;
  align-items: center;
}
.intro-copy { grid-area: copy; }
.role { margin-top: .35rem; color: var(--accent); font-weight: 500; }
.portrait-panel { grid-area: portrait; align-self: center; }
.portrait {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: .75rem;
  box-shadow: 0 0 0 1px var(--line);
}
.bio {
  max-width: 34rem;
  margin-top: .9rem;
  font-size: 1rem;
  line-height: 1.43;
  text-align: justify;
  text-align-last: start;
  text-wrap: pretty;
  hyphens: none;
  word-break: normal;
  overflow-wrap: normal;
}
.bio p + p { margin-top: .55rem; }
.bio strong { font-weight: 600; }
.bio .unbroken { white-space: nowrap; }
.cv-link {
  margin-top: 1rem;
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: .48rem .7rem .48rem .85rem;
  border-radius: .45rem;
  background: var(--accent);
  color: #fff;
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
}
.cv-link:hover { background: var(--accent-hover); color: #fff; }
.cv-link span { padding: .06rem .28rem; border: 1px solid #ffffff60; border-radius: .25rem; font-size: .7rem; }
.social, .topics, .paper-list, .record-list { padding: 0; list-style: none; }
.social { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .2rem .45rem; margin-top: .6rem; font-size: .875rem; }
.social a { color: var(--muted); text-decoration-color: #c3a9c3; }
.social a:hover { color: var(--accent); }

.research { margin-top: 1.65rem; margin-bottom: 1.5rem; }
.research h2 { font-size: 1rem; letter-spacing: -.015em; }
.topics { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: .65rem; margin-top: .7rem; font-size: .875rem; }
.topics li { display: grid; place-items: center; padding: .48rem .63rem; border-radius: .4rem; background: var(--tint); color: var(--accent); text-align: center; }
.section { padding-block: 1.65rem; border-top: 1px solid var(--line); }
.paper-list, .record-list { margin-top: .6rem; }
.paper-list > li, .record-list > li { display: grid; column-gap: 1.2rem; padding-block: .84rem; border-bottom: 1px solid var(--line); }
.paper-list > li:last-child, .record-list > li:last-child { border-bottom: 0; padding-bottom: 0; }
.paper-list > li { grid-template-columns: 13.25rem minmax(0, 1fr); align-items: start; }
.venue { margin-top: .09rem; color: var(--accent); font-size: .875rem; font-weight: 600; line-height: 1.4; }
.venue abbr { text-decoration: none; }
.under-review { color: var(--muted); font-weight: 500; }
.paper-list h3 a { text-decoration-color: #d8cce4; }
.paper-list h3 a:hover { text-decoration-color: currentColor; }
.authors { margin-top: .22rem; font-size: .875rem; }
.authors strong { color: var(--ink); font-weight: 600; }

.record-list > li { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; row-gap: .15rem; }
.record-list p { font-size: .9rem; }
.record-meta { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.gpa { width: fit-content; margin-top: .45rem; padding: .2rem .58rem; border-radius: .4rem; background: var(--tint); color: var(--accent); font-variant-numeric: tabular-nums; }
.gpa span { color: var(--muted); }
.rank { margin-top: .35rem; }
#teaching { margin-top: 1.55rem; }
.teaching > li { padding-block: .55rem; }
.teaching h3 { font-weight: 500; }

.outdoors-intro { margin-top: .35rem; }
.gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; margin-top: .95rem; }
.nature-mark { font-size: .85em; }
.gallery img { width: 100%; height: auto; border-radius: .55rem; }
.contact-card { padding: clamp(1rem, 3vw, 1.6rem); border: 1px solid var(--line); border-radius: .7rem; background: var(--tint); }
.contact-card h2 + p { margin-top: .5rem; }
.contact-email { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .6rem; margin-top: .85rem; color: var(--accent); }
.contact-email strong { color: var(--ink); font-size: .875rem; }
.contact-email span { font-size: .9rem; }

@media (max-width: 840px) {
  .layout { width: calc(100% - 2rem); grid-template-columns: 10.5rem minmax(0, 1fr); gap: 1.4rem; }
  .paper-list > li { grid-template-columns: minmax(0, 1fr); row-gap: .35rem; }
}
@media (max-width: 640px) {
  html { scroll-padding-top: 5.5rem; }
  .layout { display: block; padding-block: .85rem 2rem; }
  .sidebar { top: 0; z-index: 2; margin-bottom: 1.45rem; padding-block: .3rem .45rem; border-bottom: 1px solid var(--line); background: var(--page); }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: .15rem .35rem; border: 0; }
  .sidebar nav a { padding: .3rem .32rem; margin: 0; border: 0; border-radius: .35rem; font-size: .875rem; }
  .intro { grid-template-columns: minmax(0, 1fr) clamp(8rem, 39vw, 10.5rem); grid-template-areas: "heading portrait" "bio bio" "cv cv" "social social"; }
  .intro-copy, .portrait-panel { display: contents; }
  .intro-heading { grid-area: heading; }
  .bio { grid-area: bio; max-width: 22.125rem; margin-top: 0; }
  .cv-link { grid-area: cv; justify-self: start; margin-top: 0; }
  .portrait { grid-area: portrait; aspect-ratio: .95; }
  .social { grid-area: social; justify-content: flex-start; gap: .2rem .9rem; margin-top: 0; }
  .topics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topics li:last-child { grid-column: 1 / -1; }
  .research { margin-top: 1.35rem; }
  .record-list:not(.teaching) > li { grid-template-columns: 1fr; }
  .record-list:not(.teaching) .record-meta { text-align: left; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (width < 640px) {
  .bio { text-align: left; }
}
@media (max-width: 350px) {
  .cv-link { padding-inline: .55rem; gap: .35rem; font-size: .825rem; }
  .topics { grid-template-columns: 1fr; }
  .teaching > li { grid-template-columns: 1fr; }
  .teaching .record-meta { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .sidebar nav a { transition: none; }
}

.photo-gallery { margin-top: 24px; }
.photo-gallery-header { display: flex; justify-content: space-between; align-items: center; gap: .65rem; margin-bottom: .45rem; }
.photo-gallery-controls:not([hidden]) { display: flex; align-items: center; gap: .4rem; }
.photo-dots { display: flex; align-items: center; gap: .3rem; margin-inline-end: .3rem; }
.photo-dots i { width: 6px; height: 6px; border-radius: 50%; background: #d9c5d7; }
.photo-dots .current { background: var(--accent); }

.photo-gallery-controls button, .photo-viewer > button, .viewer-stage > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  line-height: 0;
  cursor: pointer;
}
.photo-gallery-controls button { width: 2rem; height: 2rem; color: var(--accent); border-color: #d7bdd4; }
.photo-gallery-controls button:hover { background: var(--tint); }
.photo-gallery-controls button[aria-disabled="true"], .viewer-stage > button[aria-disabled="true"] { opacity: .35; cursor: default; background: transparent; }

.gallery-viewport {
  padding: 16px 12px 24px;
  margin: -8px -12px -12px;
  scroll-padding-inline: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
}
.photo-track {
  display: flex;
  gap: 10px;
  transition: transform .55s cubic-bezier(.22, 1, .36, 1);
}
@media (width >= 640px) {
  .photo-strip.is-paged { overflow: hidden; scroll-snap-type: none; }
  .is-paged .photo-track { --photo-page-gap: 24px; }
  .is-paged .photo-track a:nth-child(5) { margin-inline-end: calc(var(--photo-page-gap) - 10px); }
  .photo-track.second-page { transform: translateX(calc(-100% - var(--photo-page-gap))); }
}
.photo-strip::-webkit-scrollbar { display: none; }
.photo-strip a {
  position: relative;
  flex: 0 0 calc((100% - 40px) / 5);
  min-width: 0;
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: opacity .3s ease, transform .3s ease, box-shadow .3s ease;
}
.photo-strip a:nth-child(5n + 1) { scroll-snap-align: start; }
.photo-strip a:focus-visible { outline-offset: -3px; z-index: 2; }
.photo-strip img { width: 100%; height: 100%; object-fit: cover; }
.photo-strip a:first-child img { object-position: 50% 75%; }
.photo-strip a:last-child img { object-position: 50% 65%; }
.photo-expand {
  position: absolute;
  top: 7px;
  right: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgb(20 14 20 / .55);
  backdrop-filter: blur(4px);
  color: white;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
.photo-strip a:focus-visible .photo-expand { opacity: 1; }

@media (hover: hover) and (pointer: fine) {
  .photo-track:has(a:hover) a:not(:hover) { opacity: .55; }
  .photo-strip a:hover { z-index: 2; transform: translateY(-3px) scale(1.05); box-shadow: 0 10px 24px rgb(107 45 92 / .18); }
  .photo-strip a:hover .photo-expand { opacity: 1; }
}
@media (width >= 640px) {
  .photo-strip a:nth-child(5n + 1) { transform-origin: left center; }
  .photo-strip a:nth-child(5n) { transform-origin: right center; }
}

html:has(.photo-viewer[open]) { overflow: hidden; }
.photo-viewer {
  --viewer-height: min(74vh, 620px, calc(100dvh - 8rem), calc((100vw - 7rem) * 16 / 9));
  --viewer-button-size: 2.4rem;
  position: fixed;
  inset: 0;
  z-index: 9999;
  box-sizing: border-box;
  width: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  padding: 3rem .55rem 1rem;
  background: transparent;
  color: #f9f1f8;
  overflow: hidden auto;
  overscroll-behavior: contain;
  opacity: 0;
  transition: opacity .28s ease;
}
.photo-viewer[open] { display: grid; place-items: center; }
.photo-viewer::backdrop { background: rgb(18 12 18 / .92); backdrop-filter: blur(8px); opacity: 0; transition: opacity .28s ease; }
.photo-viewer.is-visible, .photo-viewer.is-visible::backdrop { opacity: 1; }
.photo-viewer:focus-visible, .photo-viewer :focus-visible { outline-color: #f9f1f8; }
.photo-viewer .viewer-close { position: absolute; z-index: 30; top: .8rem; right: .8rem; width: var(--viewer-button-size); height: var(--viewer-button-size); border-color: #ffffff66; }
.viewer-content {
  width: 100%;
  min-width: 0;
  transform: scale(.96);
  transition: transform .28s ease;
}
.photo-viewer.is-visible .viewer-content { transform: scale(1); }
.viewer-stage {
  position: relative;
  height: calc(var(--viewer-height) + 1.25rem);
  overflow: clip;
  touch-action: pan-y pinch-zoom;
}
.viewer-stage > button {
  position: absolute;
  top: 50%;
  z-index: 20;
  width: var(--viewer-button-size);
  height: var(--viewer-button-size);
  border-color: #ffffff66;
  transform: translate(-50%, -50%);
}
.viewer-prev { left: calc(50% - var(--viewer-arrow-offset, 28px)); }
.viewer-next { left: calc(50% + var(--viewer-arrow-offset, 28px)); }
.photo-viewer button:hover { background-color: #ffffff1c; }
.viewer-cards { position: absolute; inset: 0; pointer-events: none; }
.viewer-card {
  position: absolute;
  top: 50%;
  left: 50%;
  height: var(--viewer-height);
  aspect-ratio: 9 / 16;
  padding: 0;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  background: transparent var(--photo-thumb) center / contain no-repeat;
  box-shadow: 0 .45rem 2rem #0008;
  transform: translate(-50%, -50%) translateX(var(--card-x, 0px)) scale(var(--card-scale, 1));
  opacity: var(--card-opacity, 0);
  z-index: var(--card-order, 1);
  pointer-events: none;
  transition: transform .48s cubic-bezier(.22, 1, .36, 1), opacity .45s ease, filter .45s ease;
}
.viewer-card img { width: 100%; height: 100%; object-fit: contain; }
.viewer-card img:not(.is-loaded) { visibility: hidden; }
.viewer-card[data-slot="active"], .viewer-card[data-slot="near"], .viewer-card[data-slot="outer"] { pointer-events: auto; }
.viewer-card[data-slot="near"], .viewer-card[data-slot="outer"] { cursor: pointer; }
.viewer-card:is([data-slot="near"], [data-slot="outer"]):is(:hover, :focus-visible) { opacity: .65; }
.photo-viewer:not(.is-visible) .viewer-card { transition: none; }
.viewer-meta { display: grid; justify-items: center; padding-inline: .5rem; text-align: center; font-size: .95rem; line-height: 1.3; color: #eadcea; }
.viewer-caption-content { grid-area: 1 / 1; }
.viewer-caption-outgoing { pointer-events: none; }
.viewer-counter { display: block; margin-top: .2rem; font-size: .8rem; color: #c9b6c8; font-variant-numeric: tabular-nums; }

@media (width >= 900px) {
  .photo-viewer { --viewer-height: min(74vh, 620px, calc(100dvh - 8rem), calc((100vw - 2rem) * .46)); }
}
@media (width < 640px) {
  .photo-gallery-controls:not([hidden]) button { display: none; }
  .photo-dots { margin-inline-end: 0; }
  .photo-strip a { flex-basis: 36%; scroll-snap-align: start; }
  .photo-viewer { --viewer-button-size: 2.1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .photo-strip { scroll-behavior: auto; }
  .photo-track, .photo-strip a, .photo-expand, .photo-viewer, .photo-viewer::backdrop,
  .viewer-content, .viewer-card { transition: none; }
  .photo-strip a:hover { transform: none; }
}
