:root {
  --ink: #17211f;
  --muted: #56615e;
  --paper: #fffdf8;
  --canvas: #f4f0e7;
  --sage: #6d826e;
  --sage-dark: #405845;
  --terracotta: #d36749;
  --peach: #e9b49c;
  --line: #d7d2c6;
  --white: #ffffff;
  --shadow: 0 24px 70px rgba(32, 43, 38, 0.11);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 7rem;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(64, 88, 69, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(64, 88, 69, 0.035) 1px, transparent 1px),
    var(--canvas);
  background-size: 40px 40px;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body.nav-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

img {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 3rem));
  margin-inline: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  padding: 0.75rem 1rem;
  color: var(--white);
  background: var(--ink);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid transparent;
  background: rgba(244, 240, 231, 0.85);
  backdrop-filter: blur(18px);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.site-header.scrolled {
  border-color: rgba(23, 33, 31, 0.1);
  box-shadow: 0 8px 30px rgba(23, 33, 31, 0.06);
}

.nav {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  text-decoration: none;
}

.wordmark-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  color: var(--canvas);
  background: var(--ink);
  font-family: var(--serif);
  font-size: 0.9rem;
  letter-spacing: -0.04em;
}

.wordmark-name {
  font-size: 0.93rem;
  letter-spacing: 0.02em;
}

.wordmark-sep {
  color: var(--muted);
  font-size: 0.93rem;
  font-weight: 500;
}

.wordmark-title {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.wordmark-crest {
  width: auto;
  height: 22px;
  margin-left: 0.05rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-links a {
  position: relative;
  font-size: 0.88rem;
  font-weight: 650;
  text-decoration: none;
}

.nav-links > a:not(.nav-contact)::after {
  position: absolute;
  right: 0;
  bottom: -0.35rem;
  left: 0;
  height: 1px;
  content: "";
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 180ms ease;
}

.nav-links > a:not(.nav-contact):hover::after,
.nav-links > a:not(.nav-contact):focus-visible::after {
  transform: scaleX(1);
  transform-origin: left;
}

.nav-contact {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.62rem 1rem;
  border-radius: 999px;
  color: var(--white);
  background: var(--ink);
  line-height: 1;
}

.nav-contact .link-icon {
  transform: translateY(0.5px);
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  background: transparent;
}

.nav-toggle span:not(.sr-only) {
  display: block;
  width: 24px;
  height: 2px;
  margin: 6px auto;
  background: var(--ink);
  transition: transform 180ms ease;
}

.profile-section {
  padding-block: clamp(4.5rem, 8vw, 7.5rem);
}

.profile-grid {
  max-width: 980px;
}

.eyebrow,
.section-label {
  margin: 0 0 1.1rem;
  color: var(--sage-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.profile-copy h1,
.research-heading h2,
.section-heading h2 {
  margin: 0 0 1.5rem;
  font-family: var(--serif);
  font-size: clamp(1.75rem, 2.6vw, 2.35rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.profile-copy h1 {
  width: fit-content;
  font-weight: 700;
  cursor: default;
  transition: color 260ms ease;
}

.profile-copy h1:hover {
  color: var(--terracotta);
  animation: name-wiggle 540ms ease;
}

@keyframes name-wiggle {
  0%, 100% { transform: rotate(0); }
  30% { transform: rotate(-2.2deg); }
  60% { transform: rotate(1.4deg); }
  82% { transform: rotate(-0.7deg); }
}

.profile-copy::after {
  display: table;
  clear: both;
  content: "";
}

.profile-copy > p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 1.12rem;
}

.profile-copy .about-lead {
  max-width: 780px;
  margin-bottom: 1.25rem;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.45rem, 2.4vw, 2rem);
  letter-spacing: -0.025em;
  line-height: 1.35;
}

.profile-copy .fellowship-note {
  max-width: 780px;
  margin-bottom: 1.25rem;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.45rem, 2.4vw, 2rem);
  letter-spacing: -0.025em;
  line-height: 1.35;
}

.profile-copy a {
  color: var(--sage-dark);
}

.hero-links {
  display: flex;
  margin-top: 2.25rem;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.4rem;
}

.button {
  display: inline-flex;
  min-height: 50px;
  padding: 0.72rem 1.25rem;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 3px;
  font-size: 0.9rem;
  font-weight: 750;
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-2px);
}

.button-primary {
  color: var(--white);
  background: var(--ink);
  box-shadow: 6px 6px 0 var(--peach);
}

.button-primary:hover {
  box-shadow: 3px 3px 0 var(--peach);
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.91rem;
  font-weight: 700;
  text-decoration: none;
}

.paper-links span,
.paper-row > a span,
.row-links span {
  display: inline-block;
  transition: transform 160ms ease;
}

.paper-links a:hover span,
.paper-row > a:hover span,
.row-links a:hover span {
  transform: translate(2px, -2px);
}

.link-icon {
  width: 1.05rem;
  height: 1.05rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.github-link .link-icon {
  fill: currentColor;
  stroke: none;
}

.portrait-wrap {
  position: relative;
  float: right;
  width: 250px;
  margin: 0.2rem 0 1rem 2.4rem;
}

.portrait-accent {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 56%;
  height: 54%;
  background: var(--peach);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 22% 100%);
  transition: transform 420ms ease;
}

.portrait {
  position: relative;
  z-index: 1;
  width: 250px;
  margin: 0;
  padding: 0.4rem;
  background: var(--paper);
  box-shadow: 0 12px 32px rgba(32, 43, 38, 0.12);
  transform: rotate(-1deg);
  transition: transform 420ms cubic-bezier(0.2, 0.8, 0.3, 1), box-shadow 420ms ease;
}

.portrait-wrap:hover .portrait {
  transform: rotate(1.5deg) scale(1.05);
  box-shadow: 0 22px 50px rgba(32, 43, 38, 0.2);
}

.portrait-wrap:hover .portrait-accent {
  transform: translate(7px, -7px) rotate(4deg);
}

/* Push the portrait into the right gutter only when the layout has room,
   so narrower windows never gain a horizontal scrollbar. */
@media (min-width: 1120px) {
  .portrait-wrap {
    margin-right: -4rem;
  }
}

@media (min-width: 1280px) {
  .portrait-wrap {
    margin-right: -7rem;
  }
}

.portrait img {
  width: 100%;
  height: 287px;
  object-fit: cover;
  object-position: 50% 47%;
  filter: saturate(0.88) contrast(1.02);
}

.research-block {
  margin-top: clamp(4rem, 8vw, 7rem);
  padding-top: clamp(3rem, 5vw, 4.5rem);
  border-top: 1px solid var(--line);
}

.research-heading {
  margin-bottom: 2.5rem;
}

.research-heading h2 {
  margin: 0;
}

.section {
  padding-block: clamp(5rem, 10vw, 9rem);
}

.section-heading {
  display: grid;
  margin-bottom: clamp(2.5rem, 5vw, 5rem);
  align-items: end;
  grid-template-columns: 1.15fr 0.65fr;
  gap: 3rem;
}

.section-heading h2 {
  margin: 0;
}

.simple-heading {
  display: block;
}

.section-heading > p {
  max-width: 430px;
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 1.04rem;
}

.section-heading > p a {
  color: var(--sage-dark);
  font-weight: 700;
}

.section-heading > p a.scholar-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.research-grid {
  display: grid;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  grid-template-columns: repeat(3, 1fr);
}

.research-card {
  position: relative;
  min-height: 370px;
  padding: 2rem;
  overflow: hidden;
  border-right: 1px solid var(--line);
}

.research-card:last-child {
  border-right: 0;
}

.card-number {
  color: var(--terracotta);
  font-family: var(--serif);
  font-size: 0.95rem;
  font-style: italic;
}

.research-card h3 {
  max-width: 250px;
  margin: 4.5rem 0 1.25rem;
  font-family: var(--serif);
  font-size: clamp(1.75rem, 2.6vw, 2.35rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.research-card p {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.topic-line {
  position: absolute;
  right: -25%;
  bottom: -55%;
  width: 90%;
  aspect-ratio: 1;
  border: 1px solid var(--peach);
  border-radius: 50%;
  transition: transform 350ms ease;
}

.research-card:hover .topic-line {
  transform: translate(-1rem, -1rem) scale(1.08);
}

.publications-section {
  background: var(--paper);
}

.featured-papers {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.paper-card {
  padding: clamp(1.5rem, 3.5vw, 2.6rem);
  border: 1px solid var(--line);
  background: var(--white);
}

.paper-card.featured {
  display: flex;
  min-height: 560px;
  flex-direction: column;
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.paper-card.featured:hover {
  border-color: var(--sage);
  box-shadow: 0 20px 50px rgba(23, 33, 31, 0.08);
  transform: translateY(-4px);
}

.paper-meta {
  display: flex;
  margin-bottom: 2.5rem;
  justify-content: space-between;
  gap: 1rem;
  color: var(--sage-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.paper-image {
  width: 100%;
  height: 292px;
  margin-bottom: 1.6rem;
  border: 1px solid rgba(64, 88, 69, 0.16);
  object-fit: cover;
  object-position: 50% 0;
}

.paper-card h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.55rem, 2.7vw, 2.2rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.12;
}

.authors {
  margin: 1.4rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.authors strong,
.paper-row strong {
  color: var(--ink);
}

.paper-summary {
  margin: 1.5rem 0 2rem;
  color: var(--muted);
  font-size: 0.94rem;
}

.paper-links {
  display: flex;
  margin-top: auto;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.paper-links a,
.paper-row > a,
.row-links a {
  color: var(--sage-dark);
  font-size: 0.83rem;
  font-weight: 800;
  text-decoration: none;
}

.paper-links a:has(.arxiv-logo) {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.arxiv-logo {
  display: block;
  width: auto;
  height: 0.95rem;
}

.more-papers {
  margin-top: clamp(4rem, 8vw, 7rem);
}

.more-papers-title {
  margin: 0 0 1.5rem;
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 500;
}

.paper-row {
  display: grid;
  padding: 1.65rem 0;
  align-items: start;
  border-top: 1px solid var(--line);
  grid-template-columns: 80px minmax(0, 1fr) auto;
  gap: 1.5rem;
}

.paper-row:last-child {
  border-bottom: 1px solid var(--line);
}

.paper-year {
  color: var(--terracotta);
  font-family: var(--serif);
  font-style: italic;
}

.paper-row h4 {
  margin: 0 0 0.5rem;
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.paper-row p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.paper-row .venue {
  margin-top: 0.35rem;
  color: var(--sage-dark);
  font-weight: 700;
}

.row-links {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.background-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: clamp(2rem, 7vw, 7rem);
}

.timeline > h3,
.education > h3 {
  margin: 0 0 2rem;
  color: var(--sage-dark);
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.timeline article {
  position: relative;
  display: grid;
  min-height: 125px;
  padding: 0 0 2rem 2.5rem;
  grid-template-columns: 130px 1fr;
  gap: 1.25rem;
}

.timeline article:not(:last-child)::before {
  position: absolute;
  top: 12px;
  bottom: -12px;
  left: 5px;
  width: 1px;
  content: "";
  background: var(--line);
}

.timeline-marker {
  position: absolute;
  top: 6px;
  left: 0;
  width: 11px;
  height: 11px;
  border: 2px solid var(--canvas);
  border-radius: 50%;
  background: var(--terracotta);
  box-shadow: 0 0 0 1px var(--terracotta);
}

.timeline-date,
.education-year {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.timeline h4,
.education h4 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.education h4 {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.edu-logo {
  width: auto;
  height: 1.5rem;
  flex: none;
}

.timeline p,
.education p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.education {
  padding: 2.2rem;
  background: #e5e9df;
}

.education article {
  padding: 1.7rem 0;
  border-top: 1px solid rgba(64, 88, 69, 0.2);
}

.education article:last-child {
  padding-bottom: 0;
}

.education .detail {
  font-size: 0.78rem;
}

.footer {
  padding-block: 1.6rem;
  color: #c4cbc7;
  background: var(--ink);
}

.footer .shell {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
}

.footer p {
  margin: 0;
  font-size: 0.78rem;
}

.footer div div {
  display: flex;
  gap: 1.4rem;
}

.footer a {
  font-size: 0.78rem;
  text-decoration: none;
}

.footer a:hover {
  color: var(--paper);
}

.reveal {
  opacity: 1;
  transform: none;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid var(--terracotta);
  outline-offset: 4px;
}

@media (max-width: 920px) {
  .portrait-wrap {
    width: 156px;
    margin-right: 0;
    margin-left: 1.8rem;
  }

  .portrait {
    width: 156px;
  }

  .portrait img {
    height: 179px;
  }

  .section-heading {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .research-grid {
    grid-template-columns: 1fr;
  }

  .research-card {
    min-height: auto;
    padding: 2.25rem 1rem 2.5rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .research-card:last-child {
    border-bottom: 0;
  }

  .research-card h3 {
    margin-top: 2.5rem;
  }

  .background-grid {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 2rem, 1180px);
  }

  .nav {
    min-height: 68px;
  }

  .nav-toggle {
    display: block;
    position: relative;
    z-index: 3;
  }

  .nav-toggle[aria-expanded="true"] span:nth-of-type(2) {
    transform: translateY(4px) rotate(45deg);
  }

  .nav-toggle[aria-expanded="true"] span:nth-of-type(3) {
    transform: translateY(-4px) rotate(-45deg);
  }

  .nav-links {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    height: 100dvh;
    z-index: 2;
    display: flex;
    padding: 7rem 2rem 3rem;
    align-items: flex-start;
    flex-direction: column;
    gap: 1.25rem;
    overflow-y: auto;
    background: var(--paper);
    backdrop-filter: none;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-1rem);
    transition: opacity 180ms ease, transform 180ms ease;
  }

  .nav-links.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .nav-links a {
    font-family: var(--serif);
    font-size: 2rem;
    font-weight: 500;
  }

  .nav-contact {
    margin-top: 0;
    padding: 0;
    gap: 0.6rem;
    border-radius: 0;
    color: var(--ink);
    background: transparent;
    font-family: var(--serif) !important;
    font-size: 2rem !important;
    font-weight: 500;
  }

  .nav-contact .link-icon {
    width: 1.6rem;
    height: 1.6rem;
  }

  .wordmark-name,
  .wordmark-sep {
    display: none;
  }

  .wordmark {
    gap: 0.4rem;
    min-width: 0;
  }

  .wordmark-title {
    font-size: 0.66rem;
    letter-spacing: -0.005em;
    line-height: 1.2;
    white-space: nowrap;
  }

  .wordmark-crest {
    height: 17px;
  }

  .profile-section {
    padding-block: 3.5rem 5rem;
  }

  .profile-grid {
    max-width: none;
  }

  .hero-links {
    display: grid;
    align-items: center;
    justify-content: start;
    grid-template-columns: repeat(3, auto);
    gap: 1rem 1.4rem;
  }

  .portrait-wrap {
    width: 126px;
    margin: 0.1rem 0 0.75rem 1.2rem;
  }

  .portrait {
    width: 126px;
  }

  .portrait img {
    height: 145px;
  }

  .featured-papers {
    grid-template-columns: 1fr;
  }

  .paper-card.featured {
    min-height: auto;
  }

  .paper-meta {
    margin-bottom: 2.5rem;
  }

  .paper-links {
    margin-top: 1rem;
  }

  .paper-row {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .paper-row > a,
  .paper-row > .row-links {
    grid-column: 2;
  }

  .row-links {
    flex-direction: row;
  }

  .timeline article {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .education {
    padding: 1.5rem;
  }

  .button-light {
    width: 100%;
    overflow-wrap: anywhere;
  }

  .footer .shell {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.75rem;
  }
}

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

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

}
