/* Source Serif 4 (Adobe, SIL OFL 1.1 — see fonts/OFL.txt), subset to the
   glyphs this page uses so the file stays under 20 KB. */
@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #fbfaf8;
  --fg: #24211d;
  --muted: #6f6a63;
  --rule: #e2ded7;
  --rule-strong: #c4bdb1;
  --hover: #f3f0ea;
  --accent: #8a5a2b;
  --measure: 44rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16150f;
    --fg: #e8e4dc;
    --muted: #9d968b;
    --rule: #302d26;
    --rule-strong: #4c463c;
    --hover: #1e1c15;
    --accent: #d3a06a;
  }
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0 auto;
  padding: 4.5rem 1.5rem 6rem;
  max-width: var(--measure);
  background: var(--bg);
  color: var(--fg);
  font: 400 17px/1.65 "Source Serif 4", ui-serif, Georgia, serif;
  font-feature-settings: "kern", "liga";
  text-rendering: optimizeLegibility;
}

/* ---------- header ---------- */

header { margin-bottom: 3.5rem; }

h1 {
  margin: 0;
  font-size: 2.6rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

h1::after {
  content: "";
  display: block;
  width: 2.5rem;
  height: 2px;
  margin-top: 1rem;
  background: var(--accent);
}

/* ---------- links ---------- */

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}

a:hover, a:focus-visible {
  border-bottom-color: var(--accent);
}

/* ---------- sections ---------- */

section { margin: 0 0 3.25rem; }

h2 {
  margin: 0 0 1.4rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

/* ---------- publications ---------- */

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

.pubs li {
  padding: 0.85rem 0.7rem 0.85rem;
  margin: 0 -0.7rem;
  border-radius: 3px;
  border-bottom: 1px solid var(--rule);
  transition: background-color 0.15s ease;
}

.pubs li:last-child { border-bottom: 0; }

.pubs li:hover { background: var(--hover); }

a.title {
  display: block;
  color: var(--fg);
  font-size: 1.02rem;
  line-height: 1.4;
  border-bottom: 0;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--rule-strong);
  text-underline-offset: 3px;
}

a.title:hover, a.title:focus-visible {
  color: var(--accent);
  text-decoration-style: solid;
  text-decoration-color: var(--accent);
}

.pubs .authors {
  display: block;
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.pubs .authors strong { color: var(--fg); font-weight: 600; }

.pubs .venue {
  display: block;
  margin-top: 0.22rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.pubs .venue em { font-style: italic; }

/* ---------- tags ---------- */

.tags {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

/* ---------- footer ---------- */

footer {
  margin-top: 4rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.83rem;
  color: var(--muted);
}

footer p { margin: 0; }

/* ---------- narrow screens ---------- */

@media (max-width: 34rem) {
  body { padding: 3rem 1.25rem 4rem; }
  h1 { font-size: 2.1rem; }
  .pubs li { margin: 0; padding-left: 0; padding-right: 0; }
}

/* ---------- motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ---------- print: one-page CV ---------- */

@media print {
  :root {
    --bg: #fff;
    --fg: #000;
    --muted: #444;
    --rule: #bbb;
    --rule-strong: #bbb;
    --hover: transparent;
    --accent: #000;
  }

  body {
    max-width: none;
    padding: 0;
    font-size: 10.5pt;
  }

  h1 { font-size: 20pt; }
  h1::after { display: none; }

  section {
    margin-bottom: 1.4rem;
    break-inside: avoid;
  }

  .pubs li, .project { break-inside: avoid; }

  a, a.title {
    color: #000;
    text-decoration: none;
  }

  /* spell out link targets, which a printed page cannot follow */
  a.title::after {
    content: " (" attr(href) ")";
    font-family: ui-sans-serif, system-ui, sans-serif;
    font-size: 7.5pt;
    color: #555;
    word-break: break-all;
  }

  .pubs .venue a::after { content: ""; }

  footer { margin-top: 1.5rem; }
}
