:root {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --text: #1d1d1f;
  --muted: #5f5f66;
  --faint: #6e6e75;
  --line: #e7e4df;
  --accent: #9b1c31;          /* Swarthmore garnet */
  --accent-soft: #f7ecee;
  --link: #1f5fbf;
  --chip: #f1efeb;
  --shadow: 0 1px 2px rgba(20, 20, 30, .06), 0 8px 24px rgba(20, 20, 30, .06);
  --radius: 12px;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15.5px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .25s ease, color .25s ease;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
strong { font-weight: 600; }
img { display: block; max-width: 100%; }

.wrap { max-width: 880px; margin: 0 auto; padding: 0 24px; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 20px; height: 56px; }
.brand {
  font-weight: 600; color: var(--text); letter-spacing: -.01em;
  opacity: 0; transform: translateY(4px); transition: opacity .25s, transform .25s;
}
.topbar.scrolled .brand { opacity: 1; transform: none; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 18px; margin-left: auto; font-size: 14px; }
.nav a { color: var(--muted); }
.nav a:hover, .nav a.active { color: var(--text); text-decoration: none; }

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: 1fr 220px; gap: 44px; align-items: center;
  padding: 112px 0 36px;
}
.hero h1 {
  font-size: 40px; line-height: 1.1; letter-spacing: -.025em; font-weight: 700;
  margin: 0 0 6px;
}
.hero .role {
  font-family: var(--mono); font-size: 13px; color: var(--accent);
  letter-spacing: .02em; margin: 0 0 20px;
}
.hero p { margin: 0 0 14px; }
.hero p.soft { color: var(--muted); }
.portrait { position: relative; width: 220px; aspect-ratio: 1; justify-self: end; }
.portrait img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
  box-shadow: var(--shadow);
}
.portrait::after {
  content: ""; position: absolute; inset: -8px; border-radius: 50%;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent);
  animation: spin 60s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.callout {
  margin: 18px 0 22px; padding: 12px 16px;
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  border-radius: 0 8px 8px 0; font-size: 15px;
}
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.links a {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--text); font-size: 14px; font-weight: 500;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.links a:hover { text-decoration: none; border-color: var(--faint); transform: translateY(-1px); box-shadow: var(--shadow); }
.links svg { width: 15px; height: 15px; flex: none; }

/* ---------- sections ---------- */
section { padding: 30px 0 10px; }
.sec-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 6px; }
h2 { font-size: 24px; letter-spacing: -.02em; font-weight: 700; margin: 0; }
.sec-head .count { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.sec-sub { color: var(--muted); margin: 0 0 18px; font-size: 14.5px; }

/* ---------- entries (pubs + projects) ---------- */
.entry {
  display: grid; grid-template-columns: 220px 1fr; gap: 26px;
  padding: 22px 0; border-top: 1px solid var(--line);
}
.entries > .entry:first-child { border-top: 0; }

.thumb {
  position: relative; width: 220px; aspect-ratio: 4 / 3; border-radius: 10px;
  overflow: hidden; background: var(--chip); cursor: zoom-in;
  box-shadow: 0 0 0 1px var(--line); align-self: start;
}
.thumb img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: opacity .45s ease, transform .6s ease;
}
.thumb img.contain { object-fit: contain; background: #fff; padding: 6px; }
.thumb .alt { opacity: 0; }
.thumb:hover .alt, .thumb:focus-visible .alt { opacity: 1; }
.thumb:hover img { transform: scale(1.03); }
.thumb .hint {
  position: absolute; right: 8px; bottom: 8px; z-index: 2;
  font: 500 10.5px/1 var(--mono); color: #fff; background: rgba(0, 0, 0, .55);
  padding: 4px 7px; border-radius: 4px; transition: opacity .3s; pointer-events: none;
}

.entry h3 { font-size: 16.5px; line-height: 1.35; margin: 0 0 4px; font-weight: 600; letter-spacing: -.01em; }
.entry h3 a { color: var(--text); }
.entry h3 a:hover { color: var(--link); }
.meta { font-size: 13.5px; color: var(--muted); margin: 0 0 2px; }
.meta .me { color: var(--text); font-weight: 600; }
.venue { font-size: 13.5px; font-style: italic; color: var(--muted); margin: 0 0 6px; }
.badge {
  display: inline-block; font: 600 10.5px/1 var(--mono); letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); padding: 4px 7px; border-radius: 4px;
  vertical-align: 2px; margin-left: 6px; font-style: normal;
}
.entry-links { font-size: 13.5px; margin: 2px 0 8px; }
.entry-links a + a::before { content: "/"; color: var(--faint); margin: 0 7px; display: inline-block; }
.entry p { margin: 6px 0 0; font-size: 14.5px; }
.entry ul { margin: 6px 0 0; padding-left: 18px; font-size: 14.5px; }
.entry li { margin: 3px 0; }
.entry li::marker { color: var(--faint); }

/* ---------- experience timeline ---------- */
.job {
  display: grid; grid-template-columns: 150px 1fr; gap: 24px;
  padding: 16px 0; border-top: 1px solid var(--line);
}
.job:first-child { border-top: 0; }
.when { font: 500 12.5px/1.6 var(--mono); color: var(--faint); padding-top: 2px; }
.job h3 { font-size: 16px; margin: 0; font-weight: 600; letter-spacing: -.01em; }
.job .org { color: var(--muted); font-size: 14px; margin: 0 0 6px; }
.job ul { margin: 0; padding-left: 18px; font-size: 14.5px; }
.job li { margin: 3px 0; }
.job li::marker { color: var(--faint); }

/* ---------- skills ---------- */
.skills { display: grid; grid-template-columns: 150px 1fr; gap: 12px 24px; font-size: 14.5px; margin: 8px 0 0; }
.skills dt { font: 500 12.5px/2 var(--mono); color: var(--faint); }
.skills dd { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--chip);
  border: 1px solid var(--line); color: var(--text);
}

/* ---------- footer ---------- */
footer { padding: 36px 0 56px; margin-top: 36px; border-top: 1px solid var(--line); color: var(--faint); font-size: 13px; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
footer a { color: var(--muted); }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 32px;
  background: rgba(10, 10, 12, .9); opacity: 0; pointer-events: none; transition: opacity .25s;
}
.lightbox.open { opacity: 1; pointer-events: auto; cursor: zoom-out; }
.lightbox img { max-width: min(1100px, 100%); max-height: 80vh; border-radius: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.lightbox p { color: #ddd; font-size: 14px; margin: 14px 0 0; text-align: center; max-width: 720px; }

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .portrait::after { animation: none; }
  html { scroll-behavior: auto; }
}

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .wrap { padding: 0 16px; }
  .nav { display: none; }
  .brand { opacity: 1; transform: none; }
  .topbar .wrap { justify-content: space-between; }
  .hero { grid-template-columns: 1fr; gap: 22px; padding-top: 84px; }
  .portrait { order: -1; width: 132px; justify-self: start; }
  .hero h1 { font-size: 32px; }
  .entry { grid-template-columns: 1fr; gap: 14px; }
  .thumb { width: 100%; }
  .job, .skills { grid-template-columns: 1fr; gap: 4px; }
  .skills dd { margin-bottom: 8px; }
}

/* ---------- compact publications + projects ---------- */
.entry { grid-template-columns: 190px 1fr; gap: 22px; padding: 18px 0; }
.thumb { width: 190px; }
.entry.pub { grid-template-columns: 130px 1fr; gap: 18px; padding: 12px 0; }
.entry.pub .thumb { width: 130px; }
.entry.pub h3 { font-size: 15.5px; }
.entry.pub .entry-links { margin-bottom: 0; }
.entry p { margin-top: 5px; }
section { padding-top: 24px; }

@media (max-width: 760px) {
  .entry, .entry.pub { grid-template-columns: 1fr; }
  .entry.pub { grid-template-columns: 96px 1fr; gap: 14px; }
  .entry.pub .thumb { width: 96px; }
  .thumb { width: 100%; }
}

.clubs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 24px; font-size: 14.5px; color: var(--muted); }
.clubs b { color: var(--text); font-weight: 600; }
@media (max-width: 760px) { .clubs { grid-template-columns: 1fr; } }
.job ul.clubs { padding-left: 0; }
.thumb.tall { width: 190px; aspect-ratio: 1; }
.thumb.tall img { object-position: 50% 62%; }
@media (max-width: 760px) { .thumb.tall { width: 100%; aspect-ratio: 4 / 3; } }

.print-contact, .print-block { display: none; }
@page { size: letter; margin: 0.5in 0.6in; }
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  html { scroll-padding-top: 0; }
  body { font-size: 10pt; line-height: 1.45; background: #fff; }
  .topbar, .lightbox, .links, .thumb .hint, .thumb .alt, .thumb video.hover, footer { display: none !important; }
  /* the PDF is a projects portfolio: the resume covers the rest */
  .callout, #publications, #experience, #skills, .sec-head .count, .sec-sub { display: none !important; }
  .entry.print-block { display: grid; }
  #projects .entry { grid-template-columns: 220px 1fr; gap: 18px; padding: 20px 0; }
  #projects .thumb { width: 220px; border-radius: 6px; }
  #projects .thumb.tall { width: 220px; aspect-ratio: 4 / 3; }
  #projects h3 { font-size: 11pt; }
  #projects .entries { display: flex; flex-direction: column; }
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  .wrap { max-width: none; padding: 0; }
  a { color: var(--link); text-decoration: none; }

  .hero { grid-template-columns: 1fr 112px; gap: 28px; padding: 0 0 6px; align-items: start; }
  .hero h1 { font-size: 24pt; margin-bottom: 2px; }
  .hero .role { margin-bottom: 10px; font-size: 9pt; }
  .hero p { margin-bottom: 6px; }
  .portrait { width: 112px; order: 0; justify-self: end; }
  .portrait::after { display: none; }
  .portrait img { box-shadow: none; }
  .callout { margin: 8px 0; padding: 6px 10px; font-size: 9.5pt; }
  .print-contact { display: flex; flex-wrap: wrap; gap: 3px 13px; margin: 8px 0 0; font-size: 8.5pt; color: var(--text); }
  .print-contact b { font: 500 7.5pt var(--mono); color: var(--faint); text-transform: uppercase; letter-spacing: .06em; margin-right: 4px; }
  .entry-links { font-family: var(--mono); font-size: 7.5pt; margin-top: 1px; }
  .entry-links a { font-weight: 500; color: #4a6fa5; }
  .entry-links a + a::before { content: "·"; margin: 0 6px; }

  section { padding: 12px 0 0; }
  .sec-head { margin-bottom: 2px; break-after: avoid; }
  h2 { font-size: 13.5pt; }
  .sec-sub { margin: 0 0 6px; font-size: 9.5pt; }

  .entry { grid-template-columns: 150px 1fr; gap: 16px; padding: 10px 0; break-inside: avoid; }
  .thumb { width: 150px; box-shadow: 0 0 0 0.5pt var(--line); }
  .thumb img { transform: none !important; }
  .thumb.tall { width: 150px; aspect-ratio: 4 / 3; }
  .entry.pub { grid-template-columns: 96px 1fr; gap: 14px; padding: 7px 0; }
  .entry.pub .thumb { width: 96px; }
  .entry h3 { font-size: 10.5pt; margin-bottom: 1px; }
  .meta, .venue, .entry-links { font-size: 9pt; margin: 0; }
  .entry p { font-size: 9.5pt; margin-top: 3px; }

  .job { grid-template-columns: 112px 1fr; gap: 16px; padding: 7px 0; break-inside: avoid; }
  .when { font-size: 8.5pt; }
  .job h3 { font-size: 10.5pt; }
  .job .org { font-size: 9.5pt; margin-bottom: 2px; }
  .job ul, .job li { font-size: 9.5pt; }
  .job li { margin: 1px 0; }
  #leadership { padding-top: 26px; }
  #leadership .job { padding: 12px 0; }

  .skills { grid-template-columns: 112px 1fr; gap: 5px 16px; font-size: 9pt; break-inside: avoid; }
  .skills dt { font-size: 8.5pt; line-height: 1.8; }
  .chip { font-size: 8.5pt; padding: 1px 7px; }
  .clubs { font-size: 9.5pt; }

  .entry, .job { border-top: 0 !important; }
  .clubs { grid-template-columns: 1fr 1fr; }

  footer { margin-top: 14px; padding: 8px 0 0; font-size: 8.5pt; }
}

/* ---------- blimp loop + viewer ---------- */
.entry.pub.lead { grid-template-columns: 190px 1fr; gap: 22px; }
.entry.pub.lead .thumb { width: 190px; }
.thumb video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
}
.job .thumb { width: 130px; margin-top: 10px; }
.thumb video::-webkit-media-controls-start-playback-button { display: none; }
.thumb video.hover { opacity: 0; transition: opacity .45s ease; pointer-events: none; }
.thumb:hover video.hover { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .thumb video { display: none; } }
.lightbox video { max-width: min(1100px, 100%); max-height: 80vh; border-radius: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.lightbox [hidden] { display: none; }
.lightbox:not(.open) { visibility: hidden; }
.lightbox:focus { outline: none; }
.thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- research layout: photo on the left, date at the far right of the title line ---------- */
@media screen and (min-width: 761px) {
  #experience .job { grid-template-columns: 215px 1fr; gap: 0 24px; }
  #experience .side { display: contents; }
  #experience .thumb { grid-column: 1; grid-row: 1; width: 215px; margin-top: 2px; }
  #experience .when { grid-column: 2; grid-row: 1; justify-self: end; padding-top: 2px; }
  #experience .when br { display: none; }
  #experience .job > div:last-child { grid-column: 2; grid-row: 1; }
  #experience .job h3 { padding-right: 150px; }
}

/* ---------- photo viewer controls, thumbnail dots, shared sizing ---------- */
.lightbox.open { cursor: default; }
.lightbox img, .lightbox video { max-height: 76vh; }
.lightbox .lb-count { font: 500 12px/1 var(--mono); color: #aaa; margin: 12px 0 0; min-height: 12px; }
.lightbox .lb-cap { margin-top: 8px; }
.lightbox button {
  position: absolute; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .14); color: #fff; font: 400 26px/1 var(--sans);
  cursor: pointer; display: grid; place-items: center;
}
.lightbox button:hover { background: rgba(255, 255, 255, .26); }
.lightbox button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.lb-close { top: 16px; right: 16px; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
@media (max-width: 760px) { .lb-prev { left: 6px; } .lb-next { right: 6px; } .lb-close { top: 8px; right: 8px; } }

/* Dots mark a photo with more than one view */
.thumb .hint {
  left: 50%; right: auto; bottom: 8px; transform: translateX(-50%);
  display: flex; gap: 5px; padding: 0; background: none; border-radius: 0;
}
.thumb .hint i { width: 6px; height: 6px; border-radius: 50%; background: #fff; opacity: .55; box-shadow: 0 0 3px rgba(0, 0, 0, .65); }
.thumb .hint i:first-child { opacity: 1; }
@media (hover: hover) {
  .thumb.has-alt:hover .hint i:first-child { opacity: .55; }
  .thumb.has-alt:hover .hint i:nth-child(2) { opacity: 1; }
}

.brand:focus-visible { opacity: 1; transform: none; }
.job li a, .job .org a, .entry p:not(.entry-links):not(.meta) a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

@media screen {
  .entry h3, .entry.pub h3, .job h3 { font-size: 16px; }
  .entry, .entry.pub, .job { padding-top: 16px; padding-bottom: 16px; }
  .meta, .venue, .entry-links, .job .org { font-size: 13.5px; }
  .job .entry-links { margin: 0 0 6px; }
  .entries > .print-block:first-child + .entry { border-top: 0; }
}
@media screen and (min-width: 761px) {
  #leadership .job, .skills { grid-template-columns: 190px 1fr; column-gap: 22px; }
  #leadership .when br { display: none; }
}

/* ---------- phones (screen only: a letter page is narrow enough to match this width too) ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (hover: none) {
  .thumb:hover .alt { opacity: 0; }
  .thumb:hover img { transform: none; }
}
@media screen and (max-width: 760px) {
  /* Section links replace the name in the bar; the name is right there in the header */
  .brand { display: none; }
  .topbar .wrap { height: 48px; }
  .nav { display: flex; width: 100%; margin: 0; justify-content: space-between; }
  .nav a { padding: 12px 0; }
  html { scroll-padding-top: 60px; }

  /* Header: name beside a small photo, so the links land on the first screen */
  .hero { grid-template-columns: 1fr 84px; gap: 0 16px; padding: 72px 0 8px; align-items: center; }
  .hero > div:first-child { display: contents; }
  .hero > div:first-child > * { grid-column: 1 / -1; }
  .hero > div:first-child > h1, .hero > div:first-child > .role { grid-column: 1; }
  .portrait { order: 0; grid-column: 2; grid-row: 1 / span 2; width: 84px; justify-self: end; }
  .portrait::after { display: none; }
  .hero h1 { font-size: 30px; margin-bottom: 4px; }
  .hero .role { font-size: 12px; line-height: 1.5; margin-bottom: 0; }
  .hero > div:first-child > p:nth-of-type(2) { margin-top: 16px; }
  .callout { margin: 14px 0 16px; }
  .links a { padding: 9px 13px; }

  section { padding: 24px 0 6px; }
  .reveal { opacity: 1; transform: none; transition: none; }

  .venue .badge { display: table; margin: 5px 0 0; }
  .entry:not(.pub) .thumb { aspect-ratio: 16 / 10; }
  .entry:not(.pub) .thumb.tall { aspect-ratio: 1; }
  .entry { gap: 10px; }

  /* One-line dates */
  .when br { display: none; }
  .job { gap: 2px; padding: 14px 0; }

  .lightbox { padding: 16px; }
  .lightbox img { max-height: 72vh; }

  .entry.pub.lead { grid-template-columns: 1fr; gap: 10px; }
  .entry.pub.lead .thumb { width: 100%; aspect-ratio: 4 / 3; }

  /* Research photos go below each job's text instead of between the date and title */
  .job > .side { display: contents; }
  .job .thumb { order: 2; width: 100%; aspect-ratio: 16 / 10; margin-top: 10px; }
}

/* The figure preview is cropped to 16:10 so it fills its frame */
#experience .thumb.fig { aspect-ratio: 16 / 10; background: #fff; }
