/* ============================================================
   作品集页：页头 / 分类筛选 / 瀑布流网格 / 灯箱
   ============================================================ */

.page-head {
  padding: calc(var(--header-h) + clamp(40px, 6vw, 80px)) var(--gutter)
    clamp(34px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
}

.page-head-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: clamp(26px, 4vw, 54px);
}

.page-head-loc {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.page-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: clamp(30px, 6vw, 100px);
}

.page-head h1 {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(52px, 7.6vw, 112px);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: 0.02em;
}

.head-count {
  font-family: var(--font-sans);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--muted);
  padding-top: 10px;
}

.page-head-desc {
  max-width: 420px;
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 1.95;
  color: var(--ink-2);
  text-wrap: pretty;
}

/* ---------- 筛选栏 ---------- */

.gallery-section {
  padding: 0 var(--gutter) clamp(80px, 10vw, 140px);
}

.filter-bar {
  position: sticky;
  top: calc(var(--header-h) + 1px);
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 18px 0;
  background: var(--paper);
  border-bottom: 1px solid transparent;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(244, 242, 238, 0.6);
  color: var(--ink-2);
  font-size: 12px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.3s var(--ease), color 0.3s var(--ease),
    border-color 0.3s var(--ease);
}

.filter-chip span {
  font-size: 9px;
  color: var(--muted);
  transition: color 0.3s var(--ease);
}

.filter-chip:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.filter-chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.filter-chip.is-active span {
  color: rgba(244, 242, 238, 0.6);
}

/* ---------- 瀑布流网格 ---------- */

.gallery-grid {
  columns: 3;
  column-gap: clamp(14px, 1.8vw, 26px);
  padding-top: clamp(16px, 2.4vw, 30px);
}

.photo-card {
  display: block;
  width: 100%;
  margin: 0 0 clamp(20px, 2.4vw, 34px);
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  animation: cardIn 0.8s var(--ease-out) both;
  animation-delay: var(--delay, 0s);
}

.photo-frame {
  position: relative;
  overflow: hidden;
  background: var(--paper-2);
}

/* 图片加载前的轻微呼吸占位，避免布局抖动 */
.photo-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(
    110deg,
    #e6e2da 0%,
    #efece6 42%,
    #e6e2da 68%
  );
  background-size: 220% 100%;
  animation: shimmer 1.8s linear infinite;
  transition: opacity 0.6s var(--ease);
}

.photo-frame.is-loaded::before {
  opacity: 0;
}

.photo-frame img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  opacity: 0;
  transform: scale(1.015);
  transition: opacity 0.8s var(--ease), transform 1s var(--ease-out);
}

.photo-frame.is-loaded img {
  opacity: 1;
  transform: scale(1);
}

.photo-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(
    180deg,
    rgba(9, 9, 8, 0.04) 0%,
    rgba(9, 9, 8, 0.34) 100%
  );
  opacity: 0;
  transition: opacity 0.45s var(--ease);
}

.photo-no {
  position: absolute;
  top: 14px;
  left: 16px;
  z-index: 3;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: rgba(250, 249, 246, 0.85);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}

.photo-view {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: rgba(250, 249, 246, 0.92);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease);
}

.photo-view i {
  font-style: normal;
  font-size: 14px;
}

.photo-card:hover .photo-frame::after,
.photo-card:focus-visible .photo-frame::after {
  opacity: 1;
}

.photo-card:hover .photo-frame img {
  transform: scale(1.04);
}

.photo-card:hover .photo-no,
.photo-card:hover .photo-view,
.photo-card:focus-visible .photo-no,
.photo-card:focus-visible .photo-view {
  opacity: 1;
  transform: none;
}

.photo-card:focus-visible {
  outline-offset: 6px;
}

.photo-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding-top: 12px;
}

.photo-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 0.03em;
}

.photo-title span {
  display: block;
  margin-top: 2px;
  font-family: var(--font-sans);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.photo-info {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--muted);
  white-space: nowrap;
}

.gallery-empty {
  margin: 60px 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes shimmer {
  from {
    background-position: 140% 0;
  }
  to {
    background-position: -40% 0;
  }
}

/* ---------- 页尾引导 ---------- */

.gallery-outro {
  padding: clamp(70px, 9vw, 130px) var(--gutter);
  border-top: 1px solid var(--line);
  text-align: center;
}

.gallery-outro .eyebrow {
  margin-bottom: 24px;
}

.outro-text {
  margin: 0 0 30px;
  font-family: var(--font-display);
  font-size: clamp(24px, 3.4vw, 42px);
  line-height: 1.5;
  letter-spacing: 0.02em;
}

/* ---------- 灯箱 ---------- */

.lightbox {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #0c0c0b;
  color: var(--white);
  overflow: hidden;
}

.lightbox[open] {
  display: flex;
  flex-direction: column;
  animation: lbIn 0.45s var(--ease-out) both;
}

.lightbox::backdrop {
  background: rgba(6, 6, 6, 0.7);
  animation: lbFade 0.45s ease both;
}

.lb-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px clamp(20px, 4vw, 56px);
  border-bottom: 1px solid rgba(250, 249, 246, 0.14);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: rgba(250, 249, 246, 0.7);
  flex: none;
}

.lb-counter {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.16em;
  color: var(--white);
}

.lb-category {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(250, 249, 246, 0.5);
}

.lb-close {
  position: relative;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(250, 249, 246, 0.22);
  border-radius: 50%;
  background: none;
  color: var(--white);
  cursor: pointer;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}

.lb-close:hover {
  background: rgba(250, 249, 246, 0.12);
  border-color: rgba(250, 249, 246, 0.5);
}

.lb-close span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 1px;
  background: currentColor;
}

.lb-close span:first-child {
  transform: translate(-50%, -50%) rotate(45deg);
}

.lb-close span:last-child {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.lb-stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 12px clamp(64px, 9vw, 130px);
}

.lb-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
}

body.lb-open {
  overflow: hidden;
}

.lb-image {
  max-width: 100%;
  max-height: calc(100dvh - 210px);
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 1;
  transition: opacity 0.3s var(--ease);
}

.lb-image.is-switching {
  opacity: 0;
}

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(250, 249, 246, 0.24);
  border-radius: 50%;
  background: rgba(12, 12, 11, 0.35);
  color: var(--white);
  font-size: 18px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease),
    transform 0.3s var(--ease);
}

.lb-nav:hover {
  background: rgba(250, 249, 246, 0.14);
  border-color: rgba(250, 249, 246, 0.55);
}

.lb-prev {
  left: clamp(16px, 3vw, 40px);
}

.lb-next {
  right: clamp(16px, 3vw, 40px);
}

.lb-prev:hover {
  transform: translateY(-50%) translateX(-3px);
}

.lb-next:hover {
  transform: translateY(-50%) translateX(3px);
}

.lb-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex: none;
  padding: 18px clamp(20px, 4vw, 56px) 26px;
  border-top: 1px solid rgba(250, 249, 246, 0.14);
}

.lb-caption h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 0.03em;
}

.lb-caption p {
  margin: 4px 0 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(250, 249, 246, 0.55);
}

.lb-tip {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: rgba(250, 249, 246, 0.4);
  white-space: nowrap;
}

@keyframes lbIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes lbFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ---------- 响应式 ---------- */

@media (max-width: 1180px) {
  .gallery-grid {
    columns: 2;
  }
}

@media (max-width: 860px) {
  .page-head {
    padding-top: calc(var(--header-h) + 40px);
  }

  .page-head-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: clamp(22px, 5vw, 36px);
  }

  .page-head-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }

  .page-head-desc {
    max-width: 100%;
  }

  .filter-bar {
    gap: 7px;
    padding: 14px 0;
  }

  .filter-chip {
    padding: 8px 13px;
    font-size: 11px;
  }

  .lb-stage {
    padding: 8px 10px;
  }

  .lb-nav {
    width: 42px;
    height: 42px;
    font-size: 15px;
  }

  .lb-prev {
    left: 10px;
  }

  .lb-next {
    right: 10px;
  }

  .lb-image {
    max-height: calc(100dvh - 230px);
  }

  .lb-bottom {
    padding: 14px 20px 20px;
  }

  .lb-caption h2 {
    font-size: 20px;
  }

  .lb-tip {
    display: none;
  }
}

@media (max-width: 640px) {
  .filter-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .filter-bar::-webkit-scrollbar {
    display: none;
  }

  .filter-chip {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .gallery-grid {
    columns: 1;
    column-gap: 0;
  }

  .page-head h1 {
    font-size: clamp(46px, 14vw, 68px);
  }

  .lb-top {
    padding: 12px 20px;
  }

  .lb-close {
    width: 38px;
    height: 38px;
  }

  .lb-image {
    max-height: calc(100dvh - 210px);
  }
}
