/* 矿物 - 交互教程风格 CSS */
/* 变量定义 */
:root {
  --accent-color: #9c27b0;
  --accent-light: #ba68c8;
  --accent-dark: #7b1fa2;
  --bg-primary: #fafafa;
  --bg-secondary: #f5f5f5;
  --bg-code: #263238;
  --text-primary: #212121;
  --text-secondary: #616161;
  --text-light: #9e9e9e;
  --border-color: #e0e0e0;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.12);
  --radius: 8px;
  --radius-sm: 4px;
  --max-width: 1200px;
  --header-height: 64px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
}

a {
  color: var(--accent-color);
  text-decoration: none;
}

a:hover {
  color: var(--accent-dark);
}

/* 头部 */
.header {
  height: var(--header-height);
  background: #fff;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-light));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
}

.nav {
  display: flex;
  gap: 32px;
}

.nav a {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
  transition: color 0.2s;
}

.nav a:hover,
.nav a.active {
  color: var(--accent-color);
}

.search-box {
  position: relative;
}

.search-box input {
  width: 240px;
  height: 40px;
  padding: 0 16px 0 40px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 14px;
  background: var(--bg-secondary);
  transition: all 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-color);
  background: #fff;
}

.search-box::before {
  content: "🔍";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
}

/* 主体容器 */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* Hero 区域 */
.hero {
  padding: 80px 0 60px;
  text-align: center;
  background: linear-gradient(180deg, #fff 0%, var(--bg-secondary) 100%);
}

.hero h1 {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.hero p {
  font-size: 20px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 40px;
}

.hero-search {
  max-width: 560px;
  margin: 0 auto 48px;
}

.hero-search input {
  width: 100%;
  height: 56px;
  padding: 0 24px;
  border: 2px solid var(--border-color);
  border-radius: 28px;
  font-size: 16px;
  transition: all 0.2s;
}

.hero-search input:focus {
  outline: none;
  border-color: var(--accent-color);
}

/* 快速链接 */
.quick-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.quick-link {
  padding: 12px 28px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-weight: 500;
  color: var(--text-primary);
  transition: all 0.2s;
}

.quick-link:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
  box-shadow: var(--shadow);
}

/* 内容区块 */
.section {
  padding: 60px 0;
}

.section-title {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 32px;
  color: var(--text-primary);
}

/* 主题列表 */
.topic-list {
  max-width: 600px;
  margin: 0 auto;
}

.topic-item {
  display: flex;
  align-items: center;
  padding: 20px 24px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 12px;
  transition: all 0.2s;
}

.topic-item:hover {
  border-color: var(--accent-color);
  box-shadow: var(--shadow);
}

.topic-icon {
  width: 40px;
  height: 40px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 16px;
  font-size: 20px;
}

.topic-info h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.topic-info p {
  font-size: 14px;
  color: var(--text-secondary);
}

.topic-arrow {
  margin-left: auto;
  color: var(--text-light);
}

/* 三栏布局 */
.three-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.column {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
}

.column h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent-color);
}

.column ul {
  list-style: none;
}

.column li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}

.column li:last-child {
  border-bottom: none;
}

.column a {
  color: var(--text-primary);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.column a::before {
  content: "•";
  color: var(--accent-color);
}

/* 面包屑 */
.breadcrumb {
  padding: 20px 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.breadcrumb a {
  color: var(--text-secondary);
}

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

.breadcrumb span {
  margin: 0 8px;
  color: var(--text-light);
}

/* 页面标题区 */
.page-header {
  padding: 40px 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.page-header h1 {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 12px;
}

.page-header p {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 600px;
}

/* 模块列表 */
.module-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 40px;
}

.module-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.2s;
}

.module-card:hover {
  border-color: var(--accent-color);
  box-shadow: var(--shadow);
}

.module-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--accent-color);
}

.module-card p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* 类列表 */
.class-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.class-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.2s;
}

.class-card:hover {
  border-color: var(--accent-color);
  box-shadow: var(--shadow);
}

.class-card h4 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.class-card span {
  font-size: 13px;
  color: var(--text-light);
}

/* 文章布局 */
.article-layout {
  display: grid;
  grid-template-columns: 240px 1fr 240px;
  gap: 40px;
  padding: 40px 0;
}

.sidebar-left {
  position: sticky;
  top: 100px;
  height: fit-content;
}

.sidebar-left h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

.sidebar-left h2 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 12px;
}

.sidebar-left p {
  font-size: 14px;
  color: var(--text-secondary);
}

.sidebar-right {
  position: sticky;
  top: 100px;
  height: fit-content;
}

.sidebar-right h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
}

.sidebar-right ul {
  list-style: none;
  border-left: 2px solid var(--border-color);
  padding-left: 16px;
}

.sidebar-right li {
  margin-bottom: 12px;
}

.sidebar-right a {
  font-size: 14px;
  color: var(--text-secondary);
}

.sidebar-right a:hover {
  color: var(--accent-color);
}

/* 文章内容 */
.article-content {
  min-width: 0;
}

.article-content h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.article-content h2 {
  font-size: 24px;
  font-weight: 600;
  margin: 40px 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.article-content h3 {
  font-size: 20px;
  font-weight: 600;
  margin: 32px 0 16px;
}

.article-content p {
  margin-bottom: 16px;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* 代码块 */
.code-block {
  background: var(--bg-code);
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
  overflow-x: auto;
}

.code-block pre {
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 14px;
  line-height: 1.6;
  color: #aed581;
  margin: 0;
}

/* 参数表格 */
.params-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

.params-table th,
.params-table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.params-table th {
  font-weight: 600;
  background: var(--bg-secondary);
}

.params-table code {
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--accent-color);
}

/* 推荐文章 */
.recommended {
  background: var(--bg-secondary);
  padding: 40px 0;
  border-top: 1px solid var(--border-color);
}

.recommended-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 24px;
}

.recommended-section h4 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.recommended-section ul {
  list-style: none;
}

.recommended-section li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}

.recommended-section a {
  color: var(--text-primary);
  font-size: 14px;
}

.recommended-section a:hover {
  color: var(--accent-color);
}

.related-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 32px;
}

.tag {
  padding: 8px 16px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 14px;
  color: var(--text-secondary);
  transition: all 0.2s;
}

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

/* 页脚 */
.footer {
  background: #fff;
  border-top: 1px solid var(--border-color);
  padding: 40px 0;
  text-align: center;
}

.footer p {
  font-size: 14px;
  color: var(--text-secondary);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
}

.footer-links a {
  font-size: 14px;
  color: var(--text-secondary);
}

/* 404页面 */
.error-page {
  min-height: calc(100vh - var(--header-height) - 200px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
}

.error-code {
  font-size: 120px;
  font-weight: 700;
  color: var(--accent-color);
  line-height: 1;
  margin-bottom: 16px;
}

.error-title {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 16px;
}

.error-desc {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  max-width: 400px;
}

.btn {
  display: inline-block;
  padding: 12px 32px;
  background: var(--accent-color);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 500;
  transition: background 0.2s;
}

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

/* 响应式设计 */
@media (max-width: 1024px) {
  .article-layout {
    grid-template-columns: 1fr;
  }

  .sidebar-left,
  .sidebar-right {
    position: static;
    display: none;
  }

  .three-columns {
    grid-template-columns: 1fr;
  }

  .class-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .header-inner {
    padding: 0 16px;
  }

  .nav {
    display: none;
  }

  .search-box {
    display: none;
  }

  .hero {
    padding: 60px 0 40px;
  }

  .hero h1 {
    font-size: 32px;
  }

  .hero p {
    font-size: 16px;
  }

  .container {
    padding: 0 16px;
  }

  .section {
    padding: 40px 0;
  }

  .section-title {
    font-size: 24px;
  }

  .recommended-grid {
    grid-template-columns: 1fr;
  }

  .code-block {
    overflow-x: auto;
  }

  .code-block pre {
    white-space: pre;
  }
}

@media (max-width: 480px) {
  .quick-links {
    flex-direction: column;
    align-items: center;
  }

  .quick-link {
    width: 100%;
    max-width: 280px;
    text-align: center;
  }

  .error-code {
    font-size: 80px;
  }
}
