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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2d3a;
  --text: #e2e8f0;
  --muted: #8892a4;
  --accent: #7c9ef8;
  --accent-hover: #a5bcff;
  --code-bg: #161b22;
  --tag-bg: #1e2433;
  --tag-text: #7c9ef8;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
  --max-width: 740px;
}

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

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

/* Layout */
header, main, footer {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

main { flex: 1; padding-top: 3rem; padding-bottom: 4rem; }

/* Header / Nav */
header {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.site-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.site-title:hover { color: var(--accent-hover); }

/* Footer */
footer {
  padding-top: 2rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
}
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--accent-hover); }

/* Home */
.intro {
  margin-bottom: 3rem;
  font-size: 1.05rem;
}
.intro p { color: var(--muted); }
.intro p + p {
  margin-top: 0.75rem;
  font-size: 0.9rem;
}
.intro a { color: var(--accent); text-decoration: none; }
.intro a:hover { color: var(--accent-hover); text-decoration: underline; }

.post-list { display: flex; flex-direction: column; gap: 2.5rem; }

.backlog {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.backlog h3 { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.75rem; }
.backlog ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.backlog li { color: var(--muted); font-size: 0.9rem; padding-left: 1rem; position: relative; }
.backlog li::before { content: "·"; position: absolute; left: 0; color: var(--border); }

.post-item time {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
  font-variant-numeric: tabular-nums;
}

.post-item h2 { font-size: 1.2rem; font-weight: 600; margin-bottom: 0.5rem; }
.post-item h2 a { color: var(--text); text-decoration: none; }
.post-item h2 a:hover { color: var(--accent-hover); }
.post-item p { color: var(--muted); font-size: 0.95rem; }

/* Tags */
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.tag {
  font-size: 0.75rem;
  padding: 0.15rem 0.6rem;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 999px;
  border: 1px solid var(--border);
}

/* Post */
.post-header { margin-bottom: 2.5rem; }
.post-header h1 { font-size: 2rem; font-weight: 700; line-height: 1.3; margin-bottom: 0.75rem; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.post-meta time { color: var(--muted); font-size: 0.875rem; }

.post-footer { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.post-footer a { color: var(--accent); text-decoration: none; font-size: 0.9rem; }
.post-footer a:hover { color: var(--accent-hover); }

/* Post content typography */
.post-content { line-height: 1.8; }
.post-content > * + * { margin-top: 1.25rem; }

.post-content h2 { font-size: 1.5rem; font-weight: 700; margin-top: 2.5rem; margin-bottom: 0.75rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.post-content h3 { font-size: 1.2rem; font-weight: 600; margin-top: 2rem; margin-bottom: 0.5rem; }
.post-content h4 { font-size: 1.05rem; font-weight: 600; margin-top: 1.5rem; }

.post-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.post-content a:hover { color: var(--accent-hover); }

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

.post-content ul, .post-content ol { padding-left: 1.5rem; }
.post-content ul { list-style: disc; }
.post-content ol { list-style: decimal; }
.post-content li + li { margin-top: 0.3rem; }
.post-content li > ul, .post-content li > ol { margin-top: 0.3rem; }

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  color: var(--muted);
  border-radius: 0 6px 6px 0;
  font-style: italic;
}

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

/* Images */
.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
  margin: 1.5rem auto;
}
.post-content figure { margin: 1.5rem 0; }
.post-content figcaption { text-align: center; font-size: 0.85rem; color: var(--muted); margin-top: 0.5rem; }

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

/* Inline code */
.post-content code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  color: #e2a8f5;
}

/* Code blocks (Hugo Chroma) */
.post-content .highlight {
  margin: 1.5rem 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.post-content .highlight pre {
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  background: var(--code-bg) !important;
}
.post-content .highlight code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* Mermaid diagrams */
.post-content .mermaid {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  text-align: center;
}

/* Responsive */
@media (max-width: 600px) {
  .post-header h1 { font-size: 1.5rem; }
  .post-content h2 { font-size: 1.25rem; }
}
