:root {
  --ink: #1a1a1a;
  --muted: #555;
  --accent: #7a1f2b;
  --line: #d9d9d9;
  --bg: #f4f4f2;
  --card: #ffffff;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
  line-height: 1.55;
}
.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}
header.site {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.5rem 1.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
header.site h1 {
  margin: 0 0 .35rem;
  font-size: 1.9rem;
  letter-spacing: .2px;
}
.header-main {
  display: flex;
  gap: 1.75rem;
  align-items: flex-start;
}
.identity { flex: 1; min-width: 0; }
header.site .role {
  margin: .1rem 0 .9rem;
  color: var(--muted);
  font-size: 1rem;
  max-width: 46ch;
}
.headshot {
  width: 150px;
  height: auto;
  flex-shrink: 0;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
}
header.site .contact {
  color: var(--muted);
  font-size: .95rem;
}
header.site .contact a { color: var(--accent); }
.links-row {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1.25rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-weight: 600;
}
.links-row a {
  color: var(--accent);
  text-decoration: none;
}
.links-row a:hover { text-decoration: underline; }

/* Tabs */
nav.tabs {
  display: flex;
  gap: .25rem;
  margin: 1.75rem 0 0;
  flex-wrap: wrap;
}
nav.tabs button {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--line);
  border-bottom: none;
  background: #e8e8e6;
  color: var(--muted);
  padding: .6rem 1.15rem;
  border-radius: 8px 8px 0 0;
}
nav.tabs button:hover { color: var(--ink); }
nav.tabs button.active {
  background: var(--card);
  color: var(--accent);
  border-color: var(--line);
  position: relative;
  top: 1px;
}
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0 10px 10px 10px;
  padding: 1.5rem 1.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.panel[hidden] { display: none; }
.panel h2 {
  margin-top: 0;
  font-size: 1.3rem;
  color: var(--accent);
}
.panel h2:not(:first-child) {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.panel a { color: var(--accent); }
.conferences a { display: inline-block; margin: .2rem 0; }
ol.papers { padding-left: 1.4rem; }
ol.papers li { margin-bottom: .85rem; }
ol.papers .ref { color: var(--muted); }
ul.students { list-style: none; padding-left: 0; }
ul.students li {
  margin-bottom: 1.1rem;
  padding-left: 1rem;
  border-left: 3px solid var(--line);
}
ul.students .name { font-weight: 700; }
ul.students .title { font-style: italic; }
ul.students .meta { color: var(--muted); font-size: .9rem; }
.subhead { font-weight: 700; margin: 1.5rem 0 .5rem; }
.abs-toggle {
  display: block;
  margin: .3rem 0 0;
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .3px;
  text-transform: uppercase;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
}
.abs-toggle:hover { color: var(--accent); }
.abs-toggle::before { content: "\25B8\00a0"; display: inline-block; }
.abs-toggle[aria-expanded="true"]::before { transform: none; content: "\25BE\00a0"; }
.abstract {
  margin: .5rem 0 .25rem;
  padding: .75rem .9rem;
  background: #faf9f7;
  border-left: 3px solid var(--line);
  border-radius: 0 6px 6px 0;
  font-size: .93rem;
  color: #333;
  text-align: justify;
}
.abstract[hidden] { display: none; }
.source-note { color: var(--muted); font-size: .85rem; margin-top: 1.5rem; }

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

/* ---------- Course and project pages ---------- */

.crumb {
  margin: 0 0 1rem;
  font-size: .92rem;
  font-weight: 600;
}
.crumb a { color: var(--accent); text-decoration: none; }
.crumb a:hover { text-decoration: underline; }

header.site .course-term {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}
.course-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .3rem 1rem;
  margin: 1rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: .95rem;
}
.course-meta dt { color: var(--muted); }
.course-meta dd { margin: 0; }

/* Standalone content card, for pages with no tab strip above them */
.page {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.5rem 1.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  margin-top: 1.5rem;
}
.page h2 {
  margin-top: 0;
  font-size: 1.3rem;
  color: var(--accent);
}
.page h2:not(:first-child) {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.page h3 {
  font-size: 1.05rem;
  margin: 1.5rem 0 .4rem;
}
.page a { color: var(--accent); }
.page > p:first-of-type { margin-top: 0; }

ul.reading, ol.topics { padding-left: 1.3rem; }
ul.reading li, ol.topics li { margin-bottom: .6rem; }
ul.reading .by, ol.topics .src { color: var(--muted); }

ul.materials { list-style: none; padding-left: 0; }
ul.materials li {
  margin-bottom: .55rem;
  padding-left: 1rem;
  border-left: 3px solid var(--line);
}
ul.materials a { font-weight: 600; text-decoration: none; }
ul.materials a:hover { text-decoration: underline; }

.toc { font-size: .95rem; }
.toc ul { padding-left: 1.2rem; }

.page pre, .page code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em;
}
.page pre {
  background: #faf9f7;
  border-left: 3px solid var(--line);
  border-radius: 0 6px 6px 0;
  padding: .75rem .9rem;
  overflow-x: auto;
}
.page blockquote {
  margin: .9rem 0;
  padding: .1rem 0 .1rem .9rem;
  border-left: 3px solid var(--line);
  color: #333;
}
.page mjx-container[display="true"] { overflow-x: auto; overflow-y: hidden; }

@media (max-width: 620px) {
  .wrap { padding: 1.25rem .9rem 2rem; }
  header.site, .panel, .page { padding: 1.15rem 1.1rem; }
  header.site h1 { font-size: 1.55rem; }
  .header-main {
    flex-direction: column-reverse;
    align-items: center;
    gap: 1rem;
  }
  .identity { width: 100%; }
  .headshot { width: 128px; }
  nav.tabs button { padding: .5rem .8rem; font-size: .92rem; }
  .course-meta { grid-template-columns: 1fr; gap: 0 0; }
  .course-meta dt { margin-top: .5rem; }
}
