.section__mediaGallery { position: relative; }
.section__mediaGalleryHeading { max-width: 768px; margin: 0 auto 50px; text-align: center; }
.section__mediaGalleryHeading .section__mediaGalleryTitle { margin-bottom: var(--space-3); }
.section__mediaGalleryHeading .section__mediaGalleryCopy p { margin: 0; }

.section__mediaGalleryWrap { position: relative; overflow: hidden; max-height: 1420px; transition: max-height .2s ease; }
.section__mediaGalleryWrap:after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 180px; pointer-events: none; opacity: 1; transition: opacity .3s ease; background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--color-white)); }
.section__mediaGallery.bg-color-s-10 .section__mediaGalleryWrap:after { background: linear-gradient(to bottom, rgba(248, 248, 248, 0), var(--color-s-10)); }
.section__mediaGallery.bg-color-grey .section__mediaGalleryWrap:after { background: linear-gradient(to bottom, rgba(155, 155, 156, 0), var(--color-grey)); }
.section__mediaGallery.bg-color-p .section__mediaGalleryWrap:after { background: linear-gradient(to bottom, rgba(254, 214, 2, 0), var(--color-p)); }
.section__mediaGallery.bg-color-p-80 .section__mediaGalleryWrap:after { background: linear-gradient(to bottom, rgba(255, 233, 0, 0), var(--color-p-80)); }
.section__mediaGallery.bg-color-black .section__mediaGalleryWrap:after,
.section__mediaGallery.bg-color-s .section__mediaGalleryWrap:after { background: linear-gradient(to bottom, rgba(0, 0, 0, 0), var(--color-black)); }
.section__mediaGalleryWrap.is-expanded { max-height: none; }
.section__mediaGalleryWrap.is-expanded:after { opacity: 0; }

/* bg-color-beige/bg-color-yellow aren't global utility classes (same as image-copy, sticky-nav,
   richtext-content - each defines these locally); matching their colors here for consistency. */
.section__mediaGallery.bg-color-beige { background: #b5ac9c; }
.section__mediaGallery.bg-color-yellow { background: #ffd400; }
.section__mediaGallery.bg-color-beige .section__mediaGalleryWrap:after { background: linear-gradient(to bottom, rgba(181, 172, 156, 0), #b5ac9c); }
.section__mediaGallery.bg-color-yellow .section__mediaGalleryWrap:after { background: linear-gradient(to bottom, rgba(255, 212, 0, 0), #ffd400); }

.section__mediaGalleryGrid { display: grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: masonry; align-items: start; gap: 20px; }
.section__mediaGalleryGrid.is-js-masonry { display: block; }
.section__mediaGalleryGrid.is-js-masonry .section__mediaGalleryItem { position: absolute; top: 0; left: 0; margin: 0; transition: left .2s ease, top .2s ease, width .2s ease, height .2s ease; }
.section__mediaGalleryGrid.is-js-masonry .section__mediaGalleryItem img,
.section__mediaGalleryGrid.is-js-masonry .section__mediaGalleryItem video { height: 100%; object-fit: cover; }
.section__mediaGalleryItem { display: block; position: relative; overflow: hidden; }
.section__mediaGalleryItem img,
.section__mediaGalleryItem video { display: block; width: 100%; height: auto; }
.section__mediaGalleryItem:not(.section__mediaGalleryItem--video):after { content: ""; position: absolute; inset: 0; background: var(--color-s); opacity: 0; transition: opacity .2s ease; pointer-events: none; }
@media (hover: hover) {
  .section__mediaGalleryItem:not(.section__mediaGalleryItem--video):hover:after { opacity: .35; }
}

.section__mediaGalleryMoreWrap { display: flex; justify-content: center; margin-top: var(--space-4); }
.section__mediaGalleryMoreWrap.is-hidden { display: none; }

@media screen and (min-width: 768px) {
  .section__mediaGalleryGrid { grid-template-columns: repeat(3, 1fr); gap: 32px; }
  .section__mediaGalleryMoreWrap { margin-top: var(--space-5); }
}

/* Lightbox. Moved to <body> by module.js, so it's styled as its own block.
   Desktop: Embla slider. Mobile (<768px): Embla is switched off and it becomes a vertical feed. */
.mediaGallery-isLocked { overflow: hidden; }
.mediaGalleryLightbox {
  --mg-backdrop: rgb(255 255 255 / 94%);
  --mg-gap: 40px;
  --mg-media-h: min(750px, calc(100vh - 250px));
  --mg-max-w: min(78vw, 1400px);
  position: fixed; inset: 0; z-index: 10000; color: var(--color-black);
}
@supports (height: 100dvh) {
  .mediaGalleryLightbox { --mg-media-h: min(750px, calc(100dvh - 250px)); }
}
.mediaGalleryLightbox[hidden] { display: none; }
.mediaGalleryLightbox__backdrop { position: absolute; inset: 0; background: var(--mg-backdrop); }
.mediaGalleryLightbox__stage { position: relative; display: flex; flex-direction: column; justify-content: center; height: 100%; box-sizing: border-box; }
.mediaGalleryLightbox__main { position: relative; }
.mediaGalleryLightbox__viewport { overflow: hidden; width: 100%; }
.mediaGalleryLightbox__track { display: flex; align-items: center; height: var(--mg-media-h); touch-action: pan-y pinch-zoom; }
/* Each slide sizes itself to its own media (height capped at 750px, width follows the aspect ratio) -
   Embla measures these real widths, so the active slide is always centred with no dead space. */
.mediaGalleryLightbox__slide { flex: 0 0 auto; min-width: 0; padding: 0 calc(var(--mg-gap) / 2); opacity: .5; cursor: pointer; transition: opacity .3s ease; }
.mediaGalleryLightbox__slide.is-selected { opacity: 1; cursor: grab; }
/* A peeking slide's video must not get the click itself: its native click-to-toggle would pause the
   video right after we select and autoplay it. The click falls through to the slide, which selects it. */
@media screen and (min-width: 768px) {
  .mediaGalleryLightbox__slide:not(.is-selected) .mediaGalleryLightbox__media > * { pointer-events: none; }
}
.mediaGalleryLightbox__media {
  --h: min(var(--mg-media-h), calc(var(--mg-max-w) * var(--ih) / var(--iw)));
  position: relative; height: var(--h); width: calc(var(--h) * var(--iw) / var(--ih));
  overflow: hidden; border-radius: 8px; background: rgba(0, 0, 0, .06);
}
.mediaGalleryLightbox__img,
.mediaGalleryLightbox__video { display: block; width: 100%; height: 100%; object-fit: cover; user-select: none; }
.mediaGalleryLightbox__video { background: var(--color-black); }
.mediaGalleryLightbox__muteBadge { display: none; align-items: center; justify-content: center; position: absolute; right: 12px; bottom: 12px; width: 34px; height: 34px; border-radius: 50%; background: rgba(0, 0, 0, .55); color: var(--color-white); pointer-events: none; }
.mediaGalleryLightbox__slideCaption { display: none; }
.mediaGalleryLightbox__caption { max-width: 768px; min-height: 70px; margin: var(--space-4) auto 0; padding: 0 20px; text-align: center; }
.mediaGalleryLightbox__captionTitle { display: block; margin-bottom: var(--space-2); }
.mediaGalleryLightbox__captionCopy { display: block; }
.mediaGalleryLightbox__dots { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); margin-top: var(--space-3); padding: 0 20px; }
/* Buttons below reset the site's global button styles (padding, square corners, max-width) */
.mediaGalleryLightbox__dots button { width: 8px; height: 8px; min-width: 0; max-width: none; padding: 0; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .2); cursor: pointer; transition: background .2s ease; }
.mediaGalleryLightbox__dots button.is-active { background: var(--color-black); }
.mediaGalleryLightbox__close,
.mediaGalleryLightbox__arrow { display: flex; align-items: center; justify-content: center; max-width: none; padding: 0; border: 0; color: var(--color-black); cursor: pointer; }
.mediaGalleryLightbox__close { position: absolute; top: 24px; right: 24px; z-index: 2; width: 44px; height: 44px; border-radius: 50%; background: transparent; }
.mediaGalleryLightbox__arrow { position: absolute; top: 50%; z-index: 2; width: 48px; height: 48px; border-radius: 50%; background: var(--color-white); box-shadow: 0 2px 10px rgba(0, 0, 0, .15); transform: translateY(-50%); transition: opacity .2s ease; }
.mediaGalleryLightbox__arrow--prev { left: 24px; }
.mediaGalleryLightbox__arrow--next { right: 24px; }
.mediaGalleryLightbox__arrow:disabled { opacity: 0; pointer-events: none; }
.mediaGalleryLightbox__close:focus-visible,
.mediaGalleryLightbox__arrow:focus-visible,
.mediaGalleryLightbox__dots button:focus-visible { outline: 2px solid var(--color-black); outline-offset: 2px; }

/* Mobile feed - must match the Embla breakpoint in module.js */
@media screen and (max-width: 767px) {
  .mediaGalleryLightbox__stage { display: block; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 76px 20px 40px; }
  .mediaGalleryLightbox__viewport { overflow: visible; }
  .mediaGalleryLightbox__track { flex-direction: column; align-items: stretch; gap: 20px; height: auto; touch-action: auto; transform: none !important; }
  .mediaGalleryLightbox__slide { padding: 0; opacity: 1; cursor: auto; transform: none !important; }
  .mediaGalleryLightbox__media { width: 100%; height: auto; aspect-ratio: var(--iw) / var(--ih); }
  .mediaGalleryLightbox__slide.is-muted .mediaGalleryLightbox__muteBadge { display: flex; }
  .mediaGalleryLightbox__slideCaption { display: block; margin-top: var(--space-3); text-align: center; }
  .mediaGalleryLightbox__arrow,
  .mediaGalleryLightbox__caption,
  .mediaGalleryLightbox__dots { display: none; }
  /* Content scrolls underneath the close button, so give it a solid backing */
  .mediaGalleryLightbox__close { top: 16px; right: 16px; background: var(--color-white); box-shadow: 0 2px 10px rgba(0, 0, 0, .15); }
}
