:root {
  --bg: #ffffff;
  --bg-alt: #f5f6f8;
  --fg: #1a1d23;
  --fg-muted: #5a6270;
  --border: #e2e5ea;
  --accent: #2f5fdd;
  --accent-fg: #ffffff;
  --code-bg: #1e1e2e;
  --max-width: 760px;
  --radius: 6px;
}

[data-theme="dark"] {
  --bg: #12141a;
  --bg-alt: #1a1d25;
  --fg: #e6e8ec;
  --fg-muted: #9aa2b1;
  --border: #2a2e38;
  --accent: #6c8fff;
  --accent-fg: #0d0f14;
  --code-bg: #16171f;
}

* { box-sizing: border-box; }

html { color-scheme: light dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--max-width);
  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);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
  gap: 16px;
}
.brand { font-weight: 700; color: var(--fg); font-size: 1.05rem; }
.brand:hover { text-decoration: none; opacity: 0.8; }

.site-header nav { flex: 1; display: flex; justify-content: center; }
.site-header ul {
  list-style: none;
  display: flex;
  gap: 20px;
  margin: 0;
  padding: 0;
}
.site-header a { color: var(--fg-muted); font-size: 0.95rem; }
.site-header a.active, .site-header a:hover { color: var(--fg); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  padding: 4px 10px;
  cursor: pointer;
}

#theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  cursor: pointer;
  padding: 4px 10px;
  font-size: 1rem;
  line-height: 1.4;
}
#theme-toggle:hover { background: var(--bg-alt); }

/* Hero */
.hero { padding: 48px 0 8px; }
.hero h1 { margin: 0 0 8px; font-size: 1.9rem; }
.tagline { color: var(--fg-muted); font-size: 1.1rem; margin: 0; }

.home-section { padding: 32px 0; border-top: 1px solid var(--border); }
.home-section h2 { font-size: 1.15rem; margin-bottom: 14px; }
.more { display: inline-block; margin-top: 10px; font-size: 0.9rem; }

/* Lists */
.post-list, .cve-list { list-style: none; margin: 0; padding: 0; }
.post-list li, .cve-list li { padding: 12px 0; border-bottom: 1px solid var(--border); }
.post-list li:last-child, .cve-list li:last-child { border-bottom: none; }
.post-list a { font-weight: 600; color: var(--fg); }
.post-list time { display: block; font-size: 0.82rem; color: var(--fg-muted); margin-top: 2px; }
.post-list p { margin: 6px 0 0; color: var(--fg-muted); font-size: 0.92rem; }
.cve-list .cvss { float: right; font-size: 0.85rem; color: var(--fg-muted); }
.empty { color: var(--fg-muted); }

/* Article */
.post-header h1 { margin-bottom: 6px; font-size: 1.7rem; }
.post-meta { color: var(--fg-muted); font-size: 0.88rem; margin-top: 0; }
.tag {
  display: inline-block;
  font-size: 0.8rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 9px;
}
.toc {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  margin: 20px 0;
  font-size: 0.92rem;
}
.toc ul { margin: 6px 0; padding-left: 18px; }

.post-content { margin-top: 24px; }
.post-content h2 { margin-top: 2em; font-size: 1.35rem; }
.post-content h3 { margin-top: 1.6em; font-size: 1.1rem; }
.post-content img { max-width: 100%; border-radius: var(--radius); }
.post-content blockquote {
  margin: 1.2em 0;
  padding: 4px 16px;
  border-left: 3px solid var(--accent);
  background: var(--bg-alt);
  color: var(--fg-muted);
}
.post-content pre {
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  background: var(--code-bg) !important;
  font-size: 0.87rem;
}
.post-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.post-content :not(pre) > code {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.88em;
}
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2em 0;
  font-size: 0.92rem;
}
.post-content th, .post-content td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}
.post-content th { background: var(--bg-alt); }

/* CVE table */
.table-wrap { overflow-x: auto; margin-top: 20px; }
.cve-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 640px; }
.cve-table th, .cve-table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}
.cve-table th { color: var(--fg-muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.02em; }

/* Severity badges */
.sev {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.sev-critical { color: #c81e3a; border-color: #c81e3a44; background: #c81e3a14; }
.sev-high { color: #d9642c; border-color: #d9642c44; background: #d9642c14; }
.sev-medium { color: #b98a05; border-color: #b98a0544; background: #b98a0514; }
.sev-low { color: #2f8f5b; border-color: #2f8f5b44; background: #2f8f5b14; }

/* Tools list */
.tool-list { list-style: none; margin: 0; padding: 0; }
.tool-list li { padding: 14px 0; border-bottom: 1px solid var(--border); }
.tool-list li:last-child { border-bottom: none; }
.tool-list a { font-weight: 600; }
.tool-list .lang {
  margin-left: 8px;
  font-size: 0.78rem;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
}
.tool-list p { margin: 6px 0 0; color: var(--fg-muted); font-size: 0.92rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); margin-top: 48px; padding: 24px 0 40px; color: var(--fg-muted); font-size: 0.88rem; }

/* Mobile */
@media (max-width: 640px) {
  .site-header nav { position: absolute; top: 100%; left: 0; right: 0; }
  .site-header ul {
    display: none;
    flex-direction: column;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    gap: 12px;
  }
  .site-header ul.open { display: flex; }
  .nav-toggle { display: inline-block; }
  .hero h1 { font-size: 1.5rem; }
}
