/* ── Design tokens ─────────────────────────────────────────── */
:root {
  --bg:        #09090b;
  --surface:   #111113;
  --surface2:  #18181b;
  --border:    #27272a;
  --accent:    #6366f1;   /* indigo — techy, readable on dark */
  --accent-hi: #818cf8;
  --text:      #e4e4e7;
  --muted:     #71717a;
  --danger:    #f43f5e;

  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', Menlo, Consolas, monospace;

  --max-w:     720px;
  --max-w-wide: 1100px;
  --radius:    6px;
}

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

/* ── Base ──────────────────────────────────────────────────── */
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent-hi);
  text-decoration: none;
}
a:hover { color: #fff; text-decoration: underline; }

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

/* ── Layout shell ──────────────────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9,9,11,0.92);
  backdrop-filter: blur(8px);
}

.header-inner {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.site-logo {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #fff;
  white-space: nowrap;
}
.site-logo span { color: var(--accent-hi); }
.site-logo:hover { text-decoration: none; color: #fff; }

nav { display: flex; gap: 1.75rem; align-items: center; }

nav a {
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 500;
  transition: color 0.15s;
}
nav a:hover, nav a.active { color: var(--text); text-decoration: none; }

.main-content {
  flex: 1;
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 3rem 1.5rem;
  width: 100%;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Homepage hero ─────────────────────────────────────────── */
.hero {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.hero-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-hi);
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: #fff;
  max-width: 680px;
  margin-bottom: 1.25rem;
}

.hero-sub {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 560px;
  line-height: 1.6;
  margin-bottom: 2rem;
}

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

/* ── Tags / pills ──────────────────────────────────────────── */
.tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface2);
}
.tag:hover { border-color: var(--accent); color: var(--accent-hi); text-decoration: none; }

/* ── Post grid / listing ───────────────────────────────────── */
.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color 0.15s, transform 0.15s;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.post-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}

.post-card-meta {
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.post-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.post-card-excerpt {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
  flex: 1;
}

.post-card-footer {
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--accent-hi);
  font-weight: 500;
}

/* Full post list (blog index) */
.post-list { list-style: none; }

.post-list-item {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: start;
}

.post-list-item:first-child { border-top: 1px solid var(--border); }

.post-list-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 0.3rem;
  transition: color 0.15s;
}
.post-list-item:hover .post-list-title { color: #fff; }

.post-list-excerpt {
  font-size: 0.85rem;
  color: var(--muted);
}

.post-list-date {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ── Single post ───────────────────────────────────────────── */
.post-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
}

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

.post-header-meta {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: center;
}

.post-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: #fff;
  margin-bottom: 1rem;
}

.post-header-desc {
  font-size: 1.1rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ── Prose ─────────────────────────────────────────────────── */
.prose {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--text);
}

.prose h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.prose h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin: 2rem 0 0.75rem;
}

.prose h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.5rem 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.85rem;
}

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

.prose a { color: var(--accent-hi); }
.prose a:hover { color: #fff; }

.prose strong { color: #fff; font-weight: 600; }
.prose em { font-style: italic; }

.prose ul, .prose ol {
  margin: 0 0 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.prose li { color: var(--text); }

.prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  background: var(--surface2);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--muted);
  font-style: italic;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  color: var(--accent-hi);
}

.prose pre {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.prose pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  font-size: 0.875rem;
}

.prose img {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 1.5rem 0;
}

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

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

.prose th {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 2px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.prose td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

/* ── Pagination ────────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}

.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--surface);
  color: var(--muted);
  transition: all 0.15s;
}

.pagination a:hover { border-color: var(--accent); color: var(--text); text-decoration: none; }
.pagination .current { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination .disabled { opacity: 0.3; pointer-events: none; }

/* ── Back link ─────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 2rem;
  transition: color 0.15s;
}
.back-link:hover { color: var(--text); text-decoration: none; }

/* ── Post tags row ─────────────────────────────────────────── */
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1rem;
}

/* ── Giscus comments ───────────────────────────────────────── */
.giscus-wrap {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 640px) {
  .post-grid { grid-template-columns: 1fr; }
  .post-list-item { grid-template-columns: 1fr; }
  .post-list-date { display: none; }
  .header-inner { padding: 0 1rem; }
  .main-content { padding: 2rem 1rem; }
}
