:root {
  color-scheme: light dark;
  --bg: #f9f7f2;
  --surface: #ffffff;
  --text: #171717;
  --muted: #67625b;
  --line: #ded8ce;
  --accent: #0f766e;
  --code-bg: #151515;
  --code-text: #f5f5f5;
  --quote: #8a4b27;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151413;
    --surface: #1e1d1b;
    --text: #f0eee9;
    --muted: #aaa39a;
    --line: #393530;
    --accent: #5eead4;
    --code-bg: #0d0d0d;
    --code-text: #f7f7f7;
    --quote: #d8a16f;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-size: 18px;
  line-height: 1.65;
}

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, var(--accent), transparent 45%);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent);
}

.site-header,
.site-footer,
main {
  width: min(100% - 32px, 1120px);
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 750;
  text-decoration: none;
}

nav {
  display: flex;
  gap: 18px;
  font-size: 0.92rem;
}

main {
  padding: 48px 0 64px;
}

.intro,
.page-heading,
.post-header,
.about-page {
  max-width: 780px;
}

.intro {
  margin-bottom: 48px;
}

h1,
h2,
h3,
h4 {
  line-height: 1.18;
  margin: 0 0 0.55em;
}

h1 {
  font-size: clamp(2.1rem, 6vw, 4.4rem);
}

h2 {
  font-size: 1.8rem;
}

h3 {
  font-size: 1.35rem;
}

p {
  margin: 0 0 1.25em;
}

.post-list {
  display: grid;
  gap: 28px;
  max-width: 780px;
}

.about-section {
  margin-top: 42px;
}

.about-section h2 {
  margin-bottom: 0.45em;
}

.post-card {
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.post-card h2 {
  margin-bottom: 0.2em;
}

.post-card h2 a {
  text-decoration: none;
}

.post-meta,
.tags,
.site-footer {
  color: var(--muted);
  font-size: 0.9rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tags a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
  text-decoration: none;
}

.post {
  max-width: 100%;
}

.post-header {
  margin-bottom: 42px;
}

.prose {
  max-width: 780px;
}

.prose > * + * {
  margin-top: 1.15em;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  margin-top: 1.9em;
}

.prose blockquote {
  margin: 1.6em 0;
  padding: 0.2em 0 0.2em 1.1em;
  color: color-mix(in srgb, var(--text), var(--quote) 35%);
  border-left: 4px solid var(--quote);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
}

.prose th,
.prose td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  vertical-align: top;
}

.prose figure {
  margin: 2em 0;
}

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

.prose figcaption {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 0.5em;
}

.code-block {
  position: relative;
  width: min(100vw - 32px, 1120px);
  margin: 1.7em 0;
}

.code-block pre {
  margin: 0;
  padding: 18px;
  color: var(--code-text);
  background: var(--code-bg);
  border-radius: 6px;
  overflow-x: auto;
  tab-size: 4;
}

.code-block code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.88rem;
  line-height: 1.55;
}

.copy-code {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 1px solid color-mix(in srgb, var(--code-text), transparent 70%);
  border-radius: 4px;
  color: var(--code-text);
  background: color-mix(in srgb, var(--code-bg), white 12%);
  padding: 4px 8px;
  cursor: pointer;
}

.site-footer {
  padding: 28px 0 42px;
  border-top: 1px solid var(--line);
}

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  main {
    padding-top: 36px;
  }
}
