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

:root {
  --bg: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --primary: #3B82F6;
  --primary-hover: #2563EB;
  --primary-light: #EFF6FF;
  --accent-blue: #0EA5E9;
  --accent-green: #10B981;
  --accent-purple: #8B5CF6;
  --accent-orange: #F59E0B;
  --accent-red: #EF4444;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-md: 0 8px 24px -4px rgba(0,0,0,.08), 0 2px 8px -2px rgba(0,0,0,.04);
  --shadow-lg: 0 20px 48px -12px rgba(0,0,0,.12);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --font-sans: 'Inter', 'Noto Sans SC', system-ui, -apple-system, sans-serif;
  --header-h: 64px;
  --sidebar-w: 240px;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

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

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  height: 100%;
  display: flex; align-items: center; gap: 32px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; flex-shrink: 0;
}
.logo-icon svg { display: block; }
.logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.logo-title { font-weight: 700; font-size: 15px; color: var(--text); }
.logo-sub { font-size: 11px; color: var(--text-muted); font-weight: 400; }

.main-nav {
  display: flex; align-items: center; gap: 4px;
  flex: 1;
}
.nav-link {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
  color: var(--text-secondary);
  transition: all .15s;
  white-space: nowrap;
}
.nav-link:hover { color: var(--text); background: var(--bg-tertiary); }
.nav-link.active { color: var(--primary); background: var(--primary-light); }

.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.search-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all .15s;
}
.search-btn:hover { background: var(--bg-tertiary); color: var(--text); }

.mobile-menu-btn {
  display: none;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

/* ===== Mobile Menu ===== */
.mobile-menu {
  display: none;
  position: fixed; top: var(--header-h); left: 0; right: 0;
  background: white;
  border-bottom: 1px solid var(--border);
  z-index: 99;
  padding: 12px;
}
.mobile-menu.open { display: block; }
.mobile-menu nav { display: flex; flex-direction: column; gap: 2px; }
.mobile-menu a {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 500;
  color: var(--text-secondary);
  transition: all .15s;
}
.mobile-menu a:hover { background: var(--bg-tertiary); color: var(--text); }

/* ===== Search Modal ===== */
.search-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
  backdrop-filter: blur(2px);
}
.search-overlay.open { display: block; }

.search-modal {
  display: none;
  position: fixed;
  top: 80px; left: 50%; transform: translateX(-50%);
  width: min(640px, calc(100vw - 32px));
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 201;
  overflow: hidden;
}
.search-modal.open { display: block; }

.search-input-wrap {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.search-input-wrap input {
  flex: 1; border: none; outline: none;
  font-size: 16px; font-family: inherit;
  background: transparent; color: var(--text);
}
.search-input-wrap input::placeholder { color: var(--text-muted); }
.search-input-wrap kbd {
  padding: 2px 8px; border-radius: 4px;
  background: var(--bg-tertiary);
  font-size: 12px; font-family: inherit;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.search-results { max-height: 400px; overflow-y: auto; padding: 8px; }
.search-result-item {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .1s;
}
.search-result-item:hover { background: var(--bg-tertiary); }
.search-result-item .result-title { font-size: 14px; font-weight: 500; color: var(--text); }
.search-result-item .result-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.search-result-item .result-section { font-size: 11px; color: var(--primary); margin-top: 2px; }
.search-empty { padding: 32px; text-align: center; color: var(--text-muted); font-size: 14px; }

/* ===== Hero ===== */
.hero {
  background: linear-gradient(160deg, #0f172a 0%, #1e3a5f 50%, #0c2340 100%);
  color: white;
  padding: 80px 0 72px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 70% 50%, rgba(59,130,246,.15) 0%, transparent 70%),
    radial-gradient(ellipse 40% 60% at 20% 80%, rgba(14,165,233,.08) 0%, transparent 60%);
}
.hero::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59,130,246,.3), transparent);
}
.hero .container { position: relative; z-index: 1; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  background: rgba(59,130,246,.15);
  border: 1px solid rgba(59,130,246,.25);
  border-radius: 100px;
  font-size: 13px; font-weight: 500;
  color: #93c5fd;
  margin-bottom: 24px;
}
.badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #60a5fa;
  animation: pulse-dot 2s ease infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(0.8); }
}
.hero h1 {
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}
.hero-desc {
  font-size: 17px;
  color: rgba(255,255,255,.65);
  line-height: 1.7;
  margin-bottom: 36px;
  max-width: 560px;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  transition: all .18s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(59,130,246,.35);
}
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(59,130,246,.4);
}
.btn-ghost {
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.85);
  border: 1px solid rgba(255,255,255,.2);
}
.btn-ghost:hover {
  background: rgba(255,255,255,.18);
  color: white;
}

/* ===== Stats Bar ===== */
.stats-bar {
  display: flex; align-items: center; justify-content: center; gap: 32px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 32px;
  margin: 40px 0 48px;
}
.stat-item { text-align: center; }
.stat-item strong { display: block; font-size: 28px; font-weight: 800; color: var(--text); letter-spacing: -0.02em; }
.stat-item span { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.stat-divider { width: 1px; height: 40px; background: var(--border); }

/* ===== Section Titles ===== */
.section-title-row { margin-bottom: 24px; }
.section-title {
  font-size: 22px; font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* ===== Category Grid ===== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
.cat-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.cat-card::before {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 3px; height: 100%;
  border-radius: 0 0 0 0;
}
.cat-basics::before { background: #3B82F6; }
.cat-offline::before { background: #10B981; }
.cat-online::before { background: #F59E0B; }
.cat-peripheral::before { background: #8B5CF6; }
.cat-core::before { background: #EF4444; }
.cat-news::before { background: #0EA5E9; }

.cat-card:hover {
  border-color: transparent;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.cat-icon {
  width: 52px; height: 52px; flex-shrink: 0;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}
.cat-basics .cat-icon { background: #EFF6FF; color: #3B82F6; }
.cat-offline .cat-icon { background: #ECFDF5; color: #10B981; }
.cat-online .cat-icon { background: #FFFBEB; color: #F59E0B; }
.cat-peripheral .cat-icon { background: #F5F3FF; color: #8B5CF6; }
.cat-core .cat-icon { background: #FEF2F2; color: #EF4444; }
.cat-news .cat-icon { background: #F0F9FF; color: #0EA5E9; }

.cat-content { flex: 1; min-width: 0; }
.cat-content h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.cat-content p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.cat-count {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px; font-weight: 600;
  background: var(--bg-tertiary);
  color: var(--text-muted);
}
.cat-arrow { color: var(--text-muted); align-self: center; flex-shrink: 0; opacity: 0; transition: opacity .2s; }
.cat-card:hover .cat-arrow { opacity: 1; }

/* ===== Article Grid ===== */
.article-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.article-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all .2s;
}
.article-card:hover {
  border-color: transparent;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.article-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px; font-weight: 600;
  margin-bottom: 10px;
}
.tag-basics { background: #EFF6FF; color: #3B82F6; }
.tag-offline { background: #ECFDF5; color: #10B981; }
.tag-online { background: #FFFBEB; color: #F59E0B; }
.tag-peripheral { background: #F5F3FF; color: #8B5CF6; }
.tag-core { background: #FEF2F2; color: #EF4444; }
.tag-news { background: #F0F9FF; color: #0EA5E9; }
.tag-tech { background: #FEF3C7; color: #D97706; }
.tag-market { background: #EDE9FE; color: #7C3AED; }
.tag-event { background: #FEF2F2; color: #DC2626; }

.article-card h4 { font-size: 15px; font-weight: 600; margin-bottom: 8px; line-height: 1.4; }
.article-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 12px; }
.article-meta { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.meta-sep { color: var(--border); }

/* ===== Doc Views ===== */
.view { display: none; padding: 40px 0 80px; }
.view.active { display: block; }

.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-muted);
  margin-bottom: 24px;
}
.breadcrumb a { color: var(--primary); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { color: var(--text-secondary); font-weight: 500; }

.section-header { margin-bottom: 32px; }
.section-header h2 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 8px; }
.section-header p { font-size: 15px; color: var(--text-secondary); }

.toc-layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; gap: 32px; }
.toc-sidebar { position: sticky; top: calc(var(--header-h) + 24px); align-self: start; }
.toc-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: 12px; padding: 0 12px; }
.toc-nav { display: flex; flex-direction: column; gap: 2px; }
.toc-item {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
  color: var(--text-secondary);
  transition: all .15s;
  border-left: 2px solid transparent;
}
.toc-item:hover { background: var(--bg-tertiary); color: var(--text); }
.toc-item.active {
  background: var(--primary-light);
  color: var(--primary);
  border-left-color: var(--primary);
}

.doc-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 40px;
  min-height: 400px;
}

/* ===== Doc Content Styles ===== */
.doc-content h2 { font-size: 22px; font-weight: 700; margin: 32px 0 16px; letter-spacing: -0.01em; }
.doc-content h2:first-child { margin-top: 0; }
.doc-content h3 { font-size: 17px; font-weight: 600; margin: 24px 0 12px; }
.doc-content p { font-size: 15px; color: var(--text-secondary); line-height: 1.8; margin-bottom: 14px; }
.doc-content ul, .doc-content ol { padding-left: 20px; margin-bottom: 14px; }
.doc-content li { font-size: 15px; color: var(--text-secondary); line-height: 1.8; margin-bottom: 6px; }
.doc-content strong { color: var(--text); font-weight: 600; }

.doc-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 300px; text-align: center;
  color: var(--text-muted);
}
.doc-placeholder svg { margin-bottom: 16px; opacity: .3; }
.doc-placeholder h3 { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.doc-placeholder p { font-size: 14px; }

/* Spec table */
.spec-table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 14px; }
.spec-table th, .spec-table td { padding: 10px 14px; border: 1px solid var(--border); text-align: left; }
.spec-table th { background: var(--bg-tertiary); font-weight: 600; color: var(--text); }
.spec-table td { color: var(--text-secondary); }
.spec-table tr:hover td { background: #f8fafc; }

/* Info box */
.info-box {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin: 16px 0;
  font-size: 14px;
  line-height: 1.6;
}
.info-box.info { background: var(--primary-light); border-left: 3px solid var(--primary); color: #1e40af; }
.info-box.warn { background: #FFFBEB; border-left: 3px solid #F59E0B; color: #92400E; }
.info-box.tip { background: #ECFDF5; border-left: 3px solid #10B981; color: #065F46; }

/* ===== News Feed ===== */
.news-feed { display: flex; flex-direction: column; gap: 12px; }
.news-item {
  display: flex; gap: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  cursor: pointer;
  transition: all .2s;
}
.news-item:hover { border-color: transparent; box-shadow: var(--shadow-md); transform: translateY(-1px); }
.news-date { font-size: 13px; color: var(--text-muted); white-space: nowrap; padding-top: 3px; min-width: 90px; font-weight: 500; }
.news-body { flex: 1; }
.news-body h4 { font-size: 16px; font-weight: 600; margin-bottom: 8px; line-height: 1.4; }
.news-body p { font-size: 14px; color: var(--text-secondary); line-height: 1.7; margin-top: 6px; }
.news-tag { display: inline-block; padding: 2px 8px; border-radius: 100px; font-size: 11px; font-weight: 600; margin-bottom: 4px; }

/* ===== Article Detail ===== */
.article-detail { max-width: 760px; }
.article-detail .article-header { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.article-detail .article-header h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.25; margin-bottom: 12px; }
.article-detail .article-header .article-info { display: flex; gap: 16px; font-size: 13px; color: var(--text-muted); flex-wrap: wrap; }
.article-detail .article-body h2 { font-size: 20px; font-weight: 700; margin: 28px 0 14px; }
.article-detail .article-body p { font-size: 15px; color: var(--text-secondary); line-height: 1.85; margin-bottom: 14px; }
.article-detail .article-body ul { padding-left: 20px; margin-bottom: 14px; }
.article-detail .article-body li { font-size: 15px; color: var(--text-secondary); line-height: 1.8; }

/* ===== Footer ===== */
.site-footer {
  background: #0f172a;
  color: rgba(255,255,255,.7);
  padding: 56px 0 32px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}
.footer-brand p { font-size: 14px; line-height: 1.7; margin: 12px 0 16px; color: rgba(255,255,255,.5); }
.footer-link { font-size: 14px; color: var(--primary); font-weight: 500; }
.footer-link:hover { color: #93c5fd; }
.footer-logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: white; }
.footer-links h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.4); margin-bottom: 16px; }
.footer-links a { display: block; font-size: 14px; color: rgba(255,255,255,.6); margin-bottom: 10px; transition: color .15s; }
.footer-links a:hover { color: white; }
.footer-bottom { padding-top: 24px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; color: rgba(255,255,255,.35); }

/* ===== Animations ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.view.active .hero { animation: fadeIn .4s ease; }
.view.active .category-grid { animation: fadeIn .5s ease; }
.view.active .article-grid { animation: fadeIn .6s ease; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .category-grid, .article-grid { grid-template-columns: repeat(2, 1fr); }
  .toc-layout { grid-template-columns: 1fr; }
  .toc-sidebar { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .stats-bar { gap: 20px; }
}

@media (max-width: 640px) {
  .main-nav { display: none; }
  .mobile-menu-btn { display: flex; }
  .hero { padding: 48px 0 48px; }
  .hero h1 { font-size: 32px; }
  .category-grid, .article-grid { grid-template-columns: 1fr; }
  .stats-bar { flex-direction: column; gap: 16px; }
  .stat-divider { width: 40px; height: 1px; }
  .doc-content { padding: 20px; }
  .news-item { flex-direction: column; gap: 8px; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
}
