/* Shared spacing scale; 1rem follows the browser's default text size. */
:root {
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --content-width: 45rem;
  --date-width: 7.5rem;
  --date-gap: var(--space-6);
  --section-space: var(--space-8);
  --heading-space: var(--space-6);
}

html {
  background: #ffffff;
  color: #000000;
  font-family: Baskerville, "Baskerville Old Face", "Songti SC", "Noto Serif CJK SC", Georgia, serif;
  font-size: 100%;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

body {
  margin: 0;
  padding: 5rem 1.5rem;
}

main {
  max-width: var(--content-width);
  margin: 0 auto;
}

.identity {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-4);
  margin: 0 0 var(--space-4);
}

.portrait {
  width: clamp(4.5rem, 22vw, 7.5rem);
  aspect-ratio: 1;
  border: 1px solid currentColor;
  border-radius: 50%;
}

h1 {
  margin: 0 0 var(--space-4);
  font-size: 2rem;
  font-weight: normal;
  line-height: 1.2;
}

p {
  margin: 0 0 var(--space-4);
  font-size: 1.125rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

a {
  color: inherit;
  text-underline-offset: 0.15em;
}

.socials {
  display: flex;
  gap: var(--space-4);
}

.socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  min-height: 2rem;
}

a:focus-visible,
pre:focus-visible,
.table-scroll:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 0.25rem;
}

.intro {
  margin: 1rem 0 0;
}

.home {
  font-size: 1.25rem;
}

.home .intro,
.home .section p {
  font-size: inherit;
}

.home > .section {
  margin-top: var(--section-space);
}

.home > .section + .section {
  border-top: 1px solid #e5e5e5;
  padding-top: var(--section-space);
}

.home > .section > h2 {
  margin: 0 0 var(--heading-space);
  font-size: 1.75rem;
}

.home .about p {
  margin-bottom: var(--space-4);
}

h2 {
  margin: 0 0 var(--space-4);
  font-size: 1.5rem;
  font-weight: normal;
  line-height: 1.3;
}

.home > .section > :last-child {
  margin-bottom: 0;
}

h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: normal;
}

.experience-list,
.project-list,
.writing-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.experience-entry,
.writing-list li {
  display: grid;
  grid-template-columns: var(--date-width) minmax(0, 1fr);
  column-gap: var(--date-gap);
  align-items: baseline;
}

.experience-detail {
  min-width: 0;
}

.experience-detail h3,
.project-list h3 {
  margin: 0 0 var(--space-2);
  font-size: 1.25rem;
}

/* Optional real logo shares the institution's content area. */
.experience-entry:has(> .institution-logo) {
  grid-template-columns: var(--date-width) 2rem minmax(0, 1fr);
}

.institution-logo {
  width: 2rem;
  height: 2rem;
  object-fit: contain;
  align-self: start;
}

.entry-date,
.article-meta,
figcaption {
  color: #666;
  font-size: 1rem;
}

.experience-detail p,
.project-list p {
  margin: 0;
}

.experience-entry + .experience-entry,
.project-list > li + li {
  margin-top: var(--space-8);
}

.project-links {
  font-size: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 0.5rem;
}

.writing-list {
  font-size: 1.25rem;
}

.writing-list li + li {
  margin-top: var(--space-3);
}

.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
}

.article-page {
  max-width: 45rem;
}

.article-header {
  margin: 1.5rem 0 3rem;
  text-align: center;
}

.article-meta {
  display: flex;
  justify-content: center;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.article-header h1 {
  margin: 1rem 0 0;
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  line-height: 1.3;
  text-wrap: balance;
}

.prose {
  font-size: 1.25rem;
  line-height: 1.75;
}

.prose p {
  margin-bottom: 1.5rem;
  font-size: inherit;
  line-height: inherit;
}

.prose h2 {
  margin-top: 1.75rem;
}

.prose h3 {
  font-size: 1.125rem;
  margin-top: 1.5rem;
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
  margin: 0 0 var(--space-4);
}

.prose li + li {
  margin-top: 0.25rem;
}

.prose blockquote {
  margin: 1.25rem 0 1.25rem 1em;
}

.prose figure {
  margin: 2rem 0;
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
}

.prose .photo img {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

figcaption {
  margin-top: 0.5rem;
}

pre,
.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  margin: 1.25rem 0;
}

pre {
  font-size: 0.9375rem;
  line-height: 1.6;
  overflow-wrap: normal;
}

table {
  border-collapse: collapse;
  text-align: left;
  overflow-wrap: normal;
}

th,
td {
  padding: 0.5rem 1rem 0.5rem 0;
  vertical-align: top;
}

@media (max-width: 30rem) {
  .article-header {
    margin: 1rem 0 2rem;
  }

  .prose {
    font-size: 1.125rem;
  }
}

@media (max-width: 25rem) {
  .contact p {
    font-size: 1rem;
  }
}

@media (max-width: 37.5rem) {
  :root {
    --section-space: var(--space-6);
    --heading-space: 1.25rem;
  }

  body {
    padding: var(--space-12) 1.25rem;
  }

  .home,
  .writing-list {
    font-size: 1.125rem;
  }

  .home > .section > h2 {
    font-size: 1.625rem;
  }

  .experience-entry,
  .writing-list li,
  .experience-entry:has(> .institution-logo) {
    grid-template-columns: minmax(0, 1fr);
    row-gap: var(--space-2);
  }
}
