.gallery__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: var(--s-4);
  margin: 0;
  padding: 0;
  list-style: none;
}
.gallery__item { margin: 0; }

.gallery__trigger {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--c-slate-050);
  cursor: zoom-in;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.gallery__trigger:hover { border-color: var(--c-slate-300); box-shadow: var(--shadow-md); }
.gallery__trigger :is(img, picture) { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }

.gallery__zoom {
  position: absolute;
  inset-block-end: var(--s-2);
  inset-inline-end: var(--s-2);
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-pill);
  background: rgb(29 42 56 / 0.72);
  color: #fff;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}
.gallery__trigger:hover .gallery__zoom,
.gallery__trigger:focus-visible .gallery__zoom { opacity: 1; }

.gallery__caption {
  margin: var(--s-2) 0 0;
  font-size: var(--fs-2xs);
  line-height: var(--lh-normal);
  color: var(--fg-faint);
}

.gallery__consent {
  margin: var(--s-5) 0 0;
  padding-top: var(--s-4);
  border-top: 1px solid var(--border);
  font-size: var(--fs-2xs);
  color: var(--fg-faint);
  max-width: var(--measure);
}

/* ---- Empty state ------------------------------------------------------- */
.gallery--empty {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-warm);
  padding: var(--s-7) var(--s-6);
  text-align: center;
}
.gallery__empty-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-lg);
  color: var(--fg-muted);
}
.gallery__empty-text {
  margin: var(--s-3) auto 0;
  max-width: 46ch;
  font-size: var(--fs-sm);
  color: var(--fg-faint);
}

/* ---- Lightbox ---------------------------------------------------------- */
.gallery__dialog {
  width: min(92vw, 64rem);
  max-width: none;
  max-height: 92vh;
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--c-slate-900);
  color: var(--fg-invert);
  overflow: hidden;
}
.gallery__dialog::backdrop { background: rgb(15 22 30 / 0.82); }

.gallery__figure { margin: 0; display: grid; }
.gallery__figure img {
  display: block;
  width: 100%;
  max-height: 76vh;
  object-fit: contain;
  background: #0F161E;
}
.gallery__figure figcaption {
  padding: var(--s-4) var(--s-5);
  font-size: var(--fs-sm);
  color: var(--fg-invert-muted);
}
.gallery__figure figcaption:empty { display: none; }

.gallery__close {
  position: absolute;
  inset-block-start: var(--s-3);
  inset-inline-end: var(--s-3);
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: var(--radius-pill);
  background: rgb(255 255 255 / 0.14);
  color: #fff;
  cursor: pointer;
}
.gallery__close:hover { background: rgb(255 255 255 / 0.26); }

.gallery__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-4);
  padding: 0 var(--s-5) var(--s-5);
}
.gallery__nav-btn {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid rgb(255 255 255 / 0.22);
  border-radius: var(--radius-pill);
  background: none;
  color: #fff;
  cursor: pointer;
}
.gallery__nav-btn:hover { background: rgb(255 255 255 / 0.12); }
.gallery__counter {
  font-size: var(--fs-2xs);
  letter-spacing: 0.08em;
  color: var(--c-slate-300);
  font-variant-numeric: tabular-nums;
}
