:root {
  --paper: #f5f6f7;
  --ink: #16191e;
  --muted: #6b717b;
  --faint: #a3a8b0;
  --rule: #dcdfe3;
  --serif: "Newsreader", "Iowan Old Style", Georgia, "Times New Roman", serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #101215;
    --ink: #e3e5e8;
    --muted: #8a909a;
    --faint: #5a6069;
    --rule: #262a30;
    color-scheme: dark;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  scroll-padding-top: 1.5rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  font-weight: 380;
  line-height: 1.6;
  font-optical-sizing: auto;
}

p { margin: 0; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: text-decoration-color 160ms ease;
}

a:hover { text-decoration-color: currentColor; }

a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
  border-radius: 2px;
}

/* Frame */
.topbar,
main,
.site-foot {
  max-width: 66rem;
  margin: 0 auto;
  padding-left: 2rem;
  padding-right: 2rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-top: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
}

.topbar-name {
  font-weight: 560;
  text-decoration: none;
}

.topbar nav {
  display: flex;
  gap: 1.5rem;
}

.topbar nav a {
  color: var(--muted);
  text-decoration: none;
}

.topbar nav a:hover { color: var(--ink); }

main {
  padding-top: 3.5rem;
  padding-bottom: 5rem;
}

.site-foot {
  padding-top: 1.5rem;
  padding-bottom: 2.5rem;
  border-top: 1px solid var(--rule);
  color: var(--faint);
  font-size: 0.9375rem;
}

/* Home: profile beside content */
.home-grid {
  display: grid;
  grid-template-columns: 14rem minmax(0, 40rem);
  gap: 5rem;
  align-items: start;
}

.profile {
  position: sticky;
  top: 2rem;
}

.avatar {
  display: block;
  width: 11rem;
  height: 11rem;
  border-radius: 50%;
  object-fit: cover;
}

.profile-name {
  margin: 1.25rem 0 0;
  font-size: 1.5rem;
  font-weight: 480;
  line-height: 1.2;
}

.profile-tag {
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.4;
}

.profile-links {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
  font-size: 1rem;
}

.profile-links li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.2rem 0;
  color: var(--muted);
}

.profile-links a { color: var(--ink); }

.profile-links svg {
  flex: none;
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.profile-links svg .fill {
  fill: var(--muted);
  stroke: none;
}

.content section + section { margin-top: 3.25rem; }

.content h2,
.cv-block h2 {
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
  font-size: 1.5rem;
  font-weight: 480;
  line-height: 1.25;
}

.interests,
.pubs {
  margin: 0;
  padding-left: 1.15rem;
}

.interests li + li { margin-top: 0.2rem; }

.pubs li + li { margin-top: 0.75rem; }

.pubs li { line-height: 1.45; }

/* Projects */
.work-item + .work-item { margin-top: 3rem; }

.work-media { margin: 0 0 1rem; }

.work-video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 3px;
  background: #f0f0f0;
}

.work-chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  font-family: var(--serif);
}

.work-chart .grid line { stroke: var(--rule); stroke-width: 1; }
.work-chart .grid .axis { stroke: var(--faint); }
.work-chart .ticks text { fill: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.work-chart polyline { fill: none; stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.work-chart .line-main { stroke: var(--ink); }
.work-chart .line-base { stroke: var(--faint); stroke-dasharray: 4 4; }
.work-chart .dots-main circle { fill: var(--ink); }
.work-chart .dots-base circle { fill: var(--paper); stroke: var(--faint); stroke-width: 1.5; }
.work-chart .label-main { fill: var(--ink); font-size: 15px; font-style: italic; }
.work-chart .label-base { fill: var(--muted); font-size: 15px; font-style: italic; }

.work-media figcaption {
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.9375rem;
  font-style: italic;
}

.work-title { font-weight: 480; }

.work-note {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 1.0625rem;
  text-wrap: pretty;
}

/* CV */
.cv main { max-width: 46rem; }

.cv-title {
  margin: 0;
  font-size: 2rem;
  font-weight: 400;
  line-height: 1.2;
}

.cv-updated {
  margin-top: 0.3rem;
  color: var(--muted);
  font-style: italic;
}

.cv-block { margin-top: 3rem; }

.entry + .entry { margin-top: 1.5rem; }

.entry p + p { margin-top: 0.3rem; }

.entry p:not(.entry-head):not(.venue) {
  color: var(--muted);
  font-size: 1.0625rem;
  text-wrap: pretty;
}

.entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  line-height: 1.4;
}

.entry-head .when {
  flex: none;
  color: var(--muted);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.venue {
  font-style: italic;
  font-size: 1rem;
  color: var(--muted);
}

.cv-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.6rem;
  margin-top: 3.5rem;
}

@media (max-width: 52rem) {
  body { font-size: 1.0625rem; }

  .topbar,
  main,
  .site-foot {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .topbar nav { gap: 1rem; }

  main { padding-top: 2.25rem; }

  .home-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 2.75rem;
  }

  .profile {
    position: static;
    display: grid;
    grid-template-columns: 5.5rem 1fr;
    column-gap: 1.25rem;
    align-items: center;
  }

  .avatar {
    width: 5.5rem;
    height: 5.5rem;
    grid-row: span 2;
  }

  .profile-name { margin: 0; align-self: end; }
  .profile-tag { align-self: start; }

  .profile-links {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.1rem 1.25rem;
  }

  .entry-head {
    flex-direction: column;
    gap: 0;
  }

  .work-chart .ticks text { font-size: 19px; }
  .work-chart .label-main,
  .work-chart .label-base { font-size: 20px; }
}
