.st_gallery_page {
  width: min(calc(100% - 2rem), 84rem);
  margin-inline: auto;
  padding: clamp(3.5rem, 7vw, 6rem) 0 clamp(5rem, 8vw, 8rem);
}

.st_gallery_page__hero {
  margin: 0 auto clamp(2rem, 4vw, 3.5rem);
  text-align: center;
}

.st_gallery_page__hero h1 {
  margin: 0;
  font-family: var(--st-font-display);
  font-size: clamp(2.6rem, 5vw, 4.4rem);
  font-weight: 400;
  line-height: 1.1;
}

.st_gallery_page__filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin: 0 auto clamp(2rem, 4vw, 3rem);
}

.st_gallery_page__select {
  display: none;
}

.st_gallery_page__filter {
  min-height: 44px;
  padding: 0.65rem 1rem;
  border: 1px solid var(--st-color-primary);
  border-radius: 0;
  background: transparent;
  color: var(--st-color-text);
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.st_gallery_page__filter:hover,
.st_gallery_page__filter:focus-visible,
.st_gallery_page__filter.is-active {
  border-color: var(--st-color-accent);
  background: var(--st-color-accent);
  color: #fff;
}

.st_gallery_page__filter:focus-visible,
.st_gallery_page__link:focus-visible {
  outline: 2px solid var(--st-color-text);
  outline-offset: 3px;
}

.st_gallery_page__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.85rem, 2vw, 1.5rem);
}

.st_gallery_page__item {
  min-width: 0;
  margin: 0;
}

.st_gallery_page__item[hidden] {
  display: none;
}

.st_gallery_page__link {
  display: block;
  overflow: hidden;
  background: var(--st-color-surface, #f4f0e8);
}

.st_gallery_page__link img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 260ms ease;
}

.st_gallery_page__link:hover img {
  transform: scale(1.035);
}

.st_gallery_page__item figcaption {
  padding: 0.7rem 0.1rem 0;
  color: var(--st-color-muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.st_gallery_page__empty {
  padding: 3rem 0;
  text-align: center;
}

.st_gallery_lightbox {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 4.5rem 4.5rem 3rem;
  border: 0;
  background: rgba(22, 21, 20, 0.96);
  color: #fff;
}

.st_gallery_lightbox[open] {
  display: grid;
  place-items: center;
}

.st_gallery_lightbox::backdrop {
  background: transparent;
}

.st_gallery_lightbox__figure {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  justify-items: center;
  align-content: center;
  gap: 0.8rem;
  touch-action: pan-y;
}

.st_gallery_lightbox__image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100dvh - 9rem);
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.st_gallery_lightbox__caption {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.9rem;
  text-align: center;
}

.st_gallery_lightbox__counter {
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.st_gallery_lightbox__close,
.st_gallery_lightbox__arrow {
  position: absolute;
  z-index: 1;
  display: grid;
  width: 3rem;
  height: 3rem;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 1.8rem;
  line-height: 1;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.st_gallery_lightbox__close:hover,
.st_gallery_lightbox__arrow:hover,
.st_gallery_lightbox__close:focus-visible,
.st_gallery_lightbox__arrow:focus-visible {
  border-color: var(--st-color-accent);
  background: var(--st-color-accent);
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.st_gallery_lightbox__close:disabled,
.st_gallery_lightbox__arrow:disabled {
  cursor: default;
  opacity: 0.45;
}

.st_gallery_lightbox__close {
  top: 1rem;
  right: 1rem;
  font-size: 1.6rem;
}

.st_gallery_lightbox__previous {
  top: 50%;
  left: 1.25rem;
  transform: translateY(-50%);
}

.st_gallery_lightbox__next {
  top: 50%;
  right: 1.25rem;
  transform: translateY(-50%);
}

@media (max-width: 900px) {
  .st_gallery_page__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .st_gallery_page {
    width: min(calc(100% - 1.5rem), 84rem);
    padding-top: 2.5rem;
  }

  .st_gallery_page__grid {
    gap: 0.7rem;
  }

  .st_gallery_page__hero {
    margin-bottom: 1.25rem;
  }

  .st_gallery_page__filters {
    display: none;
  }

  .st_gallery_page__select {
    display: block;
    width: min(100%, 21rem);
    min-height: 46px;
    margin: 0 auto 1.25rem;
    padding: 0.65rem 2.4rem 0.65rem 1rem;
    border: 1px solid rgba(183, 145, 76, 0.7);
    border-radius: 999px;
    appearance: none;
    background-color: #fff;
    background-image:
      linear-gradient(45deg, transparent 50%, #8a7043 50%),
      linear-gradient(135deg, #8a7043 50%, transparent 50%);
    background-position:
      calc(100% - 17px) 50%,
      calc(100% - 11px) 50%;
    background-repeat: no-repeat;
    background-size: 6px 6px;
    color: var(--st-color-text);
    font: inherit;
    font-size: 0.92rem;
    box-shadow: 0 5px 16px rgba(73, 58, 34, 0.07);
  }

  .st_gallery_page__select:focus-visible {
    outline: 2px solid var(--st-color-text);
    outline-offset: 3px;
  }

  .st_gallery_lightbox {
    padding: 4rem 3.5rem 2.5rem;
  }

  .st_gallery_lightbox__image {
    max-width: calc(100vw - 5.5rem);
    max-height: calc(100dvh - 8rem);
  }

  .st_gallery_lightbox__close,
  .st_gallery_lightbox__arrow {
    width: 2.75rem;
    height: 2.75rem;
  }

  .st_gallery_lightbox__previous {
    left: 0.35rem;
  }

  .st_gallery_lightbox__next {
    right: 0.35rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .st_gallery_page__filter,
  .st_gallery_page__link img,
  .st_gallery_lightbox__close,
  .st_gallery_lightbox__arrow {
    transition: none;
  }
}
