:root {
  --bg: #f7f5f1;
  --paper: #ffffff;
  --fg: #1f1d24;
  --muted: #5e5a66;
  --rule: #e4e0d8;
  --accent: #a33d12;
  --accent-soft: #fbeee6;
  --nav-bg: #17131f;
  --nav-fg: #e9e4f0;
  --nav-hot: #f39a3c;
  --serif: "Source Serif 4", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #110f15;
    --paper: #1a1720;
    --fg: #ebe7f0;
    --muted: #a49eae;
    --rule: #2e2a36;
    --accent: #f39a3c;
    --accent-soft: #33241a;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 4rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1.0625rem/1.6 var(--sans);
}
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }

.page {
  max-width: 64rem;
  margin: 0 auto;
  padding-inline: 1rem;
}

/* ---------- Masthead: title, banner, menu bar ---------- */
.masthead { padding-top: 1.75rem; }
.site-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding-bottom: 1rem;
}
.site-title a {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.site-title p {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  color: var(--muted);
}

.banner {
  position: relative;
  margin: 0;
  background: #07060c;
}
.banner img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 1;
  object-fit: cover;
}
.banner figcaption {
  position: absolute;
  right: 0.75rem;
  bottom: 0.5rem;
  padding: 0.1rem 0.45rem;
  border-radius: 2px;
  background: rgba(7, 6, 12, 0.78);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
}

.site-nav {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: var(--nav-bg);
}
.nav-toggle {
  display: none;
  width: 100%;
  padding: 0.75rem 1rem;
  border: 0;
  background: none;
  color: var(--nav-fg);
  font: 600 1rem var(--sans);
  text-align: left;
  cursor: pointer;
}
.menu, .sub { list-style: none; margin: 0; padding: 0; }
.menu { display: flex; flex-wrap: wrap; }
.menu > li { position: relative; }
.menu a {
  display: block;
  color: var(--nav-fg);
  text-decoration: none;
}
.menu > li > a {
  padding: 0.7rem 1.1rem;
  font-weight: 600;
  border-bottom: 3px solid transparent;
}
.menu > li > a[aria-current="page"] { border-bottom-color: var(--nav-hot); }
.menu > li:hover > a, .menu > li:focus-within > a { color: var(--nav-hot); }
.has-sub > a::after {
  content: "";
  display: inline-block;
  margin-left: 0.4rem;
  border: 0.28rem solid transparent;
  border-top-color: currentColor;
  border-bottom-width: 0;
  vertical-align: 0.15em;
}
.sub {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  min-width: 15rem;
  padding: 0.35rem 0;
  background: var(--nav-bg);
  border-top: 3px solid var(--nav-hot);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}
.sub a { padding: 0.45rem 1.1rem; font-size: 0.95rem; }
.sub a:hover, .sub a:focus { background: #2a2335; color: var(--nav-hot); }
.has-sub:hover > .sub, .has-sub:focus-within > .sub { display: block; }

@media (max-width: 44rem) {
  .js .nav-toggle { display: block; }
  .js .site-nav:not(.open) .menu { display: none; }
  .menu { flex-direction: column; padding-bottom: 0.5rem; }
  .menu > li > a { padding: 0.55rem 1rem; border-bottom: 0; }
  .menu > li > a[aria-current="page"] { color: var(--nav-hot); }
  .has-sub > a::after { display: none; }
  .sub {
    display: block;
    position: static;
    min-width: 0;
    padding: 0 0 0.25rem 1rem;
    border-top: 0;
    box-shadow: none;
  }
  .sub a { padding: 0.3rem 1rem; color: #bdb5c9; }
}

/* ---------- Body: content + sidebar ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 15.5rem;
  gap: 2.5rem;
  padding: 2.25rem 2rem 3rem;
  background: var(--paper);
}
@media (max-width: 52rem) {
  .layout { grid-template-columns: 1fr; gap: 2rem; padding: 1.75rem 1.1rem 2.5rem; }
}

h1, h2, h3 { font-family: var(--serif); line-height: 1.25; }
h1 { font-size: 2rem; margin: 0 0 1rem; }
h2 { font-size: 1.4rem; margin: 2.25rem 0 0.75rem; }
h3 { font-size: 1.12rem; margin: 1.6rem 0 0.4rem; }
.content > :first-child { margin-top: 0; }
.lede { font-size: 1.18rem; line-height: 1.55; }
.kicker {
  margin: 0 0 0.3rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

/* Sidebar */
.sidebar { font-size: 0.95rem; }
.sidebar img {
  display: block;
  width: 100%;
  max-width: 15.5rem;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 3px;
}
.sidebar h2 {
  margin: 1.5rem 0 0.4rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.sidebar p { margin: 0.5rem 0; line-height: 1.45; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { padding: 0.3rem 0; border-bottom: 1px solid var(--rule); }
.sidebar li:last-child { border-bottom: 0; }
@media (max-width: 52rem) {
  .sidebar {
    display: grid;
    grid-template-columns: 8rem 1fr;
    gap: 0 1.25rem;
    border-top: 1px solid var(--rule);
    padding-top: 1.5rem;
  }
  .sidebar img { grid-row: span 3; }
  .sidebar h2:first-of-type { margin-top: 0; }
}

/* Research highlight cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1rem;
  margin: 1rem 0 0.5rem;
}
.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  background: var(--paper);
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #fff;
  border-bottom: 1px solid var(--rule);
}
.card div { padding: 0.75rem 0.9rem 0.9rem; }
.card h3 { margin: 0 0 0.3rem; font-size: 1.02rem; color: var(--accent); }
.card p { margin: 0; font-size: 0.92rem; line-height: 1.45; color: var(--muted); }

/* Figures */
figure.fig { margin: 1.5rem 0; }
figure.fig img { display: block; border: 1px solid var(--rule); background: #fff; }
figure.fig figcaption { margin-top: 0.5rem; font-size: 0.88rem; color: var(--muted); line-height: 1.5; }

/* Publications */
.pubs { list-style: none; padding: 0; margin: 0; }
.pubs li { padding: 0.9rem 0; border-bottom: 1px solid var(--rule); }
.pubs li:last-child { border-bottom: 0; }
.pubs .title { display: block; font-family: var(--serif); font-size: 1.08rem; font-weight: 600; line-height: 1.35; }
.pubs .title a { color: var(--fg); text-decoration: none; }
.pubs .title a:hover { color: var(--accent); text-decoration: underline; }
.pubs .authors, .pubs .venue { display: block; font-size: 0.93rem; color: var(--muted); }
.pubs .venue em { color: var(--fg); }
.pubs .summary { margin: 0.35rem 0 0.3rem; font-size: 0.97rem; }
.pubs .more { font-size: 0.88rem; }
.pubs .more a + a { margin-left: 0.9rem; }
.pubs .year {
  display: inline-block;
  margin-right: 0.4rem;
  padding: 0 0.35rem;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
}

/* Footer */
.site-footer {
  padding-block: 1.25rem 2rem;
  font-size: 0.88rem;
  color: var(--muted);
}
.site-footer p { margin: 0; }
