.stone-page h1 {
  max-width: 18ch;
  font-size: clamp(2.25rem, 5vw, 4.5rem);
  overflow-wrap: anywhere;
  hyphens: auto;
}

.csten-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 150px));
  gap: .75rem;
  margin-block: 1.5rem 2rem;
}

.csten-gallery__thumb {
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: zoom-in;
}

.csten-gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.csten-lightbox {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(3rem, 1fr) minmax(0, 80rem) minmax(3rem, 1fr);
  align-items: center;
  padding: 4rem 1rem 1rem;
  background: rgba(0, 0, 0, .92);
}

.csten-lightbox[hidden] { display: none; }
.csten-lightbox figure {
  display: grid;
  grid-column: 2;
  grid-row: 1;
  place-items: center;
  min-width: 0;
  max-height: calc(100vh - 7rem);
  max-height: calc(100dvh - 7rem);
  margin: 0;
  text-align: center;
}
.csten-lightbox__image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 9rem);
  max-height: calc(100dvh - 9rem);
  object-fit: contain;
}
.csten-lightbox__counter { margin-top: .5rem; color: #fff; }
.csten-lightbox button { border: 0; background: rgba(20,20,20,.75); color: #fff; cursor: pointer; }
.csten-lightbox__close { position: absolute; top: 1rem; right: 1rem; width: 3rem; height: 3rem; font-size: 2rem; }
.csten-lightbox__previous,.csten-lightbox__next { width: 3rem; height: 4rem; font-size: 2.5rem; }
.csten-lightbox__previous {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
}
.csten-lightbox__next {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
}
.csten-lightbox-open { overflow: hidden; }

@media (max-width: 520px) {
  .stone-page h1 {
    max-width: 100%;
    font-size: clamp(2rem, 11vw, 3.25rem);
  }
  .csten-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .csten-lightbox { grid-template-columns: 3rem minmax(0, 1fr) 3rem; padding-inline: .25rem; }
}

@media (prefers-reduced-motion: reduce) {
  .csten-lightbox * { scroll-behavior: auto; }
}
