/* =========================================
   Personal Photography Archive - Style
   ========================================= */

*, *::before, *::after { box-sizing: border-box; }

html { 
  background: #0a0a0b; 
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #0a0a0b;
  color: #e8e8e6;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.is-locked { overflow: hidden; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 30;
  height: 52px;
  padding: 0 clamp(16px, 4vw, 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 10, 11, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: transform 0.35 ease;
}

.topbar.is-hidden { transform: translateY(-100%); }

.brand {
  color: #e8e8e6;
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 0.22em;
  font-weight: 600;
}

.count {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: rgba(232, 232, 230, 0.45);
  font-variant-numeric: tabular-nums;
}
/* ---------- 主页简介（RAUL 署名） ---------- */
.intro {
  padding: calc(52px + 3px) 24px 40px; /* 顶栏52px + 额外3px留白 */
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
}

.intro__name {
  margin: 0;
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 300;
  letter-spacing: 0.25em;
  color: #e8e8e6;
}

.intro__desc {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.15em;
  color: #666;
  text-transform: uppercase;
}

.intro__email {
  margin-top: 8px;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: #888 !important; /* 强制灰色 */
  text-decoration: none !important; /* 去掉蓝色下划线 */
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 3px;
  transition: color 0.3 ease, border-color 0.3 ease;
}

.intro__email:hover {
  color: #fff !important;
  border-color: #fff;
}

/* ---------- 画廊（自动适配密集照片墙） ---------- */
.gallery {
  --gap: clamp(4px, 0.6vw, 8px);
  padding: var(--gap) var(--gap) var(--gap);
  max-width: 1800px;
  margin: 0 auto;
  display: grid;
  /* 核心改动：桌面端自动排列 3~5 列，每个格子最小 280px，首页变成缩略图 */
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); 
  gap: var(--gap);
}

.photo {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: #121214;
  cursor: zoom-in;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: z-index 0; 
}

.photo:hover {
  z-index: 10;
}

.photo img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 3 / 4; /* 3:4 缩略图 */
  object-fit: cover;   
  background: #121214;
  opacity: 1;

  /* 左右轻微浮动动画 */
  animation: sway var(--float-duration, 5s) ease-in-out infinite;
  animation-delay: var(--float-delay, 0s);
  
  /* 过渡动画 */
  transition: box-shadow 0.4s ease;
}

/* 核心改动：鼠标悬停只暂停浮动 + 加阴影，坚决不放大 */
.photo:hover img {
  animation-play-state: paused; 
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.8); 
}

@keyframes sway {
  0% { transform: translateX(0px); }
  50% { transform: translateX(-6px); }
  100% { transform: translateX(0px); }
}

.photo:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.5);
  outline-offset: -1px;
}

.empty {
  padding: 46vh 24px;
  text-align: center;
  color: #55565a;
  font-size: 13px;
  letter-spacing: 0.08em;
}

.empty code {
  padding: 2px 6px;
  background: rgba(255,255,255,.07);
  border-radius: 3px;
}

/* ---------- 灯箱（大图） ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 6, 7, 0.97);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.lightbox.is-open { opacity: 1; visibility: visible; }

.lb-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 96vw;
}

.lb-img {
  max-width: 96vw;
  max-height: 96vh; /* 核心改动：大图几乎铺满全屏 */
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.lb-meta {
  display: flex;
  gap: 18px;
  font-size: 11px;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
}

.lb-meta span:empty { display: none; }

.lb-close,
.lb-nav {
  position: absolute;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition: color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.lb-close:hover,
.lb-nav:hover { color: #fff; }

.lb-close:focus-visible,
.lb-nav:focus-visible { outline: 1px solid rgba(255,255,255,.5); }

.lb-close {
  top: 14px;
  right: 18px;
  font-size: 34px;
  line-height: 1;
  padding: 6px 12px;
}

.lb-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  font-size: 32px;
  line-height: 1;
  border-radius: 50%;
}

.lb-prev { left: 8px; }
.lb-next { right: 8px; }

/* ---------- 响应式（手机端 2 列，关闭动画） ---------- */
@media (max-width: 720px) {
  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr)); /* 手机端 2 列缩略图 */
    gap: 4px;
  }
  .photo img {
    aspect-ratio: 3 / 4; 
    max-height: none;
    object-fit: cover;
    animation: none; /* 手机端关闭浮动，保证性能 */
  }
  .photo:hover img {
    box-shadow: none; /* 手机端无悬停概念 */
  }
  .lb-nav { width: 48px; height: 48px; font-size: 26px; }
  .lb-prev { left: 0; }
  .lb-next { right: 0; }
  .lb-img { max-height: 90vh; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; }
  .photo img { animation: none !important; }
}
