/* ============================================================
   Gallery — grid + lightbox
   Depends on css/styles.css for tokens.
   ============================================================ */

.gallery-main {
  padding-top: calc(var(--header-h) + 64px);
  padding-bottom: 100px;
  min-height: 70vh;
}

.gallery-intro { max-width: 720px; margin-bottom: 54px; }
.gallery-intro h1 {
  font-family: var(--font-head);
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 10px 0 18px;
}
.gallery-lede { color: var(--text-dim); font-size: 1.05rem; }

/* Asking us to hold something is the one action this page wants, so it gets
   a real control rather than a sentence telling people to message us. */
.gallery-hold {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 26px;
  padding: 18px 22px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  background: var(--bg-alt);
}
.gallery-hold p {
  color: var(--text);
  font-size: 0.96rem;
  margin: 0;
  flex: 1 1 240px;
}
.gallery-hold .btn { flex: 0 0 auto; }

.gallery-status {
  color: var(--text-faint);
  font-size: 0.95rem;
  padding: 40px 0;
}
.gallery-status.empty {
  padding: 44px 26px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.gallery-section { margin-bottom: 64px; }
.gallery-section-head { margin-bottom: 22px; }
.gallery-section-head h2 {
  font-family: var(--font-head);
  font-size: 1.45rem;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.gallery-section-head p { color: var(--text-faint); font-size: 0.93rem; max-width: 60ch; }

/* ---------- Grid ---------- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.photo-tile {
  position: relative;
  display: block;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  cursor: zoom-in;
  /* Uniform square tiles. The booth photos are a mix of portrait and
     landscape, and letting each tile take its own aspect ratio made the
     rows ragged and looked like a bug. Cropping to a square in the grid
     keeps it orderly; the lightbox shows the full uncropped photo. */
  aspect-ratio: 1 / 1;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.photo-tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.photo-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.photo-tile img.loaded { opacity: 1; }

.tile-badge {
  position: absolute;
  top: 10px; left: 10px;
  font-family: var(--font-head);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--gradient);
  color: #0a0d18;
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(5, 7, 14, 0.94);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 60px 20px;
}
/* An author `display` beats the UA rule for [hidden], so the attribute
   needs an explicit guard or the lightbox sits open on page load. */
.lightbox[hidden] { display: none; }
.lb-stage {
  margin: 0;
  max-width: min(1100px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}
.lb-stage img {
  max-width: 100%;
  max-height: calc(100vh - 150px);
  width: auto;
  border-radius: 10px;
  object-fit: contain;
}
.lb-stage figcaption {
  color: var(--text-dim);
  font-size: 0.9rem;
  text-align: center;
  min-height: 1.2em;
}

.lb-close, .lb-nav {
  position: absolute;
  background: rgba(20, 24, 48, 0.85);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.lb-close:hover, .lb-nav:hover { border-color: var(--accent); color: var(--accent); }
.lb-close:focus-visible, .lb-nav:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.lb-close {
  top: 18px; right: 20px;
  width: 44px; height: 44px;
  font-size: 1.8rem;
  line-height: 1;
  padding-bottom: 4px;
}
.lb-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 52px; height: 52px;
  font-size: 2rem;
  line-height: 1;
  padding-bottom: 5px;
}
.lb-prev { left: 18px; }
.lb-next { right: 18px; }
.lb-nav[hidden] { display: none; }

/* ---------- CTA ---------- */
.gallery-cta {
  margin-top: 20px;
  padding: 34px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  text-align: center;
}
.gallery-cta h2 { font-family: var(--font-head); font-size: 1.3rem; margin-bottom: 10px; }
.gallery-cta p { color: var(--text-dim); font-size: 0.95rem; max-width: 520px; margin: 0 auto 20px; }

@media (max-width: 640px) {
  .gallery-main { padding-top: calc(var(--header-h) + 36px); }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .lightbox { padding: 56px 12px; }
  .lb-nav { width: 44px; height: 44px; font-size: 1.6rem; }
  .lb-prev { left: 8px; }
  .lb-next { right: 8px; }
  .gallery-cta { padding: 26px 22px; }
}

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