@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,600;0,700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');
:root {
  --bg: #08080f; --bg-card: rgba(255,255,255,0.025); --bg-input: rgba(255,255,255,0.04);
  --text: #c8c8d0; --text-heading: #ededf0;
  --text-secondary: #8888a0; --text-muted: #555568;
  --border: rgba(255,255,255,0.06); --border-strong: rgba(255,255,255,0.12);
  --accent: #8b7bf6; --accent-bg: rgba(139,123,246,0.1);
  --success: #34d399; --warning: #fbbf24; --danger: #f87171;
  --radius: 8px; --radius-lg: 14px;
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', 'JetBrains Mono', monospace;
}
body.alt-theme {
  --bg: #f8f8f4; --bg-card: #fff; --bg-input: #fff;
  --text: #2a2a30; --text-heading: #141418;
  --text-secondary: #606068; --text-muted: #9898a0;
  --border: #e4e4e0; --border-strong: #d0d0cc;
  --accent: #5b5fd0; --accent-bg: rgba(91,95,208,0.06);
  --success: #34d399; --warning: #d97706; --danger: #dc2626;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  line-height: 1.7; -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s, color 0.3s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.site-header {
  border-bottom: 1px solid var(--border); padding: 16px 0; position: sticky; top: 0;
  background: var(--bg); z-index: 10; backdrop-filter: blur(10px);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 900px;
}
.site-name { font-size: 1.1rem; font-weight: 700; color: var(--text-heading); text-decoration: none; }
.site-name:hover { text-decoration: none; opacity: 0.8; }
.site-nav { display: flex; gap: 16px; font-size: 0.85rem; align-items: center; }
.site-nav a { color: var(--text-secondary); }
.site-nav a:hover { color: var(--accent); text-decoration: none; }
.container { max-width: 900px; margin: 0 auto; padding: 0 20px; }
.container-wide { max-width: 900px; margin: 0 auto; padding: 0 20px; }
.site-footer {
  border-top: 1px solid var(--border); padding: 24px 0;
  margin-top: 48px; color: var(--text-muted); font-size: 0.8rem; text-align: center;
}

/* Theme toggle */
.theme-toggle {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 4px 8px;
  transition: color 0.2s, border-color 0.2s; line-height: 1;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* Search */
.search-toggle { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 4px; }
.search-toggle:hover { color: var(--accent); }
.search-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  z-index: 100; backdrop-filter: blur(4px);
}
.search-overlay.open { display: flex; align-items: flex-start; justify-content: center; padding-top: 15vh; }
.search-box {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
  width: min(560px, 90vw); padding: 20px; box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.search-input {
  width: 100%; padding: 12px 16px; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 16px; color: var(--text); font-family: var(--font); outline: none;
}
.search-input:focus { border-color: var(--accent); }
.search-results { margin-top: 12px; max-height: 50vh; overflow-y: auto; }
.search-result {
  display: block; padding: 10px 12px; border-radius: var(--radius); color: var(--text);
  text-decoration: none; transition: background 0.15s;
}
.search-result:hover { background: var(--bg-card); text-decoration: none; }
.search-result-title { font-weight: 600; color: var(--text-heading); font-size: 0.95rem; }
.search-result-summary { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

/* Hero */
.hero { padding: 48px 0 32px; text-align: center; }
.hero h1 { font-size: 2rem; font-weight: 700; color: var(--text-heading); margin-bottom: 8px; }
.hero .tagline { font-size: 1rem; color: var(--text-secondary); margin-bottom: 16px; }
.hero .social { display: flex; gap: 16px; justify-content: center; font-size: 0.85rem; }

/* Featured post */
.featured {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; margin-bottom: 32px; transition: border-color 0.2s;
}
.featured:hover { border-color: var(--accent); }
.featured .label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: var(--accent); font-weight: 600; margin-bottom: 8px; }
.featured .title { font-size: 1.4rem; font-weight: 700; color: var(--text-heading); margin-bottom: 6px; }
.featured .summary { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 10px; }
.featured .meta { font-size: 0.8rem; color: var(--text-muted); }

/* Post grid */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 32px; }
.post-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px; transition: border-color 0.2s, transform 0.15s;
}
.post-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.post-card .card-title { font-size: 1rem; font-weight: 600; color: var(--text-heading); margin-bottom: 6px; }
.post-card .card-meta { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 6px; }
.post-card .card-summary { font-size: 0.85rem; color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-card .card-tags { margin-top: 8px; }

/* Post list (tag pages, related) */
.post-list { list-style: none; }
.post-item { padding: 16px 0; border-bottom: 1px solid var(--border); }
.post-item:last-child { border-bottom: none; }
.post-title { font-size: 1.15rem; font-weight: 600; color: var(--text-heading); }
.post-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.post-summary { font-size: 0.9rem; color: var(--text-secondary); margin-top: 6px; }

/* Tags */
.tag { display: inline-block; padding: 2px 10px; border-radius: 4px; font-size: 0.75rem;
  background: var(--accent-bg); color: var(--accent); margin-right: 4px; text-decoration: none; }
.tag:hover { text-decoration: none; opacity: 0.8; }

/* Article content */
.article { line-height: 1.8; }
.article h1 { font-size: 1.8rem; color: var(--text-heading); margin: 32px 0 12px; font-weight: 700; }
.article h2 { font-size: 1.4rem; color: var(--text-heading); margin: 28px 0 10px; font-weight: 600; }
.article h3 { font-size: 1.15rem; color: var(--text-heading); margin: 24px 0 8px; font-weight: 600; }
.article p { margin: 12px 0; }
.article ul, .article ol { margin: 12px 0; padding-left: 24px; }
.article li { margin: 4px 0; }
.article blockquote {
  border-left: 3px solid var(--accent); padding: 8px 16px; margin: 16px 0;
  color: var(--text-secondary); background: var(--bg-card); border-radius: 0 var(--radius) var(--radius) 0;
}
.article img { max-width: 100%; border-radius: var(--radius); margin: 16px 0; }
.article code {
  font-family: var(--mono); font-size: 0.85em;
  background: var(--bg-card); padding: 2px 6px; border-radius: 4px;
}
.article pre {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; overflow-x: auto; margin: 16px 0;
}
.article pre code { background: none; padding: 0; font-size: 0.85rem; }
.article table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.article th { text-align: left; font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.5px; padding: 8px; border-bottom: 1px solid var(--border); }
.article td { padding: 8px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }

/* Callouts */
.callout {
  border-left: 3px solid var(--accent); padding: 12px 16px; margin: 16px 0;
  background: var(--bg-card); border-radius: 0 var(--radius) var(--radius) 0;
}
.callout-title { font-weight: 600; color: var(--text-heading); }
.callout-note { border-left-color: var(--accent); }
.callout-warning { border-left-color: var(--warning); }
.callout-tip { border-left-color: var(--success); }
.callout-danger { border-left-color: var(--danger); }

/* Wikilinks */
.wikilink { color: var(--accent); text-decoration: none; border-bottom: 1px dashed var(--accent); }
.wikilink:hover { border-bottom-style: solid; }
.wikilink-private { color: var(--text-muted); }

/* Header permalink */
.header-link { color: var(--text-muted); margin-left: 6px; font-size: 0.8em; opacity: 0; transition: opacity 0.15s; }
h1:hover .header-link, h2:hover .header-link, h3:hover .header-link { opacity: 1; }

/* Video embeds */
.video-embed { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; margin: 16px 0; border-radius: var(--radius); }
.video-embed iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; border-radius: var(--radius); }

/* Audio */
audio { width: 100%; margin: 12px 0; border-radius: var(--radius); }

/* Avatar */
.hero-avatar { width: 80px; height: 80px; border-radius: 50%; margin-bottom: 12px; border: 2px solid var(--border); }
.author-avatar { width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--border); flex-shrink: 0; }

/* Author card */
.author-card {
  display: flex; align-items: center; gap: 16px; padding: 20px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  margin-top: 40px;
}
.author-card .author-info { flex: 1; }
.author-card .author-name { font-weight: 700; color: var(--text-heading); font-size: 1rem; }
.author-card .author-bio { font-size: 0.85rem; color: var(--text-secondary); margin-top: 4px; }
.author-card .author-links { font-size: 0.8rem; margin-top: 6px; }
.author-card .author-links a { color: var(--text-muted); margin-right: 12px; }
.author-card .author-links a:hover { color: var(--accent); text-decoration: none; }

/* Language switcher */
.lang-switch {
  display: flex; gap: 6px; margin-bottom: 16px;
}
.lang-switch a {
  padding: 3px 10px; border-radius: 4px; font-size: 0.75rem; font-weight: 500;
  color: var(--text-muted); border: 1px solid var(--border); text-decoration: none;
}
.lang-switch a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.lang-switch a.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* AI translation notice */
.ai-notice {
  padding: 10px 14px; margin-bottom: 20px; border-radius: var(--radius);
  background: var(--accent-bg); border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  font-size: 0.8rem; color: var(--text-secondary);
}

/* TOC sidebar */
.post-layout { display: grid; grid-template-columns: 1fr 200px; gap: 32px; align-items: start; }
.toc-sidebar { position: sticky; top: 80px; font-size: 0.8rem; }
.toc-sidebar .toc-title { font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-size: 0.7rem; margin-bottom: 8px; }
.toc-sidebar ul { list-style: none; padding: 0; }
.toc-sidebar li { margin: 4px 0; }
.toc-sidebar a { color: var(--text-muted); text-decoration: none; display: block; padding: 2px 0; transition: color 0.15s; }
.toc-sidebar a:hover { color: var(--accent); text-decoration: none; }
.toc-sidebar li li { padding-left: 12px; }
.toc-sidebar li li li { padding-left: 12px; }

/* Section heading */
.section-heading { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); font-weight: 600; margin-bottom: 16px; }

/* Landing page hero */
.landing-hero { padding: 64px 0 48px; text-align: center; }
.landing-hero h1 { font-size: 2.6rem; font-weight: 700; color: var(--text-heading); margin-bottom: 12px; letter-spacing: -0.02em; }
.landing-hero .tagline { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 28px; max-width: 600px; margin-left: auto; margin-right: auto; line-height: 1.7; }
.landing-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.landing-cta a {
  display: inline-block; padding: 10px 24px; border-radius: var(--radius);
  font-weight: 600; font-size: 0.95rem; text-decoration: none; transition: opacity 0.2s;
}
.landing-cta a:hover { text-decoration: none; opacity: 0.85; }
.cta-primary { background: var(--accent); color: #fff; }
.cta-secondary { border: 1px solid var(--border-strong); color: var(--text-heading); }

/* Feature grid */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; margin: 40px 0; }
.feature-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; transition: border-color 0.2s;
}
.feature-card:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.feature-card h3 { font-size: 1.05rem; font-weight: 600; color: var(--text-heading); margin-bottom: 8px; }
.feature-card .fc-body { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.6; }
.feature-card .fc-body p { margin: 4px 0; }

/* Blog preview on landing */
.blog-preview { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--border); }

/* Docs sidebar layout */
.docs-layout { display: grid; grid-template-columns: 200px 1fr; gap: 32px; align-items: start; }
.docs-sidebar {
  position: sticky; top: 80px; font-size: 0.85rem; padding-top: 8px;
}
.docs-sidebar .sidebar-title {
  font-weight: 600; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.5px; font-size: 0.7rem; margin-bottom: 12px;
}
.docs-sidebar ul { list-style: none; padding: 0; }
.docs-sidebar li { margin: 2px 0; }
.docs-sidebar a {
  display: block; padding: 6px 12px; border-radius: 6px; color: var(--text-secondary);
  text-decoration: none; font-size: 0.85rem; transition: background 0.15s, color 0.15s;
}
.docs-sidebar a:hover { background: var(--bg-card); color: var(--accent); text-decoration: none; }
.docs-sidebar a.active { background: var(--accent-bg); color: var(--accent); font-weight: 500; }

/* Responsive */
@media (max-width: 768px) {
  .post-layout { grid-template-columns: 1fr; }
  .toc-sidebar { display: none; }
  .hero h1 { font-size: 1.5rem; }
  .landing-hero h1 { font-size: 1.8rem; }
  .docs-layout { grid-template-columns: 1fr; }
  .docs-sidebar { display: none; }
  .post-grid { grid-template-columns: 1fr; }
  .featured { padding: 18px; }
  .author-card { flex-direction: column; text-align: center; }
}
@media (max-width: 600px) {
  .container { padding: 0 16px; }
  .article h1 { font-size: 1.4rem; }
  .article h2 { font-size: 1.2rem; }
}
