/* =========================================================
   My Lab · 全局样式
   设计：清新 · 简约 · 高级
   白底 + 细线 + 单一强调色 + 克制动效
   ========================================================= */

/* ---------- 设计变量 ---------- */
:root {
  --font: "Poppins", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;

  /* 浅色（默认） */
  --bg: #fafaf9;
  --surface: #ffffff;
  --text-0: #1c1917;
  --text-1: #57534e;
  --text-2: #a8a29e;
  --line: #e7e5e4;
  --line-strong: #d6d3d1;
  --accent: #0d9488;          /* 单一强调色：青碧 */
  --accent-2: #0ea5e9;        /* 渐变搭档：天青 */
  --grad: linear-gradient(135deg, #0d9488, #0ea5e9);
  --accent-soft: #f0fdfa;
  --accent-line: #99f6e4;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.04);
  --shadow-md: 0 10px 30px -12px rgba(28, 25, 23, 0.12);
  --bg-dot: rgba(28, 25, 23, 0.05);
}

[data-theme="dark"] {
  --bg: #1c1917;
  --surface: #262220;
  --text-0: #fafaf9;
  --text-1: #d6d3d1;
  --text-2: #78716c;
  --line: #35302c;
  --line-strong: #44403c;
  --accent: #2dd4bf;
  --accent-2: #38bdf8;
  --grad: linear-gradient(135deg, #2dd4bf, #38bdf8);
  --accent-soft: rgba(45, 212, 191, 0.08);
  --accent-line: rgba(45, 212, 191, 0.35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 30px -12px rgba(0, 0, 0, 0.5);
  --bg-dot: rgba(250, 250, 249, 0.06);
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text-0);
  /* 背景：暖灰基底 + 顶部淡青晕染 + 细点阵纹理，安静但不无聊 */
  background:
    radial-gradient(900px 480px at 50% -160px, var(--accent-soft), transparent 70%),
    radial-gradient(var(--bg-dot) 1px, transparent 1px) 0 0 / 26px 26px,
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  transition: background 0.35s ease, color 0.35s ease;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
::selection { background: var(--accent-soft); color: var(--accent); }

/* 背景光斑：简约风格下不再渲染 */
.bg-orbs { display: none; }

/* ---------- 导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1080px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
  padding: 16px 24px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 17px; letter-spacing: -0.2px;
}
.brand-logo {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--grad); color: #fff; font-size: 12px;
}
.nav-search {
  flex: 1; max-width: 420px; margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.nav-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.nav-search .icon { width: 16px; height: 16px; color: var(--text-2); flex: none; }
.nav-search input {
  flex: 1; border: none; background: transparent; outline: none;
  color: var(--text-0); font-family: var(--font); font-size: 14px;
}
.nav-search input::placeholder { color: var(--text-2); }

.theme-toggle {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center; cursor: pointer; font-size: 16px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, transform 0.2s;
}
.theme-toggle:hover { border-color: var(--line-strong); transform: translateY(-1px); }

/* ---------- 主视觉 ---------- */
.hero {
  max-width: 1080px; margin: 88px auto 20px; padding: 0 24px;
  text-align: center;
}
.hero h1 {
  margin: 0; font-size: clamp(32px, 5vw, 52px); font-weight: 700;
  letter-spacing: -1px; line-height: 1.15;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub {
  margin: 16px auto 0; color: var(--text-1);
  font-size: clamp(15px, 2vw, 17px); line-height: 1.7;
  max-width: 520px;
}

/* ---------- 首页装饰：徽章 / 统计 / 星点 / 分隔线 ---------- */
/* 英雄区徽章：小药丸，强调色描边 */
.hero-badge {
  display: inline-block; margin-bottom: 16px; padding: 6px 15px; border-radius: 999px;
  font-size: 12.5px; font-weight: 500; letter-spacing: .3px;
  color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line);
  animation: cardIn .6s ease both;
}

/* 统计条：项目数 / 分类数 / 最近更新 */
.stats {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin-top: 28px; flex-wrap: wrap;
  animation: cardIn .7s ease both .1s;
}
.stat { display: flex; align-items: baseline; gap: 5px; }
.stat-num {
  font-size: 24px; font-weight: 700;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-label { font-size: 12.5px; color: var(--text-2); }
.stat-div { width: 1px; height: 20px; background: var(--line); }

/* 漂浮星点：克制的微动效，落在内容之后不喧宾夺主 */
.sparkles { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.spark {
  position: absolute; color: var(--accent); opacity: .18; font-size: 12px;
  animation: twinkle 5s ease-in-out infinite;
}
.spark.s1 { top: 24%; left: 10%; }
.spark.s2 { top: 32%; right: 12%; color: var(--accent-2); font-size: 15px; animation-delay: .9s; }
.spark.s3 { top: 62%; left: 14%; font-size: 10px; animation-delay: 1.7s; }
.spark.s4 { top: 70%; right: 16%; animation-delay: 2.3s; }
.spark.s5 { top: 16%; left: 46%; color: var(--accent-2); animation-delay: 1.2s; }
.spark.s6 { bottom: 14%; left: 44%; color: var(--accent-2); font-size: 13px; animation-delay: 2.9s; }
@keyframes twinkle {
  0%, 100% { opacity: .08; transform: scale(.85); }
  50% { opacity: .22; transform: scale(1.15); }
}

/* 分隔线：柔和渐变，呼应细线风格 */
.divider {
  max-width: 1080px; margin: 8px auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}

/* ---------- 分类筛选 ---------- */
.filters {
  max-width: 1080px; margin: 44px auto 36px; padding: 0 24px;
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}
.chip {
  padding: 7px 16px; border-radius: 999px; cursor: pointer;
  font-size: 13.5px; font-weight: 500; color: var(--text-1);
  background: transparent; border: 1px solid var(--line);
  transition: all 0.2s ease;
}
.chip:hover { color: var(--text-0); border-color: var(--line-strong); }
.chip.active {
  color: #fff; border-color: transparent;
  background: var(--grad);
  box-shadow: 0 4px 14px -4px rgba(13, 148, 136, 0.5);
}

/* ---------- 项目网格 ---------- */
.grid {
  max-width: 1080px; margin: 0 auto; padding: 0 24px 80px;
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.card {
  position: relative; overflow: hidden; cursor: pointer;
  border-radius: var(--radius); padding: 16px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s cubic-bezier(.2,.8,.2,1), border-color 0.25s, box-shadow 0.25s;
  opacity: 0; transform: translateY(10px);
  animation: cardIn 0.45s forwards;
}
@keyframes cardIn { to { opacity: 1; transform: translateY(0); } }
.card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.card-thumb {
  height: 150px; border-radius: 10px; margin-bottom: 14px;
  display: grid; place-items: center; position: relative; overflow: hidden;
}
.card-thumb::after { content: none; }
.card-thumb .thumb-initial {
  font-size: 40px; font-weight: 600; color: rgba(255,255,255,0.95);
  letter-spacing: -1px; z-index: 1;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }

.card-cat {
  position: absolute; bottom: 10px; left: 10px; z-index: 2;
  font-size: 11px; font-weight: 500; color: #fff;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(0,0,0,0.28); backdrop-filter: blur(4px);
}
.card-badge {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  font-size: 11px; font-weight: 600; color: #fff;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(0,0,0,0.28); backdrop-filter: blur(4px);
}
.card-title { margin: 2px 0 6px; font-size: 16.5px; font-weight: 600; color: var(--text-0); letter-spacing: -0.2px; }
.card-desc { margin: 0 0 12px; font-size: 13.5px; color: var(--text-1); line-height: 1.6; min-height: 42px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 11.5px; color: var(--text-2);
  padding: 2px 8px; border-radius: 6px;
  background: transparent; border: 1px solid var(--line);
}

/* ---------- 空状态 / 页脚 ---------- */
.empty { text-align: center; color: var(--text-2); padding: 60px 20px; }
.empty-emoji { font-size: 36px; display: block; margin-bottom: 10px; filter: grayscale(0.3); }
.footer {
  text-align: center; color: var(--text-2); font-size: 13px;
  padding: 28px 20px 56px;
  border-top: 1px solid var(--line);
  max-width: 1080px; margin: 0 auto 0; 
}

/* ---------- 查看页 ---------- */
.viewer { position: fixed; inset: 0; display: flex; flex-direction: column; z-index: 10; }
.viewer-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; flex: none;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.viewer-bar .v-title { font-weight: 600; font-size: 15px; }
.viewer-bar .spacer { flex: 1; }
.v-btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 7px 14px; border-radius: 9px; font-size: 13px; font-weight: 500;
  color: var(--text-0); background: var(--surface); border: 1px solid var(--line);
  transition: all 0.2s;
}
.v-btn:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.v-btn.primary { color: #fff; border-color: transparent; background: var(--grad); }
.v-frame { flex: 1; border: none; width: 100%; background: #fff; }
.v-loading { flex: 1; display: grid; place-items: center; color: var(--text-1); }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .nav-inner { flex-wrap: wrap; gap: 10px; }
  .nav-search { order: 3; flex-basis: 100%; max-width: none; }
  .grid { grid-template-columns: 1fr; }
  .hero { margin-top: 56px; }
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
