/* ============================================
   葬AI Web4 — 独立、尖锐、有态度
   ============================================ */

:root {
  --bg: #0a0a0a;
  --bg-elevated: #131313;
  --bg-card: #1a1a1a;
  --border: #2a2a2a;
  --border-bright: #3a3a3a;
  --text: #f0f0f0;
  --text-secondary: #a0a0a0;
  --text-muted: #666;
  --brand: #c8ff2c;
  --brand-dim: rgba(200, 255, 44, 0.15);
  --brand-glow: rgba(200, 255, 44, 0.3);
  --c-product: #4ecdc4;
  --c-person: #ff8c42;
  --c-company: #c77dff;
  --c-vc: #ffd23f;
  --c-product-dim: rgba(78, 205, 196, 0.12);
  --c-person-dim: rgba(255, 140, 66, 0.12);
  --c-company-dim: rgba(199, 125, 255, 0.12);
  --c-vc-dim: rgba(255, 210, 63, 0.12);
  --max-width: 1200px;
  --radius: 2px;
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}

::selection { background: var(--brand); color: #000; }

a { color: var(--brand); text-decoration: none; transition: color .15s; }
a:hover { color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-bright); }
::-webkit-scrollbar-thumb:hover { background: var(--brand); }

/* ===== Navigation ===== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: .5px;
  color: var(--text);
}
.nav-brand:hover { color: var(--text); }
.nav-brand .dot {
  width: 8px;
  height: 8px;
  background: var(--brand);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--brand-glow);
  animation: pulse 2s infinite;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-link {
  padding: 6px 14px;
  font-size: .875rem;
  color: var(--text-secondary);
  border-radius: var(--radius);
  transition: all .15s;
}
.nav-link:hover { color: var(--text); background: var(--bg-card); }
.nav-link.active { color: var(--brand); background: var(--brand-dim); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .6; transform: scale(.85); }
}

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

/* ===== Hero / Home ===== */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 56px);
  text-align: center;
  padding: 60px 24px;
  position: relative;
}
.hero::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--brand-dim) 0%, transparent 70%);
  pointer-events: none;
  opacity: .5;
}
.hero-logo {
  font-size: clamp(3rem, 10vw, 6rem);
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1;
  margin-bottom: 8px;
  position: relative;
}
.hero-logo .accent { color: var(--brand); }
.hero-sub {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-secondary);
  letter-spacing: 2px;
  margin-bottom: 12px;
  font-weight: 300;
}
.hero-tagline {
  font-size: .875rem;
  color: var(--text-muted);
  max-width: 500px;
  line-height: 1.8;
  margin-bottom: 40px;
}
.hero-stats {
  display: flex;
  gap: 0;
  margin-bottom: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.stat {
  padding: 20px 32px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  min-width: 140px;
}
.stat:last-child { border-right: none; }
.stat-num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--brand);
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  line-height: 1;
}
.stat-label {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 6px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.hero-nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  font-size: .9rem;
  font-weight: 600;
  border-radius: var(--radius);
  transition: all .2s;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--brand);
  color: #000;
  border-color: var(--brand);
}
.btn-primary:hover {
  background: transparent;
  color: var(--brand);
  box-shadow: 0 0 20px var(--brand-glow);
}
.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border-bright);
}
.btn-outline:hover {
  border-color: var(--brand);
  color: var(--brand);
}

/* ===== Section Headers ===== */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
}
.section-title .accent { color: var(--brand); }
.section-meta {
  font-size: .8rem;
  color: var(--text-muted);
  font-family: monospace;
}

/* ===== Page Wrapper ===== */
.page {
  padding: 40px 0 80px;
}

/* ===== Graph Page ===== */
.graph-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 0;
  height: calc(100vh - 56px);
}
.graph-canvas-wrap {
  position: relative;
  background: var(--bg);
  overflow: hidden;
  border-right: 1px solid var(--border);
}
#graph-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}
#graph-canvas:active { cursor: grabbing; }

.graph-overlay-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
  z-index: 5;
}
.graph-overlay-top > * { pointer-events: auto; }
.graph-search {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  font-size: .85rem;
  border-radius: var(--radius);
  width: 240px;
  outline: none;
  transition: border-color .15s;
}
.graph-search:focus { border-color: var(--brand); }
.graph-search::placeholder { color: var(--text-muted); }

.graph-controls {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
}
.graph-ctrl-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 5px 10px;
  font-size: .8rem;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all .15s;
}
.graph-ctrl-btn:hover { color: var(--text); background: var(--bg-elevated); }
.graph-ctrl-btn.active { color: var(--brand); background: var(--brand-dim); }

.graph-overlay-bottom {
  position: absolute;
  bottom: 16px;
  left: 20px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  z-index: 5;
}
.graph-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.graph-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-muted);
  font-size: .875rem;
  font-family: monospace;
}

/* Node Detail Panel */
.graph-panel {
  background: var(--bg-elevated);
  overflow-y: auto;
  padding: 0;
}
.graph-panel-empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--text-muted);
}
.graph-panel-empty .icon {
  font-size: 2rem;
  margin-bottom: 12px;
  opacity: .3;
}
.node-detail {
  padding: 24px;
}
.node-detail-header {
  margin-bottom: 16px;
}
.node-detail-type {
  display: inline-block;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.node-detail-type.product { background: var(--c-product-dim); color: var(--c-product); }
.node-detail-type.person { background: var(--c-person-dim); color: var(--c-person); }
.node-detail-type.company { background: var(--c-company-dim); color: var(--c-company); }
.node-detail-type.vc_firm { background: var(--c-vc-dim); color: var(--c-vc); }
.node-detail-name {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.3;
}
.node-detail-desc {
  color: var(--text-secondary);
  font-size: .875rem;
  line-height: 1.7;
  margin-bottom: 20px;
}
.node-detail-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
}
.node-stat {
  background: var(--bg-card);
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.node-stat-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--brand);
  font-family: monospace;
}
.node-stat-label {
  font-size: .7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.node-detail-section {
  margin-bottom: 16px;
}
.node-detail-section h4 {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.connection-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.connection-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .8rem;
  cursor: pointer;
  transition: all .15s;
}
.connection-item:hover {
  border-color: var(--brand);
  background: var(--brand-dim);
}
.connection-item .rel-type {
  font-size: .7rem;
  color: var(--text-muted);
  font-family: monospace;
}

/* Leaderboards on graph page */
.leaderboards-section {
  padding: 40px 24px;
  border-top: 1px solid var(--border);
}
.leaderboards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 20px;
}
.leaderboard-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.leaderboard-header {
  padding: 12px 16px;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.leaderboard-header.product { color: var(--c-product); border-color: var(--c-product); }
.leaderboard-header.person { color: var(--c-person); border-color: var(--c-person); }
.leaderboard-header.company { color: var(--c-company); border-color: var(--c-company); }
.leaderboard-header.vc_firm { color: var(--c-vc); border-color: var(--c-vc); }
.leaderboard-list {
  list-style: none;
}
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
}
.leaderboard-item:last-child { border-bottom: none; }
.leaderboard-item:hover { background: var(--bg-elevated); }
.lb-rank {
  font-size: .8rem;
  font-weight: 700;
  color: var(--text-muted);
  font-family: monospace;
  min-width: 24px;
}
.lb-name {
  font-size: .85rem;
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-score {
  font-size: .75rem;
  color: var(--text-muted);
  font-family: monospace;
}

/* ===== Articles List ===== */
.article-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.filter-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 16px;
  font-size: .8rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .15s;
}
.filter-btn:hover { border-color: var(--border-bright); color: var(--text); }
.filter-btn.active {
  background: var(--brand);
  color: #000;
  border-color: var(--brand);
}
.article-search {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 16px;
  font-size: .85rem;
  border-radius: var(--radius);
  width: 100%;
  max-width: 400px;
  margin-bottom: 24px;
  outline: none;
  transition: border-color .15s;
}
.article-search:focus { border-color: var(--brand); }

.article-list {
  display: flex;
  flex-direction: column;
}
.article-card {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  transition: all .15s;
}
.article-card:hover {
  padding-left: 12px;
}
.article-card:hover .article-card-title {
  color: var(--brand);
}
.article-card-num {
  font-size: .8rem;
  font-family: monospace;
  color: var(--text-muted);
  min-width: 36px;
  padding-top: 2px;
}
.article-card-body {
  flex: 1;
}
.article-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 6px;
  transition: color .15s;
}
.article-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .8rem;
  color: var(--text-muted);
}
.article-card-author {
  padding: 2px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .75rem;
}
.article-card-excerpt {
  font-size: .85rem;
  color: var(--text-secondary);
  margin-top: 8px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== Article Detail ===== */
.article-detail {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}
.article-detail-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.article-detail-title {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 16px;
}
.article-detail-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: .85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.article-detail-meta .author {
  color: var(--brand);
  font-weight: 600;
}
.article-detail-meta .sep {
  color: var(--border-bright);
}

.article-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  gap: 12px;
}
.article-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: .8rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all .15s;
}
.article-nav-link:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.article-nav-link.disabled {
  opacity: .3;
  pointer-events: none;
}
.article-nav-back {
  font-size: .8rem;
  color: var(--text-muted);
}
.article-nav-back:hover { color: var(--brand); }

/* Article Body / Markdown */
.article-body {
  font-size: 1rem;
  line-height: 1.85;
  color: var(--text);
}
.article-body h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 32px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.article-body h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 28px 0 12px;
}
.article-body h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 24px 0 10px;
  color: var(--brand);
}
.article-body p {
  margin-bottom: 16px;
}
.article-body strong {
  font-weight: 700;
  color: #fff;
}
.article-body em {
  font-style: italic;
  color: var(--text-secondary);
}
.article-body ul, .article-body ol {
  margin: 12px 0 16px 20px;
}
.article-body li {
  margin-bottom: 6px;
}
.article-body blockquote {
  border-left: 3px solid var(--brand);
  padding: 8px 16px;
  margin: 16px 0;
  background: var(--brand-dim);
  color: var(--text-secondary);
  font-size: .95rem;
}
.article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}
.article-body code {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: .875em;
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--c-product);
}
.article-body pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  margin: 16px 0;
}
.article-body pre code {
  background: none;
  padding: 0;
  color: var(--text);
}
.article-body a {
  color: var(--c-product);
  text-decoration: underline;
  text-decoration-color: var(--border-bright);
  text-underline-offset: 2px;
}
.article-body a:hover {
  text-decoration-color: var(--c-product);
}
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: .875rem;
}
.article-body th, .article-body td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}
.article-body th {
  background: var(--bg-card);
  font-weight: 600;
}
.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 16px 0;
}

/* Article footer entities */
.article-entities {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.article-entities h3 {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.entity-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.entity-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: .75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .15s;
}
.entity-tag:hover {
  border-color: var(--brand);
  color: var(--text);
}
.entity-tag .etype {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

/* ===== Footer ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: .8rem;
}
.footer a { color: var(--text-secondary); }
.footer a:hover { color: var(--brand); }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .graph-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .graph-canvas-wrap {
    height: 60vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .graph-panel {
    max-height: 50vh;
  }
}
@media (max-width: 640px) {
  .hero-stats {
    flex-wrap: wrap;
  }
  .stat {
    min-width: 50%;
    border-bottom: 1px solid var(--border);
  }
  .nav-link {
    padding: 6px 10px;
    font-size: .8rem;
  }
  .article-card {
    gap: 12px;
  }
  .article-card-num {
    display: none;
  }
}

/* Hide elements */
.hidden { display: none !important; }

/* Fade in animation */
.fade-in {
  animation: fadeIn .4s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
