/**
 * Forum 2024 — Photos Gallery (grid, lightbox; sidebar uses daab-sidebar-widget.css)
 */

html[data-daab-page-id="forum-photos-gallery"] .photos-gallery-main {
  min-width: 0;
  background: var(--card-bg, rgba(255, 255, 255, 0.96));
  border: 1px solid var(--color-border-blue-faint, rgba(0, 45, 82, 0.1));
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0, 45, 82, 0.06);
  padding: 24px 22px 28px;
}

html[data-daab-page-id="forum-photos-gallery"] #photos-gallery-panel {
  scroll-margin-top: calc(var(--daab-nav-height, 86px) + 1rem);
}

.photos-gallery-head {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border-blue-faint);
}

.photos-gallery-head h2 {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  font-weight: 800;
  color: var(--ink);
  line-height: 1.25;
}

.photos-gallery-meta {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.photos-gallery-status {
  margin: 16px 0;
  padding: 14px 18px;
  border-radius: 12px;
  background: rgba(0, 45, 82, 0.06);
  color: var(--ink);
}

.photos-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 168px), 1fr));
  gap: 14px;
  width: 100%;
  max-width: 100%;
}

.photos-gallery-item {
  position: relative;
  margin: 0;
  padding: 0;
  border: none;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 45, 82, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  content-visibility: auto;
  contain-intrinsic-size: auto 126px;
}

.photos-gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 45, 82, 0.14);
}

.photos-gallery-item:focus-visible {
  outline: 3px solid var(--gold, #f0c75e);
  outline-offset: 2px;
}

.photos-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  background: #eef3f8;
}

.photos-gallery-thumb:not([src]) {
  visibility: hidden;
}

.photos-gallery-item--failed {
  display: none !important;
}

html[data-daab-page-id="forum-photos-gallery"] .lightbox img.is-loading {
  opacity: 0.15;
}

html[data-daab-page-id="forum-photos-gallery"] .lightbox.is-loading-view::before {
  content: "";
  position: fixed;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: photos-gallery-spin 0.7s linear infinite;
  z-index: 100001;
}

@keyframes photos-gallery-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Lightbox */
html[data-daab-page-id="forum-photos-gallery"] .lightbox {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 20, 40, 0.92);
  backdrop-filter: blur(6px);
}

html[data-daab-page-id="forum-photos-gallery"] .lightbox.open {
  display: flex;
}

html[data-daab-page-id="forum-photos-gallery"] .lightbox img {
  max-width: min(100%, 1200px);
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius, 12px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  transition: opacity 180ms ease, transform 220ms ease;
  will-change: opacity, transform;
}

html[data-daab-page-id="forum-photos-gallery"] .lightbox img.is-transitioning {
  opacity: 0.08;
  transform: translateY(4px) scale(0.992);
}

html[data-daab-page-id="forum-photos-gallery"] .lightbox-close {
  position: fixed;
  top: 20px;
  right: 24px;
  width: 44px;
  height: 44px;
  color: var(--white);
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
}

html[data-daab-page-id="forum-photos-gallery"] .lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.26);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
  z-index: 100001;
}

html[data-daab-page-id="forum-photos-gallery"] .lightbox-nav span {
  display: block;
  font-size: 34px;
  line-height: 1;
  margin-top: -2px;
}

html[data-daab-page-id="forum-photos-gallery"] .lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-50%) scale(1.02);
}

html[data-daab-page-id="forum-photos-gallery"] .lightbox-nav:active {
  transform: translateY(-50%) scale(0.985);
}

html[data-daab-page-id="forum-photos-gallery"] .lightbox-nav:disabled {
  opacity: 0.25;
  cursor: default;
  transform: translateY(-50%);
}

html[data-daab-page-id="forum-photos-gallery"] .lightbox-nav-prev {
  left: 18px;
}

html[data-daab-page-id="forum-photos-gallery"] .lightbox-nav-next {
  right: 18px;
}

html[data-daab-page-id="forum-photos-gallery"] .lightbox-caption {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(90vw, 640px);
  padding: 10px 16px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.9rem;
  text-align: center;
}

@media (max-width: 600px) {
  html[data-daab-page-id="forum-photos-gallery"] .lightbox {
    padding: 16px;
  }

  html[data-daab-page-id="forum-photos-gallery"] .lightbox-nav {
    width: 44px;
    height: 44px;
  }

  html[data-daab-page-id="forum-photos-gallery"] .lightbox-nav span {
    font-size: 30px;
  }

  .photos-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 130px), 1fr));
    gap: 10px;
  }
}
