/* Personal site — minimal, monospace-accented sans.
   Based on the "Quiet" variation. Edit variables below to retune. */

:root {
  --bg:        #faf8f4;
  --fg:        #19181a;
  --muted:     #6b6a6d;
  --rule:      rgba(0, 0, 0, 0.08);
  --max-w:     720px;
  --pad-y:     72px;
  --pad-x:     32px;
  --font:      'Geist', ui-sans-serif, system-ui, sans-serif;
  --mono:      'Geist Mono', ui-monospace, monospace;
}

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

html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--pad-y) var(--pad-x) calc(var(--pad-y) + 24px);
}

/* ── Header / nav ────────────────────────────────────────────────────── */
.site-header { margin-bottom: 56px; }

.name-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--rule);
}
.site-name {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.015em;
}
.site-affil {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  padding-top: 18px;
}
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  font-size: 15px;
  transition: color .12s, border-color .12s;
}
.site-nav a:hover { color: var(--fg); }
.site-nav a.active {
  color: var(--fg);
  border-bottom-color: var(--fg);
}
/* Language switch sits at the far end of the nav row. */
.site-nav .lang-switch {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}

/* ── Section labels (monospace, small caps) ─────────────────────────── */
h1.section-label, h2.section-label { font-weight: 400; }
.section-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 22px;
}

/* ── Body typography ────────────────────────────────────────────────── */
main p { margin: 0 0 18px; max-width: 620px; text-wrap: pretty; }
main h1 { font-size: 22px; font-weight: 500; letter-spacing: -0.01em; margin: 0 0 18px; }
main h2 { font-size: 15px; font-weight: 500; margin: 32px 0 14px; }
main h3 { font-size: 14px; font-weight: 500; margin: 24px 0 10px; }

/* ── Headshot (About page) ───────────────────────────────────────────── */
.headshot { float: right; width: 180px; margin: 2px 0 20px 30px; }
.headshot p { margin: 0; }
.headshot img { width: 100%; height: auto; display: block; border-radius: 3px; }
@media (max-width: 560px) {
  .headshot { float: none; width: 150px; margin: 0 0 18px; }
}
main a  { color: var(--fg); }

main ul, main ol { padding-left: 0; margin: 0 0 18px; list-style: none; }
main ul li, main ol li { padding: 3px 0; color: var(--fg); }
main ul li::before { content: "— "; color: var(--muted); }
main ol { counter-reset: ol; }
main ol li::before {
  counter-increment: ol;
  content: counter(ol) ". ";
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin-right: 6px;
}

main code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: rgba(0, 0, 0, 0.04);
  padding: 1px 4px;
  border-radius: 3px;
}
main pre {
  background: rgba(0, 0, 0, 0.04);
  padding: 14px 16px;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.55;
  margin: 0 0 18px;
}
main pre code { background: transparent; padding: 0; }

main blockquote {
  border-left: 2px solid var(--rule);
  padding-left: 16px;
  margin: 0 0 18px;
  color: var(--muted);
}

/* ── About: contact / links row ─────────────────────────────────────── */
.about-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  align-items: baseline;
}
.about-links li { padding: 0; }
.about-links li::before { content: none; }
.about-links a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  font-size: 14px;
  padding-bottom: 1px;
}
.about-links a:hover { border-bottom-color: var(--fg); }
.about-links .email {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

/* ── Publications (pandoc citeproc output) ──────────────────────────── */
.pubs-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 16px;
}
.scholar-link {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1px;
  letter-spacing: 0.01em;
}
.scholar-link:hover { border-bottom-color: var(--fg); }

#refs.references { margin-top: 12px; }
.csl-entry {
  padding: 14px 0;
  border-top: 1px solid var(--rule);
  font-size: 14.5px;
  line-height: 1.55;
  text-wrap: pretty;
  padding-left: 28px;
  text-indent: -28px;
  color: var(--fg);
}
.csl-entry:last-child { border-bottom: 1px solid var(--rule); }
.csl-entry em { font-style: italic; color: var(--fg); }
.csl-entry a { color: var(--fg); }

/* ── Writing index ──────────────────────────────────────────────────── */
.post-entry {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 16px;
  padding: 18px 0;
  border-top: 1px solid var(--rule);
  align-items: baseline;
}
.post-entry:last-of-type { border-bottom: 1px solid var(--rule); }
.post-date {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.post-body { min-width: 0; }
.post-title {
  font-weight: 500;
  font-size: 15px;
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  display: inline-block;
}
.post-title:hover { border-bottom-color: var(--fg); }
.post-blurb {
  font-size: 14px;
  color: var(--muted);
  margin: 4px 0 6px;
  max-width: 620px;
  text-wrap: pretty;
}
.post-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

/* ── Individual post page ───────────────────────────────────────────── */
article.post .post-header { margin-bottom: 36px; }
article.post .post-header h1 {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  text-wrap: balance;
  line-height: 1.25;
}
article.post .post-meta-line {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.01em;
}
article.post p { font-size: 16px; line-height: 1.7; max-width: 640px; }
article.post h2 { font-size: 17px; margin: 32px 0 12px; }

.post-back {
  margin-top: 56px !important;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 12px;
}
.post-back a {
  color: var(--muted);
  text-decoration: none;
}
.post-back a:hover { color: var(--fg); }

/* ── Teaching (pandoc definition list) ──────────────────────────────── */
main dl {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 4px 16px;
  margin: 0;
}
main dl dt {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  padding: 18px 0 0;
  border-top: 1px solid var(--rule);
  grid-column: 1;
  align-self: start;
}
main dl dd {
  margin: 0;
  padding: 18px 0;
  border-top: 1px solid var(--rule);
  grid-column: 2;
  min-width: 0;
}
main dl dd strong {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 8px;
}
main dl dd em {
  font-style: normal;
  color: var(--muted);
  font-size: 14px;
  display: block;
  margin-top: 2px;
}
main dl dd p { margin: 0; }

/* ── Tables (used by course pages) ───────────────────────────────────── */
main table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 18px 0 26px;
}
main thead th {
  text-align: left;
  font-weight: 500;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px 10px 0;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
main tbody td {
  padding: 10px 14px 10px 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  line-height: 1.5;
  text-wrap: pretty;
}
main tbody tr:last-child td { border-bottom: 0; }
main tbody td:first-child {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
main tbody td:first-child strong {
  font-weight: 500;
  color: var(--fg);
}
/* Collapse empty header cells (markdown `| | |` two-column key/value tables) */
main thead:has(th:empty:only-child),
main thead:has(th:empty + th:empty:last-child) { display: none; }
main th:empty { padding: 0; border: 0; }

main del, main s { color: var(--muted); }

/* ── Course page header ──────────────────────────────────────────────── */
article.course .course-header { margin-bottom: 32px; }
article.course .course-header h1 {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  text-wrap: balance;
  line-height: 1.25;
}
article.course .course-term {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.01em;
}
article.course p { max-width: 680px; }
article.course h2 {
  font-size: 16px;
  font-weight: 500;
  margin: 36px 0 12px;
  padding-top: 4px;
}
article.course h2::before {
  content: "";
  display: block;
  width: 24px;
  height: 1px;
  background: var(--fg);
  margin-bottom: 12px;
}

/* ── Current-courses list on the Teaching index ──────────────────────── */
.course-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}
.course-list li { padding: 0; }
.course-list li::before { content: none; }
.course-list .course-link {
  display: grid;
  grid-template-columns: 110px 1fr 110px;
  gap: 16px;
  align-items: baseline;
  padding: 8px 0;
  border-top: 1px solid var(--rule);
  color: var(--fg);
  text-decoration: none;
}
.course-list li:last-child .course-link { border-bottom: 1px solid var(--rule); }
.course-list .course-code {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--fg);
}
.course-list .course-name {
  font-weight: 500;
  font-size: 15px;
  border-bottom: 1px solid transparent;
  transition: border-color .12s;
}
.course-list a.course-link:hover .course-name {  /* only rows that link to a page */
  border-bottom-color: var(--fg);
}
.course-list .course-term {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

/* ── Link rows on the Links page: name left, host right ─────────────── */
.link-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}
.link-list li { padding: 0; }
.link-list li::before { content: none; }
.link-list > li > a {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: baseline;
  padding: 14px 0;
  border-top: 1px solid var(--rule);
  color: var(--fg);
  text-decoration: none;
}
.link-list li:last-child > a { border-bottom: 1px solid var(--rule); }
.link-list .link-name {
  font-weight: 500;
  font-size: 15px;
  border-bottom: 1px solid transparent;
  transition: border-color .12s;
  justify-self: start;
}
.link-list > li > a:hover .link-name { border-bottom-color: var(--fg); }
.link-list .link-host {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

/* ── Responsive: stack tight columns on narrow screens ──────────────── */
@media (max-width: 720px) {
  :root { --pad-y: 48px; --pad-x: 20px; }
  .post-entry { grid-template-columns: 1fr; gap: 4px; }
  main dl { grid-template-columns: 1fr; gap: 0; }
  main dl dt { border-top: 1px solid var(--rule); padding-bottom: 4px; }
  main dl dd { border-top: 0; padding-top: 0; }
  .course-list .course-link {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .course-list .course-term { text-align: left; }
  main table { font-size: 13px; }
  .link-list > li > a { grid-template-columns: 1fr; gap: 2px; }
  .link-list .link-host { text-align: left; }
}

/* ── Footer: attribution and an honest freshness date ─────────────────── */
.site-footer {
  margin-top: 40px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.site-footer time { color: inherit; }
