/* ---------- tokens ---------- */
:root {
  --bg:        #0f1115;
  --bg-soft:   #161922;
  --bg-code:   #0b0d11;
  --fg:        #c9d1d9;
  --fg-dim:    #8b949e;
  --accent:    #4cc9f0;
  --accent-2:  #7ee787;
  --border:    #232833;
  --radius:    10px;
  --wrap:      860px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 20px;
}

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

/* ---------- header ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(15, 17, 21, .85);
  position: sticky;
  top: 0;
  backdrop-filter: blur(6px);
  z-index: 10;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  flex-wrap: wrap;
}
.brand {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--fg);
  font-size: 1.05rem;
}
.brand .prompt { color: var(--accent-2); }
.nav a {
  font-family: var(--mono);
  font-size: .9rem;
  color: var(--fg-dim);
  margin-left: 16px;
}
.nav a:hover { color: var(--accent); text-decoration: none; }

/* ---------- main ---------- */
main { padding: 40px 0 64px; }

.hero h1 { margin: 0 0 6px; font-size: 2rem; letter-spacing: -.02em; }
.lead { color: var(--fg-dim); margin: 0 0 32px; }

h2.rule {
  font-size: 1rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--fg-dim);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin: 40px 0 16px;
}

/* ---------- cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.card {
  display: block;
  padding: 18px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
}
.card:hover {
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-2px);
  transition: transform .12s ease;
}
.card h2 { margin: 0 0 6px; font-size: 1.1rem; color: var(--fg); }
.card p { margin: 0 0 10px; color: var(--fg-dim); font-size: .92rem; }
.card .count {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--accent-2);
}

/* ---------- post list ---------- */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.post-list li:last-child { border-bottom: 0; }
.post-link { font-size: 1.05rem; font-weight: 600; }
.meta {
  display: block;
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--fg-dim);
  margin-top: 2px;
}
.excerpt { margin: 6px 0 0; color: var(--fg-dim); font-size: .92rem; }
.empty { color: var(--fg-dim); font-style: italic; }

.tag {
  display: inline-block;
  background: #1d2430;
  border: 1px solid var(--border);
  color: var(--fg-dim);
  border-radius: 999px;
  padding: 0 8px;
  margin-left: 6px;
  font-size: .72rem;
}

/* ---------- article ---------- */
.post-header { margin-bottom: 28px; border-bottom: 1px solid var(--border); padding-bottom: 14px; }
.post-header h1 { margin: 0 0 6px; font-size: 1.9rem; letter-spacing: -.02em; }
.post-footer { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--border); font-family: var(--mono); font-size: .85rem; }

.content h2 { margin-top: 40px; font-size: 1.35rem; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.content h3 { margin-top: 28px; font-size: 1.1rem; }
.content p, .content li { color: #d5dde5; }
.content img { max-width: 100%; border: 1px solid var(--border); border-radius: 8px; }

.content blockquote {
  margin: 20px 0;
  padding: 4px 16px;
  border-left: 3px solid var(--accent);
  background: var(--bg-soft);
  color: var(--fg-dim);
}

.content code {
  font-family: var(--mono);
  font-size: .88em;
  background: #1b2029;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
}
.content pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  font-size: .86rem;
  line-height: 1.6;
}
.content pre code { background: none; border: 0; padding: 0; }

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: .9rem;
  display: block;
  overflow-x: auto;
}
.content th, .content td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.content th { background: var(--bg-soft); }

hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }

/* ---------- rouge (dark) ---------- */
.highlight { background: var(--bg-code); }
.highlight .c, .highlight .c1, .highlight .cm { color: #6a737d; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kt { color: #ff7b72; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sc { color: #a5d6ff; }
.highlight .m, .highlight .mi, .highlight .mf { color: #79c0ff; }
.highlight .na, .highlight .nb, .highlight .nc, .highlight .nf { color: #d2a8ff; }
.highlight .nv, .highlight .vi { color: #ffa657; }
.highlight .o, .highlight .ow { color: #ff7b72; }
.highlight .p, .highlight .pun { color: var(--fg); }
.highlight .err { color: #f85149; }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--fg-dim);
  font-family: var(--mono);
  font-size: .8rem;
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 18px;
  padding-bottom: 18px;
  flex-wrap: wrap;
}

@media (max-width: 520px) {
  .hero h1 { font-size: 1.6rem; }
  .nav a { margin-left: 0; margin-right: 14px; }
}
