/* ============================================================
   星轨 STARLOG —— 全站共享样式（index.html / post.html 都用它）
   ------------------------------------------------------------
   阅读顺序建议：
   00 颜色变量 → 01 基础 → 02 星空层 → 06 首屏 → 09 文章列表
   → 11 联系 → 12 页脚 → 14 文章详情页正文排版
   想换配色，只改 00 里的变量即可，全站联动。
   ============================================================ */

/* ---------- 00. 颜色与尺寸变量 ---------- */
:root {
  --bg:       #04060f;               /* 深空底色 */
  --bg-soft:  rgba(12, 18, 38, .55); /* 卡片底色（半透明，能透出星星） */
  /* 卡片/面板底色。比 --bg-soft 略实一点：
     上一版靠 backdrop-filter 加模糊，代价是每帧重采样背后那块画布，
     滚动时非常吃性能。改成「更实的半透明 + 一道顶部高光」，
     观感几乎一样，合成器只当普通图层处理。 */
  --panel:    linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, 0) 42%),
              rgba(11, 17, 35, .66);
  --text:     #e8eeff;
  --muted:    #8893b8;
  --line:     rgba(150, 175, 255, .13);

  --c1:       #7dd3fc;   /* 星蓝 */
  --c2:       #a78bfa;   /* 星紫 */
  --c3:       #f0abfc;   /* 星粉 */

  --radius:   20px;
  --maxw:     1140px;
  --ease:     cubic-bezier(.22, .61, .36, 1);
}

/* ---------- 01. 基础重置 ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

::selection { background: var(--c2); color: #04060f; }

a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; background: none; border: none; }
canvas { display: block; }

/* hidden 属性必须赢过 .post-nav{display:grid} 这类作者样式，
   否则 JS 里 el.hidden = true 会失效（浏览器默认样式优先级更低） */
[hidden] { display: none !important; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 24px;
  position: relative;
  z-index: 1;
}

/* ============================================================
   02. 星空：七层结构，撑起景深
   ------------------------------------------------------------
   ① 底色   —— 极深蓝 → 近黑，四角更沉
   ② 星云   —— 4 团高饱和气体，每团都带一个「亮核」
   ③ 银河   —— 三层椭圆光带 + 一道尘带，中心偏暖
   ④ 星场   —— canvas：星点 + 星尘 + 流星
   ⑤ 颗粒   —— 5% 的胶片噪点，顺手给渐变做抖动
   ⑥ 光斑   —— 前景失焦圆斑，制造「镜头景深」
   ⑦ 暗角   —— 四周压黑，把视线收进画面中间

   ⚠ 性能铁律（踩过的坑，别改回去）：
   · 不用 filter: blur()  —— 每帧重新栅格化整个图层
   · 不用 mix-blend-mode  —— 合成器要逐帧读背景再混合
   · 动画只动 transform    —— 走合成快车道，不碰重绘
   所有柔软边缘都由 radial-gradient 的多级停靠点自己给出来。
   ============================================================ */
.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  /* 底色不是纯黑：带一点深蓝，星云的彩色才「有地方发光」。
     但也不能太亮 —— 底一抬，所有星云就糊成一片灰紫。 */
  background:
    radial-gradient(ellipse 130% 100% at 50% -10%,
      #081026 0%, #050917 36%, #02030c 64%, #000104 100%);
}
#stars { position: absolute; inset: 0; }

/* ⑤ 胶片颗粒：一张 200×200 的 SVG 噪声贴图，平铺，静态。
   它还有个隐藏职责 —— 给大盘渐变做抖动（dither）。
   深色大渐变在 8bit 色深下会出现一圈圈「等高线」（banding），
   叠一层 5% 的噪声就能把台阶打散，比调渐变停靠点有效得多。 */
.grain {
  position: absolute;
  inset: 0;
  opacity: .055;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='200' height='200' filter='url(%23n)'/></svg>");
  background-size: 200px 200px;
}

/* ② 星云：4 团气体，每团 = 高饱和亮核 + 大范围暗晕
   ------------------------------------------------------------
   ⚠ 性能要点（踩过坑，别改回去）：
   早期版本给每团都加了 filter: blur(80px) + mix-blend-mode: screen，
   视觉没问题，但滚动时掉帧非常厉害。原因是这两个属性都会把图层
   踢出「直接合成」的快车道：
     · filter 让图层每帧重新栅格化；
     · blend 让合成器必须逐帧读取背景再重新混合。
   4 个 58vw×58vw 的大图层 × 60fps ≈ 每帧 4 次全屏级模糊 + 混合。

   正确做法是「把模糊画进渐变里」：
   radial-gradient 本身就能给出连续柔和的衰减，不需要真去做模糊。
   顺带修掉一个隐性问题——渐变的终点写 transparent 会插值到
   rgba(0,0,0,0)，在纯黑底上会现出一圈灰边；必须写「同色 + 0 透明度」。

   ⚠ 另一个坑（这次修的就是它）：
   上一版把四团的圆心都摆到了视口之外（left:-10vw / top:-16vw），
   结果是画面里只剩渐变最暗的那 20% 尾巴 —— 于是「星云看不见」。
   圆心必须落在视口内，亮核才露得出来。
   ============================================================ */
.nebula { position: absolute; inset: -20%; will-change: transform; }

.cloud {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
}
/* 每团都用 6~7 个停靠点：0~8% 是亮核，随后快速衰减成暗晕。
   这种「陡开头 + 长尾」的形状才像真实星云，均匀渐变会糊成一坨灰。 */
/* 青色气体：左上角的主光源，圆心压在 26vw / 18vw 附近。
   为什么用「椭圆 + 偏心亮结」而不是正圆：正圆的等值线是一圈圈同心圆，
   深色底上会看出一个明确的「球」；椭圆 + 一个偏心的亮结，轮廓就散了，
   读起来才像气体。 */
.cloud.c1 {
  width: 48vw; height: 48vw; left: -2vw; top: -8vw;
  background:
    radial-gradient(ellipse 30% 22% at 62% 40%,
      rgba(170, 252, 255, 0.34) 0%,
      rgba(30, 214, 255, 0.18) 34%,
      rgba(0, 150, 235, 0.05) 62%,
      rgba(6, 96, 200, 0) 84%),
    radial-gradient(ellipse 72% 64% at 50% 50%,
      rgba(206, 253, 255, 0.62) 0%,
      rgba(60, 230, 255, 0.54) 6%,
      rgba(0, 188, 250, 0.35) 15%,
      rgba(4, 130, 230, 0.165) 29%,
      rgba(8, 82, 192, 0.055) 46%,
      rgba(10, 52, 150, 0.014) 66%,
      rgba(8, 34, 110, 0) 84%);
  animation: cloudA 34s ease-in-out infinite alternate;
}
/* 紫罗兰：右上角，和青色形成冷暖对冲 */
.cloud.c2 {
  width: 42vw; height: 42vw; right: -4vw; top: 8vh;
  background:
    radial-gradient(ellipse 26% 24% at 42% 44%,
      rgba(220, 204, 255, 0.32) 0%,
      rgba(140, 96, 255, 0.16) 36%,
      rgba(98, 52, 235, 0.045) 64%,
      rgba(80, 40, 210, 0) 84%),
    radial-gradient(ellipse 70% 70% at 50% 50%,
      rgba(212, 194, 255, 0.58) 0%,
      rgba(156, 116, 255, 0.50) 7%,
      rgba(118, 74, 250, 0.31) 17%,
      rgba(90, 46, 228, 0.14) 31%,
      rgba(62, 26, 182, 0.048) 48%,
      rgba(44, 16, 140, 0.012) 68%,
      rgba(30, 10, 110, 0) 86%);
  animation: cloudB 44s ease-in-out infinite alternate;
}
/* 品红：画面下方偏右，负责「暖」的另一半 */
.cloud.c3 {
  width: 40vw; height: 40vw; left: 44vw; bottom: -4vw;
  background:
    radial-gradient(ellipse 28% 22% at 46% 46%,
      rgba(255, 206, 252, 0.30) 0%,
      rgba(246, 86, 226, 0.14) 36%,
      rgba(196, 32, 186, 0.04) 64%,
      rgba(150, 20, 150, 0) 84%),
    radial-gradient(ellipse 74% 62% at 50% 50%,
      rgba(255, 214, 252, 0.50) 0%,
      rgba(250, 118, 236, 0.42) 7%,
      rgba(214, 54, 202, 0.24) 19%,
      rgba(156, 24, 170, 0.08) 36%,
      rgba(104, 12, 134, 0.02) 56%,
      rgba(70, 6, 100, 0.005) 74%,
      rgba(56, 4, 84, 0) 88%);
  animation: cloudC 38s ease-in-out infinite alternate;
}
/* 深蓝：左下角，压住重心，让青色不孤单 */
.cloud.c4 {
  width: 36vw; height: 36vw; left: 6vw; bottom: -8vh;
  background:
    radial-gradient(ellipse 70% 66% at 50% 50%,
      rgba(160, 212, 255, 0.44) 0%,
      rgba(44, 124, 250, 0.34) 9%,
      rgba(20, 74, 214, 0.15) 23%,
      rgba(14, 44, 168, 0.05) 42%,
      rgba(10, 26, 120, 0.012) 62%,
      rgba(8, 18, 90, 0) 82%);
  animation: cloudB 52s ease-in-out infinite alternate-reverse;
}
@keyframes cloudA {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(5vw, 4vh, 0) scale(1.14); }
}
@keyframes cloudB {
  from { transform: translate3d(0, 0, 0) scale(1.06); }
  to   { transform: translate3d(-6vw, -3vh, 0) scale(.92); }
}
@keyframes cloudC {
  from { transform: translate3d(0, 0, 0) scale(.96); }
  to   { transform: translate3d(-4vw, -6vh, 0) scale(1.12); }
}


/* ③ 银河：一条斜向光带，三层叠出「体」
   ------------------------------------------------------------
   上一版是「横向渐变 + blur」，因为线性渐变只在一个方向上柔化，
   上下是硬边；后来换成椭圆径向渐变，两个方向都自带衰减。
   但只叠一层的结果是一道灰雾——所以现在叠三层：
     外晕（宽、极淡） → 主体（冷紫白） → 亮核（偏暖）
   再加一层 34° 的交叉带，让「盘面」有体积而不是一张纸。 */
.band {
  position: absolute;
  left: -40%; right: -40%;
  top: 44%;
  height: 58vh;
  transform: translateY(-50%) rotate(-16deg);
  background:
    radial-gradient(ellipse 19% 22% at 54% 52%,
      rgba(255, 240, 222, .20) 0%,
      rgba(255, 226, 210, .115) 32%,
      rgba(226, 214, 255, .035) 62%,
      rgba(214, 208, 255, 0) 86%),
    radial-gradient(ellipse 46% 30% at 50% 50%,
      rgba(196, 208, 255, .15) 0%,
      rgba(170, 182, 255, .092) 34%,
      rgba(150, 162, 240, .032) 62%,
      rgba(140, 152, 235, 0) 84%),
    radial-gradient(ellipse 86% 46% at 50% 50%,
      rgba(128, 146, 235, .046) 0%,
      rgba(120, 136, 225, .026) 44%,
      rgba(110, 126, 215, .008) 70%,
      rgba(110, 126, 215, 0) 88%);
}
/* 尘带：银河里那道暗纹。
   只有亮没有暗，带子就是一团雾；插一道「比背景更黑」的弧，
   前后关系立刻出来 —— 这是把星云画得有体积感最省事的一招。 */
.band::before {
  content: "";
  position: absolute;
  inset: 0;
  transform: rotate(-6deg);
  background: radial-gradient(ellipse 64% 13% at 50% 46%,
    rgba(3, 5, 15, .52) 0%,
    rgba(3, 5, 15, .3) 42%,
    rgba(3, 5, 15, .07) 66%,
    rgba(3, 5, 15, 0) 82%);
}
.band::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: rotate(34deg);
  background: radial-gradient(ellipse 30% 26% at 46% 50%,
    rgba(160, 178, 255, .07) 0%,
    rgba(150, 168, 245, .038) 40%,
    rgba(140, 158, 235, 0) 72%);
}

/* ⑥ 前景失焦光斑：景深的关键，星星不再像贴在一张纸上。
   做小、做淡、带一点冷色，才像镜头虚化而不是一块糊掉的灰。 */
.bokeh { position: absolute; inset: 0; }
.bokeh i {
  position: absolute;
  border-radius: 50%;
  /* 渐变自己就是虚的，原来那层 blur(1px) 对观感没贡献，
     却让 4 个带动画的圆各自多一次滤镜，删掉。 */
  background: radial-gradient(closest-side,
    rgba(226, 240, 255, .24) 0%,
    rgba(190, 215, 255, .085) 44%,
    rgba(170, 205, 255, .02) 64%,
    rgba(170, 205, 255, 0) 78%);
  animation: bokehFloat 26s ease-in-out infinite alternate;
}
/* 后两个换成暖色/紫色，光斑全冷色会很「数字」，混一点温度才像镜头 */
.bokeh i:nth-child(5),
.bokeh i:nth-child(6) {
  background: radial-gradient(closest-side,
    rgba(255, 226, 196, .22) 0%,
    rgba(214, 168, 255, .09) 46%,
    rgba(200, 150, 250, .02) 66%,
    rgba(200, 150, 250, 0) 78%);
}
.bokeh i:nth-child(1) { width: 96px;  height: 96px;  left: 9%;  top: 17%; opacity: .5;  animation-delay: -3s; }
.bokeh i:nth-child(2) { width: 58px;  height: 58px;  left: 80%; top: 30%; opacity: .34; animation-delay: -9s; }
.bokeh i:nth-child(3) { width: 132px; height: 132px; left: 65%; top: 72%; opacity: .24; animation-delay: -15s; }
.bokeh i:nth-child(4) { width: 42px;  height: 42px;  left: 25%; top: 76%; opacity: .4;  animation-delay: -21s; }
.bokeh i:nth-child(5) { width: 74px;  height: 74px;  left: 45%; top: 12%; opacity: .22; animation-delay: -6s; }
.bokeh i:nth-child(6) { width: 34px;  height: 34px;  left: 88%; top: 64%; opacity: .32; animation-delay: -12s; }
@keyframes bokehFloat {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(2vw, -3vh, 0); }
}

/* ⑦ 暗角：四周压黑，同时补一道顶部渐隐给导航让位 */
.vignette {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(2, 4, 12, .52) 0%, rgba(2, 4, 12, 0) 16%),
    radial-gradient(ellipse 74% 64% at 50% 42%,
      rgba(2, 3, 9, 0) 26%,
      rgba(2, 3, 9, .5) 72%,
      rgba(2, 3, 9, .8) 100%);
}

/* 手机上省一点：少一团星云、少两个光斑。
   同时把星云按屏幕宽度放大 —— 桌面端 48vw 有 700px，到了手机上
   只有 200px，色块会缩成一个小点，整片背景就变回纯黑了。 */
@media (max-width: 720px) {
  .cloud.c1 { width: 86vw; height: 86vw; left: -14vw; top: -14vw; }
  .cloud.c2 { width: 78vw; height: 78vw; right: -16vw; top: 16vh; }
  .cloud.c3 { width: 84vw; height: 84vw; left: 14vw;  bottom: -10vw; }
  .cloud.c4,
  .bokeh i:nth-child(3),
  .bokeh i:nth-child(6) { display: none; }
}

/* 内容压在星空之上 */
.page { position: relative; z-index: 1; }

/* ============================================================
   03. 自定义光标（一颗发光的星）
   ============================================================ */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0;
  pointer-events: none; z-index: 9999;
  border-radius: 50%;
  opacity: 0;
}
.cursor-dot {
  width: 5px; height: 5px;
  background: #fff;
  box-shadow: 0 0 10px #fff, 0 0 22px var(--c1);
}
.cursor-ring {
  width: 30px; height: 30px;
  border: 1px solid rgba(167, 139, 250, .55);
  transition: width .25s var(--ease), height .25s var(--ease),
              background-color .25s, border-color .25s, opacity .3s;
}
.cursor-ring.is-active {
  width: 58px; height: 58px;
  background: rgba(167, 139, 250, .12);
  border-color: transparent;
}
body.has-cursor .cursor-dot,
body.has-cursor .cursor-ring { opacity: 1; }
@media (hover: hover) and (pointer: fine) {
  body.has-cursor, body.has-cursor * { cursor: none; }
}

/* ---------- 04. 阅读进度条 ---------- */
/* 进度条：用 transform 缩放代替改 width。
   改 width 每帧都要重新布局 + 重绘；scaleX 只走合成，几乎不要钱。 */
.progress {
  position: fixed; top: 0; left: 0;
  height: 2px; width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--c1), var(--c2), var(--c3));
  box-shadow: 0 0 12px var(--c2);
  z-index: 1000;
  will-change: transform;
}

/* ============================================================
   05. 导航
   ============================================================ */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 900;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px;
  padding: 18px clamp(16px, 4vw, 46px);
  border-bottom: 1px solid transparent;
  transition: background .4s var(--ease), border-color .4s, padding .4s var(--ease);
}
/* 吸顶时不再用 backdrop-filter：导航是「整屏宽 + fixed + 压着滚动内容」，
   这三条凑在一起，模糊就要跟着每一帧滚动重新采样一次。
   换成足够实的高透明度底色，看起来一样，合成器当普通图层走。 */
.nav.is-stuck {
  padding-block: 12px;
  background: rgba(5, 8, 19, .88);
  border-bottom-color: var(--line);
}

.logo {
  display: flex; align-items: center; gap: 9px;
  font-size: 14px; font-weight: 650;
  letter-spacing: .16em;
}
.logo em {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 14px #fff, 0 0 26px var(--c1);
  animation: twinkle 3.4s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .45; transform: scale(.72); }
}
.logo small { color: var(--muted); font-weight: 400; letter-spacing: .1em; }

.nav-links { display: flex; gap: 2px; }
.nav-links a {
  position: relative;
  padding: 8px 14px;
  font-size: 14px;
  color: var(--muted);
  border-radius: 999px;
  transition: color .3s;
}
.nav-links a::after {
  content: "";
  position: absolute; left: 50%; bottom: 3px;
  width: 0; height: 2px;
  border-radius: 2px;
  background: var(--c1);
  box-shadow: 0 0 8px var(--c1);
  transform: translateX(-50%);
  transition: width .3s var(--ease);
}
.nav-links a:hover, .nav-links a.is-active { color: var(--text); }
.nav-links a:hover::after, .nav-links a.is-active::after { width: 18px; }

@media (max-width: 760px) { .nav-links { display: none; } }

/* ============================================================
   06. 首屏
   ============================================================ */
.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 130px 24px 90px;
  position: relative;
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 12px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 17px;
  margin-bottom: 30px;
  background: rgba(10, 16, 34, .62);
}
.eyebrow b {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--c1);
  box-shadow: 0 0 10px var(--c1);
  animation: twinkle 2.2s ease-in-out infinite;
}

.hero-title {
  font-size: clamp(2.4rem, 8.4vw, 5.2rem);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -.02em;
  margin-bottom: 24px;
}

/* 逐字入场 + 连续渐变（原理见 JS 第 5 步）
   每个字是独立盒子，各自画渐变就会「一字一色」。
   所以把渐变宽度设成整行宽度，再用负 background-position
   把每个字该露出的那一段挪过来，视觉上拼成一条完整渐变。 */
.hero-title .char {
  display: inline-block;
  opacity: 0;
  transform: translateY(36px);
  animation: charIn .95s var(--ease) forwards;
  background-image: linear-gradient(100deg,
    #f2f6ff 0%, var(--c1) 30%, var(--c2) 58%, var(--c3) 78%, #f2f6ff 100%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
@keyframes charIn {
  to { opacity: 1; transform: translateY(0); }
}

.hero-sub {
  font-size: clamp(1.05rem, 2.5vw, 1.32rem);
  color: var(--text);
  opacity: .88;
  letter-spacing: .08em;
  min-height: 1.9em;
  margin-bottom: 26px;
  text-wrap: balance;
}
.hero-sub #typed { font-weight: 500; }
.caret {
  display: inline-block;
  width: 2px; height: 1.02em;
  background: var(--c1);
  vertical-align: -.15em;
  margin-left: 3px;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-meta {
  display: flex; flex-wrap: wrap; gap: 26px; justify-content: center;
  font-size: 13px; color: var(--muted);
  margin-bottom: 40px;
}
.hero-meta > div b {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 30px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  transition: transform .25s var(--ease), box-shadow .3s, background .3s, border-color .3s;
}
.btn-primary {
  color: #05080f;
  background: linear-gradient(120deg, #ffffff, var(--c1) 55%, var(--c2));
  box-shadow: 0 10px 34px -14px rgba(125, 211, 252, .8);
}
.btn-primary:hover { box-shadow: 0 16px 46px -12px rgba(167, 139, 250, .9); }
.btn-ghost {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(10, 16, 34, .55);
}
.btn-ghost:hover {
  border-color: rgba(125, 211, 252, .6);
  background: rgba(125, 211, 252, .1);
}

.scroll-hint {
  position: absolute;
  left: 50%; bottom: 26px;
  transform: translateX(-50%);
  font-size: 10px; letter-spacing: .34em;
  color: rgba(136, 147, 184, .8);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  animation: floatY 2.6s ease-in-out infinite;
}
.scroll-hint::after {
  content: "";
  width: 1px; height: 40px;
  background: linear-gradient(rgba(125, 211, 252, .9), transparent);
}
@keyframes floatY {
  0%, 100% { transform: translate(-50%, 0); }
  50%      { transform: translate(-50%, 9px); }
}

/* ============================================================
   07. 通用区块 + 进场动画
   ============================================================ */
section[id] { scroll-margin-top: 90px; }
.section { padding: clamp(64px, 9vw, 118px) 0; }

.section-head { margin-bottom: 46px; }
.section-tag {
  display: block;
  font-size: 11.5px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--c1);
  margin-bottom: 12px;
}
.section-title {
  font-size: clamp(1.6rem, 4.2vw, 2.6rem);
  font-weight: 750;
  letter-spacing: -.015em;
  line-height: 1.25;
}
.section-desc { margin-top: 12px; color: var(--muted); font-size: 15px; max-width: 58ch; }

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .85s var(--ease), transform .85s var(--ease);
  transition-delay: var(--d, 0s);
}
.reveal.in { opacity: 1; transform: none; }

/* ============================================================
   07.5 题记 —— 一句歌词的留白
   ------------------------------------------------------------
   刻意换成衬线字体 + 大量留白，把阅读节奏放慢，
   让它在首屏和文章之间做一次「呼吸」。
   ============================================================ */
.quote {
  position: relative;
  text-align: center;
  padding: clamp(80px, 12vw, 140px) 24px;
  overflow: hidden;
}
/* 身后一团极淡的光，让文字像浮在星云里 */
.quote::before {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: min(820px, 92vw);
  height: 380px;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at center,
    rgba(125, 211, 252, .10), rgba(167, 139, 250, .07) 45%, transparent 72%);
  filter: blur(12px);
  pointer-events: none;
}

.quote-mark {
  display: block;
  font-family: Georgia, "Songti SC", "Noto Serif SC", serif;
  font-size: 44px;
  line-height: 1;
  color: var(--c2);
  opacity: .55;
  margin-bottom: 16px;
}

.quote-line {
  position: relative;
  font-family: "Songti SC", "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
  font-size: clamp(1.15rem, 3vw, 1.85rem);
  font-weight: 500;
  line-height: 2;
  letter-spacing: .1em;
  color: var(--text);
}
.quote-line + .quote-line { margin-top: 2px; }

/* 最后半句做成一条缓慢流动的渐变，和标题呼应 */
.quote-line em {
  font-style: normal;
  font-weight: 600;
  background: linear-gradient(100deg, #22d3ee 0%, #8b5cf6 48%, #f472b6 92%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: quoteFlow 9s linear infinite alternate;
}
@keyframes quoteFlow {
  to { background-position: 200% center; }
}

/* 落款：两侧用细线收住，像排版里的分隔符 */
.quote-cite {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-top: 26px;
  font-size: 13px;
  letter-spacing: .16em;
  color: var(--muted);
}
.quote-cite::before,
.quote-cite::after {
  content: "";
  width: 46px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(150, 175, 255, .5), transparent);
}

/* ============================================================
   08. 头条文章（大卡片）
   ============================================================ */
.featured {
  display: block;
  position: relative;
  padding: clamp(26px, 4vw, 44px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
  transition: border-color .4s, transform .4s var(--ease), box-shadow .4s;
  margin-bottom: 18px;
}
.featured::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(600px circle at var(--mx, 20%) var(--my, 0%),
              rgba(125, 211, 252, .10), transparent 60%);
  opacity: 0;
  transition: opacity .45s;
  pointer-events: none;
}
.featured:hover::before { opacity: 1; }
.featured:hover {
  border-color: rgba(125, 211, 252, .38);
  transform: translateY(-4px);
  box-shadow: 0 30px 70px -40px rgba(125, 211, 252, .55);
}
.featured-label {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--c3);
  margin-bottom: 18px;
}
.featured-label::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--c3); box-shadow: 0 0 9px var(--c3);
}
.featured h2 {
  font-size: clamp(1.35rem, 3.2vw, 2rem);
  font-weight: 720;
  line-height: 1.35;
  letter-spacing: -.01em;
  margin-bottom: 14px;
  max-width: 26ch;
}
.featured p { color: var(--muted); font-size: 15px; max-width: 62ch; }

/* ---------- 文章元信息 ---------- */
.meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin-top: 22px;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); opacity: .6; }
.tag {
  font-size: 11.5px;
  letter-spacing: .05em;
  padding: 3px 11px;
  border-radius: 999px;
  color: var(--c1);
  border: 1px solid rgba(125, 211, 252, .3);
  background: rgba(125, 211, 252, .08);
}
.tag.purple { color: var(--c2); border-color: rgba(167, 139, 250, .3); background: rgba(167, 139, 250, .08); }

/* ============================================================
   09. 文章列表
   ============================================================ */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
.post {
  display: flex; flex-direction: column;
  padding: 26px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  position: relative;
  overflow: hidden;
  transition: border-color .4s, transform .4s var(--ease), box-shadow .4s;
}
.post::after {
  content: "";
  position: absolute; left: 0; bottom: 0;
  height: 2px; width: 0;
  background: linear-gradient(90deg, var(--c1), var(--c2));
  transition: width .45s var(--ease);
}
.post:hover {
  border-color: rgba(167, 139, 250, .36);
  transform: translateY(-5px);
  box-shadow: 0 26px 60px -38px rgba(167, 139, 250, .7);
}
.post:hover::after { width: 100%; }

.post-date {
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-bottom: 14px;
}
.post h3 {
  font-size: 16.5px;
  font-weight: 650;
  line-height: 1.5;
  margin-bottom: 10px;
  letter-spacing: -.005em;
}
.post p {
  font-size: 13.8px;
  color: var(--muted);
  line-height: 1.75;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post .meta { margin-top: 18px; }

.more-wrap { text-align: center; margin-top: 44px; }

/* ============================================================
   10. 关于
   ============================================================ */
.about {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: clamp(30px, 6vw, 70px);
  align-items: start;
}
.about-text p { color: var(--muted); font-size: 15.2px; margin-bottom: 16px; }
.about-text strong { color: var(--text); font-weight: 600; }

/* 「最喜欢的一句话」：左侧渐变小竖线 + 衬线体，
   在一段无衬线正文里单独拎出来，读起来像书签。 */
.about-text .fav-quote {
  position: relative;
  margin: 28px 0;
  padding: 2px 0 2px 18px;
  color: var(--text);
  font-family: "Songti SC", "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
  font-size: 16px;
  line-height: 1.95;
  letter-spacing: .05em;
}
.about-text .fav-quote::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--c1), var(--c2) 55%, var(--c3));
}

.chips { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 22px; }
.chips span {
  font-size: 12.5px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(10, 16, 34, .5);
  transition: color .3s, border-color .3s, transform .3s var(--ease);
}
.chips span:hover {
  color: var(--c1);
  border-color: rgba(125, 211, 252, .45);
  transform: translateY(-2px);
}

.stat-list { display: grid; gap: 12px; }
.stat-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}
.stat-row b {
  font-size: 22px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(120deg, var(--c1), var(--c2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-row em { font-style: normal; font-size: 13.5px; color: var(--muted); }

@media (max-width: 860px) { .about { grid-template-columns: 1fr; } }

/* ============================================================
   11. 联系 · QQ 二维码
   ------------------------------------------------------------
   注意：二维码图片必须自带「静区」（四周空白），所以画框填图时
   用白底 + 内边距，不要让它直接贴在深色背景上，否则手机扫不出来。
   ============================================================ */
.contact {
  text-align: center;
  padding: clamp(70px, 10vw, 130px) 0;
}
.contact h2 {
  font-size: clamp(1.7rem, 5vw, 2.7rem);
  font-weight: 780;
  letter-spacing: -.02em;
  line-height: 1.22;
  margin: 14px 0 12px;
}
.contact h2 em {
  font-style: normal;
  background: linear-gradient(110deg, #22d3ee, #8b5cf6 58%, #f472b6);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.contact .lead { color: var(--muted); margin-bottom: clamp(32px, 5vw, 48px); }

.qr-card {
  position: relative;
  display: inline-flex; flex-direction: column; align-items: center;
  gap: 16px;
  padding: 20px 22px 18px;
  border-radius: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  transition: transform .55s var(--ease), box-shadow .55s;
}
/* 渐变描边：用 mask 切出一圈 1px 的线，比 border-image 好控 */
.qr-card::before {
  content: "";
  position: absolute; inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(150deg, rgba(34,211,238,.55), transparent 42% 58%, rgba(244,114,182,.45));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask-composite: exclude;
  opacity: .5;
  transition: opacity .55s;
  pointer-events: none;
}
.qr-card:hover { transform: translateY(-5px); box-shadow: 0 24px 64px -22px rgba(34, 211, 238, .32); }
.qr-card:hover::before { opacity: 1; }

/* 画框：有图时白底（保证静区），没图时是虚线占位 */
.qr-frame {
  position: relative;
  width: clamp(168px, 46vw, 200px);
  aspect-ratio: 1 / 1;
  display: grid; place-items: center;
  border-radius: 16px;
  background: rgba(255, 255, 255, .035);
  border: 1px dashed rgba(125, 211, 252, .34);
  overflow: hidden;
  transition: background .4s, border-color .4s;
}
.qr-frame.has-img {
  background: #fff;
  border: 1px solid #fff;
  padding: 14px;
  aspect-ratio: auto;                   /* Allow non-square uploaded images */
  box-shadow: 0 0 0 1px rgba(125, 211, 252, .18), 0 8px 30px -12px rgba(34, 211, 238, .45);
}
.qr-frame img {
  display: block;
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  border-radius: 6px;
}

/* 占位内容（还没配图时） */
.qr-empty {
  display: grid; gap: 8px; place-items: center;
  padding: 10px 12px;
  text-align: center;
}
.qr-empty svg { width: 40px; height: 40px; opacity: .45; color: #7dd3fc; }
.qr-empty b { font-size: 12.6px; font-weight: 600; color: rgba(226, 234, 255, .82); }
.qr-empty small {
  font-size: 10.8px; line-height: 1.55;
  color: rgba(160, 176, 210, .78);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.qr-meta { display: grid; gap: 5px; justify-items: center; }
.qr-num {
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px; font-weight: 600;
  letter-spacing: .05em;
  color: var(--text);
  background: none; border: 0; border-radius: 8px;
  padding: 3px 8px;
  cursor: pointer;
  transition: color .3s, background .3s;
}
.qr-num:hover { color: #7dd3fc; background: rgba(125, 211, 252, .09); }
.qr-num.is-copied { color: #4ade80; }
.qr-tip { font-size: 12px; letter-spacing: .04em; color: var(--muted); }

.contact-note {
  margin-top: 26px;
  font-size: 12.4px;
  color: rgba(136, 147, 184, .8);
}

/* ---------- 12. 页脚 ---------- */
footer {
  position: relative; z-index: 1;
  border-top: 1px solid var(--line);
  padding: clamp(42px, 6vw, 64px) 0 20px;
  /* 底部压一层极淡的暗色，让页脚从星空里「沉」下去 */
  background: linear-gradient(180deg, transparent, rgba(4, 7, 18, .55));
}

.foot-grid {
  display: grid;
  grid-template-columns: 1.7fr .95fr .7fr;
  gap: 38px 44px;
  padding-bottom: clamp(26px, 4vw, 40px);
}

/* 左：品牌 + 一句话说明 */
.foot-brand .logo { margin-bottom: 14px; }
.foot-brand p {
  max-width: 32ch;
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
}

/* 中右：分栏列表 */
.foot-col h4 {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(136, 147, 184, .9);
  margin-bottom: 16px;
}
.foot-col ul { display: grid; gap: 11px; }
.foot-col li {
  display: flex; align-items: center; gap: 9px;
  font-size: 13.2px;
  color: var(--muted);
}
.foot-col li > svg {
  width: 15px; height: 15px;
  flex: none;
  opacity: .65;
  transition: opacity .3s;
}
.foot-col li:hover > svg { opacity: 1; }
/* 没有图标的列，留出同样的 15px + 9px 图标位，两列文字才对得上 */
.foot-col ul.is-plain li { padding-left: 24px; }
.foot-col a {
  color: var(--muted);
  position: relative;
  word-break: break-all;
  transition: color .3s;
}
/* 悬停时从左往右长出一条渐变下划线 */
.foot-col a::after {
  content: "";
  position: absolute; left: 0; bottom: -2px;
  width: 100%; height: 1px;
  background: linear-gradient(90deg, var(--c1), var(--c3));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .45s var(--ease);
}
.foot-col a:hover { color: var(--text); }
.foot-col a:hover::after { transform: scaleX(1); }

/* 复制邮箱的小按钮 */
.copy-btn {
  flex: none;
  display: grid; place-items: center;
  width: 22px; height: 22px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: rgba(136, 147, 184, .7);
  cursor: pointer;
  transition: color .3s, background .3s, border-color .3s;
}
.copy-btn:hover {
  color: var(--c1);
  background: rgba(125, 211, 252, .1);
  border-color: rgba(125, 211, 252, .28);
}
.copy-btn svg { width: 13px; height: 13px; opacity: 1; }
.copy-btn.is-copied {
  color: #4ade80;
  background: rgba(74, 222, 128, .1);
  border-color: rgba(74, 222, 128, .3);
}

/* 底栏：版权 + 签名 */
.foot-bottom {
  display: flex; flex-wrap: wrap; gap: 8px 20px;
  justify-content: space-between; align-items: center;
  padding-top: 18px;
  border-top: 1px solid rgba(120, 140, 190, .13);
  font-size: 12.2px;
  color: rgba(136, 147, 184, .82);
}
.foot-made { letter-spacing: .04em; }
.foot-made em { font-style: normal; color: #7dd3fc; }

@media (max-width: 760px) {
  .foot-grid { grid-template-columns: 1fr 1fr; gap: 30px 28px; }
  .foot-brand { grid-column: 1 / -1; }
  .foot-brand p { max-width: 44ch; }
}
@media (max-width: 520px) {
  .foot-grid { grid-template-columns: 1fr; gap: 26px; }
}

/* ---------- 13. 低动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
  .hero-title .char { opacity: 1; transform: none; }
}

/* ============================================================
   14. 文章详情页（post.html）
   ------------------------------------------------------------
   正文宽度压在 720px：超过这个宽度，中文长句的换行会让人
   找不到下一行的起点（这叫「行长」，typography 里最影响
   阅读效率的参数之一）。
   ============================================================ */
.article-wrap {
  padding: clamp(96px, 12vw, 150px) 0 clamp(60px, 8vw, 100px);
}
.article {
  max-width: 720px;
  margin-inline: auto;
}

/* 返回上一页的小链接 */
.back-link {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 30px;
  transition: color .3s, gap .3s;
}
.back-link:hover { color: var(--c1); gap: 11px; }

/* 标题区 */
.article-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  font-size: 12.6px;
  color: var(--muted);
  margin-bottom: 16px;
  font-variant-numeric: tabular-nums;
}
.article-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); opacity: .6; }

.article h1 {
  font-size: clamp(1.75rem, 4.6vw, 2.6rem);
  font-weight: 780;
  line-height: 1.32;
  letter-spacing: -.015em;
  margin-bottom: 22px;
  background: linear-gradient(112deg, #ffffff 12%, #b8e4ff 48%, #c4b5fd 82%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.article .rule {
  height: 1px;
  margin-bottom: 40px;
  background: linear-gradient(90deg, rgba(125,211,252,.5), rgba(167,139,250,.25), transparent);
}

/* ---------- 正文排版 ---------- */
.prose {
  font-size: 16.2px;
  line-height: 1.95;
  color: rgba(224, 232, 255, .9);
}
.prose > *:first-child { margin-top: 0; }
.prose p { margin-bottom: 20px; }
.prose h2 {
  font-size: 1.32rem;
  font-weight: 720;
  color: #fff;
  margin: 46px 0 16px;
  padding-left: 14px;
  position: relative;
  letter-spacing: -.01em;
}
.prose h2::before {
  content: "";
  position: absolute; left: 0; top: .38em;
  width: 3px; height: .95em;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--c1), var(--c2));
}
.prose h3 {
  font-size: 1.06rem;
  font-weight: 650;
  color: #fff;
  margin: 30px 0 12px;
}
.prose strong { color: #fff; font-weight: 620; }
.prose ul, .prose ol { margin: 0 0 20px; padding-left: 1.35em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin-bottom: 9px; }
.prose li::marker { color: var(--c1); }
.prose a { color: var(--c1); border-bottom: 1px solid rgba(125,211,252,.4); }
.prose blockquote {
  margin: 26px 0;
  padding: 14px 18px 14px 20px;
  border-left: 2px solid transparent;
  border-image: linear-gradient(180deg, var(--c1), var(--c2)) 1;
  background: rgba(125, 211, 252, .05);
  border-radius: 0 10px 10px 0;
  color: rgba(196, 210, 240, .92);
  font-size: 15.4px;
}
.prose blockquote p:last-child { margin-bottom: 0; }

.prose pre {
  margin: 24px 0;
  padding: 18px 20px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(7, 11, 24, .78);
  overflow-x: auto;
  line-height: 1.7;
}
.prose pre code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.4px;
  color: #cfe3ff;
  background: none;
  padding: 0;
}
/* 行内代码：不能影响 pre 里的代码块 */
.prose :not(pre) > code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88em;
  padding: 2px 6px;
  border-radius: 6px;
  color: #7dd3fc;
  background: rgba(125, 211, 252, .1);
  border: 1px solid rgba(125, 211, 252, .16);
}

/* ---------- 文末：上一篇 / 下一篇 ---------- */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 64px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}
.post-nav a {
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-soft);
  transition: border-color .35s, transform .35s var(--ease), background .35s;
}
.post-nav a:hover {
  border-color: rgba(125, 211, 252, .4);
  transform: translateY(-3px);
}
.post-nav small { font-size: 11.5px; letter-spacing: .12em; color: var(--muted); }
.post-nav span { font-size: 14px; line-height: 1.5; color: var(--text); }
.post-nav .pn-next { text-align: right; align-items: flex-end; }
.post-nav .pn-empty { visibility: hidden; }

@media (max-width: 640px) {
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .pn-next { text-align: left; align-items: flex-start; }
}

/* 找不到文章时的提示 */
.post-missing {
  padding: 40px 0 20px;
  color: var(--muted);
}
.post-missing h1 { -webkit-text-fill-color: currentColor; background: none; color: #fff; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
