.smart-gallery {
  display: grid;
  gap: 22px;
}

#gallery .media-layout[hidden] {
  display: none !important;
}

.smart-gallery.is-filtering .gallery-stage,
.smart-gallery.is-filtering .gallery-thumbs {
  opacity: .35;
}

.smart-gallery .gallery-stage,
.smart-gallery .gallery-thumbs {
  transition: opacity .18s ease;
}

.gallery-filters {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 2px 0 8px;
  scrollbar-width: thin;
}

.gallery-filter {
  flex: 0 0 auto;
  border: 1px solid #aebbb5;
  background: transparent;
  color: var(--green);
  padding: 10px 16px;
  font: 700 13px Cairo, Manrope, sans-serif;
  cursor: pointer;
}

.gallery-filter[aria-pressed="true"] {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.gallery-stage {
  position: relative;
  min-height: 560px;
  background: var(--green);
  overflow: hidden;
  display: grid;
  place-items: center;
  touch-action: pan-y;
  user-select: none;
  cursor: grab;
}

.gallery-stage:active {
  cursor: grabbing;
}

.gallery-stage img,
.gallery-stage video {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 720px;
  min-height: 560px;
  object-fit: contain;
  background: var(--green);
}

.gallery-stage-caption {
  position: absolute;
  right: 18px;
  left: 18px;
  bottom: 18px;
  z-index: 2;
  padding: 13px 16px;
  color: #fff;
  background: rgba(7, 43, 35, .88);
  backdrop-filter: blur(8px);
  font-weight: 800;
}

.gallery-open,
.gallery-play,
.gallery-stage-prev,
.gallery-stage-next {
  position: absolute;
  z-index: 3;
  border: 0;
  cursor: pointer;
}

.gallery-stage-prev,
.gallery-stage-next {
  top: 50%;
  width: 44px;
  height: 58px;
  transform: translateY(-50%);
  background: rgba(232, 201, 107, .94);
  color: var(--green);
  font-size: 28px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}

.gallery-stage-prev { right: 14px; }
.gallery-stage-next { left: 14px; }

.gallery-open {
  top: 16px;
  left: 16px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--green);
  font-size: 22px;
}

.gallery-play {
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--green);
  font-size: 28px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .28);
}

.gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.gallery-thumb {
  position: relative;
  min-width: 0;
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid transparent;
  background: var(--green);
  overflow: hidden;
  cursor: pointer;
}

.gallery-thumb[aria-current="true"] {
  border-color: var(--gold);
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .82;
  transition: opacity .2s ease, transform .25s ease;
}

.gallery-thumb:hover img,
.gallery-thumb[aria-current="true"] img {
  opacity: 1;
  transform: scale(1.04);
}

.gallery-thumb span {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--gold);
  color: var(--green);
}

.gallery-lightbox {
  width: min(1100px, calc(100% - 28px));
  max-width: 1100px;
  height: min(88vh, 820px);
  padding: 0;
  border: 0;
  background: #071d18;
  overflow: hidden;
}

.gallery-lightbox::backdrop {
  background: rgba(2, 12, 10, .9);
  backdrop-filter: blur(6px);
}

.gallery-lightbox img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  z-index: 2;
  border: 0;
  background: rgba(232, 201, 107, .94);
  color: var(--green);
  cursor: pointer;
}

.lightbox-close {
  top: 14px;
  left: 14px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 26px;
}

.lightbox-prev,
.lightbox-next {
  top: 50%;
  width: 46px;
  height: 58px;
  transform: translateY(-50%);
  font-size: 28px;
}

.lightbox-prev { right: 14px; }
.lightbox-next { left: 14px; }

@media (max-width: 820px) {
  .gallery-stage { min-height: 460px; }
  .gallery-stage img,
  .gallery-stage video { min-height: 460px; }
  .gallery-thumbs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .smart-gallery { gap: 14px; }
  .gallery-stage { min-height: 420px; }
  .gallery-stage img,
  .gallery-stage video { min-height: 420px; max-height: 68vh; }
  .gallery-thumbs { display: flex; overflow-x: auto; }
  .gallery-thumb { flex: 0 0 84px; }
  .gallery-stage-caption { right: 10px; left: 10px; bottom: 10px; }
  .gallery-play { width: 64px; height: 64px; }
  .gallery-stage-prev,
  .gallery-stage-next {
    width: 38px;
    height: 50px;
    font-size: 24px;
  }
}
