/* ===== 设计令牌 ===== */
:root {
  --primary: #1b3f66;
  --primary-light: #2a4b7a;
  --accent: #5f7fb0;
  --bg: #f4f7fc;
  --card-bg: #ffffff;
  --text: #1a2b3e;
  --text-light: #4f658d;
  --border: #e3eaf5;
  --code-bg: #1e293b;
  --code-text: #d6e2f1;
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 40px;
  --shadow-soft: 0 10px 25px rgba(0, 30, 60, 0.08);
  --shadow-hover: 0 18px 35px rgba(0, 30, 60, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1722;
    --card-bg: #18212f;
    --text: #e4edf7;
    --text-light: #9fb2cc;
    --border: #253347;
    --shadow-soft: 0 10px 20px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 18px 30px rgba(0, 0, 0, 0.7);
    --code-bg: #111b28;
    --code-text: #cdddf5;
  }
}

/* ===== 重置 & 基础 ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  padding: 24px 16px 60px;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 700px;
  margin: 0 auto;
}

/* ===== 标题区域 ===== */
.hero h1 {
  font-size: clamp(2rem, 5vw, 2.6rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero .sub {
  font-size: 0.95rem;
  background: var(--border);
  padding: 6px 20px;
  border-radius: 50px;
  display: inline-block;
  margin-top: 12px;
  color: var(--text-light);
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(4px);
}

/* ===== 标签云 ===== */
.topic-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin: 30px 0 28px;
  justify-content: center;
}

.topic-tag {
  background: var(--border);
  color: var(--text-light);
  padding: 6px 18px;
  border-radius: 40px;
  font-size: 0.8rem;
  font-weight: 550;
  border: 1px solid transparent;
  transition: 0.2s;
  cursor: default;
}

.topic-tag:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary-light);
}

/* ===== 卡片通用 ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 26px 22px;
  margin-bottom: 30px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  transition:
    box-shadow 0.25s ease,
    transform 0.2s;
}

@media (hover: hover) {
  .card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-3px);
  }
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 10px;
}

.card-header h2 {
  font-size: 1.5rem;
  font-weight: 650;
  color: var(--primary);
  letter-spacing: -0.3px;
}

.card-header span {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 50px;
  background: var(--primary);
  color: white;
  white-space: nowrap;
}

/* 内联代码块 */
.inline-code {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.85rem;
  background: var(--border);
  color: var(--primary);
  padding: 3px 12px;
  border-radius: 30px;
  border: 1px solid transparent;
  display: inline-block;
  margin: 2px 0;
}

/* 多行代码块 */
.code-block {
  background: var(--code-bg);
  color: var(--code-text);
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.8rem;
  padding: 20px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 24px 0;
  border: 1px solid #334a66;
  line-height: 1.6;
  box-shadow: inset 0 0 0 1px #2d3f55;
}

/* 网格布局（用于卡片内网格展示） */
.grid-2 {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin: 18px 0;
}

.grid-item {
  background: var(--border);
  padding: 16px 14px;
  border-radius: var(--radius-md);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-weight: 480;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

/* 图片占位符 */
.img-note {
  background: var(--border);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  text-align: center;
  color: var(--text-light);
  border: 2px dashed var(--accent);
  margin: 24px 0;
  font-style: italic;
  font-weight: 500;
}

.img-note::before {
  content: "🖼️ ";
  font-weight: 600;
}

/* 提示框 */
.tip {
  background: rgba(247, 183, 49, 0.12);
  border-left: 6px solid #f7b731;
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin: 24px 0;
  color: var(--text);
  font-weight: 450;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

/* 小徽章 */
.badge {
  padding: 5px 16px;
  border-radius: 40px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--primary);
  color: white;
  display: inline-block;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 标题层级 */
h3 {
  font-size: 1.25rem;
  margin: 22px 0 10px 0;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

h3::before {
  content: "▍";
  font-size: 1.8rem;
  color: var(--accent);
}

h4 {
  font-size: 1.1rem;
  margin: 20px 0 8px 0;
  color: var(--primary-light);
  font-weight: 600;
  padding-left: 6px;
}

/* 列表优化 */
ul,
ol {
  padding-left: 28px;
  margin: 16px 0;
}

li {
  margin: 10px 0;
  font-size: 0.98rem;
}

li strong {
  background: var(--border);
  font-weight: 620;
  padding: 2px 10px;
  border-radius: 30px;
  color: var(--primary);
}

/* 响应式微调 */
@media (max-width: 420px) {
  body {
    padding: 18px 12px 40px;
  }
  .card {
    padding: 22px 18px;
  }
  .card-header h2 {
    font-size: 1.3rem;
  }
}

/* 辅助分隔 */
hr {
  border: none;
  height: 2px;
  background: linear-gradient(90deg, var(--border), transparent);
  margin: 30px 0;
}
