/* 相册：分组 + 分页 + 灯箱 */
.albums {
  position: sticky;
  top: var(--nav-h);
  z-index: 30;
  background: rgba(251, 247, 238, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--gold-line);
}

.albums ul {
  width: var(--shell);
  margin: 0 auto;
  list-style: none;
  display: flex;
  gap: clamp(1rem, 3vw, 2.4rem);
  justify-content: center;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0.9rem 0;
}

.albums ul::-webkit-scrollbar { display: none; }

.albums button {
  appearance: none;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.94rem;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  white-space: nowrap;
  padding: 0.15rem 0;
  position: relative;
  transition: color 0.35s var(--ease);
}

.albums button .count {
  font-family: var(--label);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  color: var(--gold);
  margin-left: 0.4rem;
  vertical-align: 0.15em;
}

.albums button::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.15rem;
  width: 100%;
  height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transition: transform 0.45s var(--ease);
}

.albums button:hover { color: var(--ink-soft); }
.albums button[aria-current="true"] { color: var(--ink); }
.albums button[aria-current="true"]::after { transform: scaleX(1); }

/* —— 照片墙 —— */
.gallery-wrap {
  width: var(--shell);
  margin: 0 auto;
  padding: clamp(2.4rem, 5vw, 3.6rem) 0 clamp(3rem, 6vw, 4.5rem);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(0.7rem, 1.6vw, 1.1rem);
}

.tile {
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  cursor: zoom-in;
  display: block;
  animation: tile-in 0.7s var(--ease) both;
}

.tile[data-empty="1"] { cursor: default; }

.tile .frame { transition: transform 0.6s var(--ease); }
.tile:hover .frame { transform: translateY(-5px); }
.tile .frame > img { transition: transform 0.9s var(--ease); }
.tile:hover .frame > img { transform: scale(1.05); }

@keyframes tile-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.grid.is-leaving .tile {
  animation: tile-out 0.28s var(--ease) both;
}

@keyframes tile-out {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-8px); }
}

/* —— 分页 —— */
.pager {
  margin-top: clamp(2.2rem, 5vw, 3.2rem);
  padding-top: 1.6rem;
  border-top: 1px solid var(--gold-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.pager-side {
  appearance: none;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.84rem;
  letter-spacing: 0.1em;
  color: var(--ink);
  transition: color 0.3s var(--ease), opacity 0.3s var(--ease);
}

.pager-side:hover { color: var(--gold); }

.pager-side:disabled {
  opacity: 0.26;
  cursor: default;
}

.pager-pages {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.pager-pages button {
  appearance: none;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: var(--label);
  font-size: 1rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  padding: 0 0.15rem;
  position: relative;
  transition: color 0.3s var(--ease);
}

.pager-pages button::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.3rem;
  height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transition: transform 0.4s var(--ease);
}

.pager-pages button[aria-current="true"] { color: var(--ink); }
.pager-pages button[aria-current="true"]::after { transform: scaleX(1); }

/* —— 灯箱 —— */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: rgba(20, 17, 12, 0.94);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s var(--ease), visibility 0.4s var(--ease);
}

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

.lightbox img {
  max-width: min(100%, 68rem);
  max-height: 78svh;
  object-fit: contain;
  animation: shot-in 0.45s var(--ease) both;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox img.is-swiping {
  animation: none;
  transition: none;
}

@keyframes shot-in {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: none; }
}

.lightbox-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: clamp(1rem, 3vw, 2rem);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.4rem;
  color: rgba(246, 240, 228, 0.82);
  font-family: var(--sans);
  font-size: 0.84rem;
  letter-spacing: 0.08em;
}

.lightbox-bar button {
  appearance: none;
  border: 1px solid rgba(246, 240, 228, 0.35);
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0.55rem 1rem;
  cursor: pointer;
  transition: background 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.lightbox-bar button:hover {
  background: linear-gradient(120deg, #b8943f, #d4b56a);
  border-color: transparent;
  color: #fffaf0;
}

.lightbox-close {
  position: absolute;
  top: clamp(0.9rem, 3vw, 1.8rem);
  right: clamp(0.9rem, 3vw, 1.8rem);
  width: 2.6rem;
  height: 2.6rem;
  appearance: none;
  border: 1px solid rgba(246, 240, 228, 0.35);
  background: transparent;
  cursor: pointer;
  position: absolute;
}

.lightbox-close::before,
.lightbox-close::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.95rem;
  height: 1px;
  background: #f6f0e4;
}

.lightbox-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.lightbox-close::after { transform: translate(-50%, -50%) rotate(-45deg); }

.gallery-note {
  width: var(--shell);
  margin: 0 auto;
  padding-bottom: clamp(3rem, 6vw, 4.5rem);
  text-align: center;
  color: var(--ink-soft);
}

@media (max-width: 720px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .albums ul { justify-content: flex-start; }
  .pager-pages { gap: 0.55rem; }
  .lightbox-bar { gap: 0.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  .tile,
  .grid.is-leaving .tile,
  .lightbox img {
    animation: none;
  }
}
