/* =========================================================
   DOTS MEDIA — BOOTH GALLERY (service pages, Selected Work)
   Even 4:3 tiles in a centred, wrapping row so a short last
   row sits in the middle instead of hanging left.
   ========================================================= */

.booth-gallery {
  --bg-gap: 16px;
  --bg-cols: 4;

  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--bg-gap);
  /* Same 1400px column as the section headings above it */
  max-width: 1400px;
  margin: 40px auto 0;
}

.booth-gallery-item {
  position: relative;
  flex: 0 0 calc((100% - (var(--bg-cols) - 1) * var(--bg-gap)) / var(--bg-cols));
  aspect-ratio: 4 / 3;
  margin: 0;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #111;
  transition: border-color 0.35s ease, transform 0.35s ease, box-shadow 0.35s ease;
}

.booth-gallery-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  transition: transform 0.6s ease;
}

.booth-gallery-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 58%, rgba(8, 6, 4, 0.88) 100%);
  pointer-events: none;
}

.booth-gallery-item figcaption {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.booth-gallery-name {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

.booth-gallery-region {
  color: #ff7a1a;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.booth-gallery-item:hover {
  border-color: rgba(255, 122, 26, 0.5);
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 122, 26, 0.15);
}

.booth-gallery-item:hover img {
  transform: scale(1.05);
}

@media (max-width: 1100px) {
  .booth-gallery { --bg-cols: 3; }
}

@media (max-width: 768px) {
  .booth-gallery { --bg-cols: 2; --bg-gap: 12px; margin-top: 28px; }
  .booth-gallery-name { font-size: 13px; }
  .booth-gallery-item figcaption { left: 12px; right: 12px; bottom: 10px; }
}

@media (max-width: 480px) {
  .booth-gallery { --bg-cols: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .booth-gallery-item,
  .booth-gallery-item img {
    transition: none;
  }
  .booth-gallery-item:hover,
  .booth-gallery-item:hover img {
    transform: none;
  }
}

/* Small sets (e.g. 2 double-decker builds): bigger tiles side by side */
.booth-gallery:has(> .booth-gallery-item:nth-child(2):last-child) {
  --bg-cols: 2;
  max-width: 1100px;
}

@media (max-width: 480px) {
  .booth-gallery:has(> .booth-gallery-item:nth-child(2):last-child) {
    --bg-cols: 1;
  }
}

/* A single featured build: one wide tile */
.booth-gallery:has(> .booth-gallery-item:only-child) {
  --bg-cols: 1;
  max-width: 960px;
}
