/* ============================================================
 * NexHub 官方网站 — 样式
 * 设计：现代、清爽、明暗双主题、响应式。
 * 修改主题色：改下面 :root 里的 --primary 等变量即可。
 * ============================================================ */

:root {
  --primary: #159cb5;
  --primary-2: #3ec4dd;
  --accent: #06b6d4;
  --bg: #ffffff;
  --bg-soft: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f2f8;
  --text: #1a1d29;
  --muted: #6b7280;
  --border: #e6e8ef;
  --shadow: 0 8px 30px rgba(20, 23, 40, 0.08);
  --shadow-hover: 0 16px 44px rgba(20, 23, 40, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1120px;
  --grad: linear-gradient(135deg, var(--primary), var(--primary-2));
}

[data-theme="dark"] {
  --bg: #0b0d17;
  --bg-soft: #11131f;
  --surface: #161a27;
  --surface-2: #1d2233;
  --text: #e8eaf2;
  --muted: #9aa3b2;
  --border: #232838;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 16px 44px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

a { color: inherit; text-decoration: none; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(160%) blur(12px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 19px; letter-spacing: 0.2px; }
.brand img { border-radius: 8px; }
.nav-links { display: flex; gap: 26px; }
.nav-links a { color: var(--muted); font-weight: 600; font-size: 15px; transition: color 0.2s; }
.nav-links a:hover { color: var(--primary); }
.nav-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.icon-btn.ghost { background: var(--grad); color: #fff; border: none; }
.icon-btn.ghost:hover { opacity: 0.9; color: #fff; }
.menu-btn { display: none; font-size: 18px; }

/* ===== Hero ===== */
.hero { position: relative; overflow: hidden; padding: 96px 0 80px; }
.hero-bg {
  position: absolute; inset: -40% -10% auto -10%; height: 600px;
  background:
    radial-gradient(600px 300px at 20% 10%, rgba(21,156,181,0.30), transparent 60%),
    radial-gradient(500px 280px at 80% 0%, rgba(62,196,221,0.22), transparent 60%);
  filter: blur(8px);
  z-index: 0;
}
.hero-inner { position: relative; z-index: 1; text-align: center; max-width: 820px; }
.hero-logo { width: 140px; height: 140px; border-radius: 30px; box-shadow: var(--shadow-hover); margin: 0 auto 28px; display: block; }
.badge {
  display: inline-block; padding: 6px 14px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 13px; font-weight: 700; color: var(--primary);
}
.hero-title { font-size: clamp(30px, 5vw, 52px); line-height: 1.15; margin: 18px 0 0; font-weight: 800; }
.hero-title .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { font-size: clamp(15px, 2vw, 19px); color: var(--muted); margin: 18px auto 0; max-width: 680px; }
.hero-cta { display: flex; gap: 14px; justify-content: center; margin-top: 30px; flex-wrap: wrap; }
.hero-note { margin-top: 18px; font-size: 13px; color: var(--muted); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 12px; font-weight: 700; font-size: 15px;
  cursor: pointer; transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s;
  border: 1px solid transparent;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 10px 24px rgba(21,156,181,0.35); }
.btn-primary:hover { box-shadow: 0 14px 30px rgba(21,156,181,0.5); }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-outline.disabled, .btn.disabled { opacity: .55; cursor: default; border-color: var(--border); }
.btn-outline.disabled:hover { color: var(--text); border-color: var(--border); }

/* ===== Sections ===== */
.section { padding: 76px 0; }
.section-soft { background: var(--bg-soft); }
.section-head { text-align: center; max-width: 680px; margin: 0 auto 44px; }
.section-head h2 { font-size: clamp(25px, 3.4vw, 36px); margin: 0 0 10px; font-weight: 800; }
.section-head p { color: var(--muted); font-size: 16px; margin: 0; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ===== Grid ===== */
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.feature .f-icon { font-size: 30px; }
.feature h3 { margin: 12px 0 6px; font-size: 18px; font-weight: 700; }
.feature p { margin: 0; color: var(--muted); font-size: 14.5px; }

/* ===== Download cards ===== */
.dl { display: flex; flex-direction: column; gap: 12px; }
.dl-head { display: flex; align-items: center; gap: 12px; }
.dl-head .icon { font-size: 30px; }
.dl-head .name { font-size: 18px; font-weight: 800; }
.dl .desc { color: var(--muted); font-size: 14px; flex: 1; }
.dl .note { font-size: 12.5px; color: var(--muted); background: var(--surface-2); border-radius: 8px; padding: 7px 10px; }
.dl .btn { justify-content: center; }

/* ===== Accordion (docs) ===== */
.accordion { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.acc-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.acc-q { width: 100%; text-align: left; background: none; border: none; color: var(--text); padding: 18px 20px; font-size: 16px; font-weight: 700; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.acc-q .chev { transition: transform 0.25s ease; color: var(--primary); }
.acc-item.open .acc-q .chev { transform: rotate(180deg); }
.acc-a { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.acc-a .inner { padding: 0 20px 18px; color: var(--muted); font-size: 14.5px; }

/* ===== 使用指南 ===== */
.guide .guide-title { font-size: 19px; font-weight: 800; margin: 0 0 14px; }
.guide-block { margin-top: 14px; }
.guide-label {
  font-size: 12px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--primary); margin-bottom: 8px;
}
.guide-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.guide-list li { margin: 5px 0; }
.guide-ol { list-style: decimal; }
.guide-ol li::marker { color: var(--primary); font-weight: 700; }
.guide-ctrls { list-style: none; padding-left: 0; display: grid; grid-template-columns: 1fr; gap: 8px; }
.ctrl-item { display: flex; gap: 12px; align-items: flex-start; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.ctrl-key { flex: 0 0 auto; min-width: 96px; font-weight: 800; color: var(--primary); font-size: 13.5px; }
.ctrl-desc { color: var(--text); font-size: 13.5px; line-height: 1.55; }

/* ===== 源编写教程 ===== */
.tutorial { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.card.tut { padding: 22px 24px; }

/* ===== 文档中心（docs 拆分为多页） ===== */
.doc-cards { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.doc-card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.doc-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: 0 12px 28px rgba(21, 156, 181, .16);
}
.doc-card .card-link {
  display: inline-block;
  margin-top: 10px;
  font-weight: 800;
  color: var(--primary);
  font-size: 16px;
}
.back-link {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}
.back-link:hover { text-decoration: underline; }
.tut-title { font-size: 18px; font-weight: 800; margin: 0 0 12px; color: var(--text); }
.tut-body p { margin: 0 0 10px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.tut-body p:last-child { margin-bottom: 0; }
.tut-fields { margin: 14px 0; overflow-x: auto; }
.tut-fields table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tut-fields td { border: 1px solid var(--border); padding: 7px 10px; vertical-align: top; }
.tut-k { font-weight: 800; color: var(--primary); white-space: nowrap; width: 38%; background: var(--bg-soft); }
.tut-v { color: var(--text); }
/* 代码块：明暗双主题都清晰可读，字号放大，移动端可横向滚动 */
.tut-code { margin: 14px 0 0; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; overflow-x: auto; font-size: 13.5px; line-height: 1.6; }
.tut-code code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace; white-space: pre; tab-size: 2; }
/* 深色主题下给代码块一点独立底色，避免与页面背景糊在一起 */
[data-theme="dark"] .tut-code { background: #11151f; color: #e6edf3; border-color: #2a3142; }

/* ===== 文档布局：源编写教程（RSSHub 风格） ===== */
.doc-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 220px;
  gap: 32px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}
.doc-sidebar { position: relative; }
.doc-nav-scroll,
.doc-toc-scroll {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}
.doc-nav-scroll::-webkit-scrollbar,
.doc-toc-scroll::-webkit-scrollbar { width: 5px; }
.doc-nav-scroll::-webkit-scrollbar-thumb,
.doc-toc-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.doc-back {
  display: block;
  margin-bottom: 18px;
  color: var(--primary);
  font-weight: 700;
  font-size: 13.5px;
  text-decoration: none;
}
.doc-back:hover { text-decoration: underline; }

.doc-nav-group { margin-bottom: 18px; }
.doc-nav-group-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
  padding-left: 10px;
}
.doc-nav-link,
.doc-toc-link {
  display: block;
  padding: 6px 10px 6px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.45;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all 0.15s ease;
}
.doc-nav-link:hover,
.doc-toc-link:hover { color: var(--text); background: var(--bg-soft); }
.doc-nav-link.active,
.doc-toc-link.active {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border-left-color: var(--primary);
  font-weight: 700;
}

.doc-main { min-width: 0; }
.doc-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.doc-breadcrumb a { color: var(--muted); text-decoration: none; }
.doc-breadcrumb a:hover { color: var(--primary); text-decoration: underline; }
.doc-bc-sep { opacity: 0.5; }
.doc-header { margin-bottom: 36px; }
.doc-title { font-size: clamp(28px, 4vw, 38px); font-weight: 900; margin: 0 0 12px; color: var(--text); letter-spacing: -0.4px; }
.doc-lead { font-size: 17px; color: var(--muted); line-height: 1.7; margin: 0; max-width: 720px; }

.doc-section { margin-bottom: 44px; }
.doc-h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 90px;
}
.doc-anchor {
  opacity: 0;
  color: var(--primary);
  font-size: 0.75em;
  text-decoration: none;
  transition: opacity 0.15s ease;
}
.doc-h2:hover .doc-anchor { opacity: 1; }
.doc-section-body p { margin: 0 0 14px; color: var(--text); font-size: 15px; line-height: 1.8; }
.doc-section-body p:last-child { margin-bottom: 0; }
.doc-section-body a { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
.doc-section-body a:hover { color: var(--primary-2); }
.doc-section-body strong { color: var(--primary); font-weight: 700; }

.doc-table-wrap { margin: 20px 0; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.doc-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.doc-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.doc-table tr:last-child td { border-bottom: none; }
.doc-table-k { font-weight: 800; color: var(--primary); white-space: nowrap; width: 36%; background: var(--bg-soft); }
.doc-table-v { color: var(--text); line-height: 1.6; }

.doc-code { margin: 18px 0 0; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 18px; overflow-x: auto; font-size: 13.5px; line-height: 1.65; }
.doc-code code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace; white-space: pre; tab-size: 2; }
[data-theme="dark"] .doc-code { background: #11151f; color: #e6edf3; border-color: #2a3142; }

.doc-toc-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 10px; }

/* 功能页：双列卡片 */
.doc-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin-top: 18px; }
.doc-grid-2 .doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
}
.doc-card-icon {
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; line-height: 1;
  border-radius: 12px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  margin-bottom: 14px;
}
.doc-grid-2 .doc-card h3 { margin: 0 0 8px; font-size: 17px; font-weight: 800; color: var(--text); }
.doc-grid-2 .doc-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.65; }

/* 右侧大纲分组（源编写教程） */
.doc-toc-group { margin-bottom: 16px; }
.doc-toc-group-title {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); margin: 4px 0 6px; padding-left: 12px;
}
.doc-toc-group .doc-toc-link { padding-left: 22px; font-size: 13px; }

.doc-nav-toggle { display: none; }

@media (max-width: 1100px) {
  .doc-layout { grid-template-columns: 240px minmax(0, 1fr); }
  .doc-toc { display: none; }
}

@media (max-width: 900px) {
  .doc-layout { grid-template-columns: 1fr; padding-top: 18px; }
  .doc-sidebar { order: -1; position: static; margin-bottom: 8px; }
  .doc-nav-scroll {
    position: fixed;
    top: 64px; left: 0; bottom: 0;
    width: 280px;
    max-height: none;
    background: var(--surface);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 18px 16px;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .doc-nav.open .doc-nav-scroll { transform: translateX(0); }
  .doc-nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 10px;
  }
  .doc-nav-toggle svg { stroke: currentColor; }
  .doc-back { margin-bottom: 14px; }
  .doc-title { font-size: 28px; }
  .doc-h2 { font-size: 22px; scroll-margin-top: 76px; }
  .doc-table-k { width: 42%; }
}
.filter-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 30px; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 7px 16px; font-size: 13.5px; font-weight: 700; cursor: pointer; transition: all 0.2s ease; }
.chip:hover { color: var(--primary); border-color: var(--primary); }
.chip.active { background: var(--grad); color: #fff; border-color: transparent; }

.src { display: flex; flex-direction: column; gap: 10px; }
.src-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.src-name { font-size: 18px; font-weight: 800; }
.src-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.tag-type { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); }
.tag-builtin { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.tag-community { background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--muted); }
.tag-ver { background: var(--surface-2); color: var(--muted); }
.src .desc { color: var(--muted); font-size: 14px; flex: 1; }
.src .url { font-size: 12.5px; color: var(--muted); word-break: break-all; }
.src .btn { justify-content: center; margin-top: 4px; }

/* ===== Footer ===== */
.site-footer { background: var(--bg-soft); border-top: 1px solid var(--border); padding: 40px 0; }
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.footer-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 17px; }
.disclaimer { max-width: 760px; color: var(--muted); font-size: 13px; margin: 0; }
.copyright { color: var(--muted); font-size: 12.5px; margin: 0; }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: all 0.3s ease; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 680px) {
  .nav-links {
    position: fixed; top: 64px; left: 0; right: 0;
    flex-direction: column; gap: 0; background: var(--bg); border-bottom: 1px solid var(--border);
    max-height: 0; overflow: hidden; transition: max-height 0.3s ease; padding: 0 20px;
  }
  .nav-links.open { max-height: 320px; padding: 8px 20px 16px; }
  .nav-links a { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .menu-btn { display: inline-block; }
  .grid-3 { grid-template-columns: 1fr; }
  .icon-btn.ghost { display: none; }
  .hero { padding: 72px 0 56px; }
  .hero-logo { width: 112px; height: 112px; margin-bottom: 22px; }
  .tutorial { grid-template-columns: 1fr; }
  /* 源编写教程：移动端字号与间距放大，方便不同设备阅读 */
  .card.tut { padding: 18px 16px; }
  .tut-title { font-size: 17px; }
  .tut-body p { font-size: 14.5px; line-height: 1.75; }
  .tut-fields table { font-size: 13.5px; }
  .tut-fields td { padding: 8px 10px; }
  .tut-code { font-size: 13px; padding: 12px 14px; -webkit-text-size-adjust: 100%; }
}

/* 小屏手机：进一步放宽字号与字段列宽，避免挤压换行 */
@media (max-width: 480px) {
  .tut-fields td { white-space: normal; }
  .tut-k { width: 42%; }
  .tut-code { font-size: 12.5px; }
}
