/* ==========================================================================
   Design tokens
   ========================================================================== */

:root {
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
    "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;

  --ink: #16191d;
  --ink-soft: #4a5058;
  --ink-faint: #767d86;
  --line: #e2e5e9;
  --line-soft: #eef0f3;
  --bg: #fffaf0;
  --bg-soft: #f7f8fa;
  --accent: #8a1c1c;
  --accent-soft: #f4e9e9;

  --wrap: 1120px;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 20, 26, 0.04),
    0 12px 32px -18px rgba(16, 20, 26, 0.18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8eaed;
    --ink-soft: #b3b9c1;
    --ink-faint: #8b929b;
    --line: #2b3038;
    --line-soft: #23272e;
    --bg: #14171b;
    --bg-soft: #1a1e23;
    --accent: #e0837f;
    --accent-soft: #2e2020;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -18px rgba(0, 0, 0, 0.7);
  }
}

/* ==========================================================================
   Base
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 0.6em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 1.4rem + 2.4vw, 2.9rem);
}
h2 {
  font-size: clamp(1.5rem, 1.25rem + 1vw, 1.85rem);
}
h3 {
  font-size: 1.2rem;
}

p {
  margin: 0 0 1.1em;
}

a {
  color: var(--accent);
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-color: currentColor;
}

img,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

ul,
ol {
  padding-left: 1.2em;
}

li {
  margin-bottom: 0.35em;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 3rem 0;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--bg-soft);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ==========================================================================
   Layout helpers
   ========================================================================== */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.section {
  padding-block: clamp(2.75rem, 5vw, 4.5rem);
  border-top: 1px solid var(--line-soft);
}

.section--plain {
  border-top: 0;
}

.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-bottom: 1.75rem;
}

.section__head h2 {
  margin: 0;
}

.eyebrow {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 0.75rem;
}

.muted {
  color: var(--ink-soft);
}

.link-more {
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.link-more::after {
  content: " \2192";
}

.link-more:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Skip link
   ========================================================================== */

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100%;
  z-index: 100;
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
}

.skip-link:focus {
  top: 1rem;
}

/* ==========================================================================
   Site header / navigation
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
}

.brand {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover {
  color: var(--accent);
}

.nav__toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  font: inherit;
  font-size: 0.9rem;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  padding: 0.4rem 0.7rem;
  cursor: pointer;
}

.nav__list {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav__list a {
  display: block;
  padding: 0.45rem 0.7rem;
  border-radius: 7px;
  font-size: 0.9375rem;
  color: var(--ink-soft);
  text-decoration: none;
}

.nav__list a:hover {
  color: var(--ink);
  background: var(--bg-soft);
}

.nav__list a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 500;
}

@media (max-width: 780px) {
  .nav__toggle {
    display: inline-flex;
  }

  .nav__list {
    display: none;
    position: absolute;
    left: 1rem;
    right: 1rem;
    top: calc(100% + 0.5rem);
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.5rem;
  }

  .nav[data-open="true"] .nav__list {
    display: flex;
  }
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  padding-block: clamp(1.75rem, 4vw, 2.75rem) clamp(2.5rem, 5vw, 4.5rem);
}

.intro {
  display: flow-root;
}

.portrait {
  float: left;
  width: 120px;
  height: 150px;
  margin: 10px 16px 10px 0;
  object-fit: cover;
  object-position: center top;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.intro__name {
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: 0;
  margin: 0.55rem 0 0;
}

.intro__lines {
  margin: 0;
  line-height: 1.55;
}

.intro__lines em a {
  color: var(--ink);
  font-style: italic;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--bg);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn--solid {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn--solid:hover {
  color: #fff;
  filter: brightness(1.12);
}

.contact-list {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.contact-list li {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
  color: var(--ink-soft);
}

.contact-list dt,
.contact-list .label {
  color: var(--ink-faint);
  min-width: 4.25rem;
  flex: none;
}

/* ==========================================================================
   News
   ========================================================================== */

/* Fixed-height pane so a long news list does not dominate the page. */
.news-window {
  max-height: 26rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.25rem 1.25rem 0.25rem 0;
  border-right: 1px solid transparent;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.news-window::-webkit-scrollbar {
  width: 8px;
}

.news-window::-webkit-scrollbar-track {
  background: var(--bg-soft);
  border-radius: 999px;
}

.news-window::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
}

.news-window::-webkit-scrollbar-thumb:hover {
  background: var(--ink-faint);
}

.news {
  list-style: none;
  margin: 0;
  padding: 0;
}

.news > li {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 0 1.5rem;
  padding-block: 1.05rem;
  border-top: 1px solid var(--line);
  margin: 0;
}

.news > li:first-child {
  padding-top: 0.35rem;
}

.news time {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  padding-top: 0.32rem;
}

.news p {
  margin: 0;
}

.news strong {
  font-weight: 600;
  color: var(--ink);
}

@media (max-width: 560px) {
  .news > li {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}

/* ==========================================================================
   Cards (research areas, teaching)
   ========================================================================== */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.card {
  margin: 0;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.card h3 {
  margin-bottom: 0.4rem;
}

.card p:last-child {
  margin-bottom: 0;
}

.card__meta {
  font-size: 0.8125rem;
  color: var(--ink-faint);
  margin-bottom: 0.75rem;
}

/* ==========================================================================
   Publications
   ========================================================================== */

.pub-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.pub-filters button {
  font: inherit;
  font-size: 0.875rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-soft);
  cursor: pointer;
}

.pub-filters button:hover {
  color: var(--ink);
  border-color: var(--ink-faint);
}

.pub-filters button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.pub-year {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
}

.pub-year:first-of-type {
  margin-top: 0;
}

.pubs {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pub {
  margin: 0 0 1.5rem;
  padding-left: 1.1rem;
  border-left: 2px solid var(--line);
}

.pub:hover {
  border-left-color: var(--accent);
}

.pub__title {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 0.25rem;
}

.pub__authors,
.pub__venue {
  font-size: 0.9375rem;
  margin: 0;
  color: var(--ink-soft);
}

.pub__authors .me {
  color: var(--ink);
  font-weight: 600;
}

.pub__venue {
  font-style: italic;
  color: var(--ink-faint);
}

.pub__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.8125rem;
}

.pub__links a {
  text-decoration: none;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.pub__links a:hover {
  text-decoration: underline;
}

.tag {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  vertical-align: 0.15em;
  margin-left: 0.4rem;
}

/* Pending outcomes read as neutral rather than as an achievement. */
.tag--pending {
  color: var(--ink-faint);
  background: var(--bg-soft);
  border: 1px solid var(--line);
}

.is-hidden {
  display: none !important;
}

/* ==========================================================================
   Teaching / definition tables
   ========================================================================== */

.stack-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.stack-list > li {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 0 1.5rem;
  padding-block: 1.1rem;
  border-top: 1px solid var(--line-soft);
  margin: 0;
}

.stack-list > li:first-child {
  border-top: 0;
}

.stack-list__key {
  font-size: 0.875rem;
  color: var(--ink-faint);
}

/* ==========================================================================
   Education / experience, shown as two columns
   ========================================================================== */

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: auto repeat(3, auto);
  column-gap: clamp(1.75rem, 4vw, 3.5rem);
  row-gap: 0.85rem;
  align-items: stretch;
}

/* Each column shares the other's row tracks, so paired cards match in height. */
.split > div {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span 4;
  min-width: 0;
}

.split > div > h2 {
  margin: 0 0 0.65rem;
}

.cv-list {
  list-style: none;
  display: grid;
  grid-template-rows: subgrid;
  grid-row: 2 / span 3;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.cv-item {
  margin: 0;
  height: 100%;
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cv-item:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: var(--shadow);
}

/* Logo shares a line with the institution name; the date sits under it. */
.cv-item__head {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  margin-bottom: 0.7rem;
}

.cv-item__head h3 {
  font-size: 1.0625rem;
  line-height: 1.3;
  margin: 0;
}

.cv-item__date {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0.25rem 0 0;
}

.cv-item > p {
  margin: 0;
}

/* Logos keep a white plate so dark marks stay legible in dark mode. */
.inst-logo {
  flex: none;
  width: 64px;
  height: 64px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px;
}

.inst-logo--wide {
  width: 128px;
}

@media (max-width: 640px) {
  .split {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }

  .split > div,
  .cv-list {
    display: grid;
    grid-template-rows: none;
    grid-row: auto;
    gap: 0.85rem;
  }

  .split > div > h2 {
    margin-bottom: 0.65rem;
  }
}

@media (max-width: 460px) {
  .cv-item__head {
    gap: 0.7rem;
  }

  .inst-logo {
    width: 54px;
    height: 54px;
    padding: 5px;
  }

  .inst-logo--wide {
    width: 112px;
  }
}

.stack-list h3 {
  font-size: 1.0625rem;
  margin-bottom: 0.2rem;
}

.stack-list p {
  margin: 0;
}

@media (max-width: 560px) {
  .stack-list > li {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}

/* ==========================================================================
   Project pages
   ========================================================================== */

.lede {
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 1.05rem + 0.7vw, 1.55rem);
  line-height: 1.35;
  color: var(--ink-soft);
  margin-top: -0.15rem;
}

.byline {
  color: var(--ink-soft);
  margin-bottom: 0;
}

.math {
  font-family: var(--font-serif);
  font-style: italic;
}

.math sub,
.math sup {
  font-style: normal;
}

.prose + .cards {
  margin-top: 0.4rem;
}

.figure {
  margin: 1.75rem 0 0;
}

.figure img,
.figure video {
  width: 100%;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.figure video {
  background: #111;
}

.figure figcaption {
  margin-top: 0.7rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.project-split {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: start;
}

.project-split .figure {
  margin-top: 0;
}

.mode-list {
  margin: 0.2rem 0 0;
  padding-left: 1.15rem;
}

.mode-list li {
  margin-bottom: 0.7rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  list-style: none;
  margin: 0 0 1.75rem;
  padding: 0;
}

.stat {
  margin: 0;
  padding: 1.1rem 1.15rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.stat strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 0.4rem;
}

.stat span {
  display: block;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.45;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.results {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.45;
}

.results caption {
  caption-side: bottom;
  text-align: left;
  padding: 0.85rem 1rem 1rem;
  color: var(--ink-faint);
  font-size: 0.875rem;
  line-height: 1.5;
}

.results th,
.results td {
  text-align: left;
  vertical-align: top;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line-soft);
}

.results thead th {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.results tbody th {
  font-weight: 600;
}

.results tr:last-child th,
.results tr:last-child td {
  border-bottom: 0;
}

.bib {
  margin: 0 0 1.1rem;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  white-space: pre-wrap;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.84rem;
  line-height: 1.55;
}

.bib code {
  background: none;
  padding: 0;
  font-size: inherit;
}

@media (max-width: 860px) {
  .project-split {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 520px) {
  .stats {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  margin-top: 4rem;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  padding-block: 2.5rem;
  font-size: 0.9375rem;
  color: var(--ink-soft);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 2rem;
}

.site-footer a {
  color: inherit;
}

.social {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

@media print {
  .site-header,
  .site-footer,
  .pub-filters,
  .quick-links {
    display: none;
  }
}

/* Publication list: [number] | title, authors, venue, link buttons | year */
.pub-year {
  display: none;
}

.pub {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  column-gap: 1rem;
  margin: 0;
  padding: 1.6rem 0;
  border-left: 0;
  border-top: 1px solid var(--line);
}

.pubs:last-of-type .pub:last-child {
  border-bottom: 1px solid var(--line);
}

.pub > * {
  grid-column: 2;
}

.pub__num,
.pub__year {
  grid-row: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.875rem;
  color: var(--ink-faint);
  padding-top: 0.3rem;
}

.pub__num {
  grid-column: 1;
}

.pub__year {
  grid-column: 3;
  text-align: right;
}

.pub__title {
  font-size: 1.25rem;
  font-weight: 700;
  max-width: none;
  text-wrap: wrap;
  margin-bottom: 0.45rem;
}

.pub__authors {
  margin-bottom: 0.3rem;
}

.pub__links {
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.pub__links a {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.35rem 0.8rem;
}

.pub__links a:hover {
  text-decoration: none;
  border-color: var(--ink-faint);
}

@media (max-width: 640px) {
  .pub {
    grid-template-columns: 2.8rem minmax(0, 1fr) auto;
    column-gap: 0.6rem;
  }
}
