.intro {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.portrait {
  flex: none;
  width: var(--portrait);
  height: var(--portrait);
  border-radius: 50%;
  object-fit: cover;
}

.name {
  font-size: var(--text-name);
  line-height: var(--leading-tight);
}

.tagline {
  color: var(--muted);
}

.intro .links {
  margin-top: var(--space-1);
}

.lede {
  margin-top: var(--space-6);
  font-size: var(--text-lede);
}

.section,
.project-group {
  margin-top: var(--space-7);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-1);
  border-bottom: 1px solid var(--muted);
}

.section-title {
  font-size: var(--text-h2);
  line-height: var(--leading-tight);
}

.section-link {
  font-size: var(--text-small);
}

.timeline {
  display: grid;
  gap: var(--space-5);
}

.timeline-item {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: var(--space-5);
  align-items: baseline;
}

.timeline-item > div {
  display: contents;
}

.timeline-item > div > * {
  grid-column: 1 / -1;
}

.timeline-item .entry-title {
  grid-area: 1 / 1;
}

.timeline-date {
  grid-area: 1 / 2;
  font-size: var(--text-small);
  color: var(--muted);
  white-space: nowrap;
}

.entry-title {
  font-size: var(--text-entry);
  line-height: 1.3;
}

.title-sep {
  margin-inline: var(--space-1);
  color: var(--faint);
  font-weight: 400;
}

.entry-org,
.entry-detail {
  color: var(--muted);
}

.bullets {
  margin-top: var(--space-1);
  padding-left: var(--space-5);
  list-style: disc;
}

.bullets li + li {
  margin-top: var(--space-1);
}

.bullets li::marker {
  color: var(--faint);
}

.skills {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-2) var(--space-5);
}

.skills dt {
  font-weight: 700;
}

.project-list {
  display: grid;
  gap: var(--space-5);
}

.project-list:not(:has(li)) {
  display: none;
}

.group-note {
  color: var(--muted);
  font-style: italic;
}

.group-note + .project-list {
  margin-top: var(--space-4);
}

.project-row {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: var(--space-2);
  align-items: baseline;
}

.project-row:has(.project-figure) {
  grid-template-columns: auto 1fr var(--thumb);
}

.project-main {
  grid-area: 1 / 1 / 2 / 3;
  max-width: var(--measure-row);
}

.project-title {
  font-size: var(--text-lede);
  line-height: 1.3;
}

.project-desc {
  margin-top: var(--space-1);
}

.project-year,
.project-tags {
  margin-top: var(--space-1);
  font-size: var(--text-small);
  color: var(--muted);
}

.project-year {
  grid-area: 2 / 1;
}

.project-tags {
  grid-area: 2 / 2;
}

.project-tags::before {
  content: "|";
  content: "|" / "";
  margin-right: var(--space-2);
  color: var(--faint);
}

.project-figure {
  grid-area: 1 / 3 / 3 / 4;
  align-self: start;
  margin-left: var(--space-5);
  aspect-ratio: 200 / 124;
  border: 1px solid var(--rule);
  background: var(--paper);
}

.project-figure img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.project-row--part {
  margin-left: var(--space-6);
}

.project-row--soon {
  grid-template-columns: 1fr auto;
  column-gap: var(--space-5);
}

.project-row--soon .project-main {
  grid-area: 1 / 1;
}

.project-row--soon .project-year {
  grid-area: 1 / 2;
  margin-top: 0;
}

.page-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.page-head > * {
  order: 1;
}

.page-head > .back-link,
.page-head > .page-title,
.page-head > .page-intro {
  order: 0;
}

.back-link {
  margin-bottom: var(--space-4);
  font-size: var(--text-small);
}

.page-title {
  font-size: var(--text-page-title);
  line-height: var(--leading-tight);
}

.page-intro {
  max-width: var(--measure);
  margin-top: var(--space-3);
  font-size: var(--text-lede);
}

.page-head > .label,
.part-of,
.project-links,
.parts,
.toc-inline {
  margin-top: var(--space-3);
}

.part-of {
  font-size: var(--text-small);
  color: var(--muted);
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-5);
}

.parts ol {
  padding-left: var(--space-5);
  list-style: decimal;
}

.parts li::marker {
  color: var(--muted);
}

.toc-inline summary {
  width: fit-content;
  color: var(--accent);
  cursor: pointer;
}

.toc-inline ul {
  display: grid;
  gap: var(--space-1);
  margin-top: var(--space-2);
  padding-left: var(--space-5);
}

.prose {
  margin-top: var(--space-6);
}

.prose > :is(p, ul, ol, dl, blockquote) {
  max-width: var(--measure-text);
}

.prose > * + * {
  margin-top: var(--space-4);
}

.prose h2 {
  margin-top: var(--space-7);
  padding-bottom: var(--space-1);
  border-bottom: 1px solid var(--muted);
  font-size: var(--text-h2);
  line-height: var(--leading-tight);
}

.prose h3 {
  margin-top: var(--space-6);
  font-size: var(--text-entry);
  line-height: 1.3;
}

.prose ul,
.prose ol {
  padding-left: var(--space-5);
  list-style: revert;
}

.prose li + li {
  margin-top: var(--space-1);
}

.prose code {
  padding: 0 var(--space-1);
  border-radius: var(--radius);
  background: var(--hover);
}

.prose pre {
  padding: var(--space-3) var(--space-4);
  overflow-x: auto;
  border-radius: var(--radius);
  background: var(--hover);
}

.prose pre code {
  padding: 0;
  background: none;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-small);
}

.prose th,
.prose td {
  padding: var(--space-2) var(--space-3) var(--space-2) 0;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

.prose th {
  border-bottom-color: var(--muted);
}

.prose .katex-display {
  padding-block: var(--space-1);
  overflow-x: auto;
  overflow-y: hidden;
}

.figure,
.prose .figure + * {
  margin-top: var(--space-6);
}

.figure img {
  max-height: 80vh;
  width: auto;
  margin-inline: auto;
  background: var(--paper);
}

.figure figcaption {
  margin-top: var(--space-2);
  font-size: var(--text-small);
  color: var(--muted);
}

.mono {
  font-weight: 700;
}

.button {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  text-decoration-line: none;
}

.button:hover {
  background: var(--hover);
}

.not-found {
  padding-block: var(--space-8);
}

@media (max-width: 34rem) {
  .intro {
    gap: var(--space-4);
  }

  .intro .links {
    display: none;
  }

  .timeline-date {
    grid-area: 2 / 1 / 3 / -1;
  }

  .skills {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .skills dd {
    margin-bottom: var(--space-3);
  }

  .project-row:has(.project-figure) {
    grid-template-columns: auto 1fr;
  }

  .project-figure {
    grid-area: 3 / 1 / 4 / -1;
    width: var(--thumb);
    margin: var(--space-3) 0 0;
  }

  .project-row--part {
    margin-left: var(--space-4);
  }
}
