/* ============================================================
   AIHUB 文档站 - 全局样式
   ============================================================ */

:root {
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --accent: #6366f1;
  --accent-glow: rgba(99,102,241,.15);
  --bg: #0f1117;
  --bg2: #161b27;
  --bg3: #1e2535;
  --border: rgba(255,255,255,.08);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --green: #10b981;
  --yellow: #f59e0b;
  --red: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,.4);
}

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

html { scroll-behavior: smooth; }

/* ── CUSTOM SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: rgba(14,165,233,.35);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(99,102,241,.6); }
* { scrollbar-width: thin; scrollbar-color: rgba(14,165,233,.35) transparent; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ── TOP NAV ── */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15,17,23,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topnav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}
.topnav-inner .topnav-links {
  justify-self: center;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text) !important;
}
.topnav-links {
  display: flex;
  gap: 28px;
}
.topnav-links a {
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 500;
  transition: color .2s;
}
.topnav-links a:hover,
.topnav-links a.active { color: var(--primary); }

/* ── HERO ── */
.hero {
  position: relative;
  overflow: hidden;
  padding: 80px 24px 48px;
  text-align: center;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% -20%, rgba(14,165,233,.18) 0%, transparent 60%),
              radial-gradient(ellipse 60% 40% at 80% 120%, rgba(99,102,241,.12) 0%, transparent 50%);
  pointer-events: none;
}
.hero-content { position: relative; max-width: 680px; margin: 0 auto; }
.badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 99px;
  background: rgba(14,165,233,.15);
  border: 1px solid rgba(14,165,233,.3);
  color: var(--primary);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .05em;
  margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  background: linear-gradient(135deg, #e2e8f0 30%, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
  margin-bottom: 16px;
}
.hero p {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 32px;
}
.hero-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .95rem;
  transition: all .2s;
  cursor: pointer;
  border: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: 0 4px 14px rgba(14,165,233,.35);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(14,165,233,.45);
  color: #fff;
}
.btn-ghost {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover {
  background: rgba(255,255,255,.1);
  color: var(--text);
}

/* ── SECTION LABELS ── */
.section-label {
  text-align: center;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 32px;
}

/* ── CARDS ── */
.cards-section { max-width: 1100px; margin: 0 auto; padding: 24px 24px 64px; }
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.card {
  display: block;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  color: var(--text);
  transition: all .25s;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: 0;
  transition: opacity .25s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(14,165,233,.3);
  box-shadow: var(--shadow);
  color: var(--text);
}
.card:hover::before { opacity: 1; }
.card-featured {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto auto auto;
  column-gap: 20px;
  align-items: start;
}
.card-featured .card-icon { grid-row: 1; font-size: 2rem; }
.card-featured .card-badge { grid-column: 2; justify-self: start; align-self: center; }
.card-featured h2 { grid-column: 2; }
.card-featured p { grid-column: 2; }
.card-featured .card-steps { grid-column: 2; }
.card-featured .card-footer { grid-column: 2; }

@media (max-width: 640px) {
  .card-featured {
    grid-template-columns: 1fr;
  }
  .card-featured .card-icon,
  .card-featured .card-badge,
  .card-featured h2,
  .card-featured p,
  .card-featured .card-steps,
  .card-featured .card-footer { grid-column: 1; }
}
.card-icon { font-size: 2.2rem; margin-bottom: 12px; }
.card-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .06em;
  background: rgba(16,185,129,.15);
  color: var(--green);
  border: 1px solid rgba(16,185,129,.3);
  margin-bottom: 8px;
}
.card-badge-blue {
  background: rgba(14,165,233,.15);
  color: var(--primary);
  border-color: rgba(14,165,233,.3);
}
.card h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 8px; }
.card p { color: var(--text-muted); font-size: .9rem; margin-bottom: 16px; }
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.card-steps { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.card-steps span {
  padding: 3px 10px;
  background: var(--bg3);
  border-radius: 99px;
  font-size: .75rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.tag {
  padding: 3px 10px;
  background: var(--bg3);
  border-radius: 99px;
  font-size: .75rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.card-footer { color: var(--primary); font-size: .9rem; font-weight: 600; }

/* ── FLOW ── */
.flow-section {
  max-width: 1100px;
  margin: 0 auto 64px;
  padding: 0 24px;
}
.flow-steps {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
}
.flow-step {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 160px;
}
.flow-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.flow-text { display: flex; flex-direction: column; }
.flow-text strong { font-size: .95rem; font-weight: 600; }
.flow-text span { font-size: .8rem; color: var(--text-muted); }
.flow-arrow { color: var(--text-dim); font-size: 1.4rem; flex-shrink: 0; }

/* ── FOOTER ── */
.footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 24px;
  color: var(--text-dim);
  font-size: .85rem;
}
.footer a { color: var(--text-dim); }
.footer a:hover { color: var(--primary); }

/* ── DOC LAYOUT (shared by inner pages) ── */
.doc-layout {
  display: flex;
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  gap: 48px;
  align-items: flex-start;
}
.doc-sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
}
.sidebar-title {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.sidebar-nav { list-style: none; }
.sidebar-nav li { margin-bottom: 2px; }
.sidebar-nav a {
  display: block;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .88rem;
  transition: all .18s;
}
.sidebar-nav a:hover { background: var(--bg3); color: var(--text); }
.sidebar-nav a.active { background: rgba(14,165,233,.12); color: var(--primary); font-weight: 600; }
.sidebar-nav .sub { padding-left: 20px; }

.doc-content { flex: 1; min-width: 0; }

/* ── DOC CONTENT TYPOGRAPHY ── */
.doc-content h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #e2e8f0 40%, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.doc-content .subtitle { color: var(--text-muted); margin-bottom: 40px; }

.doc-content h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 48px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.doc-content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 28px 0 12px;
  color: var(--text);
}
.doc-content p { color: var(--text-muted); margin-bottom: 14px; }
.doc-content ul, .doc-content ol {
  color: var(--text-muted);
  padding-left: 20px;
  margin-bottom: 14px;
}
.doc-content li { margin-bottom: 6px; }
.doc-content strong { color: var(--text); font-weight: 600; }

/* Steps */
.steps { counter-reset: step; }
.step {
  display: flex;
  gap: 20px;
  margin-bottom: 32px;
  align-items: flex-start;
}
.step-num {
  counter-increment: step;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.step-body { flex: 1; }
.step-body h4 { font-size: 1rem; font-weight: 600; margin-bottom: 6px; }
.step-body p { font-size: .9rem; color: var(--text-muted); margin-bottom: 8px; }

/* Code blocks */
.code-block {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  font-family: 'SFMono-Regular', 'Cascadia Code', 'Fira Code', Consolas, monospace;
  font-size: .88rem;
  line-height: 1.7;
  overflow-x: auto;
  margin: 12px 0;
  position: relative;
}
.code-block .comment { color: #6b7280; }
.code-block .key { color: #e879f9; }
.code-block .val { color: #86efac; }
.code-block .cmd { color: #93c5fd; }
.code-block .str { color: #fde68a; }

.copy-btn {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: .75rem;
  padding: 3px 10px;
  cursor: pointer;
  transition: all .18s;
}
.copy-btn:hover { background: rgba(255,255,255,.14); color: var(--text); }
.copy-btn.copied { color: var(--green); border-color: rgba(16,185,129,.4); }

/* OS Tabs */
.os-tabs { display: flex; gap: 4px; margin-bottom: 0; }
.os-tab {
  padding: 7px 18px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-bottom: none;
  color: var(--text-muted);
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .18s;
}
.os-tab.active { background: var(--bg2); color: var(--primary); border-color: rgba(14,165,233,.3); }
.os-panel {
  display: none;
  background: var(--bg2);
  border: 1px solid rgba(14,165,233,.2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) var(--radius-sm);
  padding: 24px;
  margin-bottom: 24px;
}
.os-panel.active { display: block; }

/* Info / Warning / Tip boxes */
.info-box {
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin: 16px 0;
  font-size: .9rem;
}
.info-box .icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.info-note { background: rgba(14,165,233,.1); border: 1px solid rgba(14,165,233,.25); }
.info-note .icon, .info-note p { color: var(--primary); }
.info-tip { background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.25); }
.info-tip .icon, .info-tip p { color: var(--green); }
.info-warn { background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.25); }
.info-warn .icon, .info-warn p { color: var(--yellow); }
.info-box p { margin: 0; }

/* Tables */
.doc-table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: .9rem; }
.doc-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
}
.doc-table td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.doc-table tr:nth-child(even) td { background: rgba(255,255,255,.02); }

/* Screenshot */
.screenshot {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  width: 100%;
  margin: 16px 0;
  display: block;
}
.screenshot-caption {
  text-align: center;
  font-size: .8rem;
  color: var(--text-dim);
  margin-top: -10px;
  margin-bottom: 16px;
}

/* Page header breadcrumb */
.page-header { padding: 32px 0 0; }
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  color: var(--text-dim);
  margin-bottom: 16px;
}
.breadcrumb a { color: var(--text-dim); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { color: var(--text-dim); }

/* Comparison table for CLI vs WS */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 20px 0;
}
.compare-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
}
.compare-card.recommended { border-color: rgba(14,165,233,.4); }
.compare-card h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.rec-badge {
  font-size: .68rem;
  padding: 1px 8px;
  background: rgba(14,165,233,.15);
  color: var(--primary);
  border-radius: 99px;
  border: 1px solid rgba(14,165,233,.3);
  font-weight: 700;
}
.compare-card p { font-size: .85rem; color: var(--text-muted); margin: 8px 0; }
.compare-card ul { font-size: .85rem; color: var(--text-muted); padding-left: 16px; }
.compare-card li { margin-bottom: 4px; }

@media (max-width: 600px) {
  .compare-grid { grid-template-columns: 1fr; }
  .doc-layout { flex-direction: column; }
  .doc-sidebar { width: 100%; position: static; }
}

/* inline code */
code {
  background: rgba(255,255,255,.08);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: .85em;
  color: #f472b6;
}

/* ── LIGHTBOX ── */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
#lightbox.active { display: flex; }

.lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .85);
  backdrop-filter: blur(6px);
  animation: lb-fade-in .18s ease;
}

.lb-container {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lb-zoom-in .2s cubic-bezier(.34,1.56,.64,1);
}

.lb-img {
  max-width: 90vw;
  max-height: 88vh;
  border-radius: 10px;
  box-shadow: 0 24px 80px rgba(0,0,0,.7);
  object-fit: contain;
  display: block;
}

.lb-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: .95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .18s;
  line-height: 1;
}
.lb-close:hover { background: rgba(255,255,255,.3); }

@keyframes lb-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes lb-zoom-in {
  from { opacity: 0; transform: scale(.88); }
  to   { opacity: 1; transform: scale(1); }
}

