/* ============================================
   葬AI Web4 — Global Stylesheet
   Dark terminal aesthetic for AI industry media
   ============================================ */

:root {
  --bg: #0a0a0b;
  --bg-card: #131318;
  --bg-hover: #1a1a22;
  --border: #1f1f28;
  --border-hover: #2a2a38;
  --text: #e4e4e7;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-dim: #52525b;
  --accent: #00ff88;
  --accent-dim: rgba(0, 255, 136, 0.15);
  --accent-glow: rgba(0, 255, 136, 0.4);
  --type-product: #00ff88;
  --type-person: #ff6b9d;
  --type-company: #60a5fa;
  --type-vc: #fbbf24;
  --radius: 8px;
  --radius-lg: 12px;
  --mono: "SF Mono", "JetBrains Mono", "Fira Code", Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Segoe UI", Roboto, sans-serif;
}

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

html { scroll-behavior: smooth; }

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

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

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

a { color: var(--accent); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.8; }

/* ===== Navigation ===== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 11, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  height: 60px;
  display: flex;
  align-items: center;
}

.nav-inner {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-brand {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  white-space: nowrap;
}

.nav-brand .accent { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 4px;
  align-items: center;
}

.nav-links a {
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.nav-links a:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.nav-links a.active {
  color: var(--accent);
  background: var(--accent-dim);
}

/* ===== Containers ===== */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.content-narrow {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Homepage Hero ===== */
.hero {
  position: relative;
  padding: 100px 0 60px;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 600px;
  background: radial-gradient(ellipse at center, var(--accent-glow) 0%, transparent 60%);
  opacity: 0.12;
  pointer-events: none;
}

.hero-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 100px;
  padding: 4px 14px;
  margin-bottom: 32px;
  background: var(--accent-dim);
}

.hero-title {
  font-size: clamp(48px, 8vw, 88px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -2px;
  margin-bottom: 24px;
}

.hero-title .green { color: var(--accent); }

.hero-subtitle {
  font-size: clamp(18px, 2.5vw, 24px);
  color: var(--text-secondary);
  max-width: 640px;
  line-height: 1.5;
  margin-bottom: 48px;
}

.hero-subtitle .highlight { color: var(--text); font-weight: 600; }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 56px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  transition: border-color 0.3s;
}

.stat-card:hover { border-color: var(--accent); }

.stat-value {
  font-family: var(--mono);
  font-size: 42px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 14px;
  color: var(--text-muted);
}

/* Nav cards */
.nav-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 80px;
}

.nav-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  transition: all 0.3s;
  color: var(--text);
  position: relative;
  overflow: hidden;
}

.nav-card::after {
  content: '→';
  position: absolute;
  top: 32px;
  right: 28px;
  font-size: 24px;
  color: var(--text-dim);
  transition: all 0.3s;
}

.nav-card:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
  text-decoration: none;
}

.nav-card:hover::after {
  color: var(--accent);
  transform: translateX(4px);
}

.nav-card-icon {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 16px;
  display: block;
}

.nav-card-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.nav-card-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ===== Section Headers ===== */
.section-header {
  margin-bottom: 32px;
}

.section-label {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 8px;
}

.section-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: -1px;
}

.section-subtitle {
  font-size: 16px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ===== Graph Page ===== */
.graph-layout {
  display: flex;
  height: calc(100vh - 60px);
  overflow: hidden;
}

.graph-canvas-wrapper {
  flex: 1;
  position: relative;
  background: var(--bg);
  overflow: hidden;
}

#graphCanvas {
  display: block;
  cursor: grab;
}

#graphCanvas:active { cursor: grabbing; }

.graph-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}

.graph-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s;
}

.graph-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.graph-legend {
  position: absolute;
  bottom: 16px;
  left: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  z-index: 10;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 3px 0;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.graph-stats {
  position: absolute;
  top: 16px;
  left: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  z-index: 10;
}

/* Graph sidebar */
.graph-sidebar {
  width: 380px;
  border-left: 1px solid var(--border);
  background: var(--bg-card);
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 5;
}

.sidebar-tab {
  flex: 1;
  padding: 12px 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.sidebar-tab:hover { color: var(--text-secondary); }

.sidebar-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.sidebar-content { padding: 8px 0; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid rgba(31, 31, 40, 0.5);
}

.leaderboard-item:hover { background: var(--bg-hover); }

.lb-rank {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dim);
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

.lb-rank.top { color: var(--accent); }

.lb-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-bar {
  width: 60px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.lb-bar-fill {
  height: 100%;
  border-radius: 2px;
}

.lb-value {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  width: 32px;
  text-align: right;
  flex-shrink: 0;
}

/* Node detail panel */
.node-detail {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 380px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  z-index: 20;
  max-height: 280px;
  overflow-y: auto;
}

.node-detail.visible { transform: translateY(0); }

.node-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.node-detail-type {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.node-detail-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
  padding: 4px 8px;
}

.node-detail-close:hover { color: var(--text); }

.node-detail-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}

.node-detail-meta {
  display: flex;
  gap: 24px;
  font-size: 13px;
  color: var(--text-muted);
}

.node-detail-meta strong {
  color: var(--text);
  font-family: var(--mono);
}

/* ===== Articles List ===== */
.articles-page { padding: 48px 0 80px; }

.search-bar {
  position: relative;
  margin-bottom: 24px;
}

.search-input {
  width: 100%;
  padding: 14px 20px 14px 48px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text);
  font-size: 16px;
  font-family: var(--sans);
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-dim); }

.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 18px;
}

.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 6px 16px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--sans);
}

.filter-tab:hover { border-color: var(--border-hover); color: var(--text); }
.filter-tab.active { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 600; }

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

.article-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all 0.3s;
  color: var(--text);
  text-decoration: none;
}

.article-card:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.article-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.article-card-id {
  font-family: var(--mono);
  color: var(--accent);
}

.article-card-author {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.author-葬爱咸鱼 { background: rgba(0, 255, 136, 0.12); color: #00ff88; }
.author-沐秋 { background: rgba(255, 107, 157, 0.12); color: #ff6b9d; }
.author-骡子马 { background: rgba(251, 191, 36, 0.12); color: #fbbf24; }

.article-card-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 8px;
}

.article-card-excerpt {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.no-results {
  text-align: center;
  padding: 80px 0;
  color: var(--text-muted);
  font-size: 16px;
}

/* ===== Article Detail ===== */
.article-detail { padding: 48px 0 80px; }

.article-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 32px;
  transition: color 0.2s;
}

.article-back:hover { color: var(--accent); text-decoration: none; }

.article-header { margin-bottom: 40px; padding-bottom: 32px; border-bottom: 1px solid var(--border); }

.article-detail-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.article-detail-id {
  font-family: var(--mono);
  color: var(--accent);
  font-weight: 600;
}

.article-detail-title {
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.5px;
}

/* Markdown content */
.markdown-body {
  font-size: 17px;
  line-height: 1.8;
  color: var(--text);
}

.markdown-body h1 { font-size: 28px; font-weight: 800; margin: 40px 0 20px; }
.markdown-body h2 { font-size: 24px; font-weight: 700; margin: 36px 0 16px; }
.markdown-body h3 { font-size: 20px; font-weight: 700; margin: 32px 0 14px; }
.markdown-body h4 { font-size: 17px; font-weight: 700; margin: 28px 0 12px; }

.markdown-body p { margin-bottom: 20px; }

.markdown-body strong { font-weight: 700; color: var(--text); }

.markdown-body em { font-style: italic; color: var(--text-secondary); }

.markdown-body a {
  color: var(--accent);
  border-bottom: 1px solid var(--accent-dim);
  transition: border-color 0.2s;
}

.markdown-body a:hover { border-bottom-color: var(--accent); text-decoration: none; }

.markdown-body ul, .markdown-body ol {
  margin: 16px 0 20px;
  padding-left: 24px;
}

.markdown-body li { margin-bottom: 8px; }

.markdown-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 8px 20px;
  margin: 24px 0;
  background: var(--accent-dim);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-secondary);
}

.markdown-body blockquote p { margin-bottom: 0; }

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 36px 0;
}

.markdown-body code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent);
  border: 1px solid var(--border);
}

.markdown-body pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 20px 0;
}

.markdown-body pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 15px;
}

.markdown-body th, .markdown-body td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}

.markdown-body th { background: var(--bg-card); font-weight: 700; }

.markdown-body img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 16px 0;
}

/* Article entities */
.article-entities {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.entities-title {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
  font-family: var(--mono);
}

.entities-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.entity-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 13px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all 0.2s;
}

.entity-tag:hover { border-color: var(--accent); color: var(--text); text-decoration: none; }
.entity-dot { width: 6px; height: 6px; border-radius: 50%; }

/* Article nav */
.article-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  gap: 16px;
}

.article-nav-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text);
  transition: all 0.2s;
  max-width: 48%;
}

.article-nav-link:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.article-nav-link.next { text-align: right; margin-left: auto; }

.article-nav-label { font-size: 12px; color: var(--text-muted); font-family: var(--mono); }
.article-nav-title-text { font-size: 14px; font-weight: 600; color: var(--text-secondary); }

/* ===== Footer ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

.footer a { color: var(--text-muted); }
.footer .mono { font-family: var(--mono); }

/* ===== Loading ===== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 0;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 14px;
}

.loading::after {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-inner { padding: 0 16px; gap: 16px; }
  .nav-links { gap: 0; }
  .nav-links a { padding: 6px 8px; font-size: 13px; }
  .container, .content-narrow { padding: 0 16px; }
  .hero { padding: 60px 0 40px; }
  .graph-sidebar { display: none; }
  .node-detail { right: 0; }
  .article-grid { grid-template-columns: 1fr; }
  .article-nav { flex-direction: column; }
  .article-nav-link { max-width: 100%; text-align: left !important; margin-left: 0 !important; }
}

/* ===== Animations ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeInUp 0.6s ease forwards; }

/* Glitch effect for brand */
@keyframes glitch {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(-1px, 1px); }
  40% { transform: translate(1px, -1px); }
  60% { transform: translate(-1px, -1px); }
  80% { transform: translate(1px, 1px); }
}

.nav-brand:hover .accent { animation: glitch 0.3s ease; }
