/* ============================================================
   WebSpace · 信号档案室
   深空信号主题：深蓝近黑 + 单一琥珀信号色，编辑排版。
   6 套主题（深空/赛博/暗金/翡翠/纸张/冰川）+ 跟随系统自动，CSS 变量驱动。
   ============================================================ */

/* ---------- 字体（本地自托管，Latin 子集） ---------- */
@font-face {
  font-family: "Space Grotesk";
  src: url("../assets/fonts/space-grotesk.woff2") format("woff2-variations");
  font-weight: 400 700;
  font-display: swap;
  font-style: normal;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../assets/fonts/jetbrains-mono.woff2") format("woff2-variations");
  font-weight: 400 700;
  font-display: swap;
  font-style: normal;
}

/* ---------- 设计令牌：6 套主题 ---------- */

/* 1) 深空 deep（默认，深蓝近黑 + 琥珀信号灯） */
:root,
[data-theme="deep"],
[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0a0d13;
  --bg-grid: rgba(148, 163, 184, 0.045);
  --surface: #10141d;
  --surface-2: #161b26;
  --surface-hover: #1a2030;
  --border: rgba(233, 231, 225, 0.09);
  --border-strong: rgba(233, 231, 225, 0.18);

  --text: #e9e7e1;
  --text-2: #9aa1ad;
  --text-3: #757e8b;

  --accent: #f5a524;
  --accent-strong: #ffbd55;
  --accent-dim: rgba(245, 165, 36, 0.12);
  --accent-glow: rgba(245, 165, 36, 0.5);
  --accent-ink: #1c1204;

  --radius-card: 20px;
  --radius-input: 12px;
  --radius-pill: 999px;

  --shadow-card: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 18px 44px rgba(0, 0, 0, 0.38);
  --shadow-pop: 0 26px 64px rgba(0, 0, 0, 0.55);
  --shadow-panel: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 24px 60px rgba(0, 0, 0, 0.45);

  --header-bg: rgba(10, 13, 19, 0.78);
  --code-bg: rgba(233, 231, 225, 0.06);

  --glass-bg: rgba(16, 20, 29, 0.46);
  --glass-highlight: rgba(255, 255, 255, 0.18);
  --glass-sheen: rgba(255, 255, 255, 0.1);

  /* 动效：苹果式弹簧曲线 */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 2) 赛博 cyber（近黑 + 电光青） */
[data-theme="cyber"] {
  color-scheme: dark;

  --bg: #070a12;
  --bg-grid: rgba(148, 163, 184, 0.05);
  --surface: #0e1320;
  --surface-2: #151b2c;
  --surface-hover: #1a2136;
  --border: rgba(226, 240, 255, 0.1);
  --border-strong: rgba(226, 240, 255, 0.2);

  --text: #e2f0ff;
  --text-2: #93a8c4;
  --text-3: #7d93b0;

  --accent: #22d3ee;
  --accent-strong: #67e8f9;
  --accent-dim: rgba(34, 211, 238, 0.14);
  --accent-glow: rgba(34, 211, 238, 0.45);
  --accent-ink: #04141a;

  --header-bg: rgba(7, 10, 18, 0.78);
  --code-bg: rgba(226, 240, 255, 0.08);

  --glass-bg: rgba(14, 19, 32, 0.46);
  --glass-highlight: rgba(255, 255, 255, 0.18);
}

/* 3) 暗金 gold（OLED 纯黑 + 香槟金） */
[data-theme="gold"] {
  color-scheme: dark;

  --bg: #0a0907;
  --bg-grid: rgba(212, 175, 55, 0.05);
  --surface: #131110;
  --surface-2: #1b1814;
  --surface-hover: #211d17;
  --border: rgba(236, 230, 220, 0.1);
  --border-strong: rgba(236, 230, 220, 0.2);

  --text: #ece6dc;
  --text-2: #a89f8e;
  --text-3: #8a8172;

  --accent: #d4af37;
  --accent-strong: #e6c868;
  --accent-dim: rgba(212, 175, 55, 0.14);
  --accent-glow: rgba(212, 175, 55, 0.45);
  --accent-ink: #1a1405;

  --header-bg: rgba(10, 9, 7, 0.78);
  --code-bg: rgba(236, 230, 220, 0.07);

  --glass-bg: rgba(19, 17, 16, 0.46);
  --glass-highlight: rgba(255, 255, 255, 0.16);
}

/* 4) 翡翠 jade（墨绿近黑 + 翡翠绿） */
[data-theme="jade"] {
  color-scheme: dark;

  --bg: #0a120e;
  --bg-grid: rgba(52, 211, 153, 0.05);
  --surface: #0f1a14;
  --surface-2: #14241c;
  --surface-hover: #182b21;
  --border: rgba(236, 253, 245, 0.1);
  --border-strong: rgba(236, 253, 245, 0.2);

  --text: #e6f4ec;
  --text-2: #93b8a6;
  --text-3: #6f9484;

  --accent: #34d399;
  --accent-strong: #6ee7b7;
  --accent-dim: rgba(52, 211, 153, 0.14);
  --accent-glow: rgba(52, 211, 153, 0.45);
  --accent-ink: #04140c;

  --header-bg: rgba(10, 18, 14, 0.78);
  --code-bg: rgba(236, 253, 245, 0.07);

  --glass-bg: rgba(15, 26, 20, 0.46);
  --glass-highlight: rgba(255, 255, 255, 0.17);
}

/* 5) 纸张 paper（暖纸 + 朱砂，浅色） */
[data-theme="paper"] {
  color-scheme: light;

  --bg: #f7f4ef;
  --bg-grid: rgba(60, 50, 35, 0.05);
  --surface: #fffdf9;
  --surface-2: #f1ece2;
  --surface-hover: #faf7f0;
  --border: rgba(60, 50, 35, 0.1);
  --border-strong: rgba(60, 50, 35, 0.2);

  --text: #221d17;
  --text-2: #5a5247;
  --text-3: #665e52;

  --accent: #b3402a;
  --accent-strong: #96291c;
  --accent-dim: rgba(179, 64, 42, 0.1);
  --accent-glow: rgba(179, 64, 42, 0.4);
  --accent-ink: #ffffff;

  --radius-card: 20px;
  --radius-input: 12px;
  --radius-pill: 999px;

  --shadow-card: 0 1px 2px rgba(60, 50, 35, 0.06), 0 18px 44px rgba(60, 50, 35, 0.09);
  --shadow-pop: 0 26px 64px rgba(60, 50, 35, 0.15);
  --shadow-panel: 0 1px 2px rgba(60, 50, 35, 0.06), 0 24px 60px rgba(60, 50, 35, 0.12);

  --header-bg: rgba(247, 244, 239, 0.82);
  --code-bg: rgba(34, 29, 23, 0.06);

  --glass-bg: rgba(255, 253, 249, 0.5);
  --glass-highlight: rgba(255, 255, 255, 0.95);
}

/* 6) 冰川 glacier（冷白 + 冰蓝，浅色） */
[data-theme="glacier"] {
  color-scheme: light;

  --bg: #f4f7fb;
  --bg-grid: rgba(15, 40, 75, 0.05);
  --surface: #ffffff;
  --surface-2: #eef3f9;
  --surface-hover: #f8fbfe;
  --border: rgba(15, 40, 75, 0.1);
  --border-strong: rgba(15, 40, 75, 0.2);

  --text: #0f1b2d;
  --text-2: #43536b;
  --text-3: #5f6f86;

  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-dim: rgba(37, 99, 235, 0.12);
  --accent-glow: rgba(37, 99, 235, 0.4);
  --accent-ink: #ffffff;

  --radius-card: 20px;
  --radius-input: 12px;
  --radius-pill: 999px;

  --shadow-card: 0 1px 2px rgba(15, 40, 75, 0.05), 0 18px 44px rgba(15, 40, 75, 0.08);
  --shadow-pop: 0 26px 64px rgba(15, 40, 75, 0.14);
  --shadow-panel: 0 1px 2px rgba(15, 40, 75, 0.05), 0 24px 60px rgba(15, 40, 75, 0.1);

  --header-bg: rgba(244, 247, 251, 0.82);
  --code-bg: rgba(15, 40, 75, 0.06);

  --glass-bg: rgba(255, 255, 255, 0.5);
  --glass-highlight: rgba(255, 255, 255, 0.95);
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  overflow-x: clip;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
}

::selection {
  background: var(--accent-dim);
  color: var(--accent-strong);
}

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

.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: 24px;
}

/* 展示字体：优先系统显示字体（Apple：SF Pro），随后 Space Grotesk 与中文回退 */
.display,
.hero-title,
.hero-eyebrow,
.section-title,
.brand-name,
.card-title,
.panel-row dd {
  font-family: -apple-system, "SF Pro Display", "Space Grotesk", system-ui,
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* 等宽字体：元信息、标签、编号 */
.mono,
.hero-eyebrow,
.section-note,
.card-meta,
.projects-hint,
.panel-title,
.panel-state,
.panel-row dt,
.panel-note,
.footer-mid,
.search-kbd {
  font-family: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: currentColor;
}

code {
  font-family: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.86em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.1em 0.4em;
}

/* ---------- 背景：星幕 + 网格 + 晕光 ---------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.bg canvas {
  display: block;
  width: 100%;
  height: 100%;
}
[data-theme="paper"] .bg canvas,
[data-theme="glacier"] .bg canvas {
  display: none;
}
.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 56px 56px;
  transform: translateY(calc(var(--py, 0px) * -0.04));
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 78%);
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 78%);
}
.bg-glow {
  position: absolute;
  top: -14rem;
  left: 50%;
  transform: translateX(-50%) translateY(calc(var(--py, 0px) * -0.1));
  width: min(920px, 92vw);
  height: 520px;
  background: radial-gradient(ellipse at center, var(--accent-dim), transparent 66%);
}
.bg-glow--right {
  position: absolute;
  top: 4rem;
  right: -8rem;
  width: min(560px, 42vw);
  height: 480px;
  background: radial-gradient(ellipse at center, var(--accent-dim), transparent 62%);
  transform: translateY(calc(var(--py, 0px) * 0.08));
}
.bg-glow--left {
  position: absolute;
  top: 62vh;
  left: -10rem;
  width: min(520px, 40vw);
  height: 460px;
  background: radial-gradient(ellipse at center, var(--accent-dim), transparent 62%);
  transform: translateY(calc(var(--py, 0px) * -0.06));
}

/* 顶部滚动进度条 */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-dim);
  z-index: 60;
  pointer-events: none;
}

/* ---------- 顶部导航（雾化玻璃） ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 64px;
  background: var(--header-bg);
  background: linear-gradient(165deg, var(--glass-sheen), transparent 42%), var(--glass-bg);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease, background-color 0.25s ease;
}
.site-header.is-scrolled {
  border-bottom-color: var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 100%;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: "Space Grotesk", sans-serif;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 0 0 1px var(--accent-dim), 0 6px 18px var(--accent-dim);
}
.brand-name {
  font-size: 17px;
  letter-spacing: -0.01em;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}
.site-nav a {
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  color: var(--text-2);
  transition: color 0.2s ease, background 0.2s ease;
}
.site-nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}
.header-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 主题选择器（6 套色点，雾化玻璃） */
.ts-switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  background: linear-gradient(165deg, var(--glass-sheen), transparent 42%), var(--glass-bg);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.ts-switch:hover {
  border-color: var(--border-strong);
}
.ts-dot {
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--c);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.ts-dot:hover {
  transform: scale(1.18);
}
.ts-dot:active {
  transform: scale(0.92);
}
.ts-dot.is-on {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--c);
  transform: scale(1.08);
}
.ts-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--text-3);
  min-width: 2.6em;
  text-align: center;
  transition: color 0.25s ease;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  min-height: calc(100dvh - 64px);
  padding: clamp(3.25rem, 9vh, 5.5rem) 0 clamp(3.25rem, 8vh, 5rem);
}
.hero-inner {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(2.25rem, 6vw, 5.5rem);
  align-items: center;
}
.hero-eyebrow {
  font-size: 12px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.3rem;
}
.hero-title {
  font-size: clamp(2.9rem, 8vw, 5rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 600;
  text-wrap: balance;
}
.hero-title .accent {
  color: var(--accent);
}
.hero-sub {
  margin-top: 1.4rem;
  max-width: 48ch;
  font-size: 1.08rem;
  line-height: 1.65;
  color: var(--text-2);
}
.hero-cta {
  margin-top: 2rem;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* 信号面板（雾化玻璃） */
.hero-panel {
  position: relative;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
  background: var(--surface);
  background: linear-gradient(165deg, var(--glass-sheen), transparent 42%), var(--glass-bg);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: inset 0 1px 0 var(--glass-highlight), var(--shadow-panel);
  padding: 24px 26px 20px;
  overflow: hidden;
}
.hero-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 26px;
  right: 26px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent 72%);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
}
.panel-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--accent);
  letter-spacing: 0.14em;
  font-size: 11px;
  font-weight: 600;
}
.panel-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-dim);
  animation: pulse 2.2s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 var(--accent-glow); }
  70% { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.meter {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 46px;
  margin-bottom: 22px;
}
.meter-bar {
  flex: 1;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  opacity: 0.88;
  transform-origin: bottom;
  animation: meter 1.7s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
@keyframes meter {
  0%, 100% { transform: scaleY(0.22); }
  50% { transform: scaleY(1); }
}
.panel-rows {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 24px;
}
.panel-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.panel-row dt {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--text-3);
}
.panel-row dd {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.panel-note {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: 0.02em;
}

/* 首帧：弹簧入场 */
@media (prefers-reduced-motion: no-preference) {
  .hero-eyebrow,
  .hero-sub,
  .hero-cta {
    animation: rise 0.8s var(--ease-out) both;
  }
  .hero-title {
    animation: riseSpring 0.9s var(--ease-spring) both;
  }
  .hero-eyebrow { animation-delay: 0.04s; }
  .hero-title { animation-delay: 0.1s; }
  .hero-sub { animation-delay: 0.18s; }
  .hero-cta { animation-delay: 0.26s; }
  .hero-panel {
    animation: rise 0.8s var(--ease-out) 0.22s both;
  }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: none; }
}
@keyframes riseSpring {
  0% { opacity: 0; transform: translateY(34px); }
  55% { opacity: 1; }
  100% { opacity: 1; transform: none; }
}

/* ---------- 滚动字幕（雾化玻璃） ---------- */
.ticker {
  position: relative;
  z-index: 1;
  overflow: hidden;
  padding: 13px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  background: linear-gradient(165deg, var(--glass-sheen), transparent 42%), var(--glass-bg);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
}
.ticker-track {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  animation: ticker 38s linear infinite;
}
.ticker-item {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-right: 26px;
}
.ticker-sep {
  color: var(--accent);
  font-size: 12px;
  margin-right: 26px;
}
@keyframes ticker {
  to { transform: translateX(-50%); }
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 600;
  padding: 12px 23px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.18s var(--ease-spring), background 0.2s ease,
    border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}
.btn:active {
  transform: scale(0.96);
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover {
  background: var(--accent-strong);
  box-shadow: 0 12px 30px var(--accent-dim);
}
.btn-ghost {
  border-color: var(--border-strong);
  color: var(--text-2);
  background: transparent;
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* ---------- 区块通用 ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.section-title {
  font-size: clamp(1.85rem, 4vw, 2.5rem);
  letter-spacing: -0.03em;
  line-height: 1.16;
  font-weight: 600;
}
.section-note {
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--text-3);
}

/* ---------- 项目区 ---------- */
.projects {
  position: relative;
  z-index: 1;
  padding: clamp(4rem, 10vh, 6.5rem) 0 clamp(4.5rem, 11vh, 7rem);
}
.projects-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 2.2rem;
}
.filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease,
    transform 0.1s ease;
}
.chip:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
.chip:active {
  transform: scale(0.96);
}
.chip.is-on {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}
.search {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: auto;
  min-width: 240px;
  flex: 1;
  max-width: 340px;
}
.search .icon {
  position: absolute;
  left: 14px;
  width: 17px;
  height: 17px;
  color: var(--text-3);
  pointer-events: none;
}
.search input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  background: linear-gradient(165deg, var(--glass-sheen), transparent 42%), var(--glass-bg);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  backdrop-filter: blur(12px) saturate(150%);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 10px 40px 10px 42px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search input::placeholder {
  color: var(--text-3);
}
.search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.search-kbd {
  position: absolute;
  right: 12px;
  font-size: 12px;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 7px;
  pointer-events: none;
}
.projects-hint {
  margin-top: 20px;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

/* ---------- 卡片瀑布流（图片比例自适应） ---------- */
.grid {
  list-style: none;
  columns: 3 280px;
  column-gap: 24px;
  margin-top: 18px;
}
.grid > .card {
  break-inside: avoid;
  margin-bottom: 24px;
}
.card-featured {
  column-span: all;
}

html.js .card {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease-out),
    transform 0.7s var(--ease-spring);
  transition-delay: calc(min(var(--i, 0), 6) * 60ms);
}
html.js .card.from-left  { transform: translateX(-52px); }
html.js .card.from-right { transform: translateX(52px); }
html.js .card.from-up    { transform: translateY(44px); }
html.js .card.is-in {
  opacity: 1;
  transform: none;
}

/* 分层揭示：章节标头/关于区块滚动滑入 */
html.js .reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-spring);
}
html.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

.card-link {
  position: relative;
  display: flex;
  flex-direction: column;
  height: auto;
  background: var(--surface);
  background: linear-gradient(165deg, var(--glass-sheen), transparent 42%), var(--glass-bg);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  transform-style: preserve-3d;
  transition: border-color 0.24s ease, box-shadow 0.24s ease,
    background 0.24s ease;
}
.card-link::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--glass-highlight);
  z-index: 2;
  pointer-events: none;
}
.card-link:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-pop);
  background: var(--surface-hover);
}
.card-link:active {
  transform: translateY(-1px) scale(0.99);
}

.card-media {
  position: relative;
  flex: 0 0 auto;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--surface-2);
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}
.card-link:hover .card-media img {
  transform: scale(1.05);
}
.card-index {
  position: absolute;
  top: 12px;
  left: 14px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: rgba(10, 13, 19, 0.72);
  border: 1px solid rgba(245, 165, 36, 0.35);
  border-radius: 6px;
  padding: 3px 8px;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* 无截图时的渐变占位块 */
.card-media--tile {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg,
    hsl(var(--hue) 45% 20%),
    hsl(calc(var(--hue) + 40) 50% 13%));
}
.card-media--tile .icon {
  width: 34px;
  height: 34px;
  color: rgba(255, 255, 255, 0.85);
}
.card-tile-letter {
  position: absolute;
  right: 16px;
  bottom: -8px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 72px;
  font-weight: 700;
  line-height: 1;
  color: rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px 20px;
  flex: 0 0 auto;
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.card-cat {
  color: var(--accent);
  font-weight: 600;
}
.card-sep {
  opacity: 0.5;
}
.card-tags {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.card-desc {
  font-size: 14px;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-action {
  margin-top: auto;
  padding-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  transition: color 0.2s ease;
}
.card-action .icon {
  width: 16px;
  height: 16px;
  transition: transform 0.24s ease;
}
.card-link:hover .card-action {
  color: var(--accent);
}
.card-link:hover .card-action .icon {
  transform: translate(2px, -2px);
}

/* 精选（featured）卡片：大图 + 横排，占满整行 */
@media (min-width: 860px) {
  .card-featured .card-link {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
  }
  .card-featured .card-media {
    align-self: stretch;
  }
  .card-featured .card-body {
    padding: 42px 40px 36px;
    gap: 12px;
    justify-content: center;
  }
  .card-featured .card-title {
    font-size: 28px;
  }
  .card-featured .card-desc {
    -webkit-line-clamp: 4;
    font-size: 15px;
  }
}

/* ---------- 空状态（雾化玻璃） ---------- */
.empty {
  margin-top: 26px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-card);
  padding: 52px 24px;
  text-align: center;
  color: var(--text-2);
  background: var(--surface);
  background: linear-gradient(165deg, var(--glass-sheen), transparent 42%), var(--glass-bg);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  backdrop-filter: blur(12px) saturate(150%);
}
.empty-icon {
  width: 30px;
  height: 30px;
  color: var(--accent);
  margin-bottom: 14px;
}
.empty h3 {
  font-size: 17px;
  color: var(--text);
  margin-bottom: 6px;
}
.empty p {
  max-width: 46ch;
  margin-inline: auto;
  font-size: 14px;
}

/* ---------- 关于 ---------- */
.about {
  position: relative;
  z-index: 1;
  padding: clamp(4rem, 10vh, 6.5rem) 0;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, var(--accent-dim), transparent 65%);
}
.about-inner {
  display: grid;
  gap: 44px;
  grid-template-columns: 1fr;
}
@media (min-width: 860px) {
  .about-inner {
    grid-template-columns: 1fr 1fr;
    gap: 72px;
  }
}
.about-text h2 {
  margin-bottom: 16px;
}
.about-text p {
  color: var(--text-2);
  margin-bottom: 12px;
}
.about-add {
  font-size: 14px;
  color: var(--text-3) !important;
}
.about-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.about-list li {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.about-list li:last-child {
  padding-bottom: 0;
  border-bottom: none;
}
.about-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 12px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--border);
}
.about-item strong {
  display: block;
  font-size: 15px;
  margin-bottom: 3px;
}
.about-item span {
  font-size: 14px;
  color: var(--text-2);
}

/* ---------- 页脚 ---------- */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 26px 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 13px;
  color: var(--text-3);
}
.brand--footer .brand-mark {
  width: 26px;
  height: 26px;
  font-size: 14px;
  border-radius: 7px;
}
.brand--footer .brand-name {
  font-size: 15px;
}
.footer-mid {
  font-size: 12px;
  letter-spacing: 0.08em;
}
.footer-top {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  transition: color 0.2s ease;
}
.footer-top:hover {
  color: var(--accent);
}
.footer-top .icon {
  width: 15px;
  height: 15px;
}

/* ---------- noscript ---------- */
.noscript {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}
.noscript a {
  color: var(--accent);
  text-decoration: underline;
}

/* ---------- 减少动态 ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .ticker-track {
    animation: none;
  }
  .meter-bar {
    animation: none;
    transform: scaleY(0.5);
  }
  .panel-pulse {
    animation: none;
  }
  html.js .card {
    opacity: 1;
    transform: none;
    transition: none;
  }
  html.js .reveal,
  html.js .reveal.is-in {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- 减少透明（雾化玻璃回退为纯色填充） ---------- */
@media (prefers-reduced-transparency: reduce) {
  .site-header,
  .hero-panel,
  .ticker,
  .card-link,
  .search input,
  .ts-switch,
  .empty {
    background: var(--surface) !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

/* ---------- 移动端 ---------- */
@media (max-width: 860px) {
  .hero-inner {
    grid-template-columns: 1fr;
  }
  .hero {
    min-height: 0;
  }
  .hero-panel {
    max-width: 460px;
  }
  .grid {
    columns: 2 200px;
  }
  .card-featured .card-link {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  .site-nav {
    display: none;
  }
  .ts-label {
    display: none;
  }
  .ts-switch {
    gap: 6px;
    padding: 5px 10px;
  }
  .ts-dot {
    width: 15px;
    height: 15px;
  }
  .search {
    max-width: none;
    margin-left: 0;
    flex-basis: 100%;
    order: 3;
  }
  .projects-toolbar {
    gap: 12px;
  }
  .grid {
    columns: 1;
  }
  .ticker-item {
    margin-right: 20px;
  }
  .ticker-sep {
    margin-right: 20px;
  }
  .footer-mid {
    display: none;
  }
}

/* ---------- 自动主题（跟随系统） ---------- */
.ts-dot--auto {
  background: conic-gradient(from 180deg, #22d3ee, #d4af37, #34d399, #2563eb, #f5a524, #22d3ee);
  background-size: 100% 100%;
}
.ts-dot--auto:hover {
  transform: scale(1.18);
}
.ts-dot--auto.is-on {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text-2);
  transform: scale(1.08);
}

/* ---------- 随机项目按钮 ---------- */
.btn-shuffle {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  color: var(--text-2);
  background: transparent;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.btn-shuffle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* ---------- 技能栈 ---------- */
.skill-row {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.skill-row li {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  padding: 5px 12px;
}
.about-gh {
  margin-top: 18px;
}

/* ---------- 页脚 GitHub ---------- */
.footer-gh {
  color: var(--text-2);
  transition: color 0.2s ease;
}
.footer-gh:hover {
  color: var(--accent);
}

/* ---------- 项目快速预览弹层 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal[hidden] {
  display: none;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 12, 0.62);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.modal-card {
  position: relative;
  width: min(520px, 100%);
  max-height: 86vh;
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
  background: var(--surface);
  background: linear-gradient(165deg, var(--glass-sheen), transparent 42%), var(--glass-bg);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow-pop);
  animation: rise 0.35s var(--ease-out) both;
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.modal-close:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-hover);
}
.modal-media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
}
.modal-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.modal-media--tile {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg,
    hsl(var(--hue) 45% 20%),
    hsl(calc(var(--hue) + 40) 50% 13%));
}
.modal-media--tile .icon {
  width: 44px;
  height: 44px;
  color: rgba(255, 255, 255, 0.85);
}
.modal-tile-letter {
  position: absolute;
  right: 18px;
  bottom: -12px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 92px;
  font-weight: 700;
  line-height: 1;
  color: rgba(255, 255, 255, 0.1);
  pointer-events: none;
}
.modal-body {
  padding: 18px 22px 22px;
}
.modal-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.modal-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-top: 8px;
}
.modal-desc {
  margin-top: 10px;
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.65;
}
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.modal-open {
  text-decoration: none;
}
body.modal-open {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .modal-card {
    animation: none;
  }
}

@media (max-width: 480px) {
  .modal {
    padding: 12px;
  }
  .modal-card {
    max-height: 92vh;
  }
}
