/* ==========================================================
   ADORA V1.6.17 — Thai Gallery V1 Style Restore
   Visual geometry authority: V1.6.8 thai-gallery-v1.css

   Restores the original unequal-size editorial mosaic:
   - 12-column grid
   - default item = 4 columns
   - item 1 and 6 = 8 columns

   Preserved from newer production:
   - V1.6.13 responsive media / sizes=auto
   - no hover zoom / no image motion
   - V1.6.15 Thai Hero frame
   ========================================================== */

.thai-gallery-grid.media-gallery{
  display:grid!important;
  grid-template-columns:repeat(12,minmax(0,1fr))!important;
  gap:clamp(14px,1.8vw,24px)!important;
  align-items:start!important;
  grid-auto-flow:row!important;
}

.thai-gallery-grid.media-gallery .thai-gallery-item{
  grid-column:span 4!important;
  margin:0!important;
  aspect-ratio:4/3!important;
  overflow:hidden!important;
  border-radius:clamp(20px,2.2vw,34px)!important;
}

/* Original V1.6.8 editorial emphasis. */
.thai-gallery-grid.media-gallery .thai-gallery-item:nth-child(1),
.thai-gallery-grid.media-gallery .thai-gallery-item:nth-child(6){
  grid-column:span 8!important;
}

/* Keep the current sharp responsive picture pipeline intact. */
.thai-gallery-grid.media-gallery .thai-gallery-item>picture{
  display:block!important;
  width:100%!important;
  height:100%!important;
  aspect-ratio:4/3!important;
  overflow:hidden!important;
  border-radius:inherit!important;
}

.thai-gallery-grid.media-gallery .thai-gallery-item img{
  display:block!important;
  width:100%!important;
  height:100%!important;
  max-width:none!important;
  aspect-ratio:auto!important;
  object-fit:cover!important;
  object-position:center!important;

  /* V1.6.9+ approved behavior: gallery images remain static. */
  transform:none!important;
  transition:none!important;
  filter:none!important;
}

/* V1.6.8 tablet behavior: equal two-column grid. */
@media(max-width:980px){
  .thai-gallery-grid.media-gallery{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }

  .thai-gallery-grid.media-gallery .thai-gallery-item,
  .thai-gallery-grid.media-gallery .thai-gallery-item:nth-child(1),
  .thai-gallery-grid.media-gallery .thai-gallery-item:nth-child(6){
    grid-column:span 1!important;
  }
}

/* V1.6.8 mobile behavior: one image per row. */
@media(max-width:640px){
  .thai-gallery-grid.media-gallery{
    grid-template-columns:1fr!important;
    gap:14px!important;
  }

  .thai-gallery-grid.media-gallery .thai-gallery-item,
  .thai-gallery-grid.media-gallery .thai-gallery-item:nth-child(1),
  .thai-gallery-grid.media-gallery .thai-gallery-item:nth-child(6){
    grid-column:auto!important;
    border-radius:22px!important;
  }
}

@media(prefers-reduced-motion:reduce){
  .thai-gallery-grid.media-gallery img{
    transition:none!important;
    transform:none!important;
  }
}

/* ==========================================================
   V1.6.18 — Last-row balance
   Current Thai collection contains 8 gallery items.
   Preserve the approved V1.6.17 mosaic and only center
   the single incomplete final-row item on desktop.
   If a ninth image is added later this selector stops matching
   automatically and the original 4+4+4 geometry takes over.
   ========================================================== */
@media(min-width:981px){
  .thai-gallery-grid.media-gallery .thai-gallery-item:nth-child(8):last-child{
    grid-column:5 / span 4!important;
  }
}

/* Keep the closing actions visually attached to the whole collection,
   not to the left edge of the final image. */
.thai-gallery-section .thai-gallery-cta{
  display:flex;
  justify-content:center;
  align-items:center;
  flex-wrap:wrap;
  gap:10px;
  margin-top:clamp(18px,2vw,26px);
}
