/* ============================================================
   个人主页 前台样式（响应式）
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #3b7cff;
  --text: #2c3e50;
  --text-light: #8a94a6;
  --bg: #f5f7fa;
  --card-bg: #ffffff;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0, 0, 0, .06);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, .12);
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--card-bg);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.logo { font-size: 20px; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 10px; }
.logo-img { height: 34px; width: auto; display: block; }
.logo-text { white-space: nowrap; }
.subtitle { font-size: 13px; color: var(--text-light); }
.back-link { font-size: 14px; color: var(--text-light); }
.back-link:hover { color: var(--primary); }

/* ---------- 轮播图 ---------- */
.carousel {
  position: relative;
  width: 100%; /* body 是 flex 容器，auto margin 子元素不会自动撑满，必须显式指定宽度 */
  max-width: 1100px;
  margin: 20px auto 0;
  padding: 0 16px;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}
.carousel-track { position: relative; border-radius: var(--radius); overflow: hidden; height: 0; padding-bottom: 42.86%; /* 21:9，用 padding 撑高，兼容老浏览器 */ background: #dfe6ef; }
.carousel-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity .6s ease;
  pointer-events: none;
}
.carousel-slide.active { opacity: 1; pointer-events: auto; }
.carousel-slide img { width: 100%; height: 100%; object-fit: cover; }

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, .35);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  transition: background .2s;
  z-index: 5;
}
.carousel-btn:hover { background: rgba(0, 0, 0, .55); }
.carousel-btn.prev { left: 28px; }
.carousel-btn.next { right: 28px; }

.carousel-dots {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  z-index: 5;
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .55);
  cursor: pointer;
  transition: all .25s;
}
.dot.active { background: #fff; width: 22px; border-radius: 5px; }

/* ---------- 文章列表 ---------- */
main.container { flex: 1; padding-bottom: 40px; }

.section-title {
  font-size: 22px;
  margin: 32px 0 20px;
  padding-left: 12px;
  border-left: 4px solid var(--primary);
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.article-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .25s, box-shadow .25s;
  display: flex;
  flex-direction: column;
}
.article-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }

.card-cover { aspect-ratio: 16 / 9; overflow: hidden; background: #eef2f7; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.article-card:hover .card-cover img { transform: scale(1.05); }
.cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #6ea2ff, #3b7cff);
}

.card-body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; }
.card-title {
  font-size: 17px;
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-summary {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-light);
}

.empty-tip { text-align: center; color: var(--text-light); padding: 60px 0; }
.empty-tip a { color: var(--primary); }

/* ---------- 分页 ---------- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 32px;
}
.pagination a {
  padding: 8px 18px;
  background: var(--card-bg);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 14px;
  transition: all .2s;
}
.pagination a:hover { color: #fff; background: var(--primary); }
.page-info { font-size: 14px; color: var(--text-light); }

/* ---------- 文章详情 ---------- */
.article-page { max-width: 820px; }
.article-title { font-size: 28px; line-height: 1.4; margin: 32px 0 12px; }
.article-meta {
  display: flex;
  gap: 20px;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e8edf3;
}
.article-cover { border-radius: var(--radius); overflow: hidden; margin-bottom: 24px; }

.article-content { font-size: 16px; line-height: 1.9; word-wrap: break-word; }
.article-content p { margin: 0 0 1em; }
.article-content img { border-radius: 8px; margin: 12px auto; height: auto !important; }
.article-content h1, .article-content h2, .article-content h3 { margin: 1.2em 0 .6em; line-height: 1.4; }
.article-content ul, .article-content ol { padding-left: 1.6em; margin-bottom: 1em; }
.article-content blockquote {
  border-left: 4px solid var(--primary);
  background: #eef4ff;
  padding: 10px 16px;
  margin: 0 0 1em;
  border-radius: 0 8px 8px 0;
  color: #4a5568;
}
.article-content pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 14px 16px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 14px;
  margin-bottom: 1em;
}
.article-content code { font-family: Consolas, Monaco, monospace; }
.article-content table { border-collapse: collapse; width: 100%; margin-bottom: 1em; }
.article-content table td, .article-content table th { border: 1px solid #dbe2ea; padding: 8px 12px; }
.article-content a { color: var(--primary); text-decoration: underline; }

/* ---------- Footer ---------- */
.site-footer {
  background: #232a35;
  color: #9aa5b4;
  margin-top: auto;
  padding: 24px 0;
  font-size: 13px;
}
.footer-inner { text-align: center; }
.footer-copy { margin-bottom: 6px; }
.footer-beian {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 18px;
}
.footer-beian a { color: #9aa5b4; transition: color .2s; }
.footer-beian a:hover { color: #fff; }
.police-link { display: inline-flex; align-items: center; gap: 5px; }
.police-badge { width: 16px; height: 16px; }

/* ============================================================
   响应式断点
   ============================================================ */
/* 平板 */
@media (max-width: 900px) {
  .article-grid { grid-template-columns: repeat(2, 1fr); }
  .carousel-track { padding-bottom: 50%; }
}

/* 手机 */
@media (max-width: 600px) {
  .header-inner { height: 52px; }
  .logo { font-size: 17px; gap: 7px; }
  .logo-img { height: 28px; }
  .subtitle { display: none; }

  .carousel { margin-top: 12px; padding: 0 12px; }
  .carousel-track { padding-bottom: 56.25%; border-radius: 8px; }
  .carousel-btn { display: none; } /* 手机端用手势滑动 */
  .dot { width: 7px; height: 7px; }
  .dot.active { width: 16px; }

  .container { padding: 0 12px; }
  .section-title { font-size: 18px; margin: 22px 0 14px; }
  .article-grid { grid-template-columns: 1fr; gap: 14px; }

  .article-title { font-size: 22px; margin-top: 20px; }
  .article-content { font-size: 15px; }
}
