:root {
  color-scheme: light dark;
  --background: #fff;
  --text: #111;
  --muted: #666;
  --border: #ddd;
  --link: #165dcc;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  font-size: 16px;
  line-height: 1.5;
}

a { color: var(--link); }

.site-shell {
  max-width: 680px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 2em 1em;
}

.site-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 3em;
}

.site-header a { color: var(--text); }
.site-name { font-weight: bold; text-decoration: none; }

.home-intro { margin-bottom: 3em; }

h1, h2, h3 {
  line-height: 1.3;
}

h1 {
  margin: 0 0 1em;
  font-size: 1.75em;
}

h2 {
  margin: 2.5em 0 1em;
  font-size: 1.2em;
}

.social-links {
  display: flex;
  gap: 1em;
}

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

.project-list li { margin-bottom: 1em; }
.project-list span { display: block; color: var(--muted); }

.post {
  margin-bottom: 1.5em;
}

.post time {
  display: block;
  color: var(--muted);
  font-size: 0.85em;
}

.post h3 {
  margin: 0.15em 0;
  font-size: 1em;
  font-weight: normal;
}

.post p {
  margin: 0.25em 0 0;
  color: var(--muted);
}

.article-header { margin-bottom: 3em; }
.article-header h1 { margin-bottom: 0.35em; }
.article-header time { color: var(--muted); }
.eyebrow { display: none; }

.prose h2,
.prose h3,
.prose h4 { scroll-margin-top: 2em; }
.prose h2 { margin-top: 2.25em; font-size: 1.35em; }
.prose h3 { margin-top: 1.75em; font-size: 1.1em; }
.prose h4 { margin-top: 1.5em; font-size: 1em; }
.prose p { margin: 1em 0; }
.prose ul, .prose ol { padding-left: 1.5em; }
.prose li { margin: 0.35em 0; }
.prose img { max-width: 100%; height: auto; }
.prose blockquote { margin-left: 0; padding-left: 1em; border-left: 2px solid var(--border); color: var(--muted); }

.overflow-x-auto { overflow-x: auto; }
.my-8 { margin-block: 2em; }
.mt-12 { margin-top: 3em; }
.text-center { text-align: center; }

table {
  width: 100%;
  margin: 2em 0;
  border-collapse: collapse;
  font-size: 0.85em;
}

th, td {
  padding: 0.65em;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.article-layout > nav {
  position: fixed;
  top: 50%;
  left: max(1em, calc(50% - 650px));
  width: 250px;
  max-height: 80vh;
  overflow-y: auto;
  transform: translateY(-50%);
}

.article-layout > nav p { margin: 0 0 0.75em; font-weight: bold; }
.article-layout > nav ul { margin: 0; padding: 0; list-style: none; }
.article-layout > nav ul ul { margin: 0.35em 0 0.5em 0.75em; padding-left: 0.75em; border-left: 1px solid var(--border); }
.article-layout > nav li { margin-bottom: 0.4em; line-height: 1.3; }
.article-layout > nav a { color: var(--muted); font-size: 0.8em; text-decoration: none; }
.article-layout > nav a:hover,
.article-layout > nav a[aria-current="location"] { color: var(--link); }

footer {
  margin-top: 4em;
  padding-top: 1em;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8em;
}

@media (max-width: 1200px) {
  .article-layout > nav { display: none; }
}

@media (max-width: 600px) {
  .site-header { margin-bottom: 2em; }
  .article-header { margin-bottom: 2em; }
  table { font-size: 0.75em; }
  th, td { padding: 0.45em; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #111;
    --text: #eee;
    --muted: #aaa;
    --border: #444;
    --link: #7eabff;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
