:root {
  --band: #734332;
  --band-dark: #5e3628;
  --brown: #734332;
  --card: #ffffff;
  --hero-top: #f1e1dd;
  --brown-dark: #5e3628;
  --cream: #f1e1dd;
  --white: #fbf8f6;
  --ink: #1c1c1c;
  --muted: #5a5450;
  --rule: #e6ded9;
  --paper: #faf8f6;
  --serif: "Source Serif 4", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Inter", "Helvetica Neue", Arial, sans-serif;
  --display: "Cormorant Garamond", "Palatino Linotype", Palatino, Georgia, serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --wrap: 1200px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html { scroll-behavior: smooth; }
body { overflow-anchor: none; }
a { color: var(--brown); text-underline-offset: 3px; text-decoration-thickness: 1px; transition: color .2s ease; }
a:hover { color: var(--brown-dark); }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 28px; }

/* Masthead: name, title and menu share one band and one page width */
.masthead {
  position: sticky; top: 0; z-index: 50;
  background: var(--band); color: var(--white);
  transition: box-shadow .3s ease;
}
.masthead-inner, .name, .role { transition: padding .3s var(--ease), font-size .3s var(--ease), opacity .25s ease, max-height .3s var(--ease), margin .3s var(--ease); }
.role { max-height: 80px; overflow: hidden; }
.masthead.slim { box-shadow: 0 6px 20px -10px rgba(40, 20, 12, .55); }
.masthead.slim .masthead-inner { padding-top: 12px; padding-bottom: 12px; align-items: center; }
.masthead.slim .name { font-size: 30px; }
.masthead.slim .role { max-height: 0; opacity: 0; margin-top: 0; }
.masthead.slim .nav { padding-bottom: 0; }
.masthead-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
  padding-top: 32px;
  padding-bottom: 26px;
}
.masthead a { color: var(--white); }
.name {
  display: block;
  font-family: var(--display);
  font-weight: 600;
  font-size: 54px;
  line-height: 1.05;
  text-decoration: none;
  letter-spacing: 0.3px;
}
.role { margin: 10px 0 0; font-size: 19px; line-height: 1.45; color: var(--cream); }
.role a { color: var(--cream); }
.nav { display: flex; gap: 28px; font-family: var(--sans); font-size: 16px; font-weight: 500; letter-spacing: .2px; padding-bottom: 4px; }
.nav a { position: relative; text-decoration: none; padding-bottom: 4px; letter-spacing: 0.4px; }
.nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--cream); transform: scaleX(0); transform-origin: left;
  transition: transform .3s var(--ease);
}
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }

.nav { align-items: center; }
.theme-toggle {
  display: inline-grid; place-items: center; width: 36px; height: 36px; margin-left: 4px;
  border: 1px solid rgba(251, 248, 246, .45); border-radius: 50%; background: transparent; cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
}
.theme-toggle:hover { background: rgba(251, 248, 246, .14); border-color: var(--white); }
.theme-toggle:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: var(--white); stroke-width: 1.8; stroke-linecap: round; }
.theme-toggle .i-moon { fill: var(--white); stroke: none; }
:root[data-theme="dark"] .theme-toggle .i-moon, :root[data-theme="light"] .theme-toggle .i-sun { display: none; }

/* Intro */
/* Hero */
.hero { background: linear-gradient(180deg, var(--hero-top) 0%, var(--paper) 100%); }
.hero-inner {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 52px;
  align-items: start;
  padding-top: 48px;
  padding-bottom: 40px;
}
.headshot {
  width: 100%; height: auto; display: block; border-radius: 4px;
  box-shadow: 0 18px 40px -18px rgba(70, 35, 22, .45);
}
.eyebrow {
  font-family: var(--sans);
  margin: 0 0 10px; font-size: 12.5px; font-weight: 600;
  letter-spacing: 2.5px; text-transform: uppercase; color: var(--brown);
}
.tagline {
  margin: 0; font-family: var(--display); font-weight: 500;
  font-size: 32px; line-height: 1.2; color: var(--ink);
  margin-bottom: 18px;
}
.buttons { display: flex; flex-wrap: wrap; gap: 12px; margin: 22px 0 0; }
.btn {
  font-family: var(--sans); font-weight: 500;
  display: inline-block; padding: 10px 20px; border: 1px solid var(--brown); border-radius: 999px;
  font-size: 16px; line-height: 1.2; text-decoration: none; color: var(--brown); background: transparent;
  transition: background .25s ease, color .25s ease, transform .25s var(--ease), box-shadow .25s ease;
}
.btn:hover { background: var(--band); color: var(--white); transform: translateY(-2px); box-shadow: 0 8px 18px -10px rgba(70, 35, 22, .6); }
.btn-solid { background: var(--band); color: var(--white); border-color: var(--band); }
.btn-solid:hover { background: var(--band-dark); color: var(--white); }
.btn:focus-visible { outline: 2px solid var(--brown); outline-offset: 3px; }

/* Bio: links read as plain text and reveal themselves on hover */
.bio a.quiet { color: inherit; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; transition: color .2s ease, text-decoration-color .2s ease; }
.bio a.quiet:hover, .bio a.quiet:focus-visible { color: var(--brown); text-decoration-color: currentColor; }

/* Bio */
.bio p { margin: 0 0 12px; }

/* Recent work */
.recent { padding-top: 24px; padding-bottom: 48px; }
h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 38px;
  line-height: 1.15;
  color: var(--brown);
  margin: 0 0 28px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 44px 40px; }
.card {
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--rule); border-radius: 10px; overflow: hidden;
  transition: transform .35s var(--ease), box-shadow .35s ease, border-color .35s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 24px 44px -26px rgba(0, 0, 0, .55); border-color: color-mix(in srgb, var(--brown) 45%, var(--rule)); }
.js .card.reveal.in { transition: transform .35s var(--ease), box-shadow .35s ease, border-color .35s ease, opacity .8s var(--ease); }
.js .card.reveal.in:hover { transform: translateY(-4px); }
.card h3, .card p { padding: 0 20px; }
.card p { padding-bottom: 22px; }
.card h3 { font-size: 18px; line-height: 1.4; margin: 20px 0 8px; font-weight: 600; }
.card h3 a { color: var(--brown); }
.card p.card-kicker { margin: -2px 0 6px; padding-bottom: 0; font-family: var(--sans); font-size: 11.5px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.card p { margin: 0; font-size: 17px; line-height: 1.55; }
.fig {
  display: block; width: 100%; padding: 12px; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0;
  background: #ffffff; cursor: zoom-in; aspect-ratio: 16 / 10; overflow: hidden;
  transition: box-shadow .35s ease, transform .35s var(--ease), border-color .35s ease;
}
.fig img { width: 100%; height: 100%; object-fit: contain; display: block; transition: transform .5s var(--ease); }
.card:hover .fig img { transform: scale(1.03); }
.fig:focus-visible { outline: 2px solid var(--brown); outline-offset: 3px; }

/* Fellowships and support (Home) */
.support { padding-bottom: 64px; }
.support p { margin: 0; max-width: 72ch; }

/* Recent talks */
.news { padding-top: 0; padding-bottom: 48px; }
.talks-wrap { display: grid; grid-template-columns: 1fr 380px; gap: 40px; align-items: start; }
.talk-photo { margin: 0; }
.talk-photo img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; display: block; border: 1px solid var(--rule); }
.talk-photo figcaption { margin-top: 8px; font-size: 14.5px; color: var(--muted); font-style: italic; }
.talks { list-style: none; margin: 0; padding: 0; }
.talks li { display: grid; grid-template-columns: 80px 1fr; gap: 20px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.talks li:last-child { border-bottom: 0; }
.talk-date { color: var(--brown); font-family: var(--sans); font-size: 15px; font-weight: 600; padding-top: 3px; }

/* Inner pages */
.page { padding-top: 48px; padding-bottom: 64px; }
h1 { font-family: var(--display); font-weight: 600; font-size: 52px; line-height: 1.2; color: var(--brown); margin: 0 0 36px; }
.page section { margin-bottom: 52px; }
.page section:last-child { margin-bottom: 0; }
.lead { margin: 0 0 24px; }

/* Expandable items (papers, courses) */
.item { border-bottom: 1px solid var(--rule); }
.item summary {
  list-style: none;
  cursor: pointer;
  position: relative;
  padding: 18px 48px 18px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.item summary::-webkit-details-marker { display: none; }
.item summary::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  transition: transform .2s ease;
}
.item[open] summary::after { transform: translateY(-20%) rotate(-135deg); }
.item summary .item-title { transition: color .2s ease; }
.item summary:hover .item-title { color: var(--brown); }
.item summary:focus-visible { outline: 2px solid var(--brown); outline-offset: 2px; }
.item-title { font-weight: 600; line-height: 1.4; }
.item summary { gap: 4px; }
.item-meta { font-family: var(--sans); font-size: 14.5px; line-height: 1.55; color: var(--muted); }
.item-meta a { color: var(--brown); }
.abstract { padding: 0 48px 22px 0; }
.abstract p { margin: 0 0 10px; max-width: 72ch; }
.abstract ul { max-width: 72ch; }
.page h2 { margin-bottom: 18px; }
.page h2 + .item summary { padding-top: 6px; }
.fig.fig-inline { max-width: 640px; margin: 4px 0 16px; border: 1px solid var(--rule); border-radius: 8px; }
.paper-links { font-family: var(--sans); font-size: 14.5px; line-height: 1.7; color: var(--muted); margin: 0 0 14px !important; }
.abstract .sub { font-weight: 600; margin: 6px 0 4px; }
.abstract ul { margin: 0 0 12px; padding-left: 22px; }
.abstract li { margin: 2px 0; }
.item[open] .abstract { animation: reveal .22s ease; }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Paper tags and citations */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag {
  font-family: var(--sans);
  font-size: 12.5px; line-height: 1; letter-spacing: .4px; padding: 5px 10px; border-radius: 999px;
  background: var(--tag-bg, #f1e1dd); color: var(--tag-ink, #5e3628);
}
.cite { margin-top: 10px; }
.cite-btn, .copy-btn {
  font: inherit; font-size: 14px; cursor: pointer; border-radius: 999px; padding: 6px 14px;
  border: 1px solid var(--brown); background: transparent; color: var(--brown);
  transition: background .2s ease, color .2s ease;
}
.cite-btn:hover, .copy-btn:hover, .cite-btn[aria-expanded="true"] { background: var(--band); border-color: var(--band); color: var(--white); }
.cite-box {
  margin-top: 10px; padding: 14px 16px; border-left: 3px solid var(--brown); background: var(--card);
  border-radius: 0 6px 6px 0; display: flex; gap: 16px; align-items: flex-start; justify-content: space-between;
}
.cite-box[hidden] { display: none; }
.cite-text { margin: 0 !important; font-size: 15.5px; line-height: 1.55; }

/* Photos */
.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; }
.photos figure { margin: 0; }
.photos figure > img, .photos .ph { overflow: hidden; border-radius: 4px; }
.photos img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; border-radius: 4px; transition: transform .6s var(--ease), box-shadow .4s ease; }
.photos figure:hover img { transform: translateY(-3px); box-shadow: 0 22px 40px -22px rgba(70, 35, 22, .5); }
.photos figcaption { margin-top: 12px; font-size: 16px; line-height: 1.55; color: var(--ink); }
.photos figcaption strong { display: block; margin-bottom: 2px; font-weight: 600; }

/* Education journey (Teaching page) */
.journey { position: relative; padding-left: 34px; }
.journey::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px; background: var(--rule); }
.stage { position: relative; margin-bottom: 44px; }
.stage:last-child { margin-bottom: 0; }
.stage::before {
  content: ""; position: absolute; left: -34px; top: 7px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--brown);
}
.stage-head { margin: 0 0 8px; color: var(--muted); font-family: var(--sans); font-size: 14.5px; }
.stage-head strong { color: var(--brown); font-family: var(--serif); font-size: 20px; font-weight: 600; }
.stage > p { margin-top: 0; }
.stage .photos { margin-top: 20px; }

/* Footer */
.footer { font-family: var(--sans); background: var(--band); color: var(--cream); font-size: 15px; line-height: 1.7; padding: 36px 0 40px; }
.footer a { color: var(--cream); }

/* Lightbox */
.lightbox { border: 0; padding: 0; background: transparent; max-width: min(1100px, 86vw); max-height: 84vh; overflow: visible; border-radius: 6px; }
.lightbox::backdrop { background: rgba(20, 14, 12, 0.82); }
.lightbox img { display: block; max-width: min(1100px, 86vw); max-height: 84vh; background: #fff; border-radius: 6px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.6); }
.lightbox[open] { animation: rise .3s var(--ease); }
.lightbox .close {
  position: absolute; top: -16px; right: -16px; width: 38px; height: 38px; border: 0; border-radius: 50%;
  background: var(--white); box-shadow: 0 4px 14px rgba(0,0,0,.35);
  font-size: 26px; line-height: 38px; color: var(--ink); cursor: pointer;
}

/* Scroll reveal (only when JavaScript has run, so content never stays hidden) */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }
.js .hero-inner > * { animation: rise .9s var(--ease) both; }
.js .hero-text { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal, .js .hero-inner > * { opacity: 1; transform: none; transition: none; animation: none; }
}

/* Large screens: scale the whole design up so it fills wide monitors */
@media (min-width: 1700px) { .masthead, main, .footer { zoom: 1.1; } .grid { grid-template-columns: repeat(4, 1fr); gap: 36px 28px; } .card p { font-size: 16px; } }
@media (min-width: 2100px) { .masthead, main, .footer { zoom: 1.2; } }
@media (min-width: 2500px) { .masthead, main, .footer { zoom: 1.3; } }

/* Smooth page-to-page transitions (Chrome, Edge, Safari) */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .35s; }

/* 404 */
.notfound { min-height: 50vh; }
.notfound h1 { margin-bottom: 16px; }

/* Dark theme: follows the visitor's system setting, or forced with data-theme="dark" */
:root[data-theme="dark"] {
    --brown: #e0a990;
    --brown-dark: #f0c3ae;
    --paper: #171312;
    --card: #211b19;
    --hero-top: #2a1f1b;
    --ink: #ece4df;
    --muted: #c4b9b2;
    --rule: #3a302c;
    --tag-bg: #3a2a24;
    --tag-ink: #f1d3c6;
  }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brown: #e0a990;
    --brown-dark: #f0c3ae;
    --paper: #171312;
    --card: #211b19;
    --hero-top: #2a1f1b;
    --ink: #ece4df;
    --muted: #c4b9b2;
    --rule: #3a302c;
    --tag-bg: #3a2a24;
    --tag-ink: #f1d3c6;
  }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .headshot { box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .8); }
  :root:not([data-theme="light"]) .fig { background: #ffffff; }
  :root:not([data-theme="light"]) .lightbox .close { background: #ece4df; color: #1c1c1c; }
}
:root[data-theme="dark"] .stage::before { background: var(--paper); }
:root[data-theme="dark"] .headshot { box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .8); }
:root[data-theme="dark"] .fig { background: #f3eeeb; }
:root[data-theme="dark"] .fig img { filter: brightness(.94) contrast(1.02); transition: transform .5s var(--ease), filter .3s ease; }
:root[data-theme="dark"] .card:hover .fig img { filter: none; }
:root[data-theme="dark"] .lightbox .close { background: #ece4df; color: #1c1c1c; }

/* Small screens */
@media (max-width: 760px) {
  body { font-size: 17px; }
  .masthead-inner { flex-direction: column; align-items: flex-start; gap: 18px; padding-top: 32px; padding-bottom: 24px; }
  .name { font-size: 42px; }
  .role { font-size: 17px; }
  .nav { font-size: 15px; gap: 20px; }
  .masthead.slim .masthead-inner { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
  .wrap { padding: 0 20px; }
  .masthead.slim .name { font-size: 20px; white-space: nowrap; }
  .masthead.slim .nav { gap: 12px; font-size: 13.5px; }
  .masthead.slim .theme-toggle { display: none; }
  .hero-inner { grid-template-columns: 1fr; gap: 28px; padding-top: 36px; padding-bottom: 40px; }
  .headshot { max-width: 220px; }
  .tagline { font-size: 30px; }
  .buttons { margin-top: 24px; gap: 10px; }
  .btn { padding: 9px 16px; font-size: 15px; }
  h2 { font-size: 32px; }
  .grid { grid-template-columns: 1fr; }
  h1 { font-size: 40px; margin-bottom: 24px; }
  .page { padding-top: 32px; }
  .photos { grid-template-columns: 1fr; gap: 28px; }
  .talks li { grid-template-columns: 56px 1fr; gap: 12px; }
  .talks-wrap { grid-template-columns: 1fr; gap: 20px; }
  .cite-box { flex-direction: column; }
  .journey { padding-left: 26px; }
  .stage::before { left: -26px; }
  .item summary { padding-right: 36px; }
  .abstract { padding-right: 0; }
}

/* Leave room for the sticky header when jumping to a paper */
.item { scroll-margin-top: 110px; }

/* Very small phones: the name already links home, so the slim bar drops "Home" */
@media (max-width: 360px) {
  .masthead.slim .nav a:first-child { display: none; }
  .masthead.slim .name { font-size: 18px; }
}
