html {
  font-size: 18px;
}

:root {
  color-scheme: light;
  --bg: #ffffff;
  --text: #111111;
  --line: #d9d9d9;
  --line-soft: #eeeeee;
  --muted: #666666;
  --surface: #f6f6f6;
  --surface-strong: #f2f2f2;
  --image-radius: 6px;
  --page-width: 52rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #111111;
    --text: #f2f2f2;
    --line: #313131;
    --line-soft: #262626;
    --muted: #a7a7a7;
    --surface: #1a1a1a;
    --surface-strong: #202020;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.14em;
}

img,
video {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--image-radius);
}

iframe {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 22rem;
  border: 0;
  border-radius: var(--image-radius);
}

main {
  width: min(100% - 2rem, var(--page-width));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.site-header,
.section-header,
.post-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
}

.site-header {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.site-name,
.eyebrow,
nav,
.meta,
.site-footer,
.post-card-year,
.archive-tags,
.archive-date,
.post-date,
.tag-list,
.back-link {
  font-size: 0.82rem;
}

.site-name,
.eyebrow {
  margin: 0;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}

nav a[aria-current="page"] {
  font-weight: 600;
}

section,
.site-footer {
  padding-top: 2rem;
  margin-top: 2rem;
  border-top: 1px solid var(--line);
}

.intro,
.page-intro {
  border-top: 0;
  margin-top: 0;
  padding-top: 2rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(16rem, 0.8fr);
  gap: 2rem;
  align-items: start;
}

.hero-grid .stack {
  max-width: 31rem;
}

h1,
h2,
h3 {
  margin: 0 0 1rem;
  font-weight: 500;
  line-height: 1.15;
}

h1 {
  font-size: 3rem;
}

.page-home h1 {
  margin-top: 0.2rem;
  font-size: clamp(2.6rem, 4vw, 2.8rem);
  font-weight: 450;
  line-height: 1.05;
  letter-spacing: -0.025em;
}

h2 {
  font-size: 1.65rem;
}

h3 {
  font-size: 1.15rem;
}

p,
ul,
ol,
figure,
blockquote,
table,
pre {
  margin: 0 0 1rem;
}

.stack > *:last-child,
.site-footer p:last-child,
.archive-copy > *:last-child {
  margin-bottom: 0;
}

.media {
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.section-header h2 {
  margin-bottom: 0;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.card-image {
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.meta,
.archive-tags,
.archive-date,
.post-date,
.tag-list,
.eyebrow,
.back-link {
  color: var(--muted);
}

.post-card h3 {
  margin-top: 0.45rem;
}

.archive-list {
  display: grid;
  gap: 1.5rem;
}

.archive-item {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.archive-image {
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.archive-copy h2 {
  margin-bottom: 0.35rem;
}

.archive-excerpt {
  color: var(--muted);
}

.article-header h1 {
  max-width: 22ch;
  margin-bottom: 0.75rem;
  font-size: clamp(2.25rem, 4vw, 3.1rem);
  line-height: 1.05;
}

.article-hero {
  margin-top: 0;
}

.page-about .article-hero {
  max-width: 50%;
}

.article-body {
  font-size: 1.02rem;
}

.article-body > *:last-child {
  margin-bottom: 0;
}

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4,
.article-body h5,
.article-body h6 {
  margin-top: 2rem;
}

.article-body p,
.article-body ul,
.article-body ol,
.article-body figure,
.article-body blockquote,
.article-body table,
.article-body pre,
.article-body iframe,
.article-body video {
  margin-bottom: 1.25rem;
}

.article-body ul,
.article-body ol {
  padding-left: 1.4rem;
}

.article-body li + li {
  margin-top: 0.35rem;
}

.article-body blockquote {
  padding-left: 1rem;
  border-left: 2px solid var(--line);
  color: var(--muted);
}

.article-body pre {
  overflow-x: auto;
  padding: 1rem;
  background: var(--surface);
  border-radius: var(--image-radius);
}

.article-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.article-body :not(pre) > code {
  padding: 0.08rem 0.28rem;
  background: var(--surface);
  border-radius: 4px;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
}

.article-body th,
.article-body td {
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  text-align: left;
}

.article-body figcaption {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.article-body hr {
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.post-nav {
  padding-top: 1.5rem;
  margin-top: 2rem;
  border-top: 1px solid var(--line);
}

.post-nav a {
  max-width: 18rem;
}

.not-found {
  padding-top: 4rem;
}

.not-found h1 {
  font-size: 2rem;
}

.redirect-note {
  padding-top: 4rem;
}

@media (max-width: 720px) {
  html {
    font-size: 17px;
  }

  main {
    width: min(100% - 1.25rem, var(--page-width));
  }

  .hero-grid,
  .post-grid,
  .archive-item {
    grid-template-columns: 1fr;
  }

  iframe {
    min-height: 16rem;
  }

  .article-header h1,
  .page-home h1,
  h1 {
    max-width: 100%;
  }

  .page-about .article-hero {
    max-width: 50%;
  }
}
