/* MaxLife property gallery. Colours follow the site's Astra/Elementor global palette with fallbacks. */
.mpg {
  --mpg-accent: var(--e-global-color-astglobalcolor1, #cd6442);
  --mpg-ink: var(--e-global-color-astglobalcolor7, #0a404d);
  --mpg-radius: 20px;
  --mpg-thumb-radius: 10px;
  --mpg-gap: 8px;
  --mpg-nav-size: 44px;
  display: grid;
  gap: 12px;
  width: 100%;
}

.mpg-stage {
  position: relative;
  overflow: hidden;
  border-radius: var(--mpg-radius);
  background: #eef1f2;
  aspect-ratio: 3 / 2;
  touch-action: pan-y;
}

.mpg-stage::before {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(100deg, transparent 20%, rgb(255 255 255 / 0.55) 50%, transparent 80%) -150% 0 / 60% 100% no-repeat, #e7ecee;
  content: "";
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.mpg-stage:not(.is-ready)::before,
.mpg-stage.is-loading::before {
  opacity: 1;
  animation: mpg-shimmer 1.3s ease-in-out infinite;
}

.mpg-stage.is-ready.is-loading::before {
  opacity: 0.45;
}

@keyframes mpg-shimmer {
  to {
    background-position: 250% 0, 0 0;
  }
}

.mpg-stage__picture,
.mpg-thumb__picture,
.mpg-lightbox__picture {
  display: contents;
}

.mpg-stage__link {
  display: block;
  width: 100%;
  height: 100%;
  cursor: zoom-in;
}

.mpg .mpg-stage__img {
  display: block;
  width: 100%;
  max-width: none;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.22, 0.8, 0.24, 1);
}

@media (hover: hover) {
  .mpg-stage:hover .mpg-stage__img {
    transform: scale(1.025);
  }
}

.mpg .mpg-nav,
.mpg-lightbox .mpg-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: var(--mpg-nav-size);
  height: var(--mpg-nav-size);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgb(10 20 24 / 0.55);
  backdrop-filter: blur(6px);
  transform: translateY(-50%);
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.18s ease, opacity 0.25s ease;
}

.mpg .mpg-nav:hover,
.mpg-lightbox .mpg-nav:hover {
  background: var(--mpg-accent);
}

.mpg-nav:active {
  transform: translateY(-50%) scale(0.92);
}

@media (hover: hover) and (pointer: fine) {
  .mpg-stage .mpg-nav {
    opacity: 0;
  }

  .mpg-stage:hover .mpg-nav,
  .mpg-stage:focus-within .mpg-nav {
    opacity: 1;
  }
}

.mpg-nav:focus-visible,
.mpg-thumb:focus-visible,
.mpg-stage__link:focus-visible,
.mpg-lightbox__close:focus-visible {
  outline: 3px solid var(--mpg-accent);
  outline-offset: 3px;
}

.mpg-nav--prev {
  left: 12px;
}

.mpg-nav--next {
  right: 12px;
}

.mpg-counter {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  padding: 4px 10px;
  border-radius: 999px;
  color: #fff;
  background: rgb(10 20 24 / 0.6);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  pointer-events: none;
}

.mpg-expand {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--mpg-ink);
  background: rgb(255 255 255 / 0.92);
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.18);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  pointer-events: none;
  transition: transform 0.25s ease, background-color 0.25s ease, color 0.25s ease;
}

.mpg-stage:hover .mpg-expand,
.mpg-stage__link:focus-visible ~ .mpg-expand {
  color: #fff;
  background: var(--mpg-accent);
  transform: translateY(-2px);
}

.mpg-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: var(--mpg-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.mpg-thumbs__item {
  margin: 0;
}

.mpg .mpg-thumb,
.mpg-lightbox .mpg-thumb {
  position: relative;
  display: block;
  overflow: hidden;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--mpg-thumb-radius);
  aspect-ratio: 4 / 3;
  background: #eef1f2;
  cursor: pointer;
}

.mpg .mpg-thumb img,
.mpg-lightbox .mpg-thumb img {
  display: block;
  width: 100%;
  max-width: none;
  height: 100%;
  object-fit: cover;
  opacity: 0.7;
  transition: opacity 0.2s ease, transform 0.35s cubic-bezier(0.22, 0.8, 0.24, 1);
}

.mpg-thumb:hover img,
.mpg-thumb[aria-current="true"] img {
  opacity: 1;
}

.mpg-thumb:hover img {
  transform: scale(1.06);
}

.mpg-thumb:active {
  transform: scale(0.96);
}

.mpg-thumb::after {
  position: absolute;
  inset: 0;
  border: 3px solid var(--mpg-accent);
  border-radius: inherit;
  content: "";
  opacity: 0;
  transform: scale(1.08);
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.22, 0.8, 0.24, 1);
}

.mpg-thumb[aria-current="true"]::after {
  opacity: 1;
  transform: none;
}

/* Phones: a single swipeable row of thumbnails instead of a tall grid. */
@media (max-width: 767px) {
  .mpg {
    --mpg-radius: 16px;
    --mpg-nav-size: 40px;
  }

  .mpg-thumbs {
    grid-auto-columns: 76px;
    grid-auto-flow: column;
    grid-template-columns: none;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }

  .mpg-thumbs__item {
    scroll-snap-align: start;
  }
}

/* Lightbox (native dialog, rendered in the top layer above headers and language switchers). */
.mpg-scroll-lock {
  overflow: hidden;
}

.mpg-lightbox {
  --mpg-accent: var(--e-global-color-astglobalcolor1, #cd6442);
  box-sizing: border-box;
  display: none;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 12px 12px 16px;
  border: 0;
  color: #fff;
  background: transparent;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
}

.mpg-lightbox[open] {
  display: grid;
  animation: mpg-fade-in 0.22s ease both;
}

.mpg-lightbox[open] .mpg-lightbox__frame {
  animation: mpg-zoom-in 0.32s cubic-bezier(0.22, 0.8, 0.24, 1) both;
}

.mpg-lightbox::backdrop {
  background: rgb(6 12 14 / 0.94);
  backdrop-filter: blur(6px);
  animation: mpg-fade-in 0.22s ease both;
}

.mpg-lightbox.is-closing,
.mpg-lightbox.is-closing::backdrop {
  animation: mpg-fade-out 0.18s ease both;
}

@keyframes mpg-fade-in {
  from {
    opacity: 0;
  }
}

@keyframes mpg-fade-out {
  to {
    opacity: 0;
  }
}

@keyframes mpg-zoom-in {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
}

.mpg-lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
}

.mpg-lightbox__counter {
  padding-left: 4px;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.mpg-lightbox .mpg-lightbox__close {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgb(255 255 255 / 0.12);
  cursor: pointer;
}

.mpg-lightbox .mpg-lightbox__close {
  transition: background-color 0.2s ease, transform 0.18s ease;
}

.mpg-lightbox .mpg-lightbox__close:hover {
  background: rgb(255 255 255 / 0.22);
  transform: rotate(90deg);
}

.mpg-lightbox .mpg-lightbox__close:active {
  transform: scale(0.92);
}

.mpg-lightbox__figure {
  display: grid;
  place-items: center;
  min-height: 0;
  margin: 0;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
}

/* The frame shrinks to the image, so the arrows sit on the photo itself. */
.mpg-lightbox__frame {
  position: relative;
  display: grid;
  place-items: center;
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  touch-action: pan-y;
}

.mpg-lightbox .mpg-lightbox__img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 1600px);
  max-height: calc(100dvh - 210px);
  border-radius: 12px;
  object-fit: contain;
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.55);
  transition: opacity 0.2s ease;
}

.mpg-lightbox.is-loading .mpg-lightbox__img {
  opacity: 0.4;
  filter: blur(2px);
}

.mpg-lightbox__img {
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.mpg-lightbox__thumbs .mpg-thumb img {
  opacity: 0.55;
}

.mpg-nav--large {
  --mpg-nav-size: 52px;
}

.mpg-lightbox__caption {
  max-width: 70ch;
  color: rgb(255 255 255 / 0.85);
  font-size: 15px;
  line-height: 1.4;
  text-align: center;
}

.mpg-lightbox__caption:empty {
  display: none;
}

.mpg-lightbox__thumbs {
  display: flex;
  justify-content: safe center;
  gap: 8px;
  margin: 0;
  padding: 2px 2px 4px;
  overflow-x: auto;
  list-style: none;
  scrollbar-width: thin;
}

.mpg-lightbox__thumbs li {
  flex: 0 0 auto;
  margin: 0;
}

.mpg-lightbox__thumbs .mpg-thumb {
  width: 84px;
}

@media (max-width: 767px) {
  .mpg-lightbox {
    padding: 8px 8px 12px;
  }

  .mpg-lightbox__img {
    max-height: calc(100dvh - 170px);
    border-radius: 8px;
  }

  .mpg-nav--large {
    --mpg-nav-size: 44px;
  }

  .mpg-lightbox__thumbs .mpg-thumb {
    width: 64px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mpg *,
  .mpg *::before,
  .mpg *::after,
  .mpg::before,
  .mpg-stage::before,
  .mpg-lightbox,
  .mpg-lightbox *,
  .mpg-lightbox::backdrop {
    animation: none !important;
    transition: none !important;
  }

  .mpg-stage:hover .mpg-stage__img,
  .mpg-thumb:hover img {
    transform: none;
  }
}

/* No usable photo yet (files missing): a branded placeholder instead of a broken image or empty space. */
.mpg-stage--empty {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--e-global-color-astglobalcolor0, #17758c), var(--mpg-ink));
}

.mpg-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 24px;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  text-align: center;
}

.mpg-empty svg {
  opacity: 0.85;
}

/* Desktop: at most two rows; the last visible tile shows how many more photos open in the viewer. */
@media (min-width: 768px) {
  .mpg-thumbs {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }

  .mpg-thumbs__item:nth-child(n + 17) {
    display: none;
  }

  .mpg-thumb--more::before {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgb(10 20 24 / 0.6);
    content: attr(data-mpg-more);
    font-size: 18px;
    font-weight: 700;
    transition: background-color 0.2s ease;
  }

  .mpg-thumb--more:hover::before {
    background: color-mix(in srgb, var(--mpg-accent) 82%, transparent);
  }
}

/* Slideshow: progress line and pause/play control (visible on hover/focus on desktop, always on touch). */
.mpg-progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  height: 3px;
  background: rgb(255 255 255 / 0.25);
  pointer-events: none;
}

.mpg-progress::after {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--mpg-accent);
  content: "";
  transform: scaleX(0);
  transform-origin: left;
}

.mpg-progress.is-running::after {
  animation: mpg-progress var(--mpg-autoplay-ms, 5000ms) linear both;
}

.mpg.is-autoplay-paused .mpg-progress::after {
  animation-play-state: paused;
}

.mpg.is-autoplay-stopped .mpg-progress {
  opacity: 0;
}

@keyframes mpg-progress {
  to {
    transform: scaleX(1);
  }
}

.mpg .mpg-autoplay {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgb(10 20 24 / 0.55);
  backdrop-filter: blur(6px);
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.18s ease, opacity 0.25s ease;
}

.mpg .mpg-autoplay:hover {
  background: var(--mpg-accent);
}

.mpg .mpg-autoplay:active {
  transform: scale(0.92);
}

.mpg .mpg-autoplay:focus-visible {
  outline: 3px solid var(--mpg-accent);
  outline-offset: 3px;
}

.mpg-autoplay .mpg-autoplay__play,
.mpg-autoplay[data-state="stopped"] .mpg-autoplay__pause {
  display: none;
}

.mpg-autoplay[data-state="stopped"] .mpg-autoplay__play {
  display: block;
}

@media (hover: hover) and (pointer: fine) {
  .mpg-stage .mpg-autoplay {
    opacity: 0;
  }

  .mpg-stage:hover .mpg-autoplay,
  .mpg-stage:focus-within .mpg-autoplay,
  .mpg.is-autoplay-stopped .mpg-autoplay {
    opacity: 1;
  }
}
