:root {
  --bg: #ffffff;
  --text: #20313f;
  --muted: #5e7186;
  --link: #003e74;
  --link-hover: #006eaf;
  --accent: #b5895a;
  --rule: #dde3e6;
  --card-bg: #ffffff;
  --card-shadow: 0 1px 3px rgba(20, 40, 70, 0.06);
  --teaser-bg: #f0f2f4;
  --teaser-text: #8a97a3;
  --max-width: 880px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 56px 24px 96px;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--link-hover); text-decoration: underline; }

h1, h2, h3 { font-weight: 600; margin: 0; line-height: 1.25; }
h1 { font-size: 2.4rem; letter-spacing: -0.02em; }
h2 {
  font-size: 1.55rem;
  color: var(--link);
  margin: 56px 0 24px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
  position: relative;
}
h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 52px;
  height: 3px;
  background-color: var(--accent);
}
h3 { font-size: 1.06rem; margin: 0 0 6px; }

p { margin: 0 0 12px; }

/* Header */
header {
  display: flex;
  gap: 36px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.headshot {
  width: 280px;
  height: 280px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--teaser-bg);
  padding: 4px;
  background-color: #fff;
  border: 1px solid var(--rule);
  box-shadow: 0 4px 14px rgba(0, 33, 71, 0.10);
}

.intro { flex: 1; min-width: 0; }
.intro h1 { color: #002147; margin-bottom: 4px; }
.affiliation { color: var(--muted); margin-top: 4px; font-size: 1rem; }
.bio { margin-top: 14px; }

.links-row {
  margin-top: 22px;
  font-size: 0.95rem;
}
.links-row a {
  display: inline-block;
  color: var(--link);
  border: 1px solid var(--rule);
  padding: 6px 14px;
  border-radius: 999px;
  margin: 0 6px 6px 0;
  transition: all 0.15s ease;
  text-decoration: none;
}
.links-row a:hover {
  background-color: #eaf3fa;
  border-color: #eaf3fa;
  color: #002147;
  text-decoration: none;
}

/* Publications — card style */
.pub {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
  background-color: var(--card-bg);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: var(--card-shadow);
}

.teaser {
  flex: 1 1 35%;
  min-width: 220px;
  max-width: 320px;
  background: var(--teaser-bg);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--teaser-text);
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  padding: 10px;
  overflow: hidden;
}
/* Empty placeholders keep a fixed shape */
.teaser:not(:has(img)):not(:has(video)) {
  aspect-ratio: 16 / 10;
}
/* Teasers with real media size to the media's natural aspect, capped by height */
.teaser:has(img), .teaser:has(video) {
  background: transparent;
  padding: 0;
  max-height: 240px;
}
.teaser img, .teaser video {
  max-width: 100%;
  max-height: 240px;
  width: auto;
  height: auto;
  display: block;
  border-radius: 6px;
}

/* Two-media teaser: side by side */
.teaser.teaser-grid {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}
.teaser.teaser-grid img, .teaser.teaser-grid video {
  flex: 1 1 0;
  min-width: 0;
  max-width: calc(50% - 3px);
  max-height: 240px;
  object-fit: contain;
}

/* Crop teaser to show only right half of the source video */
.teaser.teaser-crop-right {
  overflow: hidden;
  aspect-ratio: 2 / 3;
  min-width: 160px;
  max-width: 200px;
  max-height: 300px;
}
.teaser.teaser-crop-right video {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  object-position: right center;
  display: block;
  border-radius: 6px;
}

/* Pub variant: narrower composite inside the teaser (keeps teaser column
   same width as other pubs so pub-body text aligns). */
.pub.pub-narrow-teaser > .teaser { max-height: none; }
.pub.pub-narrow-teaser > .teaser > video {
  max-width: 248px;
  max-height: none;
  margin: 0 auto;
}

/* Pub variant: teaser video stretches to card height (fills empty space below) */
.pub.pub-fill-teaser { align-items: stretch; }
.pub.pub-fill-teaser > .teaser { max-height: none; }
.pub.pub-fill-teaser > .teaser > video,
.pub.pub-fill-teaser > .teaser > img {
  max-height: 100%;
  max-width: 100%;
  width: auto;
  height: auto;
  margin: auto;
}

/* Grid teaser: plot on top, videos below, independent height ratio */
.teaser.teaser-plot-vids {
  display: grid;
  grid-template-rows: 3fr 2fr;   /* plot : videos */
  gap: 4px;
  width: 100%;
  height: 240px;
  max-height: 240px;
  padding: 0;
  background: transparent;
}
.teaser.teaser-plot-vids video {
  width: 100%;
  height: 100%;
  max-height: 100%;
  max-width: 100%;
  min-height: 0;
  object-fit: contain;
  display: block;
  border-radius: 6px;
}

/* Four-media teaser: 2×2 grid */
.teaser.teaser-quad {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  align-items: center;
  justify-content: center;
  max-height: none;
}
.teaser.teaser-quad img, .teaser.teaser-quad video {
  width: 100%;
  height: auto;
  max-height: 130px;
  object-fit: contain;
  display: block;
  border-radius: 6px;
}

/* Two-media teaser: stacked vertically, both same width */
.teaser.teaser-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  justify-content: center;
  max-height: none;
}
.teaser.teaser-stack img, .teaser.teaser-stack video {
  width: 100%;
  height: auto;
  max-height: none;
  display: block;
  border-radius: 6px;
}

.pub-body { flex: 1 1 55%; min-width: 0; }
.pub-body h3 a { color: #002147; }
.pub-body h3 a:hover { color: var(--link-hover); }
.pub-body .authors { margin: 4px 0 2px; font-size: 0.95rem; color: #3a4a5a; line-height: 1.55; }
.pub-body .authors strong { font-weight: 600; }
.pub-body .venue { margin: 0 0 8px; font-size: 0.92rem; font-style: italic; color: var(--muted); }
.pub-body .badge {
  font-style: italic;
  color: var(--accent);
  font-weight: 500;
  font-size: 0.85rem;
  margin-left: 4px;
}
.pub-body .tldr { margin: 6px 0 10px; font-size: 0.95rem; color: #3a4a5a; line-height: 1.55; }
.pub-body .pub-links { font-size: 0.92rem; color: var(--muted); margin-top: 4px; }
.pub-body .pub-links a { margin-right: 2px; font-weight: 500; }
.pub-body .pub-links .sep { margin: 0 6px; color: var(--muted); }
.pub-body .pub-links .coming { font-style: italic; color: var(--muted); font-weight: 400; }

/* Earlier work collapsed */
details.earlier { margin-top: 8px; }
details.earlier > summary {
  cursor: pointer;
  color: var(--link);
  font-size: 0.95rem;
  padding: 12px 0;
  list-style: none;
  user-select: none;
  font-weight: 500;
}
details.earlier > summary::-webkit-details-marker { display: none; }
details.earlier > summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.15s;
}
details.earlier[open] > summary::before { content: "▾ "; }
details.earlier > summary:hover { text-decoration: underline; }

/* Footer */
footer {
  margin-top: 72px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

/* Mobile */
@media (max-width: 768px) {
  main { padding: 32px 18px 64px; }
  header { flex-direction: column; gap: 20px; align-items: center; text-align: left; }
  .headshot { width: 170px; height: 170px; }
  /* Stretch children to full width (default flex-start on desktop would left-align them) */
  .pub { flex-direction: column; gap: 14px; padding: 18px; align-items: stretch; }
  .teaser { max-width: 100%; }
  /* Override desktop width constraints so narrow-teaser pubs fill mobile width */
  .pub.pub-narrow-teaser > .teaser { flex: 1 1 auto; width: 100%; max-width: 100%; }
  .pub.pub-narrow-teaser > .teaser > video { max-width: 100%; }
  /* Only empty placeholders get a forced aspect */
  .teaser:not(:has(img)):not(:has(video)) { aspect-ratio: 16 / 9; }
  /* Real media teasers scale to natural aspect — drop desktop height caps */
  .teaser:has(img), .teaser:has(video) { max-height: none; }
  .teaser img, .teaser video { max-height: none; }
  .teaser.teaser-quad img, .teaser.teaser-quad video { max-height: none; }
  .teaser.teaser-grid img, .teaser.teaser-grid video { max-height: none; }
  h1 { font-size: 2rem; }
  h2 { font-size: 1.35rem; margin: 40px 0 20px; }
}
