:root {
  color-scheme: dark;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", sans-serif;
  --font-serif: "Cambria", "Songti SC", Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #0a0d12;
  --bg-soft: #11161d;
  --bg-elevated: #1a2029;
  --bg-card: #141a22;
  --fg: #e6edf3;
  --fg-muted: #8b949e;
  --fg-subtle: #6e7681;
  --border: #262d36;
  --border-soft: #1c222b;

  --accent: #ff6b3d;
  --accent-soft: rgba(255,107,61,0.12);
  --accent-strong: #ff8c64;

  --product: #58a6ff;
  --founder: #f0b429;
  --vc: #b973ff;
  --company: #3fb950;

  --success: #3fb950;
  --warn: #d29922;
  --danger: #f85149;

  --radius: 8px;
  --radius-sm: 5px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 20px 48px rgba(0,0,0,0.6);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-soft); color: var(--fg); }

a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent-strong); }

/* ---------- Navbar ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,13,18,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.nav-brand {
  font-weight: 700;
  font-size: 1.15em;
  color: var(--fg);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-brand .skull { font-size: 1.25em; }
.nav-brand:hover { color: var(--accent); }
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a {
  color: var(--fg-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.93em;
  font-weight: 500;
}
.nav-links a:hover { color: var(--fg); background: var(--bg-elevated); }
.nav-links a.active { color: var(--accent); background: var(--accent-soft); }

/* ---------- Container ---------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px;
}
.container.narrow { max-width: 780px; }

/* ---------- Hero ---------- */
.hero {
  padding: 96px 24px 72px;
  text-align: center;
  max-width: 820px;
  margin: 0 auto;
}
.hero-tag {
  display: inline-block;
  font-size: 0.82em;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: 99px;
  margin-bottom: 24px;
  border: 1px solid rgba(255,107,61,0.25);
}
.hero h1 {
  font-size: clamp(2.4em, 5.5vw, 3.8em);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin-bottom: 20px;
}
.hero h1 .skull { color: var(--accent); }
.hero .lead {
  font-size: 1.12em;
  color: var(--fg-muted);
  max-width: 620px;
  margin: 0 auto 36px;
  line-height: 1.75;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 560px;
  margin: 0 auto 40px;
}
.stat {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 14px;
}
.stat-num {
  font-size: 1.9em;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: 0.82em;
  color: var(--fg-muted);
  margin-top: 2px;
}

.hero-ctas { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 22px;
  border-radius: var(--radius);
  font-size: 0.95em;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--fg);
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover { background: var(--bg-elevated); border-color: var(--fg-muted); color: var(--fg); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--fg-muted); }
.btn-ghost:hover { background: var(--bg-soft); color: var(--fg); }

/* ---------- Section ---------- */
.section-title {
  font-size: 1.45em;
  font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: -0.01em;
}
.section-sub { color: var(--fg-muted); margin-bottom: 28px; font-size: 0.95em; }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 820px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: all 0.15s;
}
.card:hover { border-color: var(--fg-muted); background: var(--bg-soft); transform: translateY(-1px); }
.card h3 { font-size: 1.1em; margin-bottom: 6px; }
.card p { color: var(--fg-muted); font-size: 0.9em; line-height: 1.6; }

/* ---------- Article list ---------- */
.articles-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
  align-items: center;
}
.search-input {
  flex: 1;
  min-width: 240px;
  padding: 11px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  font-size: 0.95em;
  font-family: inherit;
}
.search-input:focus { outline: none; border-color: var(--accent); background: var(--bg-elevated); }
.search-input::placeholder { color: var(--fg-subtle); }
.author-filter {
  padding: 11px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  font-size: 0.93em;
  font-family: inherit;
}

.article-list { display: flex; flex-direction: column; gap: 2px; }
.article-item {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 20px;
  align-items: baseline;
  padding: 16px 4px;
  border-bottom: 1px solid var(--border-soft);
  transition: background 0.1s;
}
.article-item:hover { background: var(--bg-soft); margin: 0 -8px; padding-left: 12px; padding-right: 12px; border-radius: var(--radius-sm); }
.article-date { color: var(--fg-subtle); font-size: 0.88em; font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
.article-title { font-size: 1.05em; font-weight: 600; color: var(--fg); }
.article-item:hover .article-title { color: var(--accent); }
.article-author { color: var(--fg-muted); font-size: 0.85em; white-space: nowrap; }
@media (max-width: 720px) {
  .article-item { grid-template-columns: 90px 1fr; gap: 10px; }
  .article-author { grid-column: 2; font-size: 0.82em; }
}

.count-pill {
  display: inline-block;
  font-size: 0.82em;
  color: var(--fg-muted);
  padding: 4px 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 99px;
  margin-left: 8px;
}

/* ---------- Graph page ---------- */
.graph-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  height: calc(100vh - 58px);
  padding: 16px;
  max-width: none;
}
@media (max-width: 900px) {
  .graph-layout { grid-template-columns: 1fr; height: auto; }
  #graph-canvas { height: 70vh; }
}
.graph-sidebar {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.graph-main {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}
#graph-canvas { width: 100%; height: 100%; }
.graph-main svg { width: 100%; height: 100%; display: block; }

.lb-title {
  font-size: 0.78em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.lb-title .dot { width: 8px; height: 8px; border-radius: 50%; }
.lb-list { display: flex; flex-direction: column; gap: 1px; }
.lb-item {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 4px;
  font-size: 0.88em;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s;
}
.lb-item:hover { background: var(--bg-elevated); }
.lb-rank { color: var(--fg-subtle); font-size: 0.82em; font-variant-numeric: tabular-nums; text-align: right; }
.lb-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-score { color: var(--fg-subtle); font-size: 0.8em; font-variant-numeric: tabular-nums; }

.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 0.82em; }
.legend-item { display: flex; align-items: center; gap: 6px; color: var(--fg-muted); }
.legend-item .dot { width: 10px; height: 10px; border-radius: 50%; }

.node-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 0.88em;
  max-width: 300px;
  box-shadow: var(--shadow-lg);
  z-index: 10;
  display: none;
}
.node-tooltip .tt-name { font-weight: 700; font-size: 1em; margin-bottom: 4px; }
.node-tooltip .tt-type { font-size: 0.78em; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.node-tooltip .tt-desc { color: var(--fg-muted); font-size: 0.85em; line-height: 1.5; }
.node-tooltip .tt-stats { display: flex; gap: 12px; margin-top: 8px; font-size: 0.8em; color: var(--fg-muted); }
.node-tooltip .tt-stats b { color: var(--fg); }

.graph-search {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-size: 0.9em;
  font-family: inherit;
}
.graph-search:focus { outline: none; border-color: var(--accent); }

/* ---------- Article page ---------- */
.article-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}
.article-meta {
  color: var(--fg-muted);
  font-size: 0.9em;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.article-meta .sep { margin: 0 10px; color: var(--fg-subtle); }
.article-body { font-family: var(--font-serif); font-size: 1.05em; line-height: 1.85; color: var(--fg); }
.article-body h1, .article-body h2, .article-body h3, .article-body h4 {
  font-family: var(--font-sans);
  margin: 1.6em 0 0.6em;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.article-body h1 { font-size: 1.6em; margin-top: 0; }
.article-body h2 { font-size: 1.35em; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.article-body h3 { font-size: 1.15em; }
.article-body p { margin: 1em 0; }
.article-body ul, .article-body ol { margin: 1em 0; padding-left: 1.8em; }
.article-body li { margin: 0.3em 0; }
.article-body blockquote {
  margin: 1.4em 0;
  padding: 8px 18px;
  border-left: 3px solid var(--accent);
  color: var(--fg-muted);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.article-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 4px;
}
.article-body pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 1.2em 0;
  font-size: 0.88em;
  line-height: 1.6;
}
.article-body pre code { background: none; padding: 0; }
.article-body hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }
.article-body strong { font-weight: 700; color: var(--fg); }
.article-body em { font-style: italic; }
.article-body a { border-bottom: 1px solid var(--accent-soft); }
.article-body img { max-width: 100%; border-radius: var(--radius); margin: 1em 0; }
.article-body table { border-collapse: collapse; width: 100%; margin: 1.2em 0; font-size: 0.92em; }
.article-body th, .article-body td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.article-body th { background: var(--bg-elevated); font-weight: 600; }

.article-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  gap: 16px;
}
.article-nav a {
  color: var(--fg-muted);
  font-size: 0.9em;
  max-width: 45%;
}
.article-nav a:hover { color: var(--accent); }
.article-nav .label { font-size: 0.78em; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-subtle); margin-bottom: 4px; }
.article-nav .next { text-align: right; margin-left: auto; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fg-muted);
  font-size: 0.9em;
  margin-bottom: 20px;
}
.back-link:hover { color: var(--accent); }

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--border-soft);
  padding: 32px 24px;
  text-align: center;
  color: var(--fg-subtle);
  font-size: 0.85em;
}

/* ---------- Graph SVG styles ---------- */
.link { stroke-opacity: 0.25; }
.node circle { stroke: var(--bg); stroke-width: 1.5; cursor: pointer; }
.node text { pointer-events: none; fill: var(--fg-muted); font-size: 10px; font-family: var(--font-sans); }
.node.fixed circle { stroke-width: 2px; stroke: var(--fg); }
.node.highlight circle { stroke: var(--accent); stroke-width: 2.5; }
.link.highlight { stroke: var(--accent); stroke-opacity: 0.7; }
.link.dim { stroke-opacity: 0.05; }
.node.dim circle { opacity: 0.2; }
.node.dim text { opacity: 0.2; }
