/* 基础排版与色板 */
:root {
  --bg: #0b1021;
  --fg: #e5e7eb;
  --muted: #94a3b8;
  --card: #11182b;
  --accent: #22d3ee;
  --accent-strong: #0ea5e9;
  --border: #1f2937;
  --bg-overlay-1: rgba(34,211,238,0.08);
  --bg-overlay-2: rgba(14,165,233,0.08);
  --post-text: #e2e8f0;
  --excerpt-text: #cbd5e1;
  --header-bg: rgba(11,16,33,0.9);
  --footer-bg: rgba(10,14,26,0.85);
  --nav-hover: rgba(34,211,238,0.12);
  --radius: 12px;
}

body[data-reading-bg="light"] {
  --bg: #f8fafc;
  --bg-overlay-1: rgba(37,99,235,0.08);
  --bg-overlay-2: rgba(59,130,246,0.08);
  --fg: #0f172a;
  --muted: #475569;
  --card: #ffffff;
  --accent: #000000;
  --accent-strong: #000000;
  --border: #e2e8f0;
  --post-text: #0f172a;
  --excerpt-text: #334155;
  --header-bg: rgba(255,255,255,0.92);
  --footer-bg: rgba(241,245,249,0.9);
  --nav-hover: rgba(37,99,235,0.12);
}

body[data-reading-bg="dark"] {
  --bg: #050914;
  --bg-overlay-1: rgba(34,211,238,0.06);
  --bg-overlay-2: rgba(14,165,233,0.06);
  --fg: #e5e7eb;
  --muted: #9ca3af;
  --card: #0e1526;
  --accent: #22d3ee;
  --accent-strong: #38bdf8;
  --border: #162032;
  --post-text: #e5e7eb;
  --excerpt-text: #d1d5db;
  --header-bg: rgba(5,9,20,0.9);
  --footer-bg: rgba(6,10,22,0.9);
  --nav-hover: rgba(34,211,238,0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at 20% 20%, var(--bg-overlay-1), transparent 28%),
              radial-gradient(circle at 80% 0%, var(--bg-overlay-2), transparent 30%),
              var(--bg);
  color: var(--fg);
  line-height: 1.6;
  padding: 24px 0 0; /* 与浏览器地址栏留出固定间距 */
  display: flex;
  flex-direction: column;
  min-height: 100vh; /* 短内容页面时也把页脚推到底部 */
}

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

main {
  flex: 1; /* 占满剩余空间，统一页脚位置 */
}

.container {
  width: 92%;
  max-width: 840px;
  margin: 0 auto;
  padding: 0 0 32px;
}

/* 头部导航 */
.site-header {
  position: sticky;
  top: 24px; /* 下移导航，保持与地址栏的固定距离 */
  backdrop-filter: blur(12px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo {
  font-weight: 700;
  letter-spacing: 0.4px;
  font-size: 20px;
  color: var(--fg);
}
.muted { color: var(--muted); }
.nav {
  display: flex;
  gap: 16px;
}
.nav-link {
  padding: 8px 10px;
  color: var(--muted);
  border-radius: 8px;
}
.nav-link:hover, .nav-link.active {
  color: var(--fg);
  background: var(--nav-hover);
}

/* 页脚 */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--footer-bg);
  margin-top: 32px;
}
.footer-inner {
  padding: 36px 0 20px;
  color: var(--muted);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.footer-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.footer-btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.footer-btn.secondary { background: var(--nav-hover); }
.footer-btn:hover { background: var(--nav-hover); }
.footer-icon-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 10px;
  background: var(--card);
  color: #07c160;
  cursor: pointer;
}
.footer-icon-btn:hover { background: var(--nav-hover); }
.footer-icon-btn svg { width: 20px; height: 20px; }
.wechat-qr-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
}
.wechat-qr-modal[hidden] { display: none; }
.wechat-qr-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.35);
}
.wechat-qr-content img {
  width: 180px;
  height: 180px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* 首页与列表 */
.hero {
  padding: 40px 0 20px;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 8px;
}
.page-title {
  font-size: clamp(28px, 4vw, 38px);
  margin: 0 0 12px;
}
.lede {
  margin: 0;
  color: var(--muted);
}

.section-title {
  margin: 0 0 12px;
  font-size: 18px;
}

.posts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.post-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 20px;
  transition: transform 0.1s ease, border-color 0.1s ease;
}
.post-card:hover {
  transform: translateY(-2px);
  border-color: rgba(34,211,238,0.4);
}
.post-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
}
.post-card .meta {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}
.post-card .excerpt {
  margin: 0;
  color: var(--excerpt-text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.more-link { margin-top: 14px; }

/* 标签 */
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(34,211,238,0.12);
  color: var(--fg);
  font-size: 13px;
  margin: 0 8px 8px 0;
  border: 1px solid rgba(34,211,238,0.24);
}
.tag-chip small {
  color: var(--muted);
}

/* 文章页面 */
.post-header {
  padding: 48px 0 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.post-date {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 14px;
}
.post-title {
  margin: 0 0 12px;
  font-size: clamp(26px, 4vw, 34px);
}
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; }

.post-content {
  color: var(--post-text);
  font-size: 17px;
}
.post-content p { margin: 0 0 16px; }
.post-content h2 { margin: 28px 0 12px; font-size: 22px; }
.post-content h3 { margin: 22px 0 10px; font-size: 18px; }
.post-content ul { padding-left: 20px; margin: 0 0 16px; }
.post-content li { margin: 6px 0; }

/* 媒体资源的响应式处理 */
.post-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 16px auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.post-content video {
  max-width: 100%;
  display: block;
  margin: 24px auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.post-content .img-small { width: 55%; }
.post-content .img-medium { width: 75%; }
.post-content .img-full { width: 100%; }

.reading-bg-control {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.reading-bg-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 10px;
  background: var(--card);
  color: var(--fg);
  cursor: pointer;
  padding: 0;
}
.reading-bg-toggle svg { width: 20px; height: 20px; }
.reading-bg-toggle:hover { background: var(--nav-hover); }
.reading-bg-menu {
  position: absolute;
  top: 110%;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  padding: 6px;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.reading-bg-menu[hidden] { display: none !important; }
.reading-bg-menu button {
  background: transparent;
  border: none;
  color: var(--fg);
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.reading-bg-menu button:hover,
.reading-bg-menu button.active {
  background: var(--nav-hover);
}

/* 响应式布局 */
@media (min-width: 720px) {
  .container { width: 90%; }
  .posts-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: flex-start; gap: 10px; height: auto; padding: 12px 0; }
  .nav { flex-wrap: wrap; }
  .hero { padding: 36px 0 18px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}
