:root {
  --bg: #000000;
  --fg: #f0f0f0;
  --muted: #9a9a96;
  --line: #2a2a2a;
  --accent: #b08d57;
}

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

/* 确保 hidden 属性永远生效，不被下面的 display:flex 等覆盖 */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶部导航 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; flex-direction: column; gap: 2px; }
.brand h1 {
  font-family: "Segoe UI", "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 700;
  font-size: 34px;
  letter-spacing: 2px;
}
.brand .subtitle { font-size: 12px; color: var(--muted); letter-spacing: 2px; }

.nav { display: flex; gap: 8px; }
.nav-btn {
  appearance: none;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 15px;
  color: var(--muted);
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: color .2s, background .2s;
}
.nav-btn:hover { color: var(--fg); }
.nav-btn.active {
  color: #000;
  background: #fff;
}

/* ---------- 分类导航（横向，与后台目录分类一致） ---------- */
.filter-tree {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 40px 2px;
}
.ft-level {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.ft-chip {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  padding: 5px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s;
}
.ft-chip:hover { border-color: var(--accent); color: var(--fg); }
.ft-chip.active {
  border-color: #fff;
  background: #fff;
  color: #000;
}

/* ---------- 画廊（瀑布流） ---------- */
.gallery {
  columns: 4 260px;
  column-gap: 16px;
  padding: 24px 40px 8px;
}
.photo {
  position: relative;
  break-inside: avoid;
  margin-bottom: 16px;
  overflow: hidden;
  border-radius: 6px;
  background: #1a1a1a;
  cursor: zoom-in;
}
.photo img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform .7s cubic-bezier(0.22, 1, 0.36, 1), opacity .5s ease;
  opacity: 0;
  will-change: transform;
}
.photo img.loaded { opacity: 1; }
.photo:hover img { transform: scale(1.06); }

/* ---------- 悬停聚光：压暗照片以外的区域，选中照片保持原亮度（不提亮） ---------- */
.spotlight {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity .6s ease;
}
body:has(.photo:hover) .spotlight { opacity: 1; }
.photo:hover { z-index: 41; }

.photo figcaption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 28px 14px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
  color: #fff;
  font-size: 13px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .25s, transform .25s;
  pointer-events: none;
}
.photo:hover figcaption { opacity: 1; transform: translateY(0); }
.photo figcaption .meta { display: block; font-size: 11px; opacity: .8; margin-top: 2px; }

/* ---------- 空提示 / 加载哨兵 ---------- */
.empty-tip { text-align: center; color: var(--muted); padding: 80px 0; }
.sentinel { height: 1px; }

/* ---------- 页脚 ---------- */
.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 40px;
  color: var(--muted);
  font-size: 13px;
}
.admin-link, .email-link {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
.admin-link:hover, .email-link:hover { color: var(--fg); border-color: var(--fg); }

/* ---------- 开场大字 ---------- */
.intro {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  pointer-events: none;
}
.intro-title {
  font-family: "Segoe UI", "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 700;
  font-size: clamp(64px, 16vw, 200px);
  color: #fff;
  will-change: transform, opacity;
}
.intro-word {
  display: inline-block;
  animation: introIn 2s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes introIn {
  from { opacity: 0; transform: scale(1.35); letter-spacing: 0.2em; }
  to   { opacity: 1; transform: scale(1);    letter-spacing: 0.05em; }
}

/* ---------- 灯箱 ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 10, 0.94);
  animation: fadeIn .24s linear;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.lb-figure {
  max-width: 88vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  /* 只在中心做极小幅度缩放，避免大幅位移带来的“飞入”感 */
  animation: lbFigureIn .24s linear;
}
.lb-figure img {
  max-width: 88vw;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  /* 大图解码完成后才淡入，避免先闪出一个空框 */
  opacity: 0;
  transform: scale(0.98);
  transition: opacity .24s linear var(--lb-img-delay, 0ms),
              transform .24s linear var(--lb-img-delay, 0ms);
}
.lb-figure img.loaded { opacity: 1; transform: none; }

/* 进场 / 退场：互为镜像，幅度刻意压到几乎察觉不到 */
@keyframes lbFigureIn {
  from { opacity: .85; transform: scale(0.985); }
  to { opacity: 1; transform: none; }
}
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes lbFigureOut {
  from { opacity: 1; transform: none; }
  to { opacity: .85; transform: scale(0.985); }
}
.lightbox.closing { animation: fadeOut .24s linear both; }
.lightbox.closing .lb-figure { animation: lbFigureOut .24s linear both; }

.lb-figure figcaption { color: #ddd; font-size: 14px; text-align: center; }
.lb-figure figcaption .meta { display: block; font-size: 12px; color: #999; margin-top: 4px; }
.lb-figure figcaption .exif { display: block; font-size: 12px; color: #8a8a8a; margin-top: 4px; }

.lb-img {
  position: relative;
  line-height: 0;
}
.lb-close {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 28px;
  line-height: 1;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  opacity: .7;
  transition: opacity .2s;
}
.lb-close:hover { opacity: 1; }

/* 左右切换按钮：固定在图片外侧（不随图片大小变化），高亮圆钮 */
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  line-height: 1;
  color: #fff;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5), 0 0 0 3px rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(3px);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.55);
  transition: background .2s, border-color .2s, transform .15s;
}
.lb-nav:hover {
  background: rgba(0, 0, 0, 0.72);
  border-color: rgba(255, 255, 255, 0.9);
  transform: translateY(-50%) scale(1.06);
}
.lb-prev { left: 48px; }
.lb-next { right: 48px; }

@media (max-width: 640px) {
  .site-header { padding: 16px 20px; }
  .gallery { padding: 20px 20px 4px; }
  .filter-tree { padding: 12px 20px 0; }
  .footer { padding: 32px 20px; }
  .lb-nav { width: 38px; height: 38px; font-size: 24px; }
  .lb-prev { left: 8px; }
  .lb-next { right: 8px; }
  .lb-close { font-size: 22px; top: 12px; right: 14px; }
}
