.gallery {
  padding: var(--px-112) 0;

  .gallery__images.layout-one {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    width: 100%;
    height: 100%;
    align-items: stretch;

    .cutout img {
      scale: 1.4;
    }

    .gallery__text {
      display: flex;
      width: 100%;
      height: 100%;
      padding: var(--px-20);
      max-width: var(--px-500);

      @media (min-width: 48rem) {
        margin-left: var(--px-20);
      }
    }
  }

  .gallery__images.layout-two {
    position: relative;
    display: grid;
    grid-template-columns: 40% 60%;
    gap: 0;
    width: 100%;
    height: 100%;
    align-items: stretch;

    .cutout img {
      scale: 1.4;
    }

    .gallery__text {
      display: flex;
      width: 100%;
      height: 100%;
      grid-column: 1 / 3;
      grid-row: 1 / 2;
      padding: var(--px-20);
      max-width: var(--px-500);

      @media (min-width: 48rem) {
        margin-left: var(--px-20);
      }
    }

    .image-1 {
      margin-top: auto;
      grid-column: 1 / 2;
      grid-row: 2 / 3;
      width: 100%;
      height: 60%;
    }

    .image-2 {
      grid-column: 2 / 3;
      grid-row: 2 / 3;
      width: 100%;
    }
  }

  .gallery__images.layout-three {
    position: relative;
    display: grid;
    grid-template-columns: 60% 40%;
    gap: 0;
    width: 100%;
    height: 100%;
    align-items: stretch;

    .grid-item {
      display: flex;
      flex-direction: column;
    }

    .cutout img {
      scale: 1.4;
    }

    .image-2 {
      display: flex;
      justify-content: end;
      align-items: end;
      margin-left: 40%;
    }

    .gallery__text {
      display: flex;
      width: 100%;
      height: 100%;
      justify-content: stretch;
      align-items: stretch;
      padding: var(--px-20);
      max-width: var(--px-500);

      @media (min-width: 48rem) {
        margin-left: var(--px-20);
      }
    }
  }

  .gallery__images.layout-four {
    position: relative;
    display: grid;
    grid-template-columns: 30% 30% 40%;
    gap: 0;
    width: 100%;
    height: 100%;
    align-items: stretch;

    .cutout img {
      scale: 1.4;
    }

    .gallery__text {
      display: flex;
      width: 100%;
      height: 100%;
      grid-column: 1 / 4;
      grid-row: 1 / 2;
      padding: var(--px-20);
      max-width: var(--px-500);

      @media (min-width: 48rem) {
        margin-left: var(--px-20);
      }
    }

    .image-1 {
      grid-column: 1 / 4;
      grid-row: 2 / 3;
    }

    .image-2 {
      grid-column: 2 / 3;
      grid-row: 3 / 4;
      width: 100%;
      height: 60%;
    }

    .image-3 {
      grid-column: 3 / 4;
      grid-row: 3 / 4;
      width: 100%;
    }

    .image-4 {
      grid-column: 1 / 4;
      grid-row: 4 / 5;
    }
  }

  .gallery__link {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
  }

  @media (max-width: 47.998rem) {
    .gallery__images.layout-three,
    .gallery__images.layout-four {
      position: relative;
      display: grid;
      grid-template-columns: 40% 60%;
      gap: 0;
      width: 100%;
      height: 100%;
      align-items: stretch;

      .cutout img {
        scale: 1.6;
      }

      .image-1 {
        grid-column: 1 / 3;
        grid-row: 2 / 3;
      }

      .image-2 {
        grid-column: 1 / 2;
        grid-row: 3 / 4;
        width: 100%;
        height: 60%;
      }

      .image-3 {
        grid-column: 2 / 3;
        grid-row: 3 / 4;
        width: 100%;
      }

      .image-4 {
        grid-column: 1 / 3;
        grid-row: 4 / 5;
      }
    }

    .gallery__images.layout-four {
      .gallery__text {
        display: flex;
        width: 100%;
        height: 100%;
        grid-column: 1 / 3;
        grid-row: 1 / 2;
        padding: var(--px-20);
        max-width: var(--px-500);
      }
    }

    .gallery__images.layout-three {
      .grid-item {
        justify-content: space-between;
      }

      .image-1 {
        order: 2;
      }

      .image-2 {
        order: 3;
        margin-left: 0;
      }

      .gallery__text {
        order: 1;
        position: absolute;
        top: -30%;
        left: 0;
        width: 100%;
        height: min-content;
        padding: var(--px-20);
        max-width: var(--px-500);
      }
    }
  }
}
