:root {
  --bg: #fdfcfa;
  --text: #22242a;
  --muted: #62666f;
  --rule: #e2dfd8;
  --accent: #1f5fa8;
  --tag-bg: #eef2f7;

  /* One typeface throughout, in four sizes. */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  --fs-title: 2rem;    /* name */
  --fs-body: 1rem;     /* bio, lists */
  --fs-meta: 0.9rem;   /* contact details, subsection headings */
  --fs-small: 0.8rem;  /* section headings, link tags, footer */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181c;
    --text: #e4e2dd;
    --muted: #a0a4ae;
    --rule: #30333a;
    --accent: #8ab8f0;
    --tag-bg: #22262d;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0 auto;
  padding: 4rem 1.5rem 3rem;
  max-width: 40rem;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover, a:focus-visible { text-decoration: underline; text-underline-offset: 0.15em; }

strong { font-weight: 600; }

/* Title block */

#title-block-header { margin-bottom: 0.6rem; }

h1.title {
  margin: 0;
  font-size: var(--fs-title);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

/* Contact card: details and links on the left, photo on the right */

.contact {
  display: flow-root;
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
  font-size: var(--fs-meta);
  line-height: 1.55;
  color: var(--muted);
}
.contact p { margin: 0 0 0.9rem; }
.contact p:last-child { margin-bottom: 0; }

/* The photo is pulled up so that it sits beside the name as well. */
.photo {
  float: right;
  width: 8rem;
  height: 8rem;
  margin: -2.9rem 0 0.75rem 1.5rem;
  object-fit: cover;
}

/* Section headings */

section > h1 {
  margin: 3rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
  font-size: var(--fs-small);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

section > h2 {
  margin: 1.25rem 0 0.4rem;
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--muted);
}

/* Lists */

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

li { margin: 0 0 0.3rem; }
li > p { margin: 0 0 1rem; }

/* Link tags: [doi] [pdf] [slides] */

.links {
  font-size: var(--fs-small);
  white-space: nowrap;
}
.links a {
  display: inline-block;
  margin-right: 0.15rem;
  padding: 0.05rem 0.55rem;
  border-radius: 999px;
  background: var(--tag-bg);
  line-height: 1.5;
}
.links a:hover, .links a:focus-visible {
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
}

/* Footer */

.footer {
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: var(--fs-small);
  color: var(--muted);
}
.footer p { margin: 0; }

/* Phones */

@media (max-width: 30rem) {
  html { font-size: 100%; }
  body { padding: 2.5rem 1.1rem 2rem; }
  :root { --fs-title: 1.75rem; }
  .photo { width: 5.5rem; height: 5.5rem; margin-top: -2.6rem; margin-left: 1rem; }
}

/* Wide screens: the name, photo and contact details become a sidebar that stays in view. */

@media screen and (min-width: 1400px) {
  body {
    display: grid;
    grid-template-columns: 18rem minmax(0, 40rem);
    column-gap: 4.5rem;
    justify-content: center;
    align-content: start;
    max-width: none;
  }
  body > * { grid-column: 2; }

  /* Both sidebar pieces share one grid area; the name is slotted in under the photo. */
  #title-block-header, .contact {
    grid-column: 1;
    grid-row: 1 / span 200;
    align-self: start;
    position: sticky;
    top: 4rem;
    margin: 0;
  }
  #title-block-header { z-index: 1; padding-top: 10.25rem; }
  .contact { padding: 0; border: 0; }
  .photo {
    float: none;
    display: block;
    width: 9rem;
    height: 9rem;
    margin: 0 0 4.15rem;
  }

  /* Grid items do not collapse margins, so set the bio spacing explicitly. */
  body > p { margin: 0 0 1rem; }
  body > p + section > h1 { margin-top: 2rem; }
}

@media screen and (min-width: 2200px) {
  html { font-size: 125%; }
}

/* Print */

@media print {
  :root { --bg: #fff; --text: #000; --muted: #444; --rule: #bbb; --accent: #000; --tag-bg: transparent; }
  html { font-size: 11pt; }
  body { max-width: none; padding: 0; }
  li { break-inside: avoid; }
  .links a { padding: 0; margin-right: 0.4rem; text-decoration: underline; }
  .photo { width: 6rem; height: 6rem; }
}
