:root {
  --bg: #fafafa;
  --fg: #111;
  --fg-muted: #555;
  --accent: #3db8e8;
  --border: #222;
  --card-bg: #fff;
  --mono: 'JetBrains Mono', monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --max-w: 820px;
  --grid-color: rgba(0, 0, 0, 0.02);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --fg: #e8e8e8;
    --fg-muted: #999;
    --card-bg: #141414;
    --border: #ddd;
    --grid-color: rgba(255, 255, 255, 0.02);
  }
}

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

html {
  font-size: 17px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--sans);
  background:
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px),
    var(--bg);
  background-size: 32px 32px;
  color: var(--fg);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--fg);
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
  transition: color 0.15s;
}

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

/* NAV */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem 1rem;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.nav-logo img {
  border-radius: 50%;
}

.nav-blog {
  font-family: var(--mono);
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--fg-muted);
  transition: color 0.15s;
}

.nav-blog:hover {
  color: var(--fg);
}

.nav-icons {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-icons a {
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s;
  display: flex;
  align-items: center;
}

.nav-icons a:hover {
  color: var(--fg);
}

/* MAIN */
main {
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
  flex: 1;
}

/* HERO */
.hero {
  padding: 4rem 0 2rem;
  border-bottom: 3px solid var(--border);
  margin-bottom: 2.5rem;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.tagline {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--fg-muted);
  margin-top: 0.75rem;
}

/* BIO */
.bio {
  margin-bottom: 3rem;
}

.bio p {
  margin-bottom: 1rem;
}

.bio .cta {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border: 2px dotted color-mix(in srgb, var(--fg) 15%, transparent);
  font-size: 0.95rem;
}

.bio .cta a {
  font-weight: 600;
}

/* POST CARDS */
.recent-posts,
.blog-index {
  margin-bottom: 3rem;
}

.recent-posts h2,
.blog-index h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
}

.post-card {
  display: block;
  text-decoration: none;
  padding: 1.25rem;
  border: 1px solid transparent;
  border-bottom: 1px solid color-mix(in srgb, var(--fg) 15%, transparent);
  transition: border-color 0.15s, background 0.15s;
}

.post-card:hover {
  border-color: var(--border);
  background: var(--card-bg);
}

.post-card time {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.post-card h2,
.post-card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0.25rem 0;
  color: var(--fg);
  letter-spacing: -0.02em;
}

.post-card p {
  font-size: 0.9rem;
  color: var(--fg-muted);
  line-height: 1.5;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.reading-time {
  color: var(--fg-muted);
}

.tags {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border: 1px solid color-mix(in srgb, var(--fg) 20%, transparent);
  color: var(--fg-muted);
}

.see-all {
  display: inline-block;
  margin-top: 1rem;
  font-family: var(--mono);
  font-size: 0.875rem;
}

.empty {
  color: var(--fg-muted);
  font-style: italic;
}

/* ARTICLE */
.post header {
  padding: 3rem 0 1.5rem;
  border-bottom: 3px solid var(--border);
  margin-bottom: 2rem;
}

.post header h1 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.15;
  margin-bottom: 0.75rem;
}

.prose {
  margin-bottom: 3rem;
}

.prose h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 2rem 0 0.75rem;
  letter-spacing: -0.02em;
}

.prose h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
}

.prose p {
  margin-bottom: 1rem;
}

.prose ul, .prose ol {
  margin: 0.75rem 0 1rem 1.5rem;
}

.prose li {
  margin-bottom: 0.35rem;
}

.prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 0 0.5rem 1.25rem;
  margin: 1.25rem 0;
  color: var(--fg-muted);
  font-style: italic;
}

.prose code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: color-mix(in srgb, var(--fg) 8%, transparent);
  padding: 0.15em 0.35em;
  border-radius: 2px;
}

.prose pre {
  background: color-mix(in srgb, var(--fg) 6%, transparent);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.25rem 0;
  border: 1px solid color-mix(in srgb, var(--fg) 12%, transparent);
}

.prose pre code {
  background: none;
  padding: 0;
}

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

.prose hr {
  border: none;
  border-top: 2px solid var(--border);
  margin: 2rem 0;
}

.post-footer {
  padding: 1.5rem 0;
  border-top: 1px solid color-mix(in srgb, var(--fg) 15%, transparent);
  font-family: var(--mono);
  font-size: 0.875rem;
}

/* WIDE / INTERACTIVE POSTS */
.post-wide .prose .full-width {
  width: 100vw;
  position: relative;
  left: 50%;
  margin-left: -50vw;
  padding: 2rem 1.5rem;
}

.post-wide .prose .full-width-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.prose .interactive {
  margin: 2rem 0;
  padding: 1.5rem;
  border: 1px solid color-mix(in srgb, var(--fg) 12%, transparent);
  border-radius: 4px;
  background: var(--card-bg);
}

.prose .interactive figcaption {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-top: 0.75rem;
}

.prose .scroll-section {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 404 */
.not-found {
  padding: 4rem 0;
  text-align: center;
}

.not-found h1 {
  font-size: 5rem;
  font-weight: 700;
  letter-spacing: -0.05em;
}

/* FOOTER */
footer {
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--fg-muted);
}

footer a {
  color: var(--fg-muted);
}

/* MOBILE */
@media (max-width: 600px) {
  html { font-size: 16px; }
  .hero h1 { font-size: 2.25rem; }
  .post header h1 { font-size: 1.75rem; }
  nav { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .nav-left { gap: 1rem; }
  .nav-icons { gap: 0.75rem; }
}
