.gallery {
  padding-block: 27px 40px;
}
@media (width >= 992px) {
  .gallery {
    padding-block: 70px;
  }
}
.gallery__head {
  position: relative;
  margin-block-end: 16px;
}
@media (width >= 992px) {
  .gallery__head {
    margin-block-end: 24px;
  }
}
.gallery__title {
  margin-block: 0 0.5rem;
}
.gallery__subtitle {
  margin-block: 0;
}
.gallery__button {
  position: absolute !important;
  right: 0;
  bottom: 0;
  margin-block: 0;
}
.gallery__button > a {
  display: inline-flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-block: 7px;
  padding-inline: 28px 16px;
  background-color: var(--wp--preset--color--background-light);
  border-radius: 16px;
  height: 36px;
  min-width: 142px;
  text-decoration: none;
  font-size: 1rem;
  transition: box-shadow 0.3s ease-in-out;
}
@media (width < 992px) {
  .gallery__button > a {
    display: none;
  }
}
.gallery__button > a:after {
  content: "";
  display: block;
  width: 16px;
  height: 16px;
  background: url("/wp-content/themes/portraithy/src/assets/img/ic_arrow-right.svg") no-repeat center;
  margin-inline-start: 12px;
}
.gallery__button > a:hover {
  box-shadow: -2px 1px 12px var(--wp--custom--button-hover-shadow-color);
}
.gallery__grid {
  display: grid !important;
  grid-template-columns: repeat(2, 162fr);
  grid-auto-rows: auto;
  gap: 20px !important;
}
@media (width >= 600px) {
  .gallery__grid {
    grid-template-columns: repeat(2, 304fr 86fr 192fr);
    align-items: stretch !important;
  }
}
@media (width >= 992px) {
  .gallery__grid {
    gap: 32px !important;
  }
}
.gallery__grid .wp-block-image a {
  position: relative;
  overflow: hidden;
  box-shadow: 3px -3px 0px 3px rgba(217, 217, 217, 0.9098039216);
}
.gallery__grid .wp-block-image a:before {
  content: "";
  display: block;
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.2;
  transition: background-color 0.3s ease-in-out;
  z-index: 1;
}
.gallery__grid .wp-block-image a:hover img {
  scale: 1.1;
}
.gallery__grid .wp-block-image a:active:before {
  background-color: var(--wp--preset--color--primary-black);
}
.gallery__grid .wp-block-image img {
  transition: scale 0.3s ease-in-out;
}
@media (width < 600px) {
  .gallery__grid .wp-block-image:nth-of-type(10n + 1) {
    grid-row: auto/span 2;
  }
  .gallery__grid .wp-block-image:where(:nth-of-type(10n + 8), :nth-of-type(10n + 9)) {
    grid-row: auto/span 2;
    aspect-ratio: 162/286;
  }
  .gallery__grid .wp-block-image:where(:nth-of-type(10n + 2), :nth-of-type(10n + 5), :nth-of-type(10n + 6)) {
    aspect-ratio: 1/1;
  }
  .gallery__grid .wp-block-image:nth-of-type(10n + 3) {
    aspect-ratio: 162/104;
  }
  .gallery__grid .wp-block-image:where(:nth-of-type(10n + 4), :nth-of-type(10n + 7), :nth-of-type(10n + 10)) {
    grid-column: auto/span 2;
    aspect-ratio: 344/162;
  }
}
@media (width >= 600px) {
  .gallery__grid .wp-block-image:where(:nth-of-type(10n + 2), :nth-of-type(10n + 5)) {
    aspect-ratio: 1/1;
  }
  .gallery__grid .wp-block-image:where(:nth-of-type(10n + 3), :nth-of-type(10n + 4)) {
    aspect-ratio: 304/158;
  }
  .gallery__grid .wp-block-image:where(:nth-of-type(10n + 1), :nth-of-type(10n + 9)) {
    grid-row: auto/span 3;
    grid-row-start: 1;
  }
  .gallery__grid .wp-block-image:nth-of-type(10n + 2) {
    grid-row: 1/span 2;
    grid-column: 2/span 2;
  }
  .gallery__grid .wp-block-image:nth-of-type(10n + 3) {
    grid-row-start: 3;
    grid-column: 2/span 2;
  }
  .gallery__grid .wp-block-image:nth-of-type(10n + 4) {
    grid-row-start: 1;
    grid-column: 4/span 1;
  }
  .gallery__grid .wp-block-image:nth-of-type(10n + 5) {
    grid-row: 2/span 2;
  }
  .gallery__grid .wp-block-image:nth-of-type(10n + 6) {
    aspect-ratio: 192/224;
    grid-row-start: 4;
    grid-column: 6/span 1;
  }
  .gallery__grid .wp-block-image:nth-of-type(10n + 7) {
    aspect-ratio: 416/224;
    grid-row-start: 4;
    grid-column: 4/span 2;
  }
  .gallery__grid .wp-block-image:nth-of-type(10n + 8) {
    aspect-ratio: 192/224;
    grid-row-start: 4;
    grid-column-start: 3;
  }
  .gallery__grid .wp-block-image:nth-of-type(10n + 9) {
    grid-row-start: 1;
    grid-column: 5/span 2;
  }
  .gallery__grid .wp-block-image:nth-of-type(10n + 10) {
    aspect-ratio: 416/224;
    grid-row-start: 4;
    grid-column: 1/span 2;
  }
}
.gallery .wp-block-buttons {
  margin-block-start: 24px;
}
@media (width >= 992px) {
  .gallery .wp-block-buttons {
    margin-block-start: 40px;
  }
}

.wp-block-gallery.has-nested-images figure.wp-block-image figcaption {
  background: hsla(0, 0%, 85%, 0.91);
  color: hsla(0, 0%, 0%, 0.52);
  padding: 6px 10px;
  max-width: calc(100% - 32px);
  width: max-content;
  inset-inline: auto 0;
  border-top-left-radius: 14px;
  font-size: 13px;
  font-weight: 400;
  line-height: 12px;
  text-align: right;
}
@media (width < 992px) {
  .wp-block-gallery.has-nested-images figure.wp-block-image figcaption {
    border-top-left-radius: 10px;
    max-width: calc(100% - 16px);
    padding: 5px 8px;
    font-size: 12px;
    line-height: 11px;
  }
}
.wp-block-gallery.has-nested-images figure.wp-block-image figcaption::first-line {
  font-weight: 700;
}
.wp-block-gallery.has-nested-images figure.wp-block-image figcaption strong {
  color: hsl(0, 0%, 0%);
}
