/* gallery — square mosaic plus a native <dialog> lightbox. */

.s-gallery__grid {
  display: grid;
  gap: var(--s-space-2);
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
}

.s-gallery__item {
  position: relative;
  display: block;
  overflow: hidden;
  border: var(--s-border-w) var(--s-rule-style) var(--s-border);
  border-radius: var(--s-radius-sm);
}
.s-gallery__item:hover img { transform: scale(1.05); }
.s-gallery__item .s-media { height: 100%; }

.s-gallery__caption {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  padding: var(--s-space-2);
  background: linear-gradient(to top, var(--s-overlay), transparent);
  color: var(--s-fg);
  font-size: var(--s-text-xs);
  opacity: 0;
  transition: opacity var(--s-dur-base) var(--s-ease);
}
.s-gallery__item:hover .s-gallery__caption,
.s-gallery__item:focus-visible .s-gallery__caption { opacity: 1; }

.s-gallery__box {
  width: min(92vw, 70rem);
  max-height: 92vh;
  padding: var(--s-space-3);
  background: var(--s-bg-elev);
  color: var(--s-fg);
  border: var(--s-border-w) var(--s-rule-style) var(--s-border-strong);
  border-radius: var(--s-radius-md);
  box-shadow: var(--s-shadow-3);
}
.s-gallery__box::backdrop { background: var(--s-overlay); }
.s-gallery__box img { max-height: 76vh; width: auto; margin-inline: auto; }
.s-gallery__bar {
  display: flex;
  align-items: center;
  gap: var(--s-space-3);
  margin-top: var(--s-space-3);
}
.s-gallery__text { flex: 1 1 auto; font-size: var(--s-text-sm); color: var(--s-fg-muted); }
