/* ============================================================
   HXSKY 个人技术博客 — 全局样式
   风格：Apple 官网式极简 / 浅色 / 大留白 / 细腻排版
   纯静态，无任何外部依赖（字体使用系统字体栈）
   ============================================================ */

/* ---------- 颜色与尺寸变量 ---------- */
:root {
  --bg: #f5f5f7;            /* 页面浅灰底色 */
  --surface: #ffffff;       /* 卡片白色底 */
  --text: #1d1d1f;          /* 主文字（近黑） */
  --muted: #6e6e73;         /* 次要文字（灰） */
  --accent: #0071e3;        /* Apple 蓝 */
  --accent-hover: #0077ed;
  --border: #d2d2d7;        /* 细边框 */
  --radius: 18px;           /* 卡片圆角 */
  --max-width: 980px;       /* 内容最大宽度 */
  --header-h: 52px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display",
    "SF Pro Text", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }

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

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; font-weight: 700; }
p { margin-bottom: 1em; }

/* ---------- 布局容器 ---------- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 22px;
}

/* ---------- 顶部导航（Apple 式毛玻璃） ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(251, 251, 253, 0.8);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 22px;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text);
}
.logo:hover { text-decoration: none; color: var(--accent); }
.nav-links {
  display: flex;
  gap: 36px;
  list-style: none;
}
.nav-links a {
  color: var(--text);
  font-size: 14px;
  opacity: 0.85;
  transition: opacity 0.2s;
}
.nav-links a:hover { opacity: 1; text-decoration: none; color: var(--accent); }
.nav-links a.active { color: var(--accent); opacity: 1; font-weight: 600; }

/* 汉堡菜单按钮（只在手机显示） */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  line-height: 0;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  margin: 5px 0;
  transition: transform 0.25s, opacity 0.25s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero（首页大标题区） ---------- */
.hero {
  text-align: center;
  padding: 96px 22px 72px;
}
.hero .eyebrow {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.04em;
  margin-bottom: 16px;
}
.hero h1 {
  font-size: 56px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 18px;
}
.hero .tagline {
  font-size: 21px;
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto 32px;
  line-height: 1.5;
}
.hero-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  padding: 10px 22px;
  border-radius: 980px;
  transition: background 0.2s, transform 0.2s;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-ghost:hover { background: rgba(0, 113, 227, 0.06); }

/* ---------- 内容区块 ---------- */
.section { padding: 64px 0; }
.section-head { margin-bottom: 32px; }
.section-head h2 { font-size: 32px; margin-bottom: 8px; }
.section-head p { color: var(--muted); font-size: 17px; margin-bottom: 0; }
.section-head.center { text-align: center; }

/* ---------- 卡片网格 ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  transition: transform 0.25s, box-shadow 0.25s;
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.10);
}
.card .meta {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}
.card h3 { font-size: 20px; margin-bottom: 10px; }
.card h3 a { color: var(--text); }
.card h3 a:hover { color: var(--accent); }
.card p { color: var(--muted); font-size: 15px; flex: 1; }
.card .more { font-size: 15px; font-weight: 500; }

/* 标签（技术栈小药丸） */
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.tag {
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 980px;
  padding: 3px 10px;
}

/* ---------- 首页简介区 ---------- */
.intro {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 48px;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}
.intro h2 { font-size: 28px; margin-bottom: 14px; }
.intro p { color: var(--muted); max-width: 640px; margin: 0 auto 1em; font-size: 17px; }
.intro p:last-child { margin-bottom: 0; }

/* ---------- 博客列表 ---------- */
.post-list { display: flex; flex-direction: column; gap: 16px; }
.post-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  transition: transform 0.25s, box-shadow 0.25s;
}
.post-item:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08); }
.post-item .meta { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.post-item h3 { font-size: 21px; margin-bottom: 6px; }
.post-item h3 a { color: var(--text); }
.post-item h3 a:hover { color: var(--accent); }
.post-item p { color: var(--muted); font-size: 15px; margin-bottom: 0; }
.badge-soon {
  display: inline-block;
  font-size: 12px;
  color: #b45309;
  background: #fef3c7;
  border-radius: 980px;
  padding: 2px 10px;
  margin-left: 8px;
  vertical-align: middle;
  font-weight: 600;
}

/* ---------- 文章正文 ---------- */
.post { background: var(--surface); border-radius: var(--radius); padding: 48px; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04); }
.post header { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.post header h1 { font-size: 36px; margin-bottom: 12px; }
.post header .meta { color: var(--muted); font-size: 14px; }
.post-body h2 { font-size: 24px; margin: 32px 0 12px; }
.post-body h3 { font-size: 19px; margin: 24px 0 10px; }
.post-body p { font-size: 17px; }
.post-body ul, .post-body ol { margin: 0 0 1em 1.4em; }
.post-body li { margin-bottom: 0.4em; }
.post-body code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--bg);
  border-radius: 6px;
  padding: 2px 6px;
}
.post-body pre {
  background: #1d1d1f;
  color: #f5f5f7;
  border-radius: 12px;
  padding: 18px 20px;
  overflow-x: auto;
  margin-bottom: 1em;
}
.post-body pre code { background: none; padding: 0; color: inherit; }
.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 18px;
  color: var(--muted);
  margin: 1.2em 0;
}
.post-nav { display: flex; justify-content: space-between; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); }

/* ---------- 关于 / 联系 ---------- */
.about-card, .contact-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  margin-bottom: 20px;
}
.about-card h2, .contact-card h2 { font-size: 24px; margin-bottom: 14px; }
.skill-list { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; }
.skill-list li {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 980px;
  padding: 6px 14px;
  font-size: 14px;
}
.contact-row { display: flex; gap: 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--border); }
.contact-row:last-child { border-bottom: none; }
.contact-row .label { width: 90px; flex-shrink: 0; color: var(--muted); font-size: 15px; }
.note {
  font-size: 14px;
  color: var(--muted);
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 14px 18px;
  margin-top: 20px;
}

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0 40px;
  margin-top: 40px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.site-footer p { margin-bottom: 6px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

/* ---------- 滚动淡入动效 ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- 响应式：平板 ---------- */
@media (max-width: 1024px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 44px; }
}

/* ---------- 响应式：手机 ---------- */
@media (max-width: 768px) {
  body { font-size: 16px; }
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: rgba(251, 251, 253, 0.97);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links li { border-top: 1px solid rgba(0, 0, 0, 0.06); }
  .nav-links a { display: block; padding: 14px 22px; font-size: 16px; }
  .hero { padding: 64px 22px 48px; }
  .hero h1 { font-size: 36px; }
  .hero .tagline { font-size: 18px; }
  .section { padding: 40px 0; }
  .section-head h2 { font-size: 26px; }
  .card-grid { grid-template-columns: 1fr; }
  .intro, .post, .about-card, .contact-card { padding: 28px 22px; }
  .post header h1 { font-size: 28px; }
  .post-nav { flex-direction: column; gap: 12px; }
  .contact-row { flex-direction: column; gap: 2px; }
  .contact-row .label { width: auto; }
}
