.gallery-grid.row {
  margin-inline: calc(var(--bs-gutter-x) * -.5);
  margin-top: calc(var(--bs-gutter-y) * -1);
}

.gallery-grid.row > .col {
  padding-inline: calc(var(--bs-gutter-x) * .5);
  margin-top: var(--bs-gutter-y);
}

.gallery-thumbnail {
  display: block;
  background-color: #f2f4f6;
}

.gallery-thumbnail img {
  border-radius: inherit;
  object-fit: cover;
}

.gallery-thumbnail > .gallery-thumbnail-icon {
  inset: auto .75rem .75rem auto;
  width: auto;
  height: auto;
  background-color: #fff;
  color: #17324d;
}

.gallery-thumbnail:focus-visible,
.gallery-modal button:focus-visible {
  outline: 3px solid #0059b3;
  outline-offset: 3px;
  box-shadow: none;
}

.gallery-modal .modal-body:focus-visible,
.gallery-modal figcaption:focus-visible {
  outline: 3px solid #0059b3;
  outline-offset: -3px;
}

.gallery-modal.modal {
  --bs-modal-margin: clamp(.75rem, 1.25vw, 1rem);
  height: 100dvh;
}

.gallery-modal.modal .modal-dialog {
  max-width: none;
  height: calc(100% - var(--bs-modal-margin) * 2);
  margin: var(--bs-modal-margin);
}

.gallery-modal .modal-content {
  height: 100%;
}

.gallery-modal .modal-body > figure {
  display: grid;
  grid-template-rows: minmax(0, 1fr) fit-content(40%);
  height: 100%;
  min-height: 0;
}

.gallery-modal figcaption {
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  overflow-wrap: anywhere;
}

.page-template-page-galleria-immagini #cya11y-container[inert] {
  display: none;
}

.gallery-preview-stage {
  min-height: 0;
  background-color: #f2f4f6;
}

.gallery-preview-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gallery-modal .gallery-close {
  min-width: 44px;
  min-height: 44px;
}

.gallery-modal .gallery-controls {
  justify-content: space-between;
  gap: .5rem;
}

.gallery-modal .gallery-controls > * {
  margin: 0;
}

.gallery-modal .gallery-controls .btn {
  --bs-btn-color: #000;
  --bs-btn-border-color: #000;
  --bs-btn-hover-color: #000;
  --bs-btn-hover-border-color: #000;
  --bs-btn-hover-bg: #f2f4f6;
  --bs-btn-active-color: #000;
  --bs-btn-active-border-color: #000;
  --bs-btn-active-bg: #e3e7eb;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  min-height: 44px;
  box-shadow: inset 0 0 0 2px currentColor;
}

.gallery-controls .icon,
.gallery-thumbnail-icon .icon {
  fill: currentColor;
}

@media (max-width: 960px) {
  .page-template-page-galleria-immagini #footer .grid-footer {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow-wrap: anywhere;
  }
}

@media (max-width: 575.98px) {
  .gallery-status {
    order: -1;
    flex: 0 0 100%;
    text-align: center;
  }

  .page-template-page-galleria-immagini #footer .grid-footer {
    grid-template-columns: minmax(0, 1fr);
  }
}
