/* ============ 画廊页 ============ */
.hero, .wall { position: relative; z-index: 1; }
.wall { scroll-margin-top: 64px; } /* 「开始探索」跳转后第一排完整落在吸顶筛选条之下 */

/* ---------- 动态水面背景（Three.js，仅深色主题） ----------
   宿主挂在 hero 内，高度取满一屏并向页面下方延伸；随页面滚动，滚出视口即停渲染。 */
.water-bg {
  position: absolute; left: 50%; top: 0;
  width: 100vw; height: 100vh;
  margin-left: -50vw;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  /* 底部渐隐，避免水面与下方瀑布流区域产生生硬边界 */
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 62%, transparent 96%);
          mask-image: linear-gradient(180deg, #000 0%, #000 62%, transparent 96%);
}
.hero > *:not(.water-bg) { position: relative; z-index: 1; }
html[data-theme="light"] .water-bg { display: none; } /* 浅色主题是干净白底画廊，不叠水面 */

/* 水面之上的文字加一层柔和暗晕，保证在任何浪光下都可读 */
html:not([data-theme="light"]) .hero-title { text-shadow: 0 2px 18px rgba(2, 6, 12, 0.85), 0 0 34px rgba(130, 180, 255, 0.20); }
html:not([data-theme="light"]) .hero-sub { text-shadow: 0 1px 10px rgba(2, 6, 12, 0.8); }

/* ---------- 置顶统计条（总文件数 / 存储占用 / 分类 / 最近更新） ---------- */
.stats-strip {
  position: relative; z-index: 2;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 0 34px;
  max-width: 1240px;
  margin: 16px auto 0;
  padding: 14px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.stats-strip .si {
  display: flex; align-items: baseline; gap: 8px;
  padding: 3px 0;
  white-space: nowrap;
}
.stats-strip .si + .si { position: relative; }
.stats-strip .si + .si::before {
  content: ""; position: absolute; left: -17px; top: 50%;
  width: 1px; height: 20px; margin-top: -10px;
  background: var(--line);
}
.stats-strip .si-ico {
  font-size: 14px; opacity: 0.9; transform: translateY(1px);
}
.stats-strip b {
  font-family: Poppins, var(--font);
  font-size: 19px; font-weight: 800; letter-spacing: -0.01em;
  color: #fff;
}
.stats-strip b em {
  font-style: normal; font-size: 12px; font-weight: 600;
  color: var(--accent2); margin-left: 2px;
}
.stats-strip .si-label { font-size: 12.5px; color: var(--txt3); letter-spacing: 0.04em; }
@media (max-width: 860px) {
  .stats-strip { gap: 10px 20px; padding: 12px 14px; margin-top: 12px; }
  .stats-strip .si + .si::before { display: none; }
  .stats-strip b { font-size: 16px; }
  .stats-strip .si-label { font-size: 11.5px; }
}
.hero { text-align: center; padding: 52px 20px 6px; }
.hero-title {
  margin-top: 24px;
  font-size: clamp(34px, 5.2vw, 56px);
  font-weight: 900;
  letter-spacing: 0.01em;
  line-height: 1.12;
  color: #fff;
  text-shadow: 0 0 34px rgba(130, 180, 255, 0.22);
}
.hero-title .l1, .hero-title .l2 { display: block; }
.hero-sub { color: #a9aeb5; font-size: 14px; margin-top: 16px; letter-spacing: 0.04em; }
.hero-sub b { font-weight: 600; color: #fff; }
.hero-sub .nb { white-space: nowrap; }
.hero-cta { margin-top: 26px; }

/* ---------- 弧形封面墙（参考图样式：相机在弧外，中心平铺，两侧对称后旋渐远） ----------
   卡片放在半径 R 的凸弧上：x = R·sin(a)，z = R·(cos a − 1)，rotateY(a)。
   中心卡完全正面；±20° 邻卡微缩微转；边缘被视口裁切。 */
.ring-wrap {
  position: relative; z-index: 1;
  height: 540px;
  margin: 10px 0 0;
  overflow: hidden;
}
/* 脚部渐隐，让封面墙"沉"进页面底色 */
.ring-wrap::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 90px;
  background: linear-gradient(180deg, rgba(2, 2, 4, 0), rgba(2, 2, 4, 0.94) 80%);
  pointer-events: none;
}
.arc-scale {
  position: absolute; inset: 0;
  transform: scale(var(--as, 1));
  transform-origin: 50% 0;
}
.arc-scene {
  position: absolute; left: 50%; top: 46px;
  width: 1440px; height: 500px; margin-left: -720px;
  perspective: 1400px;
  perspective-origin: 50% 44%;
  transform-style: preserve-3d;
  pointer-events: none;
  z-index: 5;
}
.arc-card {
  position: absolute; left: 50%; top: 50%;
  width: 310px; height: 432px;
  margin: -216px 0 0 -155px;
  border-radius: 14px; overflow: hidden;
  background: #0d1117;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55), 0 8px 20px rgba(0, 0, 0, 0.45);
  backface-visibility: hidden;
  will-change: transform;
  pointer-events: auto;
  cursor: pointer;
}
.arc-card img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
}
.arc-card.broken img { display: none; }
.ring-edge {
  position: absolute; inset: 0; border-radius: 14px; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14),
              inset 0 18px 34px rgba(255, 255, 255, 0.05);
}
.ring-ph {
  position: absolute; inset: 0;
  display: grid; place-items: center;
}
.ring-ph span {
  font-family: Poppins, var(--font);
  font-weight: 900; font-size: 30px; letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.88); text-transform: uppercase;
  text-align: center; padding: 0 18px;
}

/* ---------- 入场编排（一次跑完即静止；用独立 translate 属性避免与布局冲突） ---------- */
@keyframes pocketRise {
  from { opacity: 0; translate: 0 14px; }
  to   { opacity: 1; translate: 0 0; }
}
@keyframes pocketFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.badge-pill  { animation: pocketRise 0.56s cubic-bezier(0.16, 1, 0.3, 1) 0.10s both; }
.hero-title .l1 { animation: pocketRise 0.85s cubic-bezier(0.16, 1, 0.3, 1) 0.24s both; }
.hero-title .l2 { animation: pocketRise 0.85s cubic-bezier(0.16, 1, 0.3, 1) 0.34s both; }
.hero-sub    { animation: pocketRise 0.62s cubic-bezier(0.16, 1, 0.3, 1) 0.50s both; }
.hero-cta    { animation: pocketRise 0.62s cubic-bezier(0.16, 1, 0.3, 1) 0.60s both; }
.stats-strip { animation: pocketRise 0.62s cubic-bezier(0.16, 1, 0.3, 1) 0.30s both; }
.ring-wrap   { animation: pocketRise 0.95s cubic-bezier(0.16, 1, 0.3, 1) 0.55s both; }
.filter-bar  { animation: pocketFade 0.6s ease 0.15s both; }
.wall        { animation: pocketFade 0.7s ease 0.95s both; }
@media (prefers-reduced-motion: reduce) {
  .badge-pill, .hero-title .l1, .hero-title .l2, .hero-sub, .hero-cta,
  .stats-strip, .ring-wrap, .filter-bar, .wall { animation: none; }
}

/* ============ 浅色主题：复刻参考图（卡片墙在上、文案在下，白底大留白） ============ */
html[data-theme="light"] body {
  display: flex; flex-direction: column; /* 用 order 重排：卡片墙成为首屏主角 */
}
html[data-theme="light"] .topbar      { order: 1; }
html[data-theme="light"] .stats-strip { order: 2; }
html[data-theme="light"] .filter-bar  { order: 3; }
html[data-theme="light"] .ring-wrap   { order: 4; height: 620px; margin-top: 6px; }
html[data-theme="light"] .hero        { order: 5; padding: 26px 20px 10px; }
html[data-theme="light"] .wall        { order: 6; }
html[data-theme="light"] .footer      { order: 7; }
/* flex 列里带 auto 外边距的项不会 stretch，必须显式给满宽（否则瀑布流会塌成一列） */
html[data-theme="light"] .hero,
html[data-theme="light"] .wall,
html[data-theme="light"] .footer { width: 100%; }
/* 置顶统计条：白底浮卡 */
html[data-theme="light"] .stats-strip {
  background: #fff;
  border-color: rgba(20, 22, 26, 0.08);
  box-shadow: 0 8px 26px rgba(20, 22, 26, 0.07);
}
html[data-theme="light"] .stats-strip b { color: #16181d; }
html[data-theme="light"] .stats-strip b em { color: #0a86d8; }
html[data-theme="light"] .stats-strip .si-label { color: #8b9098; }
html[data-theme="light"] .stats-strip .si + .si::before { background: rgba(20, 22, 26, 0.1); }

/* 白底卡片墙：脚部渐隐改白，卡片加柔影（参考图里的悬浮感） */
html[data-theme="light"] .ring-wrap::after {
  background: linear-gradient(180deg, rgba(251, 250, 248, 0), #fbfaf8 82%);
}
html[data-theme="light"] .arc-card {
  box-shadow: 0 26px 54px rgba(20, 22, 26, 0.16), 0 4px 14px rgba(20, 22, 26, 0.08);
}
html[data-theme="light"] .ring-edge {
  box-shadow: inset 0 0 0 1px rgba(20, 22, 26, 0.06);
}
html[data-theme="light"] .ring-ph span { color: rgba(255, 255, 255, 0.92); }

/* 文案区 */
html[data-theme="light"] .hero-title { color: #16181d; text-shadow: none; }
html[data-theme="light"] .hero-sub { color: #6b7280; }
html[data-theme="light"] .hero-sub b { color: #16181d; }
html[data-theme="light"] .hstat b { color: #16181d; }
html[data-theme="light"] .hstat span { color: #8b9098; }

/* 筛选条 */
html[data-theme="light"] .filter-bar {
  background: rgba(251, 250, 248, 0.93);
  border-bottom-color: rgba(20, 22, 26, 0.07);
}

/* 瀑布流卡片 */
html[data-theme="light"] .card {
  background: #fff;
  border-color: rgba(20, 22, 26, 0.07);
  box-shadow: 0 2px 10px rgba(20, 22, 26, 0.05);
}
html[data-theme="light"] .card:hover {
  border-color: rgba(20, 22, 26, 0.16);
  box-shadow: 0 16px 38px rgba(20, 22, 26, 0.13);
}
html[data-theme="light"] .card-media { background: linear-gradient(110deg, #f2f1ee 30%, #faf9f7 45%, #f2f1ee 60%); }
html[data-theme="light"] .card-title { color: #16181d; }
html[data-theme="light"] .card-meta { color: #8b9098; }
html[data-theme="light"] .card-hover { background: rgba(255, 255, 255, 0.62); }
html[data-theme="light"] .footer { color: #8b9098; }
html[data-theme="light"] .footer a { color: #5b6169; }
html[data-theme="light"] .footer a:hover { color: #16181d; }

/* ---------- 选择模式 ---------- */
body.selecting .card-hover { display: none; }
body.selecting .card { cursor: pointer; }
.card.picked {
  border-color: rgba(34, 211, 238, 0.85) !important;
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.5), 0 14px 40px rgba(0, 0, 0, 0.5) !important;
}
.card.picked::after {
  content: "✓";
  position: absolute; top: 10px; right: 10px; z-index: 6;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent2); color: #04121a;
  font-size: 15px; font-weight: 800; line-height: 26px; text-align: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}
#btn-select.on {
  background: var(--grad); color: #fff; border-color: transparent; font-weight: 600;
}
html[data-theme="light"] #btn-select.on { background: #16181d; border-color: #16181d; }
html[data-theme="light"] .card.picked { border-color: #0a86d8 !important; box-shadow: 0 0 0 2px rgba(10, 134, 216, 0.35), 0 14px 34px rgba(20, 22, 26, 0.18) !important; }

/* 底部批量操作条 */
.selbar {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 120;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 16px 12px 20px;
  border-radius: 16px;
  border: 1px solid rgba(34, 211, 238, 0.28);
  background: rgba(12, 16, 24, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  animation: pocketRise 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
/* display:flex 会盖掉 hidden 属性的 display:none，必须显式处理 */
.selbar[hidden] { display: none; }
.selbar-count {
  font-size: 13.5px; font-weight: 600; color: #67e8f9; white-space: nowrap;
}
.selbar-btns { display: flex; gap: 8px; flex-wrap: wrap; }
html[data-theme="light"] .selbar {
  background: rgba(255, 255, 255, 0.97);
  border-color: rgba(10, 134, 216, 0.28);
  box-shadow: 0 18px 48px rgba(20, 22, 26, 0.18);
}
html[data-theme="light"] .selbar-count { color: #0a6fa8; }
@media (max-width: 720px) {
  .selbar { left: 10px; right: 10px; transform: none; gap: 10px; padding: 10px 12px; flex-wrap: wrap; }
  .selbar-btns { width: 100%; }
}
.filter-bar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 13px 28px;
  background: rgba(7, 7, 13, 0.94);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }
.filter-bar .chips { flex: 1; }
.sort-wrap { flex-shrink: 0; }
.sort-wrap .select { padding: 7px 34px 7px 13px; font-size: 13px; }

/* ---------- 瀑布流网格 ---------- */
.wall { padding: 26px 28px 40px; max-width: 1720px; margin: 0 auto; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  grid-auto-rows: 8px;
  column-gap: 18px;
  row-gap: 0;
}
.card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  background: var(--bg2);
  border: 1px solid var(--line);
  margin-bottom: 18px;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.45s ease, transform 0.45s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.card.in { opacity: 1; transform: none; }
.card:hover {
  border-color: rgba(139, 92, 246, 0.55);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(139, 92, 246, 0.25), 0 8px 30px rgba(139, 92, 246, 0.18);
}
.card-media {
  position: relative;
  width: 100%;
  background:
    linear-gradient(110deg, #14141d 30%, #1c1c28 45%, #14141d 60%);
  background-size: 220% 100%;
  animation: shimmer 1.6s linear infinite;
  overflow: hidden;
}
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.card-media img, .card-media video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.card-media img.loaded, .card-media video.loaded { opacity: 1; }
.card-video { z-index: 3; }
.card-badges { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 6px; z-index: 4; }
.card-badges .badge:first-child { margin-right: auto; }
.card-info { padding: 12px 14px 13px; }
.card-title {
  font-size: 14px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-meta {
  display: flex; align-items: center; gap: 8px;
  margin-top: 5px;
  font-size: 12px; color: var(--txt3);
}
.card-meta .dl { margin-left: auto; display: inline-flex; align-items: center; gap: 3px; }
.card-meta .dl svg { width: 12px; height: 12px; }
.card-hover {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: rgba(8, 8, 14, 0.55);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.card:hover .card-hover { opacity: 1; }
.card-hover .btn { transform: translateY(6px); transition: transform 0.22s ease; }
.card:hover .card-hover .btn { transform: none; }
.card-hover .btn svg { width: 15px; height: 15px; }

/* ---------- 灯箱 ---------- */
.lb {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(6, 6, 11, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  animation: fadeIn 0.2s ease;
}
.lb-media {
  flex: 1; min-width: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 46px 22px 22px;
  position: relative;
}
.lb-media img { max-width: 100%; max-height: 100%; border-radius: 12px; box-shadow: 0 24px 80px rgba(0,0,0,0.7); cursor: zoom-in; transition: transform 0.25s ease; }
.lb-media img.zoomed { cursor: zoom-out; transform: scale(1.7); }
.lb-media video { max-width: 100%; max-height: 100%; border-radius: 12px; background: #000; box-shadow: 0 24px 80px rgba(0,0,0,0.7); }
.lb-file {
  text-align: center; color: var(--txt2);
}
.lb-file .big-ext {
  width: 120px; height: 120px; margin: 0 auto 22px;
  border-radius: 28px; display: grid; place-items: center;
  background: var(--grad); color: #fff;
  font-size: 26px; font-weight: 800; letter-spacing: 1px;
  box-shadow: 0 16px 48px rgba(139, 92, 246, 0.4);
}
.lb-file p { font-size: 13.5px; line-height: 1.8; }
.lb-side {
  width: 330px; flex-shrink: 0;
  background: rgba(16, 16, 25, 0.85);
  border-left: 1px solid var(--line);
  padding: 30px 26px;
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.lb-cat { align-self: flex-start; }
.lb-title { font-size: 20px; font-weight: 700; line-height: 1.45; margin: 14px 0 4px; word-break: break-all; }
.lb-orig { font-size: 12.5px; color: var(--txt3); word-break: break-all; }
.lb-note {
  margin-top: 16px; padding: 13px 15px;
  background: rgba(139, 92, 246, 0.09);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 12px;
  font-size: 13.5px; line-height: 1.7; color: #d6d0ff;
  word-break: break-all;
}
.lb-attrs { margin-top: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 13px 16px; }
.lb-attr span { display: block; font-size: 11.5px; color: var(--txt3); margin-bottom: 3px; letter-spacing: 0.5px; }
.lb-attr b { font-size: 13.5px; font-weight: 600; }
.lb-actions { margin-top: auto; padding-top: 24px; display: flex; flex-direction: column; gap: 10px; }
.lb-actions .btn { width: 100%; padding: 13px; font-size: 14.5px; }
.lb-actions .row2 { display: flex; gap: 10px; }
.lb-actions .row2 .btn { flex: 1; }
.lb-close {
  position: absolute; top: 16px; right: 18px; z-index: 5;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  color: var(--txt); font-size: 17px; cursor: pointer;
  display: grid; place-items: center;
  transition: all 0.2s;
}
.lb-close:hover { background: rgba(255, 255, 255, 0.16); transform: rotate(90deg); }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  color: var(--txt); font-size: 20px; cursor: pointer;
  display: grid; place-items: center;
  transition: all 0.2s; z-index: 5;
  user-select: none;
}
.lb-nav:hover { background: rgba(139, 92, 246, 0.35); }
.lb-prev { left: 18px; }
.lb-next { right: 18px; }
.lb-count {
  position: absolute; top: 24px; left: 26px;
  font-size: 12.5px; color: var(--txt2);
  background: rgba(255,255,255,0.07); padding: 5px 13px; border-radius: 99px;
  border: 1px solid var(--line);
}

@media (max-width: 860px) {
  .lb { flex-direction: column; }
  .lb-side { width: 100%; max-height: 46vh; border-left: none; border-top: 1px solid var(--line); }
  .lb-media { padding: 60px 12px 12px; }
  .hero { padding: 40px 16px 24px; }
  .wall { padding: 18px 14px 30px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); column-gap: 12px; }
  .card { margin-bottom: 12px; }
  .filter-bar { padding: 10px 14px; }
  /* 分类 chips 单行横滑，别在窄屏堆成好几行 */
  .filter-bar .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .filter-bar .chips::-webkit-scrollbar { display: none; }
  .ring-wrap { height: 340px; }
  .arc-scale { transform: scale(0.62); }
  .arc-scene { top: 16px; }
}
@media (max-width: 560px) {
  .ring-wrap { height: 300px; }
  .arc-scale { transform: scale(0.5); }
  .arc-scene { top: 10px; }
}
