/* ---- Tokens ---------------------------------------------------------- */

:root {
  --ink: #16181d;
  --ink-muted: #55595f;
  --rule: #e3e5e8;
  --accent: #1a4f8a;
  --bg: #ffffff;

  --measure: 980px;
  --nav-h: 3.5rem;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
}

/* ---- Base ------------------------------------------------------------ */

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

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

p {
  margin: 0 0 1.1rem;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(26, 79, 138, 0.3);
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wrap {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 1rem;
  top: 0.5rem;
  z-index: 10;
  background: var(--bg);
  padding: 0.5rem 0.75rem;
}

/* ---- Nav ------------------------------------------------------------- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--rule);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.5rem;
  align-items: center;
  justify-content: flex-end;
  min-height: var(--nav-h);
  margin: 0;
  padding-block: 0.6rem;
  list-style: none;
}

.site-nav a {
  color: var(--ink);
  border-bottom: 0;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--accent);
}

/* ---- Sections -------------------------------------------------------- */

main {
  padding-block: 3.5rem 1rem;
}

section {
  scroll-margin-top: calc(var(--nav-h) + 1.5rem);
}

section + section {
  margin-top: 3.5rem;
  padding-top: 3.5rem;
  border-top: 1px solid var(--rule);
}

h1 {
  margin: 0 0 0.3rem;
  font-size: 2.1rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0 0 1.75rem;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}

/* ---- Hero ------------------------------------------------------------ */

.hero {
  display: grid;
  gap: 1.5rem;
}

.hero-photo {
  display: block;
  width: 260px;
  max-width: 100%;
  height: auto;
  border-radius: 2px;
}

.hero-role {
  margin: 0 0 1.4rem;
  color: var(--ink-muted);
}

.hero-intro p {
  text-align: justify;
}

.hero-links {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
  line-height: 1.9;
}

/* photo and contact links share the left column; the bio spans both rows so the
   links stay directly under the photo however long the bio gets */
@media (min-width: 62rem) {
  .hero {
    grid-template-columns: 260px minmax(0, 1fr);
    grid-template-areas:
      "photo intro"
      "links intro";
    grid-template-rows: auto 1fr;
    column-gap: 3.5rem;
    row-gap: 1.25rem;
    align-items: start;
  }

  .hero-photo-frame {
    grid-area: photo;
  }

  .hero-links {
    grid-area: links;
  }

  .hero-intro {
    grid-area: intro;
  }
}

/* ---- Papers ---------------------------------------------------------- */

.paper + .paper {
  margin-top: 2.25rem;
}

.paper-title {
  margin: 0 0 0.15rem;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.45;
}

.paper-meta {
  margin: 0;
  color: var(--ink-muted);
  font-style: italic;
}

.paper-links {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
}

details {
  margin-top: 0.4rem;
}

summary {
  display: inline-block;
  color: var(--accent);
  font-size: 0.95rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary:hover {
  text-decoration: underline;
}

.abstract {
  margin: 0.75rem 0 0;
  padding-left: 1rem;
  border-left: 2px solid var(--rule);
  color: var(--ink-muted);
  font-size: 0.98rem;
}

/* ---- Have we met ----------------------------------------------------- */

.year {
  margin: 1.75rem 0 0.4rem;
  font-size: 1rem;
  font-weight: 600;
}

.year:first-of-type {
  margin-top: 0;
}

.met-list {
  margin: 0;
  padding-left: 1.15rem;
}

.met-list li {
  margin-bottom: 0.3rem;
}

.met-list em {
  color: var(--ink-muted);
}

/* ---- Footer ---------------------------------------------------------- */

.site-footer {
  margin-top: 4rem;
  padding-block: 1.5rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-muted);
  font-size: 0.875rem;
}

/* ---- Small screens --------------------------------------------------- */

@media (max-width: 34rem) {
  body {
    font-size: 1rem;
  }

  /* the nav wraps to two rows here, so anchored headings need more clearance */
  section {
    scroll-margin-top: 6.5rem;
  }

  .site-nav ul {
    justify-content: center;
    gap: 0.25rem 1.1rem;
  }

  .site-nav a {
    font-size: 0.9rem;
  }

  main {
    padding-top: 2.5rem;
  }

  .hero-photo {
    width: 220px;
  }

  h1 {
    font-size: 1.8rem;
  }

  section + section {
    margin-top: 2.75rem;
    padding-top: 2.75rem;
  }
}
