/* ===========================================
   AIBook — 全站通用样式
   移动优先 · 响应式 · 深色模式支持
   =========================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Helvetica Neue", Helvetica, Arial, sans-serif;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { opacity: 0.85; }
button { font-family: inherit; cursor: pointer; border: none; }

/* ---- 主题变量（浅色默认 / 深色 data-theme="dark"） ---- */
:root {
  --bg: #ffffff;
  --bg-alt: #f7f9fc;
  --bg-card: #ffffff;
  --border: #e5e9f0;
  --text: #1a202c;
  --text-muted: #64748b;
  --accent: #2563eb;
  --accent-light: #dbeafe;
  --accent-hover: #1d4ed8;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.08);
  --radius: 8px;
  --radius-lg: 12px;
  --container-max: 1200px;
}

[data-theme="dark"] {
  --bg: #0a0c10;
  --bg-alt: #0f1318;
  --bg-card: #161b24;
  --border: rgba(99,179,237,0.15);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #63b3ed;
  --accent-light: rgba(99,179,237,0.15);
  --accent-hover: #90cdf4;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0c10;
    --bg-alt: #0f1318;
    --bg-card: #161b24;
    --border: rgba(99,179,237,0.15);
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --accent: #63b3ed;
    --accent-light: rgba(99,179,237,0.15);
    --accent-hover: #90cdf4;
  }
}

/* ---- 容器 ---- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1rem;
}

/* ---- 顶部导航（移动端） ---- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 1rem;
  max-width: var(--container-max);
  margin: 0 auto;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.nav-logo-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent), #9f7aea);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.9rem;
}

.nav-menu-btn {
  background: transparent;
  padding: 8px;
  color: var(--text);
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
}

/* 移动端折叠菜单 */
.nav-links {
  display: none;
  flex-direction: column;
  gap: 0;
  list-style: none;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 0.5rem 0;
}

.nav-links.open { display: flex; }

.nav-links li { padding: 0; }

.nav-links a {
  display: block;
  padding: 0.9rem 1rem;
  color: var(--text);
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border);
  min-height: 44px;
}

.nav-theme-toggle {
  background: transparent;
  padding: 8px;
  color: var(--text-muted);
  font-size: 1.2rem;
  min-width: 44px;
  min-height: 44px;
  border-radius: 6px;
}

.nav-theme-toggle:hover { color: var(--accent); }

/* ---- Hero 区 ---- */
.hero {
  padding: 2.5rem 1rem 2rem;
  text-align: center;
  background: linear-gradient(180deg, var(--bg-alt), var(--bg));
}

.hero h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.25;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.hero h1 .gradient {
  background: linear-gradient(135deg, var(--accent), #9f7aea);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto 1.5rem;
}

/* ---- 按钮 ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  min-height: 44px;
  transition: background 0.15s, transform 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  opacity: 1;
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

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

/* ---- 分区 ---- */
.section {
  padding: 2.5rem 0;
}

.section-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.section-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto;
}

/* ---- 工具卡片网格 ---- */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.tool-card {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
  min-height: 100px;
}

.tool-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  opacity: 1;
}

.tool-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.tool-name {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.tool-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}

.tool-category {
  font-size: 0.7rem;
  color: var(--accent);
  margin-top: 0.4rem;
}

/* ---- 文章卡片 ---- */
.article-card {
  display: block;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  color: var(--text);
}

.article-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  line-height: 1.4;
}

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

.article-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.6rem;
}

/* ---- 面包屑 ---- */
.breadcrumb {
  padding: 0.8rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { margin: 0 0.4rem; }

/* ---- 文章正文（长文章专用） ---- */
.article-body {
  max-width: 760px;
  margin: 0 auto;
  padding: 1rem;
  font-size: 1rem;
}

.article-body h1 {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 0.8rem;
}

.article-body h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 1.8rem 0 0.8rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.article-body h2:first-of-type { border-top: none; padding-top: 0; }

.article-body h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.3rem 0 0.5rem;
  color: var(--accent);
}

.article-body p { margin-bottom: 1rem; }
.article-body ul, .article-body ol { margin: 0 0 1rem 1.5rem; }
.article-body li { margin-bottom: 0.3rem; }

.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  background: var(--bg-alt);
  color: var(--text-muted);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
}

.article-body th, .article-body td {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

.article-body th {
  background: var(--bg-alt);
  font-weight: 600;
  color: var(--accent);
}

.article-body pre {
  background: #0d1117;
  color: #c9d1d9;
  padding: 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: "SF Mono", Consolas, "JetBrains Mono", monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  margin: 1rem 0;
}

.article-body p code, .article-body li code {
  background: var(--accent-light);
  color: var(--accent);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 0.88em;
}

.article-body img {
  border-radius: var(--radius);
  margin: 1rem 0;
}

/* ---- FAQ（工具页标配） ---- */
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  background: var(--bg-card);
  overflow: hidden;
}

.faq-question {
  padding: 1rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  list-style: none;
}

.faq-question::-webkit-details-marker { display: none; }

.faq-question::after {
  content: "+";
  font-size: 1.3rem;
  color: var(--accent);
  transition: transform 0.2s;
}

details[open] .faq-question::after { transform: rotate(45deg); }

.faq-answer {
  padding: 0 1rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

/* ---- 下载按钮（工具页 CTA） ---- */
.download-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  background: linear-gradient(135deg, var(--accent-light), rgba(159,122,234,0.1));
  border-radius: var(--radius-lg);
  margin: 1.5rem 0;
  text-align: center;
}

.download-cta h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.download-cta p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* ---- 友情链接（站群伪链接） ---- */
.friends {
  padding: 2rem 1rem;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.friends-title {
  font-weight: 600;
  margin-bottom: 0.6rem;
  color: var(--text);
}

.friends-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.8rem;
  max-width: var(--container-max);
  margin: 0 auto;
}

.friends-list a {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.friends-list a:hover { color: var(--accent); }

/* ---- Footer ---- */
.footer {
  padding: 2rem 1rem 1.5rem;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1.5rem;
  margin-bottom: 1rem;
}

.footer-nav a {
  color: var(--text-muted);
}

.footer-copy {
  line-height: 1.8;
}

.footer-copy a { color: var(--text-muted); }

/* ---- AIGC 合规声明 ---- */
.aigc-notice {
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.7;
  margin-top: 0.5rem;
}

/* ===========================================
   响应式断点：平板（≥768px）
   =========================================== */
@media (min-width: 768px) {
  .container { padding: 0 1.5rem; }

  .nav-inner { height: 64px; padding: 0 1.5rem; }

  .nav-menu-btn { display: none; }

  .nav-links {
    display: flex !important;
    flex-direction: row;
    gap: 1.5rem;
    background: transparent;
    border: none;
    padding: 0;
  }

  .nav-links a {
    padding: 0;
    border: none;
    font-size: 0.9rem;
    color: var(--text-muted);
  }

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

  .hero { padding: 4rem 1.5rem 3rem; }
  .hero h1 { font-size: 2.2rem; }
  .hero p { font-size: 1.05rem; }

  .section { padding: 4rem 0; }
  .section-title { font-size: 1.8rem; }
  .section-desc { font-size: 1rem; }

  .tools-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }

  .tool-card { padding: 1.2rem; min-height: 120px; }
  .tool-icon { width: 40px; height: 40px; }

  .article-body { padding: 2rem 1.5rem; font-size: 1.05rem; }
  .article-body h1 { font-size: 2rem; }
  .article-body h2 { font-size: 1.5rem; }
  .article-body h3 { font-size: 1.2rem; }
}

/* ===========================================
   响应式断点：桌面（≥1024px）
   =========================================== */
@media (min-width: 1024px) {
  .hero { padding: 6rem 2rem 4rem; }
  .hero h1 { font-size: 3rem; }

  .section-title { font-size: 2.2rem; }

  .tools-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.2rem;
  }

  .article-body { font-size: 1.1rem; padding: 3rem 2rem; }
  .article-body h1 { font-size: 2.4rem; }
}

/* ===========================================
   大屏（≥1280px）
   =========================================== */
@media (min-width: 1280px) {
  .tools-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ---- 打印样式 ---- */
@media print {
  .nav, .footer, .friends { display: none; }
  body { background: #fff; color: #000; }
}
