:root {
  --content-pad: 1.3rem;
  --content-max: calc(660px + 2 * var(--content-pad));
  --bg: #ffffff;
  --fg: #282828;
  --fg1: #3c3836;
  --fg2: #504945;
  --fg3: #6b6866;
  --fg4: #676767;
  --fg5: #969696;
  --bg-code: #f3f3f2;
  --hover-bg: rgba(128, 128, 128, 0.12);
  --border-subtle: color-mix(in srgb, var(--fg4) 35%, var(--bg) 65%);
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-sans: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --font-mono: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --header-height: 54px;
}

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

html {
  overflow-y: scroll;
  scroll-padding-top: calc(var(--header-height) + 1rem);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.6;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, var(--fg4) 30%, transparent);
  text-underline-offset: 2px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

a:hover {
  color: var(--fg2);
  text-decoration-color: color-mix(in srgb, var(--fg2) 40%, transparent);
}

/* ─── Header ─── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid color-mix(in srgb, var(--fg5) 28%, transparent);
}

.site-header-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0.85rem var(--content-pad);
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.wordmark {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.04em;
  color: var(--fg4);
  text-decoration: none;
}

.wordmark:hover {
  color: var(--fg);
  text-decoration: none;
  opacity: 0.85;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  font-family: var(--font-sans);
}

.site-nav a {
  font-size: 15px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--fg1);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--fg) 20%, transparent);
  text-underline-offset: 2px;
}

/* ─── Main ─── */

.site-main {
  flex: 1 0 auto;
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
  padding: 2.25rem var(--content-pad) 4rem;
}

/* ─── Home ─── */

.page-home .site-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.home {
  width: 100%;
  text-align: center;
}

.home-name {
  margin: 0 0 1.25rem;
  font-family: var(--font-serif);
  font-size: clamp(2.75rem, 9vw, 4.5rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: 0.06em;
  color: var(--fg);
}

.home-name-line {
  display: block;
}

.home-tagline {
  margin: 0 auto;
  color: var(--fg2);
  font-size: 1.05rem;
  line-height: 1.5;
  max-width: 22rem;
}

/* ─── Blog list ─── */

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-list > li + li {
  border-top: 1px solid color-mix(in srgb, var(--fg5) 22%, transparent);
}

.post-item-link {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 1.25rem;
  align-items: baseline;
  padding: 0.95rem 0.35rem;
  margin: 0 -0.35rem;
  border-radius: 4px;
  text-decoration: none;
  color: inherit;
}

.post-item-link:hover {
  background: var(--hover-bg);
  text-decoration: none;
}

.post-item-date {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--fg5);
  white-space: nowrap;
}

.post-item-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 550;
  color: var(--fg);
  line-height: 1.35;
}

.blog-page-title {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 550;
  letter-spacing: -0.01em;
}

.blog-page-lede {
  margin: 0 0 2rem;
  color: var(--fg3);
}

.empty-posts {
  color: var(--fg3);
  font-style: italic;
}

/* ─── Post ─── */

.post-header {
  margin-bottom: 2rem;
}

.post-title {
  margin: 0 0 0.5rem;
  font-size: 1.85rem;
  font-weight: 550;
  line-height: 1.25;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.post-date {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--fg5);
}

/* ─── About ─── */

.page-title {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 550;
  letter-spacing: -0.01em;
}

.page-lede {
  margin: 0 0 2.25rem;
  color: var(--fg2);
}

.about-section + .about-section {
  margin-top: 2.25rem;
}

.about-section h2 {
  margin: 0 0 1rem;
  font-size: 1.2rem;
  font-weight: 550;
}

.role {
  margin: 0 0 1.35rem;
}

.role:last-child {
  margin-bottom: 0;
}

.role-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  align-items: baseline;
  margin-bottom: 0.2rem;
}

.role-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 550;
}

.role-dates {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--fg5);
  white-space: nowrap;
}

.role-meta {
  margin: 0 0 0.35rem;
  color: var(--fg3);
  font-style: italic;
}

.role-body {
  margin: 0;
  color: var(--fg2);
}

.role-body + .role-body,
.role ul {
  margin-top: 0.45rem;
}

.role ul {
  margin: 0.45rem 0 0;
  padding-left: 1.2rem;
  color: var(--fg2);
}

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

/* ─── Prose ─── */

.prose > :first-child {
  margin-top: 0;
}

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

.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose pre {
  margin: 0 0 1.15rem;
}

.prose h2 {
  margin: 2.25rem 0 0.85rem;
  font-size: 1.3rem;
  font-weight: 550;
  line-height: 1.3;
}

.prose h3 {
  margin: 1.75rem 0 0.65rem;
  font-size: 1.1rem;
  font-weight: 550;
}

.prose ul,
.prose ol {
  padding-left: 1.35rem;
}

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

.prose blockquote {
  border-left: 2px solid var(--border-subtle);
  color: var(--fg2);
  margin-left: 0.5rem;
  padding: 0.1rem 0 0.1rem 1.15rem;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-code);
  border-radius: 3px;
  padding: 0.1em 0.35em;
}

.prose pre {
  background: var(--bg-code) !important;
  border-radius: 0.45rem;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.45;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

.prose pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
  border-radius: 0;
  color: var(--fg3);
}

.prose a {
  text-decoration: underline;
}

.prose hr {
  border: none;
  border-top: 1px solid color-mix(in srgb, var(--fg5) 30%, transparent);
  margin: 2rem 0;
}

.prose img {
  max-width: 100%;
  height: auto;
}

/* ─── Footer ─── */

.site-footer {
  border-top: 1px solid color-mix(in srgb, var(--fg5) 28%, transparent);
  margin-top: auto;
}

.site-footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 1.25rem var(--content-pad) 2rem;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.35rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
}

.footer-links a {
  color: var(--fg4);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--fg) 20%, transparent);
}

/* ─── Responsive ─── */

@media (max-width: 640px) {
  :root {
    --header-height: 50px;
  }

  body {
    font-size: 16px;
  }

  .site-header-inner {
    padding: 0.75rem var(--content-pad);
  }

  .site-nav {
    gap: 1.15rem;
  }

  .post-item-link {
    grid-template-columns: 1fr;
    gap: 0.2rem;
    padding: 0.85rem 0.25rem;
  }

  .post-title {
    font-size: 1.55rem;
  }

  .blog-page-title,
  .page-title {
    font-size: 1.5rem;
  }

  .role-header {
    flex-direction: column;
  }
}
