/*
Theme Name: WYL Notes
Theme URI: https://wyl123ly.cn
Author: wyl123ly
Description: 封面大图 + 双栏信息流的中文技术笔记主题。暖纸底、墨色字，内置暗色模式、文章目录、阅读进度、代码复制、图片灯箱、阅读时长、程序化缩略图。
Version: 2.0.0
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: wyl-notes
*/

/* ==========================================================================
   1. 设计令牌
   ========================================================================== */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC",
    "Noto Sans CJK SC", "WenQuanYi Micro Hei", sans-serif;
  --font-serif: "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif CJK SC",
    Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", "Courier New", monospace;

  --bg: #fbfaf7;
  --bg-2: #ffffff;
  --bg-3: #f2f0ea;
  --ink: #17181a;
  --ink-2: #4a4e57;
  --ink-3: #6b7079;
  --ink-4: #9a9fa7;
  --line: #e5e1d8;
  --line-strong: #d2ccbf;
  --accent: #2c5f8d;
  --accent-ink: #1e4265;
  --accent-soft: #ebf2f9;
  --code-bg: #14161b;
  --code-ink: #e6e8ec;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-1: 0 1px 2px rgba(23, 24, 26, 0.04), 0 10px 30px -18px rgba(23, 24, 26, 0.22);
  --shadow-2: 0 2px 6px rgba(23, 24, 26, 0.06), 0 24px 60px -28px rgba(23, 24, 26, 0.32);

  --content: 720px;
  --shell: 1160px;
  --gap: clamp(18px, 4vw, 40px);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  /* 阅读页的大气层与纸张质感 */
  --atmo-warm: rgba(232, 137, 95, 0.13);
  --atmo-cool: rgba(44, 95, 141, 0.10);
  --atmo-violet: rgba(111, 90, 166, 0.08);
  --paper-shadow: 0 1px 2px rgba(23, 24, 26, 0.04), 0 30px 70px -52px rgba(23, 24, 26, 0.5);
  --paper-glow: rgba(255, 255, 255, 0.7);
  --grain-opacity: 0.08;
  --vignette: rgba(23, 24, 26, 0.035);

  /* —— 液态玻璃 —— */
  /* 面：纸色 + alpha。已按「照片暗区 4.5:1」验算，勿随手调低 */
  --glass-bar: rgba(251, 250, 247, 0.72);
  --glass-note: rgba(251, 250, 247, 0.74);
  --glass-float: rgba(251, 250, 247, 0.76);

  /* 边：一亮一暗，缺一条就看不出是玻璃 */
  --glass-edge: rgba(255, 255, 255, 0.58);
  --glass-edge-top: rgba(255, 255, 255, 0.8);
  --glass-edge-bot: rgba(23, 24, 26, 0.05);

  /* 高光 / 投影：投影比纸面小一号（纸 70px/-52px → 玻璃 40px/-30px） */
  --glass-hi: inset 0 1px 0 var(--glass-edge-top);
  --glass-hi-sub: inset 0 -1px 0 var(--glass-edge-bot);
  --glass-shadow: 0 1px 2px rgba(23, 24, 26, 0.05), 0 18px 40px -30px rgba(23, 24, 26, 0.5);

  /* 模糊：照片已预模糊，静态面板 8px 即饱和；全站只有两个值 */
  --glass-blur: blur(8px) saturate(1.15);
  --glass-blur-bar: blur(12px) saturate(1.2);

  /* 状态：用墨膜，不用实色（实色会在玻璃上露出补丁） */
  --glass-hover: rgba(23, 24, 26, 0.055);
  --glass-press: rgba(23, 24, 26, 0.09);

  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0f1114;
  --bg-2: #15181d;
  --bg-3: #1b1f25;
  --ink: #e9e7e2;
  --ink-2: #aeb3bc;
  --ink-3: #858b95;
  --ink-4: #6a707a;
  --line: #242932;
  --line-strong: #333a45;
  --accent: #7fb4e3;
  --accent-ink: #a9ccec;
  --accent-soft: #16222d;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 30px -18px rgba(0, 0, 0, 0.8);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.5), 0 30px 70px -30px rgba(0, 0, 0, 0.9);
  --atmo-warm: rgba(232, 137, 95, 0.10);
  --atmo-cool: rgba(127, 180, 227, 0.09);
  --atmo-violet: rgba(140, 110, 200, 0.09);
  --paper-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 30px 80px -50px rgba(0, 0, 0, 0.9);
  --paper-glow: rgba(255, 255, 255, 0.045);
  --grain-opacity: 0.05;
  --vignette: rgba(0, 0, 0, 0.16);

  /* —— 液态玻璃（暗色） —— */
  --glass-bar: rgba(21, 24, 29, 0.8);
  --glass-note: rgba(21, 24, 29, 0.8);
  --glass-float: rgba(21, 24, 29, 0.84);

  --glass-edge: rgba(255, 255, 255, 0.1);
  --glass-edge-top: rgba(255, 255, 255, 0.12);
  --glass-edge-bot: rgba(0, 0, 0, 0.45);

  --glass-shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 18px 40px -30px rgba(0, 0, 0, 0.85);

  /* 暗色底本身偏暖棕，saturate 必须 ≤1，否则放大暖色 */
  --glass-blur: blur(8px) saturate(0.92);
  --glass-blur-bar: blur(12px) saturate(0.95);

  --glass-hover: rgba(255, 255, 255, 0.07);
  --glass-press: rgba(255, 255, 255, 0.11);
  color-scheme: dark;
}

/* ==========================================================================
   2. 基础
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  background-color: var(--bg);
  /* 纸面：纤维噪点（最上层）+ 三团极淡的大气光 */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23g)' opacity='0.08'/%3E%3C/svg%3E"),
    radial-gradient(1100px 640px at 88% -6%, var(--atmo-warm), transparent 62%),
    radial-gradient(900px 560px at 4% 2%, var(--atmo-cool), transparent 58%),
    radial-gradient(1200px 760px at 50% 106%, var(--atmo-violet), transparent 66%);
  background-repeat: repeat, no-repeat, no-repeat, no-repeat;
  background-size: 180px 180px, auto, auto, auto;
  background-attachment: fixed, fixed, fixed, fixed;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
  /* 让短页的页脚也贴底 */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* 背景照片：已预模糊（Imagick 生成），再由下面一层薄纱压住保证可读 */
body::before {
  content: "";
  position: fixed;
  inset: -6%;
  z-index: -2;
  pointer-events: none;
  background-image: url("assets/img/bg-doro-blur.jpg");
  background-size: cover;
  background-position: center 32%;
  background-repeat: no-repeat;
}

/* 薄纱：中间（正文纸面）无所谓，两侧留白让照片透出来 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(251, 250, 247, 0.24) 0%,
    rgba(251, 250, 247, 0.32) 40%,
    rgba(251, 250, 247, 0.4) 74%,
    rgba(251, 250, 247, 0.48) 100%
  );
}

[data-theme="dark"] body::after {
  background: linear-gradient(
    180deg,
    rgba(15, 17, 20, 0.44) 0%,
    rgba(15, 17, 20, 0.56) 45%,
    rgba(15, 17, 20, 0.68) 100%
  );
}

/* 列表页没有纸面承托，文字直接压照片：薄纱加厚 */
body.wyl-flat::after {
  background: linear-gradient(
    180deg,
    rgba(251, 250, 247, 0.66) 0%,
    rgba(251, 250, 247, 0.73) 42%,
    rgba(251, 250, 247, 0.8) 74%,
    rgba(251, 250, 247, 0.85) 100%
  );
}

[data-theme="dark"] body.wyl-flat::after {
  background: linear-gradient(
    180deg,
    rgba(15, 17, 20, 0.66) 0%,
    rgba(15, 17, 20, 0.74) 45%,
    rgba(15, 17, 20, 0.82) 100%
  );
}

/* 极淡暗角（原本挂在 body::after，现在让位给薄纱，挪到 main 上） */
main::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  box-shadow: inset 0 0 160px var(--vignette);
}

main#main { flex: 1 0 auto; }

body:not(.wyl-home) main { padding-top: 64px; }

img, svg, video { max-width: 100%; height: auto; display: block; }

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color 0.18s var(--ease);
}

a:hover { color: var(--accent-ink); text-decoration: underline; text-decoration-thickness: 1.5px; }

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.012em;
  color: var(--ink);
}

p { margin: 0; }
ul, ol { margin: 0; padding: 0; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }

::selection { background: var(--accent-soft); color: var(--accent-ink); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; top: -60px; left: 16px; z-index: 999;
  padding: 10px 16px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-1);
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 12px; }

.wrap {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gap);
}

.wrap--narrow { max-width: 800px; }

.progress-bar {
  position: fixed; inset: 0 auto auto 0;
  height: 3px; width: 0;
  background: linear-gradient(90deg, #e8895f, #f0b47a);
  z-index: 200;
  transition: width 0.08s linear;
  pointer-events: none;
}

/* ==========================================================================
   3. 顶栏（封面之上透明，滚动后变实）
   ========================================================================== */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  border-bottom: 1px solid transparent;
  -webkit-backdrop-filter: var(--glass-blur-bar);
  backdrop-filter: var(--glass-blur-bar);
  /* backdrop-filter 不参与过渡，否则滚过阈值时整条 1440×64 每帧重绘 */
  transition: background-color 0.32s var(--ease), border-color 0.32s var(--ease),
    box-shadow 0.32s var(--ease);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 22px;
  height: 64px;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gap);
}

/* 首页未滚动：透明 + 白字 */
body.wyl-home .topbar:not(.is-scrolled) { color: #fff; }

/* 整屏封面下，顶栏会在日落带上停留很久；透明态必须自带一层顶部暗渐变，
   否则白字压在橙色上只有 2.2:1。封面色是深的时候这层看不出来。 */
body.wyl-home .topbar:not(.is-scrolled) {
  background: linear-gradient(
    180deg,
    rgba(4, 9, 16, 0.62) 0%,
    rgba(4, 9, 16, 0.30) 58%,
    rgba(4, 9, 16, 0) 100%
  );
}
body.wyl-home .topbar:not(.is-scrolled) .brand-text,
body.wyl-home .topbar:not(.is-scrolled) .nav a,
body.wyl-home .topbar:not(.is-scrolled) .icon-btn { color: rgba(255, 255, 255, 0.9); }
body.wyl-home .topbar:not(.is-scrolled) .brand-mark {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}
body.wyl-home .topbar:not(.is-scrolled) .nav a:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
body.wyl-home .topbar:not(.is-scrolled) .nav .current-menu-item > a,
body.wyl-home .topbar:not(.is-scrolled) .nav .current_page_item > a {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}
body.wyl-home .topbar:not(.is-scrolled) .icon-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* 滚动后 / 内页：玻璃面 */
.topbar.is-scrolled,
body:not(.wyl-home) .topbar {
  background: var(--glass-bar);
  border-bottom-color: var(--glass-edge);
  box-shadow: var(--glass-hi), 0 1px 0 var(--glass-edge-bot),
    0 12px 32px -22px rgba(23, 24, 26, 0.4);
}

/* 玻璃上的悬停用墨膜：--bg-3 实色会在玻璃上露出一块补丁 */
.topbar .nav a:hover,
.topbar .icon-btn:hover {
  background: var(--glass-hover);
  border-color: transparent;
}

.topbar .nav .current-menu-item > a,
.topbar .nav .current_page_item > a {
  background: var(--glass-press);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: inherit;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; color: inherit; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px; height: 27px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.brand-text { color: var(--ink); }

.nav { margin-left: auto; }
.nav ul { display: flex; align-items: center; gap: 2px; list-style: none; }

.nav a {
  display: inline-block;
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink-2);
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease);
}
.nav a:hover { background: var(--bg-3); color: var(--ink); text-decoration: none; }
.nav .current-menu-item > a,
.nav .current_page_item > a { color: var(--ink); background: var(--bg-3); }

.header-tools { display: flex; align-items: center; gap: 4px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  border: 1px solid transparent;
  color: var(--ink-2);
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease),
    border-color 0.18s var(--ease);
}
.icon-btn:hover {
  background: var(--bg-3);
  border-color: var(--line);
  color: var(--ink);
  text-decoration: none;
}
.icon-btn svg { width: 17px; height: 17px; }

.icon-moon { display: block; }
.icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: block; }

/* 搜索面板 */
.search-panel {
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  animation: slide-down 0.2s var(--ease);
}
.search-panel[hidden] { display: none; }

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.search-form { display: flex; gap: 10px; padding-block: 16px; }

.search-form input[type="search"] {
  flex: 1;
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 15px;
}
.search-form input[type="search"]:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease),
    border-color 0.18s var(--ease);
}
.btn:hover {
  text-decoration: none;
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-1);
}
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }

/* ==========================================================================
   4. 封面 Hero
   ========================================================================== */
.hero {
  position: relative;
  /* 整屏封面：svh 取「最小视口高度」，移动端地址栏展开时也能完整铺满一屏 */
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: #0b1c30;
  background-size: cover;
  background-position: center;
}

.hero-grain {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.3;
  mix-blend-mode: overlay;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* 平缓山脊剪影：低对比、只占底部，为渐变色块制造纵深而不抢主体 */
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  pointer-events: none;
}

.hero::before {
  /* 整屏封面后高度约为原来 1.9 倍，山脊按比例收窄，避免底部过重 */
  height: 17%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 220' preserveAspectRatio='none'%3E%3Cpath d='M0,124 C130,100 230,146 360,126 C500,105 600,150 740,132 C880,114 980,152 1120,134 C1250,118 1340,146 1440,128 L1440,220 L0,220 Z' fill='%231a2f42' opacity='.55'/%3E%3C/svg%3E");
}

.hero::after {
  height: 10%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 220' preserveAspectRatio='none'%3E%3Cpath d='M0,152 C170,140 280,168 440,158 C600,148 720,172 880,162 C1040,152 1200,174 1440,160 L1440,220 L0,220 Z' fill='%23070f19' opacity='.92'/%3E%3C/svg%3E");
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 88px 24px 64px;
  max-width: 760px;
}

/* 标题带：横贯全宽的柔和暗色带，上下渐隐。
   不用圆形暗角——半径一收紧就会露出可见的椭圆斑。 */
.hero-content::before {
  content: "";
  position: absolute;
  inset: -72px -100vw;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(4, 10, 18, 0) 0%,
    rgba(4, 10, 18, 0.34) 26%,
    rgba(4, 10, 18, 0.38) 74%,
    rgba(4, 10, 18, 0) 100%
  );
}

/* 小屏封面更矮、暖色占比更大，色带再加深一档 */
@media (max-width: 620px) {
  .hero-content::before {
    inset: -56px -100vw;
    background: linear-gradient(
      180deg,
      rgba(4, 10, 18, 0) 0%,
      rgba(4, 10, 18, 0.46) 28%,
      rgba(4, 10, 18, 0.5) 72%,
      rgba(4, 10, 18, 0) 100%
    );
  }
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
  margin-bottom: 20px;
}

.hero-name {
  color: #fff;
  font-size: clamp(38px, 6.4vw, 68px);
  line-height: 1.1;
  letter-spacing: -0.035em;
  font-weight: 750;
  text-shadow: 0 2px 40px rgba(0, 0, 0, 0.35);
}

.hero-tagline {
  margin-top: 18px;
  font-size: clamp(14px, 1.7vw, 17px);
  color: #fff;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 2px rgba(4, 10, 18, 0.55), 0 2px 16px rgba(4, 10, 18, 0.6);
}

.hero-scroll {
  position: absolute;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(7, 15, 25, 0.42);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: rgba(255, 255, 255, 0.92);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.hero-scroll:hover { color: #fff; text-decoration: none; }
.hero-scroll svg { width: 17px; height: 17px; animation: bob 2.2s var(--ease) infinite; }

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

/* ==========================================================================
   5. 页面主干
   ========================================================================== */
.page-body { padding-bottom: 40px; }

.profile-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 32px;
  flex-wrap: wrap;
  padding: 28px 0 14px;
  border-bottom: 1px solid var(--line);
}

.profile-name { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.profile-affil { margin-top: 6px; font-size: 13px; color: var(--ink-3); }
.profile-affil .sig { color: var(--ink-2); font-weight: 500; }

.profile-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.01em;
}
.profile-stats b { color: var(--ink); font-weight: 600; }
.sep-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong); }

.quote-row {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  align-items: start;
}

.quote-date {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  padding-top: 5px;
}

.quote-body {
  font-family: var(--font-serif);
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--ink-2);
  font-style: italic;
  margin: 0;
  max-width: 62ch;
}
.quote-body cite {
  display: block;
  margin-top: 8px;
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 12px;
  color: var(--ink-3);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 0 2px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  font-size: 13px;
  color: var(--ink-2);
  transition: all 0.18s var(--ease);
}
.chip span { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); }
.chip:hover { border-color: var(--ink-3); color: var(--ink); text-decoration: none; }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip.is-active span { color: rgba(255, 255, 255, 0.55); }
[data-theme="dark"] .chip.is-active span { color: rgba(0, 0, 0, 0.5); }

.page-head { padding: 52px 0 10px; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 14px;
}
.page-head h1 { font-size: clamp(28px, 4vw, 40px); letter-spacing: -0.028em; }
.page-desc { margin-top: 10px; color: var(--ink-2); font-size: 15px; }

/* ==========================================================================
   6. 双栏布局
   ========================================================================== */
.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px;
  gap: clamp(32px, 5vw, 60px);
  padding: 2px 0 76px;
  align-items: start;
}

/* ==========================================================================
   7. 文章列表
   ========================================================================== */
.post-list { list-style: none; border-top: 1px solid var(--line); margin-top: 14px; }

.post-item { border-bottom: 1px solid var(--line); }

.post-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 26px;
  padding: 26px 0;
  align-items: center;
  color: inherit;
}
.post-link:hover { text-decoration: none; }
.post-link:hover .post-title { color: var(--accent); }
.post-link:hover .post-thumb { transform: translateY(-2px); border-color: var(--accent); }

.post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}
.post-cat { color: var(--ink-2); font-weight: 500; }
.dot { width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong); }

.post-title {
  margin-top: 10px;
  font-size: clamp(18px, 2.05vw, 20.5px);
  line-height: 1.45;
  letter-spacing: -0.014em;
  transition: color 0.18s var(--ease);
}

.post-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 8px;
  font-size: 14.5px;
  line-height: 1.72;
  color: var(--ink-2);
}

.post-thumb {
  display: block;
  width: 132px;
  height: 104px;
  border-radius: 10px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: linear-gradient(148deg, #1e2c3a 0%, #101c26 100%);
  transition: transform 0.22s var(--ease), border-color 0.22s var(--ease);
}
.post-thumb .thumb-svg { width: 100%; height: 100%; }
.post-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* 空状态 */
.empty-state {
  margin: 40px 0;
  padding: 56px 32px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-2);
}
.empty-state h2 { font-size: 19px; margin-bottom: 10px; }
.empty-state p { color: var(--ink-2); font-size: 14.5px; }
.empty-actions { margin-top: 22px; }
.empty-search { max-width: 420px; margin: 24px auto 0; }

/* 分页 */
.pagination { display: flex; justify-content: center; gap: 6px; padding: 40px 0 8px; }
.pagination .page-numbers {
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-inline: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-2);
}
.pagination .page-numbers:hover,
.pagination .page-numbers.current {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}

/* ==========================================================================
   8. 侧栏
   ========================================================================== */
.sidebar { padding-top: 22px; position: sticky; top: 88px; align-self: start; }
.widget + .widget { margin-top: 34px; }

.widget-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  /* 直接压在薄纱上，--ink-3 最差只有 3.38:1，提到 --ink-2 */
  color: var(--ink-2);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.week-num { margin-top: 14px; font-size: 13px; color: var(--ink-2); }
.week-num b { font-size: 25px; color: var(--ink); font-weight: 650; margin-right: 3px; }
.week-sub { margin-left: 4px; }

.week-bar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 12px;
}
.week-bar span {
  height: 26px;
  border-radius: 3px;
  background: var(--bg-3);
  border: 1px solid var(--line);
}
.week-bar span.on { background: var(--accent); border-color: var(--accent); opacity: 0.8; }
.week-bar span.today { box-shadow: inset 0 0 0 1px var(--accent); }

.week-labels {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-2);
  text-align: center;
}

.widget-list { list-style: none; margin-top: 12px; }
.widget-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13.5px;
}
.widget-list a { color: var(--ink-2); }
.widget-list a:hover { color: var(--accent); }
.widget-date { font-family: var(--font-mono); font-size: 11px; color: var(--ink-2); white-space: nowrap; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }

.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-3);
  transition: all 0.18s var(--ease);
}
.tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

/* ==========================================================================
   9. 文章页
   ========================================================================== */
.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 48px;
  max-width: 840px;
  margin-inline: auto;
  padding: 56px var(--gap) 64px;
}

/* 正文居中 + 目录在左：三列等宽留白，正文占中间那一列 */
@media (min-width: 1300px) {
  .post-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 760px) minmax(0, 1fr);
    column-gap: clamp(56px, 4.5vw, 80px);
    max-width: 1400px;
  }

  .post-layout > article {
    grid-column: 2;
    grid-row: 1;
  }

  .post-layout > .toc {
    grid-column: 1;
    grid-row: 1;
    justify-self: end;
    /* 100% 上限：列宽不足时自动收窄，宁可变窄也不压到纸面 */
    width: min(232px, 100%);
    margin-top: 2px;
    padding: 16px 16px 14px;
    /* 与正文纸面同一档圆角：玻璃和纸是同一套家具 */
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-edge);
    background: var(--glass-note);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    /* 双边：上白下暗。单条白边在奶油底上只有 1.09:1，等于没画 */
    box-shadow: var(--glass-hi), var(--glass-hi-sub), var(--glass-shadow);
  }

  /* 玻璃上禁用 --ink-3（照片透进后最暗处掉到 3.3–3.8:1） */
  .post-layout > .toc .toc-title,
  .post-layout > .toc a {
    color: var(--ink-2);
  }

  .post-layout > .toc a:hover {
    color: var(--ink);
  }

  /* 导轨换到右侧，朝向正文 */
  .post-layout > .toc ul {
    border-left: 0;
    border-right: 1px solid var(--glass-edge);
  }

  .post-layout > .toc a {
    padding: 5px 13px 5px 0;
    margin-left: 0;
    margin-right: -1px;
    border-left: 0;
    border-right: 2px solid transparent;
  }

  .post-layout > .toc a.is-active {
    color: var(--accent);
    border-right-color: var(--accent);
    border-left-color: transparent;
  }

  .post-layout > .toc .toc-h3 a {
    padding-left: 0;
    padding-right: 24px;
  }
}

/* 空间不够时收起目录，正文仍保持居中 */
@media (max-width: 1299px) {
  .toc { display: none; }
}

/* 正文栏承托成一张纸：有边界、有投影，桌面的大气光从四周透出来 */
.post-layout > article {
  position: relative;
  z-index: 0;
}

.post-layout > article::before {
  content: "";
  position: absolute;
  inset: -34px -32px -34px -32px;
  z-index: -1;
  pointer-events: none;
  border-radius: 18px;
  border: 1px solid var(--line);
  background:
    radial-gradient(76% 54% at 40% 0%, var(--paper-glow), transparent 72%),
    var(--bg-2);
  box-shadow: var(--paper-shadow);
}

@media (max-width: 1119px) {
  .post-layout > article::before {
    inset: -20px -14px -20px -14px;
    border-radius: 14px;
  }
}

.entry-header {
  position: relative;
  z-index: 0;
  margin-bottom: clamp(26px, 4vw, 40px);
  padding-bottom: clamp(22px, 3vw, 30px);
  border-bottom: 0;
}

/* 标题上方落下的一束柔光，像台灯打在纸上 */
.entry-header::before {
  content: "";
  position: absolute;
  inset: -56px -72px -10px -72px;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(62% 100% at 24% 0%, rgba(255, 255, 255, 0.62), transparent 72%);
  border-radius: 24px;
}

[data-theme="dark"] .entry-header::before {
  background: radial-gradient(62% 100% at 24% 0%, rgba(127, 180, 227, 0.07), transparent 72%);
}

/* 两端渐隐的发丝线，比整条实线更轻 */
.entry-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong) 12%, var(--line-strong) 88%, transparent);
}

.entry-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.entry-kicker a { color: var(--accent); }
.entry-kicker .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong); }

.entry-title {
  font-size: clamp(26px, 3.9vw, 37px);
  line-height: 1.3;
  letter-spacing: -0.028em;
  /* 自然折行：在 CJK 字符边界断开，不把「缓存」这类词拆开 */
  text-wrap: pretty;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.03em;
  color: var(--ink-3);
}
.entry-meta span { display: inline-flex; align-items: center; gap: 6px; }

/* 正文排版 */
.entry-content { font-size: 17px; line-height: 1.88; color: var(--ink); }
.entry-content > * + * { margin-top: 1.35em; }

.entry-content h2 {
  margin-top: 2.4em;
  margin-bottom: 0.8em;
  font-size: 25px;
  line-height: 1.4;
  letter-spacing: -0.02em;
  position: relative;
  scroll-margin-top: 92px;
}
.entry-content h2::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 0.42em;
  width: 4px;
  height: 1.05em;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.85;
}

.entry-content h3 { margin-top: 2em; margin-bottom: 0.6em; font-size: 19.5px; scroll-margin-top: 92px; }
.entry-content h4 { margin-top: 1.8em; font-size: 17px; }
.entry-content p { margin-bottom: 1.15em; }
.entry-content a { border-bottom: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.entry-content a:hover { border-bottom-color: var(--accent); text-decoration: none; }

.entry-content ul, .entry-content ol { margin: 0 0 1.35em; padding-left: 1.55em; }
.entry-content li { margin-bottom: 0.45em; }
.entry-content li::marker { color: var(--ink-3); }

.entry-content blockquote {
  margin: 1.8em 0;
  padding: 18px 22px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--accent-soft);
  color: var(--ink-2);
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.85;
}
.entry-content blockquote > *:last-child { margin-bottom: 0; }

.entry-content hr { margin: 2.6em auto; border: 0; border-top: 1px dashed var(--line-strong); width: 72%; }

.entry-content img {
  margin: 1.8em auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  cursor: zoom-in;
}

.entry-content figure { margin: 1.8em 0; }
.entry-content figcaption {
  margin-top: 10px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-3);
  font-family: var(--font-mono);
}

.entry-content table { width: 100%; margin: 1.8em 0; border-collapse: collapse; font-size: 15px; }
.entry-content th, .entry-content td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.entry-content th {
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  text-transform: uppercase;
  border-bottom-color: var(--line-strong);
}
.entry-content tr:hover td { background: var(--bg-3); }

.entry-content :not(pre) > code {
  padding: 0.15em 0.42em;
  border-radius: 6px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.87em;
  color: var(--accent-ink);
  white-space: nowrap;
}
[data-theme="dark"] .entry-content :not(pre) > code { color: var(--accent); }

/* 代码块 */
.code-block {
  position: relative;
  margin: 1.8em 0;
  border-radius: var(--radius);
  background: var(--code-bg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.code-block pre {
  margin: 0;
  padding: 42px 20px 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--code-ink);
  tab-size: 2;
}
.code-block code { font-family: inherit; background: none; border: 0; padding: 0; color: inherit; white-space: pre; }

/* 语法高亮：五色（正文 #E6E8EC 为底色） */
.code-block .tok-k { color: #7fb4e3; }
.code-block .tok-s { color: #e8b27f; }
.code-block .tok-c { color: #8fa39a; font-style: italic; }
.code-block .tok-n { color: #c9a7e8; }

.code-lang {
  position: absolute;
  top: 12px; left: 20px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(230, 232, 236, 0.45);
}

.code-copy {
  position: absolute;
  top: 9px; right: 9px;
  padding: 5px 11px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  color: rgba(230, 232, 236, 0.88);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  transition: background-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
  /* 微玻璃：底是不透明 #14161B，开 backdrop-filter 零收益 */
}
.code-copy:hover {
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
  color: #fff;
}
.code-copy.is-copied { border-color: rgba(126, 211, 160, 0.5); color: #9be3b8; }

/* 数学公式（KaTeX 本地托管，只有含公式的文章才加载） */
.entry-content .katex { font-size: 1.05em; }

/* 整段只有一条公式时，交给 .katex-display 自己撑间距，别再叠一层段落边距 */
.entry-content p:has(> .katex-display) { margin-block: 0; }

.entry-content .katex-display {
  margin: 1.5em 0;
  padding: 2px 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
/* 保持公式原形：超宽时横向滑动，而不是在等号/分式处折行 */
.entry-content .katex-display > .katex { white-space: nowrap; }

/* 渲染不了时留可读的红字，而不是一屏反斜杠 */
.entry-content .katex-error {
  color: #b23b2e !important;
  font-family: var(--font-mono);
  font-size: 0.92em;
}
[data-theme="dark"] .entry-content .katex-error { color: #e89286 !important; }

.heading-anchor {
  margin-left: 8px;
  font-size: 0.62em;
  color: var(--ink-3);
  opacity: 0;
  border: 0 !important;
  transition: opacity 0.18s var(--ease);
  vertical-align: middle;
}
.entry-content h2:hover .heading-anchor,
.entry-content h3:hover .heading-anchor,
.heading-anchor:focus-visible { opacity: 1; }

/* 目录 */
.toc {
  position: sticky;
  top: 92px;
  align-self: start;
  font-size: 13.5px;
  line-height: 1.65;
  /* sticky + 内部滚动 + backdrop-filter 三件套最容易掉帧，取消内部滚动 */
  max-height: none;
  overflow: visible;
  padding-bottom: 12px;
}
.toc-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.toc ul { list-style: none; border-left: 1px solid var(--line); }
.toc li { margin: 0; }
.toc a {
  display: block;
  padding: 5px 0 5px 13px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--ink-3);
  transition: all 0.18s var(--ease);
}
.toc a:hover { color: var(--ink); text-decoration: none; }
.toc a.is-active { color: var(--accent); border-left-color: var(--accent); font-weight: 500; }
.toc .toc-h3 a { padding-left: 26px; font-size: 12.8px; }

/* 文章尾 */
.entry-footer {
  margin-top: 54px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}
.share {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.post-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 26px; }
.post-nav a {
  display: block;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: inherit;
  transition: all 0.2s var(--ease);
}
.post-nav a:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-1); text-decoration: none; }
.post-nav .dir {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: block;
  margin-bottom: 8px;
}
.post-nav .ttl { font-size: 15px; font-weight: 600; line-height: 1.5; color: var(--ink); }
.post-nav .next { text-align: right; }

/* ==========================================================================
   10. 归档页 / 404
   ========================================================================== */
.archive-list { list-style: none; padding: 12px 0 56px; }
.archive-year {
  margin-top: 38px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  list-style: none;
}
.archive-list li a {
  display: flex;
  align-items: baseline;
  gap: 18px;
  padding: 13px 6px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  transition: all 0.18s var(--ease);
}
.archive-list li a:hover { background: var(--bg-3); text-decoration: none; }
.archive-list .d { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); min-width: 46px; }
.archive-list .t { font-size: 16px; }

.error-404 { padding: clamp(64px, 12vw, 140px) 0; text-align: center; }
.error-404 .code { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.24em; color: var(--ink-3); }
.error-404 h1 { margin: 18px 0 12px; font-size: clamp(64px, 16vw, 128px); line-height: 1; letter-spacing: -0.05em; color: var(--accent); }
.error-404 p { color: var(--ink-2); margin-bottom: 28px; }

/* 评论 */
.comments-area { margin-top: 62px; padding-top: 30px; border-top: 1px solid var(--line); }
.comments-title { font-size: 17px; margin-bottom: 22px; }
.comment-list { list-style: none; padding: 0; }
.comment-list .comment-body { padding: 20px 0; border-bottom: 1px solid var(--line); }

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 15px;
}
.comment-form textarea { min-height: 130px; resize: vertical; }
.comment-form .submit {
  display: inline-flex;
  padding: 11px 24px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-size: 14.5px;
  font-weight: 500;
  border: 0;
  cursor: pointer;
}
.comment-form .submit:hover { background: var(--accent-ink); }

/* ==========================================================================
   11. 页脚 / 回到顶部 / 灯箱
   ========================================================================== */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-2); }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
  align-items: center;
  justify-content: space-between;
  padding-block: 30px;
  font-size: 13px;
  color: var(--ink-3);
}
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: var(--ink-2); }
.footer-meta { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.02em; }

.to-top {
  position: fixed;
  right: clamp(16px, 3vw, 32px);
  bottom: clamp(16px, 3vw, 32px);
  width: 44px; height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--glass-edge);
  background: var(--glass-float);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  color: var(--ink-2);
  box-shadow: var(--glass-hi), var(--glass-hi-sub), var(--glass-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.24s var(--ease), transform 0.24s var(--ease),
    background-color 0.24s var(--ease), color 0.24s var(--ease),
    border-color 0.24s var(--ease);
  z-index: 90;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover {
  background: var(--bg-2);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--glass-hi), 0 10px 26px -14px rgba(23, 24, 26, 0.45);
}
.to-top svg { width: 17px; height: 17px; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vw;
  background: rgba(10, 11, 13, 0.86);
  -webkit-backdrop-filter: blur(10px) saturate(1.05);
  backdrop-filter: blur(10px) saturate(1.05);
  cursor: zoom-out;
  animation: fade-in 0.18s var(--ease);
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: var(--radius); box-shadow: 0 40px 120px -40px rgba(0, 0, 0, 0.9); }

/* 关闭按钮：遮罩本身已是模糊结果，子元素不再开一层 filter */
.lightbox-close {
  position: absolute;
  top: clamp(14px, 2.4vw, 26px);
  right: clamp(14px, 2.4vw, 26px);
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 8px 24px -12px rgba(0, 0, 0, 0.8);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.4); }
.lightbox-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ==========================================================================
   11.5 移动端菜单 / 提示 / 索引细节
   ========================================================================== */
.menu-toggle { display: none; }
.mobile-menu { display: none; }

.mobile-menu {
  position: fixed;
  inset: 58px 0 auto 0;
  z-index: 99;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  padding: 10px var(--gap) 16px;
  animation: slide-down 0.2s var(--ease);
}

.mobile-menu[hidden] { display: none; }

/* 菜单展开时，顶栏不再透出封面，避免白面板压在白字上 */
body.menu-open .topbar,
body.wyl-home.menu-open .topbar {
  background: var(--bg-2);
  border-bottom-color: var(--line);
}

body.menu-open .topbar .brand-text,
body.menu-open .topbar .nav a,
body.menu-open .topbar .icon-btn,
body.wyl-home.menu-open .topbar .brand-text,
body.wyl-home.menu-open .topbar .nav a,
body.wyl-home.menu-open .topbar .icon-btn {
  color: var(--ink);
}

body.menu-open .topbar .brand-mark,
body.wyl-home.menu-open .topbar .brand-mark {
  background: var(--accent-soft);
  border-color: var(--line-strong);
  color: var(--accent);
}

.mobile-menu ul { list-style: none; }

.mobile-menu a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 15px;
  color: var(--ink);
}

.mobile-menu a:hover,
.mobile-menu .current-menu-item > a {
  background: var(--bg-3);
  text-decoration: none;
}

.mobile-menu-foot {
  display: flex;
  gap: 18px;
  margin-top: 10px;
  padding: 12px 14px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.mobile-menu-foot a { color: var(--ink-3); }

/* 数字等宽，日期列对得齐 */
.post-date,
.widget-date,
.entry-meta,
.archive-list .d,
.archive-count,
.quote-date,
.hero-meta,
.post-meta {
  font-variant-numeric: tabular-nums;
}

/* 轻量 toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 12px);
  z-index: 400;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  box-shadow: var(--shadow-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* 归档页年份行 */
.archive-year-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 44px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  list-style: none;
}

.archive-count { letter-spacing: 0; }

/* ==========================================================================
   12. 响应式
   ========================================================================== */
@media (max-width: 1000px) {
  .content-grid { grid-template-columns: 1fr; gap: 40px; }
  .sidebar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 40px; padding-top: 8px; position: static; }
  .widget + .widget { margin-top: 0; }
}

@media (max-width: 780px) {
  .nav { display: none; }
  .menu-toggle { display: inline-flex; width: 44px; height: 44px; }
  .mobile-menu { display: block; }
  .header-tools { margin-left: auto; }
  .header-tools .icon-btn { width: 44px; height: 44px; }
  .header-tools .rss-link { display: none; }
  .hero-scroll { bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 760px) {
  .profile-row { padding-top: 32px; }
  .quote-row { grid-template-columns: 1fr; gap: 8px; }
  .profile-stats { font-size: 11.5px; }
}

@media (max-width: 620px) {
  body { font-size: 16px; }
  body:not(.wyl-home) main { padding-top: 58px; }
  .topbar-inner { height: 58px; gap: 12px; }
  .brand{ max-width: 46vw; }
  .brand-text { overflow: hidden; text-overflow: ellipsis; }
  .nav { display: none; }
  .header-tools { margin-left: auto; }
  .hero-content { padding: 84px 20px 88px; }
  .hero-tagline { max-width: 26ch; margin-inline: auto; }
  .post-link { grid-template-columns: minmax(0, 1fr) 92px; gap: 16px; }
  .post-thumb { width: 92px; height: 76px; border-radius: 8px; }
  .entry-content { font-size: 16px; line-height: 1.9; }
  .entry-content h2::before { display: none; }
  .sidebar { grid-template-columns: 1fr; }
  .post-layout { padding-top: 34px; }
}

@media (max-width: 420px) {
  .post-thumb { display: none; }
  .post-link { grid-template-columns: 1fr; }
}

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

/* ==========================================================================
   13. WordPress 兼容
   ========================================================================== */
.alignwide { width: min(100%, 900px); margin-inline: auto; }
.alignfull { width: 100vw; max-width: 100vw; margin-left: calc(50% - 50vw); }
.aligncenter { margin-inline: auto; }
.wp-caption-text, .gallery-caption { font-size: 13px; color: var(--ink-3); text-align: center; }
.sticky { position: relative; }
.bypostauthor > .comment-body { border-left: 2px solid var(--accent); padding-left: 16px; }

/* ==========================================================================
   14. 液态玻璃：小屏撤滤镜 + 三道降级
   ========================================================================== */

/* 小屏撤掉非关键滤镜（返顶按钮在手机上几乎无照片可折射） */
@media (max-width: 780px) {
  .to-top {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: var(--bg-2);
  }
}

/* ① 不支持 backdrop-filter：整块换令牌，规则一条都不用改 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root {
    --glass-bar: #f6f4ef;
    --glass-note: #f6f4ef;
    --glass-float: #f6f4ef;
    --glass-edge: var(--line);
    --glass-edge-top: rgba(255, 255, 255, 0.9);
    --glass-blur: none;
    --glass-blur-bar: none;
  }

  [data-theme="dark"] {
    --glass-bar: #1a1e24;
    --glass-note: #1a1e24;
    --glass-float: #1a1e24;
    --glass-edge: var(--line);
  }
}

/* ② 用户主动要求降低透明（不支持该媒体查询时整块忽略） */
@media (prefers-reduced-transparency: reduce) {
  :root {
    --glass-bar: #f6f4ef;
    --glass-note: #f6f4ef;
    --glass-float: #f6f4ef;
    --glass-blur: none;
    --glass-blur-bar: none;
  }

  [data-theme="dark"] {
    --glass-bar: #1a1e24;
    --glass-note: #1a1e24;
    --glass-float: #1a1e24;
  }
}