/* ==========================================================================
   照片墙  gallery.css
   --------------------------------------------------------------------------
   复用 home.css 的 token 与通用组件（导航 / 按钮 / 指针 / 进度条），
   这里只写照片墙自己的东西：页头、筛选、错落网格、卡片、灯箱。
   ========================================================================== */

body.gal { background: var(--bg); }

/* ---------- 页头 ---------- */
.gal-head { padding: clamp(120px, 15vw, 190px) 0 clamp(40px, 5vw, 64px); }
.gal-head h1 {
  font-family: var(--font-d);
  font-size: clamp(38px, 7vw, 92px);
  line-height: .98; letter-spacing: -.04em; font-weight: 600;
}
.gal-head h1 em { font-style: italic; color: var(--accent); }
.gal-sub {
  margin-top: 20px; max-width: 54ch;
  font-size: clamp(14.5px, 1.6vw, 17px); line-height: 1.72; color: var(--ink-2);
}
.gal-stat {
  display: flex; flex-wrap: wrap; gap: clamp(20px, 4vw, 56px);
  margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--line);
}
.gal-stat div { display: flex; align-items: baseline; gap: 10px; }
.gal-stat b {
  font-family: var(--font-d); font-size: clamp(20px, 2.4vw, 28px);
  letter-spacing: -.03em; font-weight: 600; font-variant-numeric: tabular-nums;
}
.gal-stat span { font-size: 12.5px; color: var(--ink-3); letter-spacing: .04em; }

/* ---------- 筛选 ---------- */
.gal-tools {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding-bottom: 22px; margin-bottom: 26px; border-bottom: 1px solid var(--line);
}
.gal-seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--r-pill); background: rgba(255,255,255,.035); border: 1px solid var(--line); }
.gal-seg button {
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
  padding: 8px 16px; border-radius: var(--r-pill); font-size: 13.5px;
  transition: background .4s var(--ease), color .4s var(--ease);
}
.gal-seg button:hover { color: var(--ink); }
.gal-seg button.on { background: var(--accent); color: #1b1508; font-weight: 600; }
.gal-count { margin-left: auto; font-size: 12.5px; color: var(--ink-3); font-family: var(--font-m); }

/* ---------- 错落网格 ---------- */
.gal-grid { columns: 4; column-gap: 16px; }
.gal-item {
  break-inside: avoid; margin-bottom: 16px; position: relative;
  border-radius: var(--r-lg); overflow: hidden; cursor: pointer;
  border: 1px solid var(--line); background: var(--card);
  transition: border-color .55s var(--ease), transform .55s var(--ease);
}
.gal-item:hover { border-color: var(--line-2); transform: translateY(-3px); }
.gal-item img, .gal-item video { width: 100%; display: block; }
.gal-item img { filter: saturate(.86) contrast(1.04); transition: transform .8s var(--ease), filter .8s var(--ease); }
.gal-item:hover img { transform: scale(1.04); filter: saturate(1) contrast(1.06); }

.gal-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 34px 16px 14px;
  background: linear-gradient(transparent, rgba(6,5,4,.88));
  opacity: 0; transform: translateY(8px);
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}
.gal-item:hover .gal-cap { opacity: 1; transform: none; }
.gal-cap b { display: block; font-size: 14px; font-weight: 500; letter-spacing: -.01em; }
.gal-cap span { font-size: 12px; color: var(--ink-3); }
.gal-cap .badge {
  position: absolute; right: 14px; top: -26px;
  font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); font-family: var(--font-m);
}

.gal-vid {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid rgba(240,234,225,.5); background: rgba(11,10,9,.55);
  display: grid; place-items: center; pointer-events: none;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.gal-vid svg { width: 18px; height: 18px; }

.gal-empty {
  padding: 80px 0; text-align: center; color: var(--ink-3); font-size: 14.5px;
}
.gal-skel { border-radius: var(--r-lg); background: rgba(255,255,255,.035); animation: gskel 1.5s ease-in-out infinite; }
@keyframes gskel { 0%,100% { opacity: .45 } 50% { opacity: .9 } }

/* ---------- 灯箱 ---------- */
.gal-lb {
  position: fixed; inset: 0; z-index: 200; display: none;
  align-items: center; justify-content: center;
  background: rgba(4,3,2,.94);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  opacity: 0; transition: opacity .4s var(--ease);
}
.gal-lb.show { display: flex; opacity: 1; }
.gal-lb figure { margin: 0; max-width: min(1200px, 92vw); max-height: 86vh; display: flex; flex-direction: column; gap: 14px; }
.gal-lb img, .gal-lb video {
  max-width: 100%; max-height: 76vh; object-fit: contain;
  border-radius: 12px; border: 1px solid var(--line-2);
}
.gal-lb figcaption { display: flex; align-items: baseline; gap: 14px; font-size: 14px; }
.gal-lb figcaption b { font-weight: 500; }
.gal-lb figcaption span { color: var(--ink-3); font-size: 12.5px; }
.gal-lb-x, .gal-lb-p, .gal-lb-n {
  position: absolute; border: 1px solid var(--line-2); background: rgba(11,10,9,.72);
  color: var(--ink); cursor: pointer; border-radius: 50%;
  width: 44px; height: 44px; display: grid; place-items: center;
  transition: background .4s var(--ease), transform .4s var(--ease);
}
.gal-lb-x:hover, .gal-lb-p:hover, .gal-lb-n:hover { background: rgba(28,24,20,.9); }
.gal-lb-x svg, .gal-lb-p svg, .gal-lb-n svg { width: 17px; height: 17px; }
.gal-lb-x { top: 24px; right: 24px; }
.gal-lb-p { left: 22px; top: 50%; margin-top: -22px; }
.gal-lb-n { right: 22px; top: 50%; margin-top: -22px; }

/* ---------- 页脚 ---------- */
.gal-foot {
  padding: 44px var(--pad); margin-top: 60px;
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 14px 30px; justify-content: space-between;
  font-size: 13px; color: var(--ink-3);
}

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) { .gal-grid { columns: 3; } }
@media (max-width: 760px)  { .gal-grid { columns: 2; } }
@media (max-width: 480px)  { .gal-grid { columns: 1; } }
@media (prefers-reduced-motion: reduce) {
  .gal-item img { transition: none; }
}
