/* ============================================
   GENERATIVE / DATA ART — clean + alive
   ============================================ */

:root {
  --bg: #fafafc;
  --bg-secondary: #f0f0f5;
  --text: #111118;
  --text-secondary: #55556a;
  --text-muted: #88889a;
  --accent: #6c5ce7;
  --accent-hover: #5a4bd6;
  --accent-glow: rgba(108,92,231,0.15);
  --border: #e0e0ea;
  --code-bg: #16161e;
  --code-text: #e8e8f0;
  --header-bg: rgba(250,250,252,0.88);
  --blockquote-border: #a29bfe;
  --blockquote-bg: #f5f4ff;
  --table-stripe: #f5f5fa;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --max-width: 720px;
  --header-height: 60px;
}

[data-theme="dark"] {
  --bg: #0a0a12;
  --bg-secondary: #12121e;
  --text: #e8e8f0;
  --text-secondary: #9898b0;
  --text-muted: #5a5a72;
  --accent: #a29bfe;
  --accent-hover: #c0b8ff;
  --accent-glow: rgba(162,155,254,0.12);
  --border: #22223a;
  --code-bg: #06060e;
  --code-text: #e8e8f0;
  --header-bg: rgba(10,10,18,0.92);
  --blockquote-border: #6c5ce7;
  --blockquote-bg: #12121e;
  --table-stripe: #12121e;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 17px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; background: var(--bg); }
body {
  font-family: var(--font-sans);
  color: var(--text); background: transparent;
  line-height: 1.7; transition: background 0.3s ease, color 0.3s ease;
}
a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
img { max-width: 100%; height: auto; border-radius: 6px; }

/* --- Layout --- */
.site-wrapper { min-height: 100vh; display: flex; flex-direction: column; }
.main-content {
  flex: 1; max-width: var(--max-width); width: 100%;
  margin: 0 auto; padding: calc(var(--header-height) + 2rem) 2rem 4rem;
  background: var(--bg);
  border-radius: 0 0 12px 12px;
}

/* --- Header --- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--header-bg); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border); height: var(--header-height);
}
.nav {
  max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem;
  height: 100%; display: flex; align-items: center; gap: 2rem;
}
.nav-logo { font-weight: 700; font-size: 1.15rem; color: var(--text); letter-spacing: -0.02em; }
.nav-logo:hover { color: var(--accent); text-decoration: none; }
.nav-links { display: flex; gap: 1.5rem; flex: 1; }
.nav-link { color: var(--text-secondary); font-size: 0.9rem; font-weight: 500; }
.nav-link:hover, .nav-link.active { color: var(--text); text-decoration: none; }

.theme-toggle {
  background: none; border: 1px solid var(--border); border-radius: 8px;
  padding: 6px; cursor: pointer; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

/* --- Generative Hero --- */
.hero {
  margin-bottom: 3rem; padding: 2.5rem 0;
  position: relative;
}
.hero h1 {
  font-size: 2.5rem; font-weight: 700; letter-spacing: -0.03em;
  line-height: 1.2; margin-bottom: 0.75rem;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub { font-size: 1.1rem; color: var(--text-secondary); line-height: 1.6; max-width: 560px; }

/* --- Sections --- */
.home-section { margin-bottom: 2.5rem; }
.home-section h2 {
  font-size: 0.8rem; font-weight: 600; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 0.75rem;
}

/* --- Post List with glow hover --- */
.post-list { list-style: none; padding: 0; }
.post-list li {
  padding: 0.6rem 0.75rem; margin-bottom: 0.25rem; font-size: 1rem;
  border-radius: 8px; transition: background 0.2s, box-shadow 0.2s;
}
.post-list li:hover {
  background: var(--accent-glow);
  box-shadow: 0 0 0 1px var(--accent);
}
.post-list a { color: var(--text); font-weight: 500; }
.post-list a:hover { color: var(--accent); text-decoration: none; }
.post-desc { color: var(--text-muted); font-size: 0.9rem; font-weight: 400; }

/* --- Page Header --- */
.page-header { margin-bottom: 2rem; }
.page-header h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; }
.page-description { color: var(--text-secondary); margin-top: 0.5rem; }

/* --- Single Post --- */
.post-header { margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.post-header h1 { font-size: 2rem; font-weight: 700; line-height: 1.25; letter-spacing: -0.02em; }

/* --- Post Content --- */
.post-content { line-height: 1.75; }
.post-content h2 { font-size: 1.5rem; font-weight: 700; margin: 2.5rem 0 1rem; }
.post-content h3 { font-size: 1.2rem; font-weight: 600; margin: 2rem 0 0.75rem; }
.post-content h4 { font-size: 1.05rem; font-weight: 600; margin: 1.5rem 0 0.5rem; }
.post-content p { margin-bottom: 1.25rem; }
.post-content ul, .post-content ol { margin-bottom: 1.25rem; padding-left: 1.5rem; }
.post-content li { margin-bottom: 0.35rem; }
.post-content li > ul, .post-content li > ol { margin-top: 0.35rem; margin-bottom: 0; }

.post-content blockquote {
  border-left: 3px solid var(--blockquote-border); background: var(--blockquote-bg);
  padding: 1rem 1.25rem; margin: 1.5rem 0; border-radius: 0 8px 8px 0;
  color: var(--text-secondary); font-size: 0.95rem;
}
.post-content blockquote p:last-child { margin-bottom: 0; }
.post-content hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* --- Code --- */
.post-content code {
  font-family: var(--font-mono); font-size: 0.85em;
  background: var(--accent-glow); color: var(--accent);
  padding: 0.15rem 0.4rem; border-radius: 4px;
}
.post-content .highlight pre, .post-content pre {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 1.25rem; margin: 1.5rem 0; overflow-x: auto;
  font-size: 0.85rem; line-height: 1.6;
}
.post-content pre code, .post-content .highlight pre code {
  background: none; color: inherit; padding: 0; border-radius: 0; font-size: inherit;
}
.post-content .highlight { margin: 1.5rem 0; border-radius: 8px; overflow: hidden; }
.post-content .highlight pre { margin: 0; border: 1px solid var(--border); }

/* --- Tables --- */
.post-content table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: 0.9rem; }
.post-content th, .post-content td { padding: 0.6rem 0.85rem; text-align: left; border-bottom: 1px solid var(--border); }
.post-content th { font-weight: 600; }
.post-content tr:nth-child(even) td { background: var(--table-stripe); }

.post-content img { display: block; margin: 1.5rem auto; border: 1px solid var(--border); border-radius: 8px; }

/* --- Footer --- */
.site-footer {
  max-width: var(--max-width); margin: 0 auto; padding: 2rem 1.5rem;
  border-top: 1px solid var(--border); text-align: center;
  font-size: 0.85rem; color: var(--text-muted);
}

/* --- Generative SVG Canvas (populated by JS) --- */
#generative-bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: 1;
}

@media (max-width: 640px) {
  html { font-size: 16px; }
  .hero h1 { font-size: 1.8rem; }
  .post-header h1 { font-size: 1.5rem; }
  .nav { gap: 1rem; }
  .main-content { padding-left: 1rem; padding-right: 1rem; }
}
