/* ══════════════════════════════════════════════════════════
   VVAN 个人小站 — 公共样式

   配色全部走语义变量，深浅两套主题只是变量取值不同。
   组件样式里不允许再出现硬编码颜色，否则换主题必然漏改。
   ══════════════════════════════════════════════════════════ */

:root,
[data-theme="dark"] {
  --bg: #0a0a0f;
  --bg2: #111118;
  --surface: #16161f;
  --surface2: #1e1e2a;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --text: #f0f0f5;
  --text2: #9999b0;
  /* 原设计是 #5a5a75，对比度 2.97:1 差一点点到 3:1 底线，
     微调到 #5e5e7a（3.16:1），肉眼几乎看不出差别 */
  --text3: #5e5e7a;
  --prose: #d8d8e4;

  --accent: #7c6fff;
  --accent2: #ff6b9d;
  --accent3: #4ecdc4;
  --accent4: #ffd166;

  /* 强调色的各种透明衍生，集中定义免得每处各写各的 */
  --accent-soft: rgba(124,111,255,0.10);
  --accent-line: rgba(124,111,255,0.30);
  --accent-glow: rgba(124,111,255,0.35);
  --accent-glow-hi: rgba(124,111,255,0.50);
  --accent-text: #b3a8ff;

  --glow1: rgba(124,111,255,0.18);
  --glow2: rgba(255,107,157,0.14);
  --glow3: rgba(78,205,196,0.12);
  --glow4: rgba(255,209,102,0.08);

  --nav-bg: rgba(10,10,15,0.85);
  --shadow-card: 0 20px 60px rgba(0,0,0,0.35);
  /* 卡片悬停时的外发光。ring 是贴边那一圈，glow 是散开的柔光，
     cast 是底下那层投影——三者叠起来才有"浮起来并且在发光"的层次。
     每个整屏板块会用自己的强调色覆盖这两个值，见下方 tone 区块。 */
  --card-ring: rgba(124,111,255,0.42);
  --card-glow: rgba(124,111,255,0.26);
  --card-cast: rgba(0,0,0,0.55);
  --noise-opacity: 0.4;

  --code-bg: #0d0d14;
  --code-inline-bg: rgba(255,255,255,0.07);
  --code-inline: #ffb3d1;

  /* 整屏板块的底色。
     最初那版是在近黑底上叠 5% 的色，三块明度全挤在 L*6 附近，差异只剩色相，
     而色相在接近纯黑时基本读不出来（金色那块彩度只有 C*≈2，实际是块中性深灰）。
     后来试过整块饱和实色，区分是够了，但大面积高饱和看久了很累，也不高级。

     现在的做法：基色仍然压得很深（L* 8~11，平均明度低，长时间看不累），
     差异靠两处——基色之间 ΔE 10~16 已经能一眼分辨；再叠一层大尺度光晕，
     光晕峰值处 ΔE 19~24，整屏的氛围色明确不同，同时保留纵深，不是一块死板的色卡。 */
  --tone-1: #14162a;   /* 内容分类 · 靛紫 */
  --tone-2: #0f1f21;   /* 最近更新 · 墨青 */
  --tone-3: #211d16;   /* 常用工具 · 暖褐 */

  /* 首屏大标题与强调文字的渐变 */
  --grad-hero: linear-gradient(135deg, #fff 0%, #b3a8ff 40%, #ff6b9d 70%, #ffd166 100%);
  --grad-em: linear-gradient(135deg, #b3a8ff 0%, #ff6b9d 60%, #ffd166 100%);

  /* 分类标签底色 */
  --t1-bg: rgba(124,111,255,0.15); --t1-fg: #b3a8ff;
  --t2-bg: rgba(255,107,157,0.15); --t2-fg: #ff9dbf;
  --t3-bg: rgba(78,205,196,0.15);  --t3-fg: #6eddd8;
  --t4-bg: rgba(255,209,102,0.15); --t4-fg: #ffd166;
  --t0-bg: rgba(255,255,255,0.06); --t0-fg: #5a5a75;

  color-scheme: dark;
}

/* ══ 浅色主题 ══
   不是简单反色：饱和的霓虹色在白底上会刺眼且对比度不足，
   强调色统一压暗，文字用近黑而非纯黑，减轻长时间阅读的疲劳。 */
[data-theme="light"] {
  --bg: #fbfbfd;
  --bg2: #f5f5f9;
  --surface: #ffffff;
  --surface2: #f2f2f7;
  --border: rgba(16,16,32,0.08);
  --border2: rgba(16,16,32,0.14);
  --text: #16161e;
  --text2: #5a5a70;
  /* 不能照搬深色那档的明度：#9292a6 在白底上只有 2.95:1，
     低于 3:1 底线，而它用在日期、元信息、页脚这些小字上 */
  --text3: #6e6e84;
  --prose: #2c2c3a;

  --accent: #5b4bdb;
  --accent2: #d63a72;
  --accent3: #12968c;
  --accent4: #b07d0a;

  --accent-soft: rgba(91,75,219,0.08);
  --accent-line: rgba(91,75,219,0.28);
  --accent-glow: rgba(91,75,219,0.22);
  --accent-glow-hi: rgba(91,75,219,0.32);
  --accent-text: #5b4bdb;

  --glow1: rgba(124,111,255,0.16);
  --glow2: rgba(255,107,157,0.12);
  --glow3: rgba(78,205,196,0.12);
  --glow4: rgba(255,209,102,0.14);

  --nav-bg: rgba(251,251,253,0.85);
  --shadow-card: 0 18px 44px rgba(20,20,50,0.10);
  /* 浅底上发光要更实一点才看得见：白底会把低透明度的色晕直接吃掉。
     但投影反过来要更淡，浅色主题里重投影会显得脏。 */
  --card-ring: rgba(91,75,219,0.38);
  --card-glow: rgba(91,75,219,0.20);
  --card-cast: rgba(30,28,70,0.16);
  --noise-opacity: 0.16;

  --code-bg: #f6f6fb;
  --code-inline-bg: rgba(16,16,32,0.06);
  --code-inline: #c2185b;

  /* 浅底对色偏没有深底敏感，透明度要比深色那套高一些才有同等观感 */
  --tone-1: rgba(91,75,219,0.07);
  --tone-2: rgba(18,150,140,0.065);
  --tone-3: rgba(176,125,10,0.075);

  --grad-hero: linear-gradient(135deg, #2a2a3c 0%, #5b4bdb 40%, #d63a72 70%, #b07d0a 100%);
  --grad-em: linear-gradient(135deg, #5b4bdb 0%, #d63a72 60%, #b07d0a 100%);

  --t1-bg: rgba(91,75,219,0.10);  --t1-fg: #5344c4;
  --t2-bg: rgba(214,58,114,0.10); --t2-fg: #c02f65;
  --t3-bg: rgba(18,150,140,0.12); --t3-fg: #0b6c65;
  --t4-bg: rgba(176,125,10,0.12); --t4-fg: #855c08;
  --t0-bg: rgba(16,16,32,0.05);   --t0-fg: #6a6a80;

  color-scheme: light;
}

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

html {
  scroll-behavior: smooth;
  /* 关掉顶部/底部橡皮筋回弹与下拉刷新：
     整屏翻页时惯性余波容易顶到边界，回弹动画会盖掉翻页效果 */
  overscroll-behavior-y: none;
  /* 永久预留滚动条槽位。滚动条一旦出现或消失，页面可用宽度就会变化，
     内容会横向弹一下——短页面、弹窗、以及任何临时改 overflow 的操作
     都会触发。预留之后宽度恒定，彻底消除这类抖动。 */
  scrollbar-gutter: stable;
}

/* 兜底：万一别处调了 lenis.stop()，别让它用 clip 把滚动条整个抹掉。
   hidden 仍然是滚动容器，配合上面的 gutter 能保住槽位。 */
html.lenis.lenis-stopped { overflow: hidden; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  overflow-x: hidden;
  /* 切换主题时整体过渡，避免生硬跳变。
     切换瞬间会给 html 加 .theme-switching 关掉过渡，防止首屏动画被拖慢 */
  transition: background-color 0.35s ease, color 0.35s ease;
}
html.theme-switching, html.theme-switching * { transition: none !important; }

/* ══ 深色版：整屏板块的局部配色 ══
   每块整屏区是一个独立的配色环境。这里只重定义语义变量，
   组件样式一行都不用改——卡片、边框、文字会自动跟着换。
   浅色主题不参与，仍用顶部那套极淡的 tone 值。

   光晕刻意放在右上和左下两角：正文是左对齐的，避开文字区域，
   既拿到氛围色，又不会让文字压在最亮的地方。 */
[data-theme="dark"] .tone-1,
[data-theme="dark"] .tone-2,
[data-theme="dark"] .tone-3 {
  /* 底色比全站基准亮一档，次级文字跟着提亮，保证在光晕峰值处仍有
     4.9:1（正文）和 3.1:1（日期这类三级信息）*/
  --text2: #a3a3bb;
  --text3: #7f7f9d;
}

[data-theme="dark"] .tone-1 {                    /* 靛紫 */
  --surface: #1d2038;  --surface2: #262a46;
  --accent: #b3a8ff;
  --card-ring: rgba(179,168,255,0.46);
  --card-glow: rgba(140,128,255,0.30);
  background-image:
    radial-gradient(88% 62% at 84% 4%,  rgba(124,111,255,0.18), transparent 62%),
    radial-gradient(70% 55% at 6%  98%, rgba(124,111,255,0.09), transparent 58%);
}
[data-theme="dark"] .tone-2 {                    /* 墨青 */
  --surface: #182c2e;  --surface2: #21393b;
  --accent: #6eddd8;
  --card-ring: rgba(110,221,216,0.44);
  --card-glow: rgba(78,205,196,0.26);
  background-image:
    radial-gradient(88% 62% at 12% 6%,  rgba(78,205,196,0.15), transparent 62%),
    radial-gradient(70% 55% at 92% 96%, rgba(78,205,196,0.08), transparent 58%);
}
[data-theme="dark"] .tone-3 {                    /* 暖褐 */
  --surface: #2c2720;  --surface2: #38312a;
  --accent: #ffd166;
  /* 金色亮度天生高，同样透明度会比紫、青显得刺眼，所以两个值都压低一档 */
  --card-ring: rgba(255,209,102,0.38);
  --card-glow: rgba(255,193,66,0.22);
  background-image:
    radial-gradient(88% 62% at 86% 8%,  rgba(255,209,102,0.13), transparent 62%),
    radial-gradient(70% 55% at 8%  96%, rgba(255,209,102,0.07), transparent 58%);
}

/* 浅色主题不换底色和强调色（那套霓虹色在白底上会刺眼），
   但发光仍按板块走各自的色相，热区的归属才明确。
   取值比深色版实一档：白底会把低透明度的色晕直接吃掉。 */
[data-theme="light"] .tone-2 {
  --card-ring: rgba(18,150,140,0.40);
  --card-glow: rgba(18,150,140,0.22);
}
[data-theme="light"] .tone-3 {
  --card-ring: rgba(176,125,10,0.42);
  --card-glow: rgba(176,125,10,0.24);
}

/* ── 噪点纹理 ── */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 1000; opacity: var(--noise-opacity);
}

/* ── 极光光晕 ── */
.aurora { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0; animation: floatBlob 20s ease-in-out infinite; }
.blob1 { width: 700px; height: 500px; background: var(--glow1); top: -15%; left: -10%; animation-delay: 0s; animation-duration: 25s; }
.blob2 { width: 500px; height: 600px; background: var(--glow2); top: 30%; right: -15%; animation-delay: -8s; animation-duration: 22s; }
.blob3 { width: 600px; height: 400px; background: var(--glow3); bottom: 10%; left: 20%; animation-delay: -15s; animation-duration: 28s; }
.blob4 { width: 400px; height: 400px; background: var(--glow4); top: 60%; right: 30%; animation-delay: -5s; animation-duration: 20s; }
@keyframes floatBlob {
  0%   { transform: translate(0,0) scale(1); opacity: 0; }
  10%  { opacity: 1; }
  50%  { transform: translate(40px,-60px) scale(1.15); opacity: 0.9; }
  90%  { opacity: 1; }
  100% { transform: translate(0,0) scale(1); opacity: 0; }
}

/* ── 导航 ── */
nav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 900;
  padding: 0 2rem;
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  background: transparent;
  backdrop-filter: blur(0);
  transition: background 0.4s, backdrop-filter 0.4s;
  border-bottom: 1px solid transparent;
}
nav.scrolled {
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  border-bottom-color: var(--border);
}
.nav-logo {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600; font-size: 1.1rem;
  color: var(--text); text-decoration: none;
  letter-spacing: 0.05em;
}
.nav-logo span { color: var(--accent); }
.nav-right { display: flex; align-items: center; gap: 1.5rem; }
.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-links a { color: var(--text2); text-decoration: none; font-size: 0.875rem; transition: color 0.2s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }

/* ── 主题切换按钮 ── */
/* 后台入口。做成图标而不是第五个文字链接：它是给站长一个人用的，
   和「文章 / 归档 / 工具」这些内容栏目不该平级，混在一起会让导航重心跑偏。 */
.admin-entry {
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text3);
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.admin-entry:hover { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.admin-entry svg { width: 15px; height: 15px; }

.theme-toggle {
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }
.theme-toggle svg { width: 17px; height: 17px; }
/* 两个图标叠在一起，按当前主题只显示其中一个 */
.theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ── 区块骨架 ── */
section { position: relative; z-index: 10; }
.section-inner { max-width: 960px; margin: 0 auto; padding: 6rem 2rem; }
.page-inner { max-width: 960px; margin: 0 auto; padding: 8rem 2rem 5rem; position: relative; z-index: 10; }

.reveal { opacity: 0; transform: translateY(40px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

.section-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem; color: var(--accent);
  letter-spacing: 0.14em; text-transform: uppercase;
  margin-bottom: 1rem;
}
.section-title {
  font-family: 'Noto Serif SC', serif;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700; line-height: 1.25;
  margin-bottom: 1.25rem;
}
.section-title .hl  { color: var(--accent2); }
.section-title .hl2 { color: var(--accent3); }
.section-title .hl3 { color: var(--accent4); }
.section-desc { color: var(--text2); font-size: 1rem; max-width: 580px; line-height: 1.8; }

/* ── 按钮 ── */
.btn-primary {
  padding: 0.75rem 1.75rem;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 0.95rem; font-weight: 500;
  text-decoration: none;
  border: none; cursor: pointer;
  box-shadow: 0 0 35px var(--accent-glow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 0 45px var(--accent-glow-hi); }
.btn-secondary {
  padding: 0.75rem 1.75rem;
  border-radius: 12px;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text);
  font-size: 0.95rem; text-decoration: none; cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.btn-secondary:hover { background: var(--surface2); border-color: var(--border2); transform: translateY(-2px); }

/* ── 文章列表项 ── */
.posts-list { display: flex; flex-direction: column; gap: 1rem; }
.post-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.4rem 1.75rem;
  text-decoration: none;
  transition: border-color 0.25s, background 0.25s, transform 0.25s;
  cursor: pointer;
}
.post-item:hover { border-color: var(--border2); background: var(--surface2); transform: translateX(6px); }
.post-meta { display: flex; flex-direction: column; gap: 0.4rem; flex: 1; min-width: 0; }
.post-tag {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  padding: 0.2rem 0.65rem;
  border-radius: 6px;
  width: fit-content;
}
/* 分类配色由后台的 colorKey 决定，前台按同名 class 取色 */
.tag-fi1, .tag-fi5 { background: var(--t1-bg); color: var(--t1-fg); }
.tag-fi2 { background: var(--t2-bg); color: var(--t2-fg); }
.tag-fi3, .tag-fi6 { background: var(--t3-bg); color: var(--t3-fg); }
.tag-fi4 { background: var(--t4-bg); color: var(--t4-fg); }
.tag-none { background: var(--t0-bg); color: var(--t0-fg); }

.post-title { font-size: 1.05rem; font-weight: 500; color: var(--text); line-height: 1.4; }
.post-excerpt { font-size: 0.85rem; color: var(--text2); line-height: 1.6; }
.post-date { font-size: 0.78rem; color: var(--text3); font-family: 'JetBrains Mono', monospace; }
.post-arrow { color: var(--text3); font-size: 1.2rem; align-self: center; transition: transform 0.2s, color 0.2s; flex-shrink: 0; }
.post-item:hover .post-arrow { transform: translateX(4px); color: var(--text2); }

/* ── 工具卡片 ── */
.tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.tool-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 1.5rem;
  display: flex; flex-direction: column; gap: 0.75rem;
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}
/* 和首页分类卡同一套发光，见 index.html 里 .feature-card:hover 的说明 */
.tool-card:hover {
  border-color: var(--card-ring); transform: translateY(-3px);
  box-shadow:
    0 0 14px -3px var(--card-glow),
    0 0 34px -6px var(--card-glow),
    0 14px 34px -16px var(--card-cast);
}
.tool-card .icon { font-size: 2rem; line-height: 1; }
.tool-card h3 { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.tool-card p { font-size: 0.82rem; color: var(--text2); line-height: 1.6; }
.tool-link {
  font-size: 0.8rem; color: var(--accent); text-decoration: none;
  font-family: 'JetBrains Mono', monospace;
  display: flex; align-items: center; gap: 0.3rem;
  margin-top: auto; transition: gap 0.2s;
}
.tool-card:hover .tool-link { gap: 0.5rem; }

/* ── 分隔线 ── */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border2) 30%, var(--border2) 70%, transparent);
  margin: 0 2rem;
  position: relative; z-index: 10;
}

/* ── 页脚 ── */
footer {
  position: relative; z-index: 10;
  padding: 2.25rem 2rem; text-align: center;
  border-top: 1px solid var(--border);
}
/* 一排排完：署名 · 授权协议 · 公安备案 · ICP 备案。
   窄屏放不下时靠 flex-wrap 换行，所以行间距（0.6rem）单独给，
   不能只写一个 gap——换行后上下会贴在一起。 */
footer .footer-bar {
  display: flex; flex-wrap: wrap;
  justify-content: center; align-items: center;
  gap: 0.6rem 1.25rem;
  font-size: 0.78rem; color: var(--text3); line-height: 1.7;
}
footer .footer-bar a {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: inherit; color: inherit;
  text-decoration: none; transition: color 0.2s;
}
footer .footer-bar a:hover { color: var(--text2); }
/* 警徽图标。官方给的图是 36×40（竖向略长），所以只锁高度、宽度自适应，
   写死成正方形会把它压扁。aspect-ratio 让图片没加载完时也占住正确宽度，
   不会等加载完再把整行往右挤一下。 */
footer .footer-bar img {
  height: 15px; width: auto; aspect-ratio: 36 / 40;
  display: block; flex-shrink: 0;
}

/* ── 状态提示 ── */
.state { text-align: center; color: var(--text3); padding: 4rem 1rem; font-size: 0.9rem; }
.state.error { color: var(--accent2); }
.spinner {
  width: 22px; height: 22px; margin: 0 auto 0.9rem;
  border: 2px solid var(--border2); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 通用动画 ── */
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes bounceDown { 0%,100%{transform:rotate(45deg) translateY(0)} 50%{transform:rotate(45deg) translateY(5px)} }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(0.8); } }

/* ── 响应式 ── */
@media (max-width: 640px) {
  nav { padding: 0 1.1rem; }
  .nav-right { gap: 0.9rem; }
  .nav-links { gap: 1rem; }
  .nav-links a { font-size: 0.8rem; }
  .section-inner { padding: 4rem 1.25rem; }
  .page-inner { padding: 6.5rem 1.25rem 4rem; }
  .post-item { padding: 1.15rem 1.25rem; }
  .post-item:hover { transform: none; }
}
