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

:root {
  --bg: #0d1117;
  --bg-card: #161b22;
  --bg-tag: #1c2b3a;
  --border: #21262d;
  --text: #c9d1d9;
  --text-muted: #8b949e;
  --text-heading: #e6edf3;
  --accent: #58a6ff;
  --accent-dim: #1f3a5c;
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --max-width: 720px;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Layout */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

main {
  flex: 1;
  padding: 3rem 0 5rem;
}

/* Header & Nav */

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 1.1rem 0;
  position: sticky;
  top: 0;
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(6px);
  z-index: 100;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-name {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-heading);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.site-name:hover {
  text-decoration: none;
  color: var(--accent);
}

.site-name-bracket {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.15s;
}

.nav-links a:hover,
.nav-links a.nav-active {
  color: var(--text-heading);
  text-decoration: none;
}

.nav-rss {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  border: 1px solid var(--border);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.nav-rss:hover {
  border-color: var(--accent);
  color: var(--accent) !important;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
}

.site-footer p {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.site-footer a {
  color: var(--text-muted);
}

.site-footer a:hover {
  color: var(--accent);
}

/* Home */

.home-intro {
  padding: 3rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.home-intro h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-heading);
  letter-spacing: -0.02em;
  margin-bottom: 0.6rem;
}

.home-intro p {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 520px;
}

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

.post-card {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}

.post-card:last-child {
  border-bottom: none;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.post-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.read-time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.post-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 0.4rem;
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.post-card-title a {
  color: inherit;
}

.post-card-title a:hover {
  color: var(--accent);
  text-decoration: none;
}

.post-card-excerpt {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

/* Tags */

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: var(--bg-tag);
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  letter-spacing: 0.02em;
}

/* Post */

.post {
  max-width: 100%;
}

.post-header {
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.post-header-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.post-header-meta time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.meta-divider {
  color: var(--border);
}

.post-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: -0.025em;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

.post-description {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Post content typography */

.post-content {
  font-size: 1rem;
  line-height: 1.8;
}

.post-content h2 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-heading);
  letter-spacing: -0.02em;
  margin: 2.5rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.post-content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-heading);
  margin: 2rem 0 0.5rem;
}

.post-content h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 1.5rem 0 0.5rem;
}

.post-content p {
  margin-bottom: 1.2rem;
}

.post-content ul,
.post-content ol {
  margin: 0 0 1.2rem 1.5rem;
}

.post-content li {
  margin-bottom: 0.35rem;
}

.post-content li::marker {
  color: var(--text-muted);
}

.post-content strong {
  color: var(--text-heading);
  font-weight: 600;
}

.post-content em {
  color: var(--text-muted);
}

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

.post-content blockquote {
  border-left: 3px solid var(--accent-dim);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  background: var(--bg-card);
  border-radius: 0 4px 4px 0;
}

.post-content blockquote p {
  margin: 0;
  color: var(--text-muted);
  font-style: italic;
}

/* Code */

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.1em 0.4em;
  border-radius: 3px;
  color: #e06c75;
}

.post-content pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.post-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
  color: var(--text);
  border-radius: 0;
}

/* Mermaid */

.post-content .mermaid {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  text-align: center;
  overflow-x: auto;
}

/* Tables */

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.875rem;
}

.post-content th {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.post-content td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.post-content tr:last-child td {
  border-bottom: none;
}

/* Post footer */

.post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.back-link {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.back-link:hover {
  color: var(--accent);
  text-decoration: none;
}

/* About page */

.about-page {
  padding-top: 1.5rem;
}

.about-page h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 1rem;
}

.about-page h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-heading);
  margin: 1.75rem 0 0.5rem;
  font-family: var(--font-mono);
}

.about-page p {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.about-page ul {
  margin: 0 0 1rem 1.25rem;
  color: var(--text-muted);
}

.about-page li {
  margin-bottom: 0.3rem;
}

/* Responsive */

/* Syntax highlighting (Rouge) */

.highlight .c,  .highlight .c1, .highlight .cm  { color: #6a737d; font-style: italic; } /* comments */
.highlight .k,  .highlight .kd, .highlight .kn,
.highlight .kp, .highlight .kr, .highlight .kt  { color: #f97583; }                     /* keywords */
.highlight .s,  .highlight .s1, .highlight .s2,
.highlight .sb, .highlight .sc, .highlight .sd,
.highlight .se, .highlight .sh, .highlight .si,
.highlight .sx, .highlight .sr, .highlight .ss  { color: #9ecbff; }                     /* strings */
.highlight .mi, .highlight .mf, .highlight .mh,
.highlight .il, .highlight .m                   { color: #79b8ff; }                     /* numbers */
.highlight .nf, .highlight .fm                  { color: #b392f0; }                     /* functions */
.highlight .na, .highlight .nb                  { color: #79b8ff; }                     /* builtins / attrs */
.highlight .nc, .highlight .nn                  { color: #b392f0; }                     /* class names */
.highlight .o,  .highlight .ow                  { color: #f97583; }                     /* operators */
.highlight .p                                   { color: var(--text); }                 /* punctuation */
.highlight .n,  .highlight .nx                  { color: var(--text); }                 /* names */
.highlight .bp                                  { color: #79b8ff; }                     /* self/cls */
.highlight .nt                                  { color: #85e89d; }                     /* tags (HTML/XML) */
.highlight .nv, .highlight .vc, .highlight .vg,
.highlight .vi                                  { color: #ffab70; }                     /* variables */

@media (max-width: 600px) {
  .post-title {
    font-size: 1.4rem;
  }

  .home-intro h1 {
    font-size: 1.25rem;
  }

  main {
    padding: 2rem 0 4rem;
  }
}
