/* Flat Margaret gallery: true 3 / 2 / 1 columns; no clipped mobile photos.
   Loaded AFTER the legacy bundle, which contains older !important overrides. */
.fm-body .fm-gallery .fm-gallery-grid,
.fm-body .fm-gallery .fm-gallery-grid-all,
.fm-body .fm-gallery .fm-gallery-preview {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: clamp(12px, 1.6vw, 20px) !important;
  align-items: start;
  max-height: none !important;
  overflow: visible !important;
  transition: none !important;
}
.fm-body .fm-gallery .fm-gallery-item {
  display: block;
  position: relative;
  width: 100%;
  min-width: 0;
  aspect-ratio: 4 / 3 !important;
  overflow: hidden;
  border-radius: 12px !important;
  background: #ebe4d8 !important;
  border: 1px solid rgba(164,135,89,.20) !important;
  box-shadow: 0 12px 28px rgba(18,40,35,.08) !important;
  cursor: zoom-in;
}
.fm-body .fm-gallery .fm-gallery-item img,
.fm-body .fm-gallery .fm-gallery-grid img {
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: auto !important;
  object-fit: cover !important;
  object-position: center !important;
  border: 0 !important;
  filter: none !important;
  transition: transform .3s ease !important;
}
@media (hover: hover) {
  .fm-body .fm-gallery .fm-gallery-item:hover img {transform: scale(1.035) !important;}
}
.fm-body .fm-gallery .fm-gallery-item:focus-visible {outline: 3px solid #b49157;outline-offset: 4px;}
/* The initial teaser shows complete rows; expanding reveals every image. */
.fm-body.fm-page-apartment .fm-gallery-grid-all:not(.is-expanded) .fm-gallery-item:nth-child(n+10) {display: none !important;}
.fm-body.fm-page-apartment .fm-gallery-grid-all.is-expanded .fm-gallery-item {display: block !important;}
@media (max-width: 1023px) {
 .fm-body .fm-gallery .fm-gallery-grid,
 .fm-body .fm-gallery .fm-gallery-grid-all,
 .fm-body .fm-gallery .fm-gallery-preview {grid-template-columns: repeat(2, minmax(0, 1fr)) !important;gap: 14px !important;}
 .fm-body.fm-page-apartment .fm-gallery-grid-all:not(.is-expanded) .fm-gallery-item:nth-child(n+7) {display: none !important;}
}
@media (max-width: 640px) {
 .fm-body .fm-gallery .fm-gallery-grid,
 .fm-body .fm-gallery .fm-gallery-grid-all,
 .fm-body .fm-gallery .fm-gallery-preview {grid-template-columns: minmax(0, 1fr) !important;gap: 20px !important;}
 .fm-body .fm-gallery .fm-gallery-item {aspect-ratio: auto !important;border-radius: 12px !important;}
 .fm-body .fm-gallery .fm-gallery-item img,
 .fm-body .fm-gallery .fm-gallery-grid img {
   display: block !important;
   width: 100% !important;
   height: auto !important;
   max-height: none !important;
   object-fit: contain !important;
   aspect-ratio: auto !important;
 }
 .fm-body.fm-page-apartment .fm-gallery-grid-all:not(.is-expanded) .fm-gallery-item:nth-child(n+7) {display: none !important;}
}
