/* ==========================================================================
   klqbk 静态博客 — 玻璃拟态主题
   浅色：透明白玻璃 + 深色字；深色：透明深玻璃 + 浅色字。
   ========================================================================== */

:root {
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-soft: rgba(255, 255, 255, 0.38);
  --border: rgba(255, 255, 255, 0.75);
  --border-ink: rgba(15, 23, 42, 0.08);
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --shadow: 0 10px 34px rgba(15, 23, 42, 0.1);
  --shadow-hover: 0 16px 44px rgba(15, 23, 42, 0.16);
  --radius: 16px;
  --rail-w: 240px;
  --site-bg: url("/images/backgrounds/default.jpg");
  --code-bg: #0f172a;
}

html.dark {
  --glass: rgba(15, 23, 42, 0.58);
  --glass-strong: rgba(15, 23, 42, 0.82);
  --glass-soft: rgba(15, 23, 42, 0.34);
  --border: rgba(148, 163, 184, 0.22);
  --border-ink: rgba(148, 163, 184, 0.16);
  --ink: #e2e8f0;
  --ink-soft: #cbd5e1;
  --muted: #94a3b8;
  --accent: #60a5fa;
  --accent-soft: rgba(96, 165, 250, 0.16);
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.38);
  --shadow-hover: 0 16px 44px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  background: transparent;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: var(--site-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image 0.5s ease;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1100px 560px at 12% 0%, rgba(255, 255, 255, 0.3), transparent 62%),
    linear-gradient(180deg, rgba(248, 250, 252, 0.5), rgba(248, 250, 252, 0.76));
}

html.dark body::after {
  background:
    radial-gradient(1100px 560px at 12% 0%, rgba(37, 99, 235, 0.1), transparent 62%),
    linear-gradient(180deg, rgba(2, 6, 23, 0.62), rgba(2, 6, 23, 0.84));
}

html.no-bg body::before { display: none; }

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

img { max-width: 100%; height: auto; }

/* ---------- 通用玻璃面板 ---------- */
.glass,
.site-header,
.rail-inner,
.right-rail,
.site-footer,
.post-card,
.list-head,
.archive-year,
.tag-cloud,
.hero,
.post-single {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
}

/* ---------- 顶栏 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  background: var(--glass-strong);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.01em;
  flex: none;
}

.brand:hover { text-decoration: none; }

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.brand-logo { height: 30px; width: auto; border-radius: 8px; }

.brand-text { font-size: 15px; }

.site-nav {
  display: none;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.site-nav a {
  padding: 6px 10px;
  border-radius: 9px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.site-nav a:hover { color: var(--accent); background: var(--accent-soft); text-decoration: none; }

.site-nav a.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.header-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--border-ink);
  background: var(--glass-soft);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.icon-btn:hover { background: var(--accent-soft); transform: translateY(-1px); }
.icon-btn svg { display: block; }

html.light .icon-moon { display: none; }
html.dark .icon-sun { display: none; }

.menu-btn { display: inline-flex; }

.mobile-nav {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 8px 16px 14px;
  border-top: 1px solid var(--border-ink);
  max-height: 70vh;
  overflow-y: auto;
}

.mobile-nav.is-open { display: flex; }

.mobile-nav a {
  padding: 9px 6px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
}

.mobile-nav a:hover { background: var(--accent-soft); text-decoration: none; }

/* ---------- 主体布局 ---------- */
.site-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 20px 60px;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.content-col { min-width: 0; }

/* ---------- 左侧学习笔记栏（宽屏固定） ---------- */
.rail-left {
  display: none;
  position: fixed;
  left: 16px;
  top: 82px;
  bottom: 22px;
  width: var(--rail-w);
  z-index: 35;
}

.rail-left .rail-inner {
  height: 100%;
  padding: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rail-left .rail-list { overflow-y: auto; }

/* ---------- 右侧随笔栏 ---------- */
.right-rail {
  padding: 14px;
  display: none;
  position: sticky;
  top: 82px;
}

/* ---------- 栏内元素 ---------- */
.rail-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 4px 10px;
  border-bottom: 1px dashed var(--border-ink);
}

.rail-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  flex: none;
}

.rail-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.rail-all {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.rail-all:hover { color: var(--accent); }

.rail-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rail-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: baseline;
  padding: 7px 8px;
  border-radius: 9px;
  color: var(--ink);
  transition: background 0.2s ease, transform 0.2s ease;
}

.rail-link:hover { background: var(--accent-soft); transform: translateX(2px); text-decoration: none; }

.rail-link.is-active {
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}

.rail-title {
  font-size: 13px;
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.rail-link time {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.rail-empty {
  margin: 0;
  padding: 12px 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.rail-toc {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-ink);
}

.rail-toc h3 {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.toc ul { list-style: none; margin: 0; padding-left: 10px; }
.toc > ul { padding-left: 0; }
.toc li { margin: 3px 0; font-size: 12.5px; line-height: 1.5; }
.toc a { color: var(--ink-soft); }
.toc a:hover { color: var(--accent); }

/* ---------- Hero ---------- */
.hero { padding: 34px 28px; margin-bottom: 20px; }

.hero-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-title {
  margin: 0 0 8px;
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.hero-sub { margin: 0; color: var(--muted); font-size: 15px; }

.hero-links { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); text-decoration: none; }

.btn-ghost {
  background: var(--glass-soft);
  border-color: var(--border-ink);
  color: var(--ink);
}

.btn-ghost:hover { background: var(--accent-soft); }

/* ---------- 区块标题 ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 2px 12px;
}

.section-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.section-head a { font-size: 12.5px; color: var(--muted); }
.section-head a:hover { color: var(--accent); }

/* ---------- 文章卡片 ---------- */
.post-list { display: grid; gap: 14px; }

.post-card {
  padding: 18px 20px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.post-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }

.post-cover {
  display: block;
  margin: -18px -20px 14px;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
}

.post-cover img { display: block; width: 100%; aspect-ratio: 16 / 8; object-fit: cover; }

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.post-section {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.post-tags-inline { font-size: 12px; }

.pin {
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-ink);
  color: var(--ink-soft);
  font-size: 11px;
}

.post-card-title { margin: 0 0 6px; font-size: 19px; line-height: 1.4; font-weight: 700; }
.post-card-title a { color: var(--ink); }
.post-card-title a:hover { color: var(--accent); text-decoration: none; }

.post-summary { margin: 0 0 10px; color: var(--ink-soft); font-size: 13.5px; line-height: 1.7; }

.post-dates {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- 列表页 ---------- */
.list-head { padding: 22px 24px; margin-bottom: 16px; }
.list-head h1 { margin: 0 0 6px; font-size: clamp(1.5rem, 3vw, 2rem); }
.list-intro { color: var(--ink-soft); font-size: 14px; }
.list-intro p { margin: 6px 0; }
.list-count { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

.empty-tip { color: var(--muted); font-size: 14px; padding: 18px 4px; }

/* ---------- 归档 ---------- */
.archive-year { padding: 18px 22px; margin-bottom: 14px; }
.archive-year h2 {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.archive-list { list-style: none; margin: 0; padding: 0; }

.archive-list li {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border-ink);
}

.archive-list li:last-child { border-bottom: 0; }
.archive-list time { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.archive-list a { color: var(--ink); font-size: 14px; }
.archive-list a:hover { color: var(--accent); }

/* ---------- 标签 ---------- */
.tag-cloud { padding: 20px 22px; display: flex; flex-wrap: wrap; gap: 9px; }

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border-ink);
  background: var(--glass-soft);
  color: var(--ink);
  font-size: 13px;
}

.tag-chip span {
  font-size: 11px;
  color: var(--muted);
  background: var(--glass);
  padding: 0 6px;
  border-radius: 999px;
}

.tag-chip:hover { background: var(--accent-soft); border-color: var(--accent); text-decoration: none; }

/* ---------- 文章详情 ---------- */
.post-single { padding: 26px 26px 20px; }

.post-crumb {
  display: inline-block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.post-title {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 3.4vw, 2.2rem);
  line-height: 1.3;
  font-weight: 800;
}

.post-timeline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 10px;
  background: var(--glass-soft);
  border: 1px solid var(--border-ink);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.pt-label { color: var(--ink); font-weight: 700; margin-right: 4px; }
.pt-sep { opacity: 0.45; }

.post-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }

.tag {
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.tag:hover { text-decoration: none; filter: brightness(0.95); }

.post-cover { display: block; width: 100%; border-radius: 12px; margin: 16px 0 4px; }

/* 正文排版 */
.post-content {
  margin-top: 16px;
  font-size: 16px;
  line-height: 1.9;
  color: var(--ink);
  overflow-wrap: break-word;
  word-break: break-word;
}

.post-content > *:first-child { margin-top: 0; }

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  color: var(--ink);
  line-height: 1.35;
  scroll-margin-top: 78px;
  font-weight: 750;
}

.post-content h1 { font-size: 1.6rem; margin: 1.8rem 0 0.8rem; }
.post-content h2 { font-size: 1.32rem; margin: 2rem 0 0.7rem; padding-bottom: 0.35rem; border-bottom: 1px dashed var(--border-ink); }
.post-content h3 { font-size: 1.12rem; margin: 1.5rem 0 0.5rem; }
.post-content h4 { font-size: 1rem; margin: 1.2rem 0 0.4rem; }

.post-content p { margin: 0.9rem 0; }
.post-content ul, .post-content ol { margin: 0.9rem 0; padding-left: 1.4rem; }
.post-content li { margin: 0.3rem 0; }

.post-content a { text-decoration: underline; text-underline-offset: 3px; }

.post-content blockquote {
  margin: 1.2rem 0;
  padding: 0.6rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--glass-soft);
  border-radius: 0 10px 10px 0;
  color: var(--ink-soft);
}

.post-content blockquote p { margin: 0.3rem 0; }

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 0.94rem;
  display: block;
  overflow-x: auto;
}

.post-content th, .post-content td {
  border: 1px solid var(--border-ink);
  padding: 0.5rem 0.7rem;
  text-align: left;
}

.post-content th { background: var(--glass-soft); font-weight: 700; }

.post-content tr:nth-child(even) td { background: rgba(148, 163, 184, 0.06); }

.post-content img {
  max-width: 100%;
  border-radius: 12px;
  box-shadow: 0 8px 26px rgba(15, 23, 42, 0.14);
  cursor: zoom-in;
  margin: 0.6rem 0;
}

.post-content hr { border: 0; border-top: 1px dashed var(--border-ink); margin: 2rem 0; }

.post-content :not(pre) > code {
  padding: 0.15em 0.4em;
  border-radius: 6px;
  background: var(--glass-soft);
  border: 1px solid var(--border-ink);
  font-size: 0.9em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.post-content pre {
  position: relative;
  margin: 1.2rem 0;
  padding: 1rem 1rem 0.9rem;
  border-radius: 12px;
  background: var(--code-bg) !important;
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
  overflow: auto;
}

.post-content pre code {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.7;
  font-size: 0.88rem;
  color: #e2e8f0 !important;
  background: transparent !important;
  padding: 0 !important;
  border: 0 !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  padding: 4px 9px;
  font-size: 11px;
  border-radius: 7px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.7);
  color: #e2e8f0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease;
}

.post-content pre:hover .code-copy-btn,
.code-copy-btn:focus { opacity: 1; }

.code-copy-btn:hover { background: rgba(37, 99, 235, 0.8); }

/* 正文里的项目卡片 / 简历 / 联系方式 */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin: 1rem 0;
}

.project-card {
  padding: 16px;
  border-radius: 14px;
  background: var(--glass-soft);
  border: 1px solid var(--border-ink);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.project-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.project-card h3 { margin: 0 0 6px; font-size: 1rem; }
.project-card p { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.project-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px !important; }

.project-tags span {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.timeline-list {
  position: relative;
  margin: 1rem 0;
  padding-left: 20px;
  border-left: 2px solid var(--border-ink);
}

.timeline-item { position: relative; padding: 0 0 16px 12px; }

.timeline-item::before {
  content: "";
  position: absolute;
  left: -27px;
  top: 7px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.timeline-item time { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.timeline-item strong { font-size: 15px; }
.timeline-item p { margin: 4px 0 0; font-size: 13.5px; color: var(--ink-soft); }

.resume-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 0.4rem 0 1rem; }

.resume-avatar {
  width: 84px;
  height: 84px;
  border-radius: 22px;
  object-fit: cover;
  border: 1px solid var(--border-ink);
  box-shadow: var(--shadow);
}

.resume-title h1 { margin: 0; font-size: 1.7rem; }
.resume-title p { margin: 4px 0 0; color: var(--muted); }

.resume-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--muted); }
.resume-actions { margin: 14px 0 6px !important; }

.skill-bar { margin: 10px 0; }

.skill-bar span {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 5px;
}

.skill-bar i {
  display: block;
  height: 7px;
  border-radius: 999px;
  background: var(--glass-soft);
  overflow: hidden;
}

.skill-bar i::after {
  content: "";
  display: block;
  height: 100%;
  width: var(--level, 60%);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #8b5cf6);
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin: 1rem 0;
}

.contact-card {
  padding: 16px;
  border-radius: 14px;
  background: var(--glass-soft);
  border: 1px solid var(--border-ink);
  transition: transform 0.25s ease;
}

.contact-card:hover { transform: translateY(-3px); }
.contact-card h3 { margin: 0 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.contact-card a, .contact-card p { margin: 0; font-size: 14.5px; color: var(--ink); word-break: break-all; }

/* 上下篇 */
.post-footer {
  display: grid;
  gap: 10px;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-ink);
}

.post-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--glass-soft);
  border: 1px solid var(--border-ink);
  color: var(--ink);
}

.post-nav span { font-size: 11.5px; color: var(--muted); }
.post-nav strong { font-size: 14px; font-weight: 600; }
.post-nav:hover { background: var(--accent-soft); text-decoration: none; }
.post-nav.next { text-align: right; }

/* ---------- 图库 ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.gallery-item {
  position: relative;
  display: block;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-ink);
  background: var(--glass-soft);
  aspect-ratio: 1 / 1;
}

.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s ease; }
.gallery-item:hover img { transform: scale(1.05); }

.gallery-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 8px 6px;
  font-size: 11.5px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.62));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 分页 ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 22px 0 6px;
}

.page-btn {
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-ink);
  background: var(--glass);
  color: var(--ink);
  font-size: 13px;
}

.page-btn:hover { background: var(--accent-soft); text-decoration: none; }
.page-btn.is-disabled { opacity: 0.4; }
.page-info { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- 页脚 ---------- */
.site-footer {
  margin-top: 24px;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  padding: 26px 20px 18px;
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: space-between;
  align-items: flex-start;
}

.footer-brand { color: var(--ink); font-weight: 700; font-size: 15px; }
.footer-desc { margin: 6px 0 0; font-size: 13px; color: var(--muted); max-width: 46ch; }
.footer-links { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--accent); }

.footer-bottom {
  max-width: 1280px;
  margin: 16px auto 0;
  padding-top: 12px;
  border-top: 1px dashed var(--border-ink);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  font-size: 12px;
  color: var(--muted);
}

.footer-bottom a { color: var(--muted); }
.footer-powered { margin-left: auto; }

/* ---------- 浮动按钮与抽屉 ---------- */
.rail-fab {
  position: fixed;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--glass-strong);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rail-fab:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }

#fab-study { left: 14px; bottom: 16px; }
#fab-essay { right: 14px; bottom: 16px; }
#fab-bg { right: 14px; bottom: 68px; padding: 9px 11px; }
#btn-top { right: 14px; bottom: 120px; padding: 9px 12px; opacity: 0; visibility: hidden; }
#btn-top.is-visible { opacity: 1; visibility: visible; }

.rail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(2, 6, 23, 0.45);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.rail-backdrop.is-open { opacity: 1; visibility: visible; }

body.drawer-open { overflow: hidden; }

/* 抽屉模式下的左栏 */
@media (max-width: 1599px) {
  .rail-left.is-open {
    display: block;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(86vw, 340px);
    padding: 14px;
    background: var(--glass-strong);
    border-right: 1px solid var(--border);
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.18);
    z-index: 60;
    overflow-y: auto;
  }

  .rail-left.is-open .rail-inner {
    height: auto;
    min-height: 100%;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

/* 抽屉模式下的右栏 */
@media (max-width: 1023px) {
  body.essay-open .right-rail {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(86vw, 340px);
    z-index: 60;
    border-radius: 0;
    overflow-y: auto;
    background: var(--glass-strong);
  }
}

/* ---------- 搜索 ---------- */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(2, 6, 23, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  padding: 10vh 16px 16px;
  overflow-y: auto;
}

.search-dialog {
  max-width: 720px;
  margin: 0 auto;
  border-radius: 16px;
  background: var(--glass-strong);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-hover);
  overflow: hidden;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-ink);
  color: var(--muted);
}

.search-bar input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  font-family: inherit;
}

.search-results { max-height: 60vh; overflow-y: auto; padding: 8px; }

.search-tip { margin: 10px 12px; color: var(--muted); font-size: 13px; }

.search-item {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--ink);
}

.search-item:hover, .search-item.is-active { background: var(--accent-soft); text-decoration: none; }

.search-item h4 { margin: 0 0 3px; font-size: 14.5px; font-weight: 700; }
.search-item p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.search-item .si-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.search-item mark { background: rgba(250, 204, 21, 0.5); color: inherit; border-radius: 3px; padding: 0 1px; }

.search-empty { padding: 18px 12px; color: var(--muted); font-size: 13px; }

/* ---------- 灯箱 ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 6, 23, 0.84);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  cursor: zoom-out;
}

.lightbox[hidden] { display: none; }

.lightbox img {
  max-width: min(94vw, 1600px);
  max-height: 88vh;
  border-radius: 10px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(15, 23, 42, 0.65);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

/* ---------- 背景面板 ---------- */
.bg-panel {
  position: fixed;
  right: 14px;
  bottom: 122px;
  z-index: 110;
  width: min(92vw, 360px);
  max-height: 56vh;
  overflow-y: auto;
  padding: 14px;
  border-radius: 16px;
  background: var(--glass-strong);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-hover);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  backdrop-filter: blur(22px) saturate(1.5);
}

.bg-panel[hidden] { display: none; }

.bg-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.bg-panel-head h3 { margin: 0; font-size: 13px; color: var(--ink); }

.bg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.bg-item {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 9px;
  overflow: hidden;
  border: 2px solid transparent;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  padding: 0;
}

.bg-item:hover { transform: translateY(-2px); }
.bg-item.is-active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.bg-item span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 3px 5px;
  font-size: 10px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.62));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bg-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

.drawer-close {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border-ink);
  background: var(--glass-soft);
  color: var(--ink);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

/* ---------- 进度条 / 加载 ---------- */
#load-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  z-index: 210;
  background: linear-gradient(90deg, var(--accent), #8b5cf6, #ec4899);
  transition: width 0.2s ease, opacity 0.4s ease;
}

#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  z-index: 190;
  background: linear-gradient(90deg, var(--accent), #22c55e);
  opacity: 0;
  transition: opacity 0.3s ease;
}

#page-loader {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: rgba(248, 250, 252, 0.55);
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

html.dark #page-loader { background: rgba(2, 6, 23, 0.55); }

#page-loader.is-hidden { opacity: 0; visibility: hidden; }

.loader-ring {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 响应式 ---------- */
@media (min-width: 1024px) {
  .right-rail { display: block; }
  #fab-essay { display: none; }
  .layout-grid { grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; }
  .post-footer { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1024px) and (max-width: 1599px) {
  #fab-study { display: inline-flex; }
}

@media (min-width: 768px) {
  .site-nav { display: flex; }
  .menu-btn { display: none; }
  .mobile-nav { display: none !important; }
}

@media (min-width: 1600px) {
  .rail-left { display: block; }
  body { padding-left: calc(var(--rail-w) + 32px); }
  .site-main, .header-inner, .footer-inner, .footer-bottom { max-width: 1180px; }
  #fab-study, #fab-essay { display: none; }
  #fab-bg { right: 16px; }
  #btn-top { right: 16px; }
}

@media (max-width: 767px) {
  .site-main { padding: 14px 12px 48px; }
  .hero { padding: 24px 18px; }
  .post-single { padding: 18px 16px 16px; }
  .post-content { font-size: 15.5px; }
  .post-card { padding: 16px; }
  .post-cover { margin: -16px -16px 12px; }
  #btn-top { bottom: 118px; }
  .search-overlay { padding-top: 4vh; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- 打印（简历） ---------- */
@media print {
  body::before, body::after, .site-header, .site-footer, .rail-left, .right-rail,
  .rail-fab, .bg-panel, #page-loader, #load-bar, #reading-progress, .rail-backdrop,
  .post-footer, .post-tags { display: none !important; }

  body { padding: 0 !important; background: #fff !important; color: #000 !important; }

  .site-main { max-width: none; padding: 0; }

  .glass, .post-single {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    background: #fff !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  .project-card, .contact-card { break-inside: avoid; }
}