/* ============================================
   Design System — Meet Shah
   Pure CSS, light/dark, system fonts
   ============================================ */
/* --- CSS Variables (Light) --- */
:root {
  --bg: #fafafa;
  --bg-card: #ffffff;
  --bg-code: #f4f4f5;
  --text: #1a1a2e;
  --text-secondary: #555;
  --text-muted: #888;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #dbeafe;
  --border: #e2e8f0;
  --border-light: #f0f0f0;
  --radius: 8px;
  --radius-sm: 4px;
  --max-width: 900px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
  --line-height: 1.7;
  --line-height-heading: 1.3;
}
/* --- Dark Mode --- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --bg-card: #111827;
    --bg-code: #18202f;
    --text: #e4e4ed;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #60a5fa;
    --accent-hover: #93bbfc;
    --accent-light: #1e293b;
    --border: #1e293b;
    --border-light: #18202f;
  }
}
[data-theme="dark"] {
  --bg: #0b1120;
  --bg-card: #111827;
  --bg-code: #18202f;
  --text: #e4e4ed;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #60a5fa;
  --accent-hover: #93bbfc;
  --accent-light: #1e293b;
  --border: #1e293b;
  --border-light: #18202f;
}
[data-theme="light"] {
  --bg: #fafafa;
  --bg-card: #ffffff;
  --bg-code: #f4f4f5;
  --text: #1a1a2e;
  --text-secondary: #555;
  --text-muted: #888;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #dbeafe;
  --border: #e2e8f0;
  --border-light: #f0f0f0;
}
/* --- Reset --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  font-size: 20px;
}
body {
  font-family: var(--font-sans);
  line-height: var(--line-height);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s ease, color 0.3s ease;
}
/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  line-height: var(--line-height-heading);
  font-weight: 600;
  color: var(--text);
}
h1 { font-size: 2rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.5rem; margin: 2rem 0 0.75rem; }
h3 { font-size: 1.25rem; margin: 1.5rem 0 0.5rem; }
p { margin-bottom: 1rem; }
a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}
strong { font-weight: 600; }
small { font-size: 0.875rem; color: var(--text-muted); }
/* --- Code --- */
code, pre {
  font-family: var(--font-mono);
  font-size: 0.875rem;
}
code {
  background: var(--bg-code);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
}
pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
  line-height: 1.5;
}
pre code {
  background: none;
  padding: 0;
}
/* --- Blockquote --- */
blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  color: var(--text-secondary);
  background: var(--accent-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
/* --- Lists --- */
ul, ol { margin: 0.5rem 0 1rem 1.5rem; }
li { margin-bottom: 0.25rem; }
/* --- Images --- */
img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}
/* --- Horizontal Rule --- */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}
/* --- Layout Container --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}
/* --- Navigation --- */
.nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
  border-bottom: 1px solid var(--border);
}
.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}
.nav-links a {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 500;
}
.nav-links a:hover {
  color: var(--accent);
  text-decoration: none;
}
.nav-links a.active {
  color: var(--text);
  font-weight: 600;
}
.nav-brand {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
}
.nav-brand:hover {
  color: var(--accent);
  text-decoration: none;
}
/* --- Theme Toggle --- */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1;
  transition: all 0.2s;
}
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}
/* --- Content --- */
.content h2:first-of-type {
  margin-top: 0;
}
/* --- Publications List --- */
.publication {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  padding-left: 1rem;
  border-bottom: 1px solid var(--border-light);
}
.publication:last-child {
  border-bottom: none;
}
.publication-title {
  font-weight: 600;
  margin-bottom: 0.15rem;
}
.publication-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.publication-meta a {
  font-size: 0.8125rem;
  font-weight: 500;
  margin-left: 0.5rem;
}
.publication:first-of-type {
  margin-top: 0.5rem;
}
/* --- Reading Progress Bar --- */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
  z-index: 1000;
  width: 0%;
  transition: width 0.1s linear;
}
/* --- Back to Top --- */
.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}
.back-to-top:hover {
  transform: translateY(-2px);
  background: var(--accent-hover);
}
/* --- Blog Listing --- */
.blog-listing {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.blog-header {
  margin-bottom: 2rem;
}
.blog-header h1 {
  margin-bottom: 0.5rem;
}
.blog-header p {
  color: var(--text-secondary);
}
.blog-list-item {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border-light);
}
.blog-list-item:first-of-type {
  padding-top: 0;
}
.blog-list-item:last-of-type {
  border-bottom: none;
}
.blog-list-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.blog-list-title a {
  color: var(--text);
}
.blog-list-title a:hover {
  color: var(--accent);
  text-decoration: none;
}
.blog-list-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.blog-list-desc {
  font-size: 0.9375rem;
  color: var(--text-secondary);
}
/* --- Blog Post Layout (TOC sidebar + content) --- */
.post-wrapper {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2.5rem;
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.post-toc {
  position: sticky;
  top: 2rem;
  align-self: start;
  padding-left: 1rem;
  border-left: 1px solid var(--border-light);
}
.post-toc .toc-progress {
  position: absolute;
  left: -1px;
  top: 0;
  width: 2px;
  height: 100%;
  background: var(--border-light);
}
.post-toc .toc-progress-fill {
  position: absolute;
  left: -1px;
  top: 0;
  width: 2px;
  height: 0%;
  background: var(--accent);
  transition: height 0.1s linear;
}
.post-toc h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-weight: 600;
}
.post-toc nav ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
.post-toc nav ol li {
  margin-bottom: 0.6rem;
}
.post-toc nav ol li a {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  display: block;
  transition: color 0.2s;
}
.post-toc nav ol li a:hover {
  color: var(--accent);
  text-decoration: none;
}
.post-toc nav ol li a.active {
  color: var(--text);
  font-weight: 600;
}
.post-toc .toc-num {
  font-size: 0.65rem;
  color: var(--text-muted);
  display: inline-block;
  width: 1.5rem;
  font-weight: 500;
  opacity: 0.6;
}
.post-toc nav ol li a.active .toc-num {
  color: var(--accent);
  opacity: 1;
}
/* --- Subscribe / RSS --- */
.subscribe-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  font-size: 0.875rem;
}
.subscribe-bar a {
  font-weight: 500;
}
/* --- Tags --- */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0;
}
.tag {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-weight: 500;
}
/* --- 404 --- */
.error-page {
  text-align: center;
  padding: 5rem 1.5rem;
}
.error-page h1 {
  font-size: 4rem;
  margin-bottom: 0.5rem;
}
.error-page p {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}
/* --- Responsive --- */
@media (max-width: 768px) {
  .post-wrapper {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .post-toc {
    position: static;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    padding-left: 0;
    border-left: none;
    border-bottom: 1px solid var(--border);
  }
  .post-toc .toc-progress,
  .post-toc .toc-progress-fill {
    display: none;
  }
  .post-toc nav ol {
    display: block;
  }
  .post-toc nav ol li {
    margin-bottom: 0.4rem;
  }
  .nav {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}
@media (max-width: 480px) {
  html { font-size: 15px; }
  .container { padding: 0 1rem; }
}
