/* ============================================================
   葬AI Web4 — Global Stylesheet
   Dark editorial / punk-tech aesthetic
   ============================================================ */

:root {
  --bg: #0a0a0c;
  --bg-elevated: #131316;
  --bg-card: #1a1a1f;
  --border: #2a2a30;
  --border-bright: #3a3a44;
  --text: #e8e8ec;
  --text-dim: #888892;
  --text-faint: #55555c;
  --accent: #39ff14;
  --accent-dim: #2bb810;
  --accent-glow: rgba(57, 255, 20, 0.15);
  --red: #ff4757;
  --gold: #ffd700;
  --cyan: #00d9ff;
  --pink: #ff6b9d;
  --purple: #a78bfa;
  --maxw: 1200px;
  --mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Noto Sans SC', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: #6fff5e; }

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

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

/* ===== NAV ===== */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,10,12,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px;
}
.nav-brand {
  font-weight: 800; font-size: 18px; letter-spacing: -.02em;
  color: var(--text); display: flex; align-items: center; gap: 8px;
}
.nav-brand .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; }
  50% { opacity: .4; }
}
.nav-brand .accent { color: var(--accent); }
.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-links a {
  color: var(--text-dim); font-size: 14px; font-weight: 500;
  padding: 6px 14px; border-radius: 6px; transition: all .15s;
}
.nav-links a:hover { color: var(--text); background: var(--bg-card); }
.nav-links a.active { color: var(--accent); }

/* ===== LAYOUT ===== */
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ===== HERO (homepage) ===== */
.hero {
  position: relative;
  padding: 100px 24px 80px;
  text-align: center;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, var(--accent-glow), transparent 70%);
  pointer-events: none;
}
.hero-tag {
  display: inline-block;
  font-family: var(--mono); font-size: 12px;
  color: var(--accent); letter-spacing: .15em; text-transform: uppercase;
  border: 1px solid var(--accent-dim); border-radius: 100px;
  padding: 4px 16px; margin-bottom: 32px;
}
.hero h1 {
  font-size: clamp(48px, 10vw, 120px);
  font-weight: 900; letter-spacing: -.04em; line-height: .95;
  margin-bottom: 24px;
}
.hero h1 .green { color: var(--accent); text-shadow: 0 0 60px var(--accent-glow); }
.hero h1 .stroke {
  -webkit-text-stroke: 2px var(--text); color: transparent;
}
.hero-sub {
  font-size: clamp(16px, 2vw, 20px);
  color: var(--text-dim); max-width: 600px; margin: 0 auto 48px;
  line-height: 1.6;
}

/* ===== STATS ===== */
.stats {
  display: flex; justify-content: center; gap: 0;
  margin-bottom: 56px; flex-wrap: wrap;
}
.stat {
  text-align: center; padding: 0 32px;
  border-right: 1px solid var(--border);
}
.stat:last-child { border-right: none; }
.stat-num {
  font-size: clamp(36px, 6vw, 56px); font-weight: 800;
  color: var(--accent); font-family: var(--mono);
  line-height: 1; margin-bottom: 8px;
}
.stat-label {
  font-size: 13px; color: var(--text-dim);
  letter-spacing: .05em;
}

/* ===== ENTRY CARDS ===== */
.entries {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  max-width: 800px; margin: 0 auto;
}
.entry-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 16px; padding: 36px 32px;
  transition: all .2s; cursor: pointer; position: relative; overflow: hidden;
}
.entry-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform .3s;
}
.entry-card:hover {
  border-color: var(--border-bright); transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
}
.entry-card:hover::before { transform: scaleX(1); }
.entry-card .ico {
  font-size: 32px; margin-bottom: 16px; display: block;
}
.entry-card h3 {
  font-size: 22px; font-weight: 700; margin-bottom: 8px;
}
.entry-card p { color: var(--text-dim); font-size: 14px; }
.entry-card .arrow {
  margin-top: 20px; font-size: 14px; color: var(--accent);
  font-family: var(--mono);
}

/* ===== SECTION ===== */
.section { padding: 64px 24px; }
.section-head {
  max-width: var(--maxw); margin: 0 auto 40px;
  display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 1px solid var(--border); padding-bottom: 20px;
}
.section-head h2 {
  font-size: clamp(24px, 4vw, 36px); font-weight: 800; letter-spacing: -.02em;
}
.section-head .count {
  font-family: var(--mono); font-size: 14px; color: var(--text-dim);
}

/* ===== LATEST ARTICLES (homepage) ===== */
.latest-grid {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px;
}
.article-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 24px;
  transition: all .2s; display: flex; flex-direction: column; gap: 10px;
}
.article-card:hover {
  border-color: var(--accent-dim); background: var(--bg-elevated);
}
.article-card .meta {
  display: flex; align-items: center; gap: 12px;
  font-size: 12px; color: var(--text-faint); font-family: var(--mono);
}
.article-card .author {
  color: var(--accent); font-weight: 600;
}
.article-card h3 {
  font-size: 17px; font-weight: 700; line-height: 1.4;
}
.article-card h3 a { color: var(--text); }
.article-card h3 a:hover { color: var(--accent); }
.article-card .excerpt {
  font-size: 13px; color: var(--text-dim); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ===== ARTICLE LIST ===== */
.list-toolbar {
  max-width: var(--maxw); margin: 0 auto 32px;
  display: flex; gap: 16px; flex-wrap: wrap; align-items: center;
}
.search-box {
  flex: 1; min-width: 240px; position: relative;
}
.search-box input {
  width: 100%; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px 12px 42px;
  color: var(--text); font-size: 15px; font-family: var(--sans);
  transition: border-color .15s;
}
.search-box input:focus { outline: none; border-color: var(--accent-dim); }
.search-box input::placeholder { color: var(--text-faint); }
.search-box .icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-faint); font-size: 16px;
}
.filter-group { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-btn {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 14px; cursor: pointer;
  color: var(--text-dim); font-size: 13px; font-weight: 500;
  transition: all .15s; font-family: var(--sans);
}
.filter-btn:hover { border-color: var(--border-bright); color: var(--text); }
.filter-btn.active {
  background: var(--accent); color: var(--bg); border-color: var(--accent);
}

.article-list {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; flex-direction: column; gap: 2px;
}
.list-item {
  display: flex; align-items: center; gap: 20px;
  padding: 18px 20px; border-radius: 10px;
  transition: background .15s; border: 1px solid transparent;
}
.list-item:hover { background: var(--bg-card); border-color: var(--border); }
.list-item .num {
  font-family: var(--mono); font-size: 13px; color: var(--text-faint);
  min-width: 36px;
}
.list-item .info { flex: 1; min-width: 0; }
.list-item .info h3 {
  font-size: 17px; font-weight: 600; line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.list-item .info h3 a { color: var(--text); }
.list-item .info h3 a:hover { color: var(--accent); }
.list-item .date-author {
  font-size: 13px; color: var(--text-dim); font-family: var(--mono);
  margin-top: 4px; display: flex; gap: 12px;
}
.list-item .date-author .au { color: var(--accent-dim); }
.list-item .ent-badge {
  font-size: 11px; font-family: var(--mono); color: var(--text-faint);
  background: var(--bg-elevated); border-radius: 4px; padding: 2px 8px;
  white-space: nowrap;
}

/* ===== ARTICLE DETAIL ===== */
.article-detail { padding: 48px 24px 80px; }
.article-detail-inner { max-width: 760px; margin: 0 auto; }
.article-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; color: var(--text-dim); margin-bottom: 32px;
  font-family: var(--mono);
}
.article-back:hover { color: var(--accent); }
.article-detail h1 {
  font-size: clamp(28px, 5vw, 44px); font-weight: 800; line-height: 1.2;
  letter-spacing: -.02em; margin-bottom: 20px;
}
.article-meta-bar {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding-bottom: 24px; margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.article-meta-bar .field {
  font-size: 14px; font-family: var(--mono); color: var(--text-dim);
}
.article-meta-bar .field .v { color: var(--text); }
.article-meta-bar .field.author .v { color: var(--accent); font-weight: 600; }

/* Markdown body */
.md-body { font-size: 17px; line-height: 1.85; color: #c8c8ce; }
.md-body h1 { font-size: 28px; font-weight: 700; margin: 40px 0 16px; color: var(--text); }
.md-body h2 { font-size: 24px; font-weight: 700; margin: 36px 0 14px; color: var(--text); }
.md-body h3 { font-size: 20px; font-weight: 600; margin: 28px 0 12px; color: var(--text); }
.md-body h4 { font-size: 17px; font-weight: 600; margin: 24px 0 10px; color: var(--text); }
.md-body p { margin: 0 0 18px; }
.md-body strong { color: var(--text); font-weight: 700; }
.md-body em { font-style: italic; color: var(--text); }
.md-body a { color: var(--accent); border-bottom: 1px solid var(--accent-dim); }
.md-body a:hover { border-bottom-color: var(--accent); }
.md-body ul, .md-body ol { margin: 0 0 18px; padding-left: 24px; }
.md-body li { margin-bottom: 6px; }
.md-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 8px 20px; margin: 0 0 18px;
  background: var(--bg-card); border-radius: 0 8px 8px 0;
  color: var(--text-dim);
}
.md-body blockquote p { margin: 0; }
.md-body code {
  font-family: var(--mono); font-size: .88em;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 6px;
  color: var(--accent);
}
.md-body pre {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px 20px; margin: 0 0 18px;
  overflow-x: auto;
}
.md-body pre code {
  background: none; border: none; padding: 0;
  color: var(--text); font-size: 14px;
}
.md-body hr {
  border: none; border-top: 1px solid var(--border); margin: 32px 0;
}
.md-body table {
  width: 100%; border-collapse: collapse; margin: 0 0 18px;
  font-size: 15px;
}
.md-body th, .md-body td {
  border: 1px solid var(--border); padding: 8px 12px; text-align: left;
}
.md-body th { background: var(--bg-card); font-weight: 600; }
.md-body img { max-width: 100%; border-radius: 8px; }

/* Article entities */
.article-entities {
  margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--border);
}
.article-entities h3 {
  font-size: 14px; font-weight: 600; color: var(--text-dim);
  margin-bottom: 16px; font-family: var(--mono); letter-spacing: .05em;
  text-transform: uppercase;
}
.entity-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.entity-tag {
  font-size: 13px; padding: 4px 12px; border-radius: 100px;
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text-dim); transition: all .15s;
}
.entity-tag .type-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle;
}

/* Prev / Next nav */
.article-nav {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--border);
}
.article-nav a {
  flex: 1; max-width: 48%; padding: 16px 20px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; transition: all .15s;
}
.article-nav a:hover { border-color: var(--accent-dim); }
.article-nav .nav-label {
  font-size: 12px; color: var(--text-faint); font-family: var(--mono);
  margin-bottom: 4px;
}
.article-nav .nav-title { font-size: 14px; color: var(--text); }
.article-nav .next { text-align: right; }

/* ===== GRAPH PAGE ===== */
.graph-page { height: calc(100vh - 56px); display: flex; }
.graph-canvas-wrap {
  flex: 1; position: relative; background: var(--bg);
  background-image: radial-gradient(circle at 50% 50%, rgba(57,255,20,.03), transparent 60%);
}
#graphCanvas { display: block; width: 100%; height: 100%; cursor: grab; }
#graphCanvas:active { cursor: grabbing; }

.graph-controls {
  position: absolute; top: 16px; right: 16px;
  display: flex; flex-direction: column; gap: 6px; z-index: 10;
}
.graph-btn {
  width: 40px; height: 40px; border-radius: 8px;
  background: rgba(19,19,22,.9); backdrop-filter: blur(8px);
  border: 1px solid var(--border); color: var(--text-dim);
  cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.graph-btn:hover { color: var(--accent); border-color: var(--accent-dim); }

.graph-legend {
  position: absolute; bottom: 16px; left: 16px; z-index: 10;
  background: rgba(19,19,22,.9); backdrop-filter: blur(8px);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px;
}
.graph-legend .lg-title {
  font-size: 11px; color: var(--text-faint); font-family: var(--mono);
  margin-bottom: 8px; text-transform: uppercase; letter-spacing: .1em;
}
.graph-legend .lg-items { display: flex; flex-direction: column; gap: 6px; }
.graph-legend .lg-item {
  display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim);
}
.graph-legend .lg-dot {
  width: 10px; height: 10px; border-radius: 50%;
}

.graph-search {
  position: absolute; top: 16px; left: 16px; z-index: 10;
}
.graph-search input {
  width: 220px; background: rgba(19,19,22,.9); backdrop-filter: blur(8px);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; color: var(--text); font-size: 14px;
}
.graph-search input:focus { outline: none; border-color: var(--accent-dim); }

/* Node detail panel */
.node-detail {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 360px; background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  padding: 24px; overflow-y: auto;
  transform: translateX(100%); transition: transform .25s;
  z-index: 20;
}
.node-detail.open { transform: translateX(0); }
.node-detail .nd-close {
  position: absolute; top: 16px; right: 16px;
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-dim); cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.node-detail .nd-close:hover { color: var(--accent); }
.node-detail .nd-type {
  font-size: 12px; font-family: var(--mono); text-transform: uppercase;
  letter-spacing: .1em; margin-bottom: 8px;
}
.node-detail h3 {
  font-size: 22px; font-weight: 800; margin-bottom: 16px;
}
.node-detail .nd-desc {
  font-size: 14px; color: var(--text-dim); line-height: 1.6;
  margin-bottom: 20px;
}
.node-detail .nd-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-bottom: 24px;
}
.node-detail .nd-stat {
  background: var(--bg-card); border-radius: 8px; padding: 12px;
}
.node-detail .nd-stat .v {
  font-size: 24px; font-weight: 700; font-family: var(--mono);
}
.node-detail .nd-stat .l {
  font-size: 11px; color: var(--text-faint); text-transform: uppercase;
}
.node-detail .nd-section-title {
  font-size: 12px; font-weight: 600; color: var(--text-faint);
  font-family: var(--mono); text-transform: uppercase; letter-spacing: .05em;
  margin-bottom: 10px; margin-top: 20px;
}
.node-detail .nd-links { display: flex; flex-direction: column; gap: 6px; }
.node-detail .nd-link {
  font-size: 13px; color: var(--text-dim);
  padding: 6px 10px; background: var(--bg-card); border-radius: 6px;
  display: flex; align-items: center; gap: 8px;
}
.node-detail .nd-link .rel {
  font-size: 11px; color: var(--text-faint); font-family: var(--mono);
}

/* ===== LEADERBOARDS ===== */
.lb-overlay {
  position: absolute; top: 0; left: 0; bottom: 0;
  width: 100%; max-width: 420px;
  background: var(--bg-elevated); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transform: translateX(0); transition: transform .25s;
  z-index: 15;
}
.lb-overlay.hidden { transform: translateX(-100%); }
.lb-tabs {
  display: flex; border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.lb-tab {
  flex: 1; padding: 14px 8px; text-align: center;
  font-size: 14px; font-weight: 600; color: var(--text-dim);
  cursor: pointer; transition: all .15s;
  border-bottom: 2px solid transparent;
}
.lb-tab:hover { color: var(--text); }
.lb-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.lb-list { flex: 1; overflow-y: auto; padding: 8px; }
.lb-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  transition: background .12s; border: 1px solid transparent;
}
.lb-item:hover { background: var(--bg-card); }
.lb-item.active { background: var(--bg-card); border-color: var(--border); }
.lb-rank {
  font-family: var(--mono); font-size: 16px; font-weight: 700;
  min-width: 32px; text-align: center;
}
.lb-rank.top { color: var(--accent); }
.lb-item .lb-info { flex: 1; min-width: 0; }
.lb-item .lb-name {
  font-size: 15px; font-weight: 600; color: var(--text);
}
.lb-item .lb-desc {
  font-size: 12px; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lb-item .lb-metric {
  font-family: var(--mono); font-size: 13px; color: var(--text-faint);
  text-align: right; white-space: nowrap;
}
.lb-toggle {
  position: absolute; top: 16px; left: 16px; z-index: 16;
}
.lb-toggle.hidden { display: none; }

/* ===== FOOTER ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: 40px 24px; text-align: center;
}
.footer p { font-size: 13px; color: var(--text-faint); font-family: var(--mono); }
.footer .brand { color: var(--accent); font-weight: 600; }

/* ===== UTIL ===== */
.hidden { display: none !important; }
.fade-in { animation: fadeIn .4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ===== TYPE COLORS ===== */
.type-product, .dot-product { color: var(--cyan); }
.dot-product { background: var(--cyan) !important; }
.type-person, .dot-person { color: var(--pink); }
.dot-person { background: var(--pink) !important; }
.type-vc_firm, .dot-vc { color: var(--gold); }
.dot-vc { background: var(--gold) !important; }
.type-company, .dot-company { color: var(--purple); }
.dot-company { background: var(--purple) !important; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .entries { grid-template-columns: 1fr; }
  .stats { gap: 0; }
  .stat { padding: 0 16px; }
  .graph-page { flex-direction: column; }
  .lb-overlay { max-width: 100%; height: 50%; border-right: none; border-bottom: 1px solid var(--border); }
  .node-detail { width: 100%; }
  .article-nav { flex-direction: column; }
  .article-nav a { max-width: 100%; text-align: left !important; }
  .list-item { flex-wrap: wrap; }
  .list-item .ent-badge { display: none; }
}
