/* ===== 全局 ===== */
:root {
  --bg: #f0f2f5;
  --bg-soft: #f6f7f9;
  --text: #1f2328;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --card: #ffffff;
  --code-bg: #f3f4f6;

  /* 液态玻璃 */
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-bg-strong: rgba(255, 255, 255, 0.72);
  --glass-highlight: rgba(255, 255, 255, 0.9);
  --glass-edge: rgba(255, 255, 255, 0.7);
  --glass-shadow: rgba(31, 35, 40, 0.12);
}

[data-theme="dark"] {
  --bg: #0a0d12;
  --bg-soft: #14181f;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --border: #2a3038;
  --accent: #58a6ff;
  --accent-soft: #1f3a5f;
  --card: #14181f;
  --code-bg: #1c2128;

  /* 液态玻璃（深色） */
  --glass-bg: rgba(28, 34, 43, 0.55);
  --glass-bg-strong: rgba(28, 34, 43, 0.72);
  --glass-highlight: rgba(255, 255, 255, 0.14);
  --glass-edge: rgba(255, 255, 255, 0.16);
  --glass-shadow: rgba(0, 0, 0, 0.45);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  transition: background .25s, color .25s;
}

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

/* ===== 布局 ===== */
.container { max-width: 720px; margin: 0 auto; padding: 0 20px; }

/* ===== 液态玻璃通用类 ===== */
.glass {
  position: relative;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-edge);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    inset 0 -1px 0 rgba(255, 255, 255, 0.06),
    0 8px 28px var(--glass-shadow);
}

/* 镜面高光 + 折射边缘（液态玻璃标志性光斑） */
.glass::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 42%),
    linear-gradient(315deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0) 32%);
  opacity: .55;
  pointer-events: none;
}

[data-theme="dark"] .glass::before {
  opacity: .35;
}

/* 不支持 backdrop-filter 时退回实色，永不穿膜 */
@supports not (backdrop-filter: blur(10px)) and not (-webkit-backdrop-filter: blur(10px)) {
  .glass {
    background: var(--bg-soft);
  }
  .glass::before {
    opacity: .2;
  }
}

/* ===== 顶部导航（液态玻璃 + sticky） ===== */
header {
  padding: 14px 0;
  position: sticky; top: 0;
  z-index: 10;
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--glass-edge);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.06);
}

/* 不支持 backdrop-filter 时退回实色 */
@supports not (backdrop-filter: blur(10px)) and not (-webkit-backdrop-filter: blur(10px)) {
  header { background: var(--bg); }
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
}
.brand { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 18px; }
.nav-links a { color: var(--text-muted); font-size: .95rem; }
.nav-links a:hover { color: var(--accent); }

.theme-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); border-radius: 999px;
  padding: 6px 12px; cursor: pointer; font-size: .95rem;
  transition: all .2s;
}
.theme-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ===== 首页头部 ===== */
.hero { padding: 56px 0 32px; }
.hero h1 { font-size: 2rem; letter-spacing: -.02em; }
.hero p { color: var(--text-muted); margin-top: 10px; }

/* ===== 文章列表（玻璃卡片） ===== */
.post-list { padding: 8px 0 48px; }
.post-item {
  display: block;
  padding: 22px 24px;
  margin-bottom: 16px;
  border-radius: 18px;
  overflow: hidden;
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease;
}
.post-item:hover { text-decoration: none; transform: translateY(-2px); }
.post-item:hover .post-title { color: var(--accent); }
.post-title { font-size: 1.25rem; font-weight: 600; color: var(--text); transition: color .2s; position: relative; z-index: 1; }
.post-meta { color: var(--text-muted); font-size: .88rem; margin-top: 6px; position: relative; z-index: 1; }
.post-excerpt { color: var(--text-muted); margin-top: 8px; font-size: .95rem; position: relative; z-index: 1; }

/* ===== 文章页 ===== */
article { padding: 48px 0 64px; }
article h1 { font-size: 1.9rem; line-height: 1.3; letter-spacing: -.01em; }
.article-meta { color: var(--text-muted); font-size: .9rem; margin: 14px 0 30px; }
.content { font-size: 1.02rem; }
.content h2 { margin: 34px 0 14px; font-size: 1.4rem; }
.content h3 { margin: 28px 0 12px; font-size: 1.18rem; }
.content p { margin: 14px 0; }
.content ul, .content ol { margin: 14px 0; padding-left: 24px; }
.content li { margin: 6px 0; }
.content code {
  background: var(--code-bg); padding: 2px 6px;
  border-radius: 5px; font-size: .9em;
  font-family: "SF Mono", "JetBrains Mono", Consolas, monospace;
}
.content pre {
  background: var(--code-bg); padding: 16px;
  border-radius: 10px; overflow-x: auto; margin: 16px 0;
}
.content pre code { background: none; padding: 0; }
.content blockquote {
  border-left: 3px solid var(--accent); padding: 6px 16px;
  margin: 16px 0; color: var(--text-muted);
  background: var(--bg-soft); border-radius: 0 8px 8px 0;
}
.content img { max-width: 100%; border-radius: 10px; margin: 16px 0; }
.content a { border-bottom: 1px solid var(--accent-soft); }
.content a:hover { border-bottom-color: var(--accent); }

/* ===== 页脚 ===== */
footer {
  border-top: 1px solid var(--border);
  padding: 28px 0 40px;
  color: var(--text-muted); font-size: .88rem; text-align: center;
}

/* ===== 返回链接 ===== */
.back { display: inline-block; margin-bottom: 20px; font-size: .92rem; }

/* ===== 标签 ===== */
.tag {
  display: inline-block; background: var(--accent-soft);
  color: var(--accent); font-size: .78rem; padding: 2px 10px;
  border-radius: 999px; margin-right: 6px;
}

/* ===== 搜索（玻璃输入框） ===== */
.search-box { margin: 8px 0 10px; }
.search-box input {
  width: 100%; padding: 13px 18px;
  border-radius: 14px;
  color: var(--text);
  font-size: 1rem; outline: none;
  transition: box-shadow .2s ease;
}
.search-box input:focus {
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 0 0 3px var(--accent-soft);
}
.no-result { color: var(--text-muted); padding: 20px 0; }

/* ===== 点赞（玻璃按钮） ===== */
.like-bar {
  display: flex; align-items: center; gap: 14px;
  margin: 40px 0 8px; padding: 18px 0;
  border-top: 1px solid var(--border);
}
.like-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 24px; border-radius: 999px;
  color: var(--text); cursor: pointer;
  font-size: 1rem; transition: all .2s;
  overflow: hidden;
}
.like-btn:hover { box-shadow: 0 0 0 3px var(--accent-soft); }
.like-btn.liked { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.like-count { color: var(--text-muted); font-size: .95rem; }

/* ===== 评论 ===== */
.comments { margin: 24px 0 40px; }
.comments h2 { font-size: 1.3rem; margin-bottom: 16px; }
.comment-count { color: var(--text-muted); font-size: .9rem; font-weight: 400; }
.comment-form { margin-bottom: 24px; }
.comment-form input, .comment-form textarea {
  width: 100%; padding: 12px 16px; margin-bottom: 10px;
  border-radius: 12px;
  color: var(--text); font-size: .95rem;
  font-family: inherit; outline: none;
  transition: box-shadow .2s ease;
}
.comment-form input:focus, .comment-form textarea:focus {
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.comment-form textarea { min-height: 90px; resize: vertical; }
.comment-submit {
  padding: 10px 26px; border: none; border-radius: 12px;
  background: var(--accent); color: #fff; cursor: pointer; font-size: .95rem;
  transition: opacity .2s, box-shadow .2s;
}
.comment-submit:hover { opacity: .9; box-shadow: 0 4px 14px rgba(37, 99, 235, .35); }
.comment-submit:disabled { opacity: .5; cursor: not-allowed; }
.comment-item { padding: 14px 0; border-bottom: 1px solid var(--border); }
.comment-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.comment-name { font-weight: 600; font-size: .95rem; }
.comment-time { color: var(--text-muted); font-size: .8rem; }
.comment-content { font-size: .95rem; word-break: break-word; white-space: pre-wrap; }
.comment-empty { color: var(--text-muted); padding: 10px 0; }

/* ===== 用户系统 ===== */
.comment-user { display: flex; align-items: center; gap: 10px; }
.c-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-soft); color: #fff; font-weight: 700; font-size: 1rem;
  flex: none; overflow: hidden;
}
.comment-uid { color: var(--text-muted); font-size: .82rem; }
.comment-login-tip {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-radius: 14px;
  background: var(--glass-bg); border: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  color: var(--text-muted); font-size: .95rem;
}
.comment-as {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.comment-as .comment-as-name { font-weight: 600; font-size: .95rem; }

/* ===== 用户主页 & 评论者链接 ===== */
.comment-user-link {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: inherit;
}
.comment-user-link:hover { text-decoration: none; }
.comment-user-link:hover .comment-name { color: var(--accent); }
.comment-name { transition: color .2s; }

.profile-head { margin-top: 8px; }
.p-card {
  display: flex; align-items: center; gap: 22px;
  padding: 28px 26px; border-radius: 20px; overflow: hidden;
}
.p-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--accent-soft); color: #fff; font-weight: 700;
  flex: none; position: relative; z-index: 1;
}
.p-info { position: relative; z-index: 1; min-width: 0; }
.p-name { font-size: 1.4rem; font-weight: 700; }
.p-uid { color: var(--text-muted); font-size: .92rem; margin-top: 2px; }
.p-bio { margin-top: 10px; color: var(--text); font-size: .95rem; }
.p-meta { margin-top: 10px; color: var(--text-muted); font-size: .82rem; }
