/* Common styles for all gallery layouts */
.mao-mosaicgallery .mao-homegallerys-block {
  position: relative;
  overflow: hidden;
}

.mao-mosaicgallery .mao-homegallerys-block img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.3s ease;
}

.mao-mosaicgallery .hover-mosaic {
  position: relative;
  height: 100%;
}

/* STYLE 1: Pattern 3+2 repetido */
.mao-mosaicgallery .mao-gallery-style1 {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-gap: 1.5rem;
}

/* Prima riga: 3 immagini (2 colonne ciascuna) */
.mao-gallery-style1 .mao-homegallerys-block:nth-child(5n+1),
.mao-gallery-style1 .mao-homegallerys-block:nth-child(5n+2),
.mao-gallery-style1 .mao-homegallerys-block:nth-child(5n+3) {
  grid-column: span 2;
}

/* Seconda riga: 2 immagini (3 colonne ciascuna) */
.mao-gallery-style1 .mao-homegallerys-block:nth-child(5n+4),
.mao-gallery-style1 .mao-homegallerys-block:nth-child(5n) {
  grid-column: span 3;
}

/* STYLE 2: Grid 2x2 */
.mao-mosaicgallery .mao-gallery-style2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-gap: 1.5rem;
}

.mao-gallery-style2 .mao-homegallerys-block {
  grid-column: span 1;
}

/* STYLE 3: Mosaic (current complex layout) */
.mao-mosaicgallery .mao-gallery-style3 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-gap: 1.5rem;
}

.mao-gallery-style3 .grid1 {
  grid-column: 1 / span 2;
  grid-row: 1 / span 2;
}

.mao-gallery-style3 .grid2 {
  grid-column: 3;
  grid-row: 1;
}

.mao-gallery-style3 .grid3 {
  grid-column: 4;
  grid-row: 1;
}

.mao-gallery-style3 .grid4 {
  grid-column: 3 / span 2;
  grid-row: 2 / span 2;
}

.mao-gallery-style3 .grid5 {
  grid-column: 1;
  grid-row: 3;
}

.mao-gallery-style3 .grid6 {
  grid-column: 2;
  grid-row: 3;
}

/* Responsive Design */
@media (max-width: 991.98px) {
  /* STYLE 1 responsive */
  .mao-mosaicgallery .mao-gallery-style1 {
    grid-template-columns: repeat(2, 1fr);
    grid-gap: 1.2rem;
  }

  .mao-gallery-style1 .mao-homegallerys-block:nth-child(odd) {
    grid-column: span 1;
  }

  .mao-gallery-style1 .mao-homegallerys-block:nth-child(even) {
    grid-column: span 1;
  }

  .mao-gallery-style1 .mao-homegallerys-block:nth-last-child(1) {
    display: none;
  }

  /* STYLE 2 responsive - remains 2x2 but smaller gap */
  .mao-mosaicgallery .mao-gallery-style2 {
    grid-gap: 1.2rem;
  }

  /* STYLE 3 responsive */
  .mao-mosaicgallery .mao-gallery-style3 {
    grid-template-columns: repeat(2, 1fr);
    grid-gap: 1.2rem;
  }

  .mao-gallery-style3 .grid1 {
    grid-column: 1 / span 2;
    grid-row: 1 / span 2;
  }

  .mao-gallery-style3 .grid2 {
    grid-column: 1;
    grid-row: 3;
  }

  .mao-gallery-style3 .grid3 {
    grid-column: 2;
    grid-row: 3;
  }

  .mao-gallery-style3 .grid4 {
    grid-column: 1 / span 2;
    grid-row: 4 / span 2;
  }

  .mao-gallery-style3 .grid5 {
    grid-column: 1;
    grid-row: 6;
  }

  .mao-gallery-style3 .grid6 {
    grid-column: 2;
    grid-row: 6;
  }

  .mao-gallery-style3 .mao-homegallerys-block:nth-last-child(-n+3) {
    display: none;
  }
}
