/* =========================================================
   八班回忆录 · 记忆墙 / 灯箱
   ========================================================= */

/* ---------------------------------------------------------
   筛选
   --------------------------------------------------------- */

.filter-bar {
  position: sticky;
  top: var(--nav-h);
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.7rem 0 0.85rem;
  margin-bottom: clamp(1.2rem, 2.6vw, 2rem);
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: rgba(6, 7, 13, 0.92);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  transition: top 0.4s var(--ease);
}

body.nav-hidden .filter-bar {
  top: 0;
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.55em 1.05em;
  border-radius: 999px;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  color: var(--txt-soft);
  white-space: nowrap;
  transition: color 0.3s, background-color 0.3s, transform 0.3s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.chip b {
  font-family: var(--font-num);
  font-size: 0.7em;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--txt-faint);
  transition: color 0.3s;
}

.chip:hover {
  color: var(--txt);
  background: rgba(255, 255, 255, 0.05);
}

.chip[aria-pressed="true"] {
  color: #171105;
  background: linear-gradient(110deg, var(--gold), #f6dfae);
  box-shadow: 0 8px 22px -12px rgba(233, 195, 126, 0.9);
}

.chip[aria-pressed="true"] b {
  color: rgba(23, 17, 5, 0.6);
}

.gallery__count {
  font-family: var(--font-num);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--txt-faint);
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}

.gallery__count .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--aqua);
  box-shadow: 0 0 10px 2px rgba(116, 230, 211, 0.6);
  animation: pulse-dot 2.4s ease-in-out infinite;
}

@keyframes pulse-dot {
  50% {
    opacity: 0.35;
    transform: scale(0.8);
  }
}

/* ---------------------------------------------------------
   瀑布流
   --------------------------------------------------------- */

.wall {
  --cols: 4;
  --wall-gap: 14px;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: var(--wall-gap);
  grid-auto-rows: 8px;
  align-items: start;
}

.wall.is-single {
  max-width: 620px;
  margin-inline: auto;
}

.card {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  -webkit-appearance: none;
  appearance: none;
  color: inherit;
  font: inherit;
  text-align: left;
  grid-row-end: span 30;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #10131b;
  box-shadow: 0 20px 40px -30px #000;
  transform: translateZ(0);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}

.card[hidden] {
  display: none;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
  transition: border-color 0.4s, box-shadow 0.4s;
}

.card__media {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  filter: blur(12px);
  transform: scale(1.06);
  transition: filter 0.7s var(--ease), transform 0.9s var(--ease);
  overflow: hidden;
}

.card.is-loaded .card__media {
  filter: none;
  transform: none;
}

.card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.7s var(--ease), transform 1.1s var(--ease);
  background: #10131b;
}

.card.is-loaded .card__img {
  opacity: 1;
}

.card__veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(4, 5, 10, 0.28) 0%, transparent 32%, transparent 55%, rgba(4, 5, 10, 0.78) 100%);
  opacity: 0;
  transition: opacity 0.45s var(--ease);
  pointer-events: none;
}

.card__meta {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.85rem 0.95rem;
  transform: translateY(8px);
  opacity: 0;
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease);
  pointer-events: none;
}

.card__meta span {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.86);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.card__meta b {
  font-family: var(--font-num);
  font-size: 0.66rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.6);
  flex: none;
}

.card__zoom {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(12, 14, 22, 0.38);
  backdrop-filter: blur(6px);
  color: #fff;
  transform: translate(-50%, -50%) scale(0.8);
  opacity: 0;
  transition: opacity 0.4s var(--ease), transform 0.5s var(--ease);
  pointer-events: none;
}

.card__zoom svg {
  width: 18px;
  height: 18px;
}

.card:hover .card__img {
  transform: scale(1.055);
}

.card:hover .card__veil {
  opacity: 1;
}

.card:hover .card__meta,
.card:hover .card__zoom {
  opacity: 1;
  transform: translateY(0);
}

.card:hover .card__zoom {
  transform: translate(-50%, -50%) scale(1);
}

.card:hover::after {
  border-color: rgba(233, 195, 126, 0.5);
  box-shadow: inset 0 0 0 1px rgba(233, 195, 126, 0.25), 0 30px 60px -30px rgba(233, 195, 126, 0.35);
}

.card.is-hidden {
  display: none;
}

.card--enter {
  animation: card-in 0.75s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 26ms);
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.97);
  }
}

.gallery__empty {
  padding: 4rem 1rem;
  text-align: center;
  color: var(--txt-mute);
}

.gallery__note {
  margin-top: 2.6rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
  font-size: 0.76rem;
  color: var(--txt-mute);
}

.gallery__note code {
  font-family: var(--font-num);
  font-size: 0.92em;
  color: var(--txt-soft);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.15em 0.45em;
}

/* ---------------------------------------------------------
   灯箱
   --------------------------------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-rows: auto 1fr;
  background: rgba(4, 5, 10, 0.86);
  backdrop-filter: blur(22px) saturate(1.1);
  -webkit-backdrop-filter: blur(22px) saturate(1.1);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s var(--ease), visibility 0.45s;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(0.8rem, 2vw, 1.3rem) clamp(1rem, 3vw, 2rem);
}

.lightbox__counter {
  font-family: var(--font-num);
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  color: var(--txt-mute);
}

.lightbox__counter b {
  color: var(--gold);
  font-weight: 500;
  font-size: 1rem;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  color: var(--txt-soft);
  background: rgba(255, 255, 255, 0.03);
  transition: color 0.3s, border-color 0.3s, background-color 0.3s, transform 0.3s;
}

.icon-btn:hover {
  color: var(--gold);
  border-color: rgba(233, 195, 126, 0.5);
  background: rgba(233, 195, 126, 0.08);
  transform: translateY(-1px);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.lightbox__stage {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0 clamp(0.6rem, 3vw, 3.6rem);
  min-height: 0;
}

.lightbox__figure {
  position: relative;
  max-width: min(1400px, 100%);
  max-height: 100%;
  display: grid;
  place-items: center;
}

.lightbox__img {
  max-width: 100%;
  max-height: calc(100vh - 132px);
  max-height: calc(100svh - 132px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 50px 100px -50px #000;
  opacity: 0;
  transform: scale(0.985);
  transition: opacity 0.4s var(--ease), transform 0.6s var(--ease);
  background: #0b0d14;
}

.lightbox__img.is-ready {
  opacity: 1;
  transform: none;
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: rgba(10, 12, 20, 0.55);
  backdrop-filter: blur(8px);
  color: var(--txt-soft);
  transition: color 0.3s, border-color 0.3s, background-color 0.3s;
  z-index: 2;
}

.lightbox__nav:hover {
  color: #171105;
  background: var(--gold);
  border-color: transparent;
}

.lightbox__nav svg {
  width: 18px;
  height: 18px;
}

.lightbox__nav--prev {
  left: clamp(0.4rem, 1.6vw, 1.6rem);
}

.lightbox__nav--next {
  right: clamp(0.4rem, 1.6vw, 1.6rem);
}

/* ---------------------------------------------------------
   响应式
   --------------------------------------------------------- */

@media (max-width: 1200px) {
  .wall {
    --cols: 3;
  }
}

@media (max-width: 900px) {
  .wall {
    --cols: 2;
    --wall-gap: 12px;
  }
  .filter-bar {
    border-radius: 0;
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    justify-content: flex-start;
    gap: 0.35rem;
    padding: 0.55rem 0 0.65rem;
    background: rgba(6, 7, 13, 0.97);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .filter-bar::-webkit-scrollbar {
    display: none;
  }
  .chip {
    flex: none;
    padding: 0.5em 0.85em;
    font-size: 0.78rem;
  }
  .lightbox__img {
    max-height: calc(100vh - 112px);
    max-height: calc(100svh - 112px);
  }
  .lightbox__nav {
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 520px) {
  .card__zoom,
  .card__meta {
    display: none;
  }
  .filter-bar {
    border-radius: 0;
  }
  .lightbox__bar {
    padding-inline: 0.9rem;
  }
  .lightbox__nav--prev {
    left: 0.2rem;
  }
  .lightbox__nav--next {
    right: 0.2rem;
  }
  .lightbox__img {
    max-height: calc(100vh - 112px);
    max-height: calc(100svh - 112px);
    border-radius: 2px;
  }
}
