/* Gallery pages — loaded separately so album-card styles apply even if duneland.css is stale on the server. */

.gallery-page {
  padding: var(--section-pad);
}

.gallery-page-intro,
.gallery-empty {
  color: var(--text-muted);
  margin-bottom: 24px;
}

.gallery-page-actions {
  display: none;
}

.gallery-section {
  margin-bottom: 48px;
}

.gallery-section-title {
  font-size: 1.35rem;
  margin-bottom: 16px;
}

.gallery-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 130px));
  gap: 10px;
  justify-content: start;
}

.gallery-card {
  display: block;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  padding: 12px;
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.gallery-card--album {
  padding: 0;
  overflow: hidden;
  width: 100%;
  max-width: 130px;
}

.gallery-card--album img {
  width: 100%;
  max-width: 130px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.gallery-card--album div {
  padding: 8px 10px 10px;
}

.gallery-card--album h3 {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.3;
}

.gallery-card__placeholder {
  width: 100%;
  max-width: 130px;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #e8eef3 0%, #d4dee8 100%);
}

.gallery-masonry {
  column-count: 3;
  column-gap: 12px;
}

.gallery-masonry-item {
  break-inside: avoid;
  margin-bottom: 12px;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
  display: block;
}

.gallery-masonry-item img {
  width: 100%;
  display: block;
  border-radius: 8px;
}

.gallery-pagination {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 24px 0;
}

.gallery-pagination-btn {
  min-width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  cursor: pointer;
}

.gallery-pagination-btn.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.gallery-search-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
  align-items: end;
}

.gallery-search-form label {
  display: grid;
  gap: 6px;
  font-size: 14px;
}

.gallery-search-form input[type="search"],
.gallery-search-form input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
}

.gallery-search-checkbox {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.gallery-lightbox {
  border: 0;
  padding: 0;
  width: min(100vw, 1100px);
  max-width: calc(100vw - 24px);
  background: transparent;
}

.gallery-lightbox::backdrop {
  background: rgba(0, 0, 0, 0.82);
}

.gallery-lightbox-inner {
  position: relative;
  background: #0b1520;
  border-radius: 12px;
  padding: 16px;
}

.gallery-lightbox-image {
  width: 100%;
  max-height: 80vh;
  object-fit: contain;
  display: block;
}

.gallery-lightbox-caption {
  color: #fff;
  margin-top: 12px;
}

.gallery-lightbox-close,
.gallery-lightbox-nav {
  position: absolute;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  border-radius: 999px;
}

.gallery-lightbox-close {
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  font-size: 24px;
}

.gallery-lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  font-size: 28px;
}

.gallery-lightbox-prev {
  left: 8px;
}

.gallery-lightbox-next {
  right: 8px;
}

/* Homepage featured builds slideshow */
#gallery .gallery-slideshow-stage {
  max-width: min(100%, 800px);
  margin: 0 auto;
  display: block;
}

#gallery .gallery-slideshow-controls {
  max-width: min(100%, 800px);
  margin: 12px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

#gallery .gallery-slideshow-image img {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
}

@media (max-width: 900px) {
  .gallery-masonry {
    column-count: 2;
  }
}

@media (max-width: 560px) {
  .gallery-card-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 110px));
  }

  .gallery-card--album,
  .gallery-card--album img,
  .gallery-card__placeholder {
    max-width: 110px;
  }
}
