.gallery-box {
  background: linear-gradient(180deg, #fffdf8 0%, #f5f8f2 100%);
  border: 1px solid #e4ebdd;
  border-radius: 26px;
  box-shadow: 0 18px 40px rgba(106, 143, 114, 0.14);
  padding: clamp(20px, 3.2vw, 36px);
}

.gallery-box__header {
  margin-bottom: 20px;
}

.gallery-box__header p {
  color: #5e5e5e;
  max-width: 720px;
}

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.gallery-hint {
  color: #5e5e5e;
  font-size: 0.92rem;
}

.gallery-filter {
  border: 1px solid #d6e2cd;
  background: #ffffff;
  color: #5e5e5e;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.92rem;
  line-height: 1.2;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
}

.gallery-filter:hover,
.gallery-filter:focus-visible {
  border-color: #6a8f72;
  color: #3f5f46;
  transform: translateY(-1px);
}

.gallery-filter.is-active {
  background: #6a8f72;
  border-color: #6a8f72;
  color: #ffffff;
}

.gallery-masonry {
  column-count: 1;
  column-gap: 16px;
}

.gallery-masonry-item {
  break-inside: avoid;
  margin-bottom: 16px;
  opacity: 1;
  transform: scale(1);
  filter: blur(0);
  transition: opacity 0.32s ease, transform 0.32s ease, filter 0.32s ease;
}

.gallery-masonry-item.is-leaving,
.gallery-masonry-item.is-entering {
  opacity: 0;
  transform: scale(0.95);
  filter: blur(2px);
}

.gallery-card {
  position: relative;
  width: 100%;
  border: none;
  padding: 0;
  margin: 0;
  display: block;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  background: #ffffff;
}

.gallery-card img {
  width: 100%;
  display: block;
  border-radius: 16px;
}

.gallery-card__title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 26px 12px 11px;
  text-align: left;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.8) 100%);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.gallery-card:focus-visible {
  outline: 3px solid rgba(106, 143, 114, 0.55);
  outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
  .gallery-card:hover .gallery-card__title,
  .gallery-card:focus-visible .gallery-card__title {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (hover: none), (max-width: 767.98px) {
  .gallery-card__title {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 768px) {
  .gallery-masonry {
    column-count: 2;
  }
}

@media (min-width: 992px) {
  .gallery-masonry {
    column-count: 3;
  }
}

@media (min-width: 1400px) {
  .gallery-masonry {
    column-count: 4;
  }
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  display: flex;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  align-items: center;
  justify-content: center;
  z-index: 1090;
  padding: 16px;
  transition: opacity 0.2s ease;
}

.gallery-lightbox.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.gallery-lightbox[aria-hidden="true"],
.gallery-lightbox[hidden] {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.gallery-lightbox__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.72);
  cursor: pointer;
}

.gallery-lightbox__content {
  position: relative;
  z-index: 1;
  width: min(100%, 980px);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  background: #0f0f0f;
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.45);
}

.gallery-lightbox__image {
  width: 100%;
  max-height: calc(100vh - 110px);
  object-fit: contain;
  background: #101010;
}

.gallery-lightbox__title {
  margin: 0;
  padding: 10px 46px 12px 14px;
  font-size: 0.95rem;
  color: #ffffff;
  background: rgba(16, 16, 16, 0.96);
}

.gallery-lightbox__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}

.gallery-lightbox__close:hover,
.gallery-lightbox__close:focus-visible {
  background: rgba(106, 143, 114, 0.9);
}

body.gallery-lightbox-open {
  overflow: hidden;
}
