.mdp-lg {
  --mdp-gallery-height: 560px;
  --mdp-side-width: 130px;
  --mdp-gallery-gap: 14px;
  --mdp-gallery-radius: 16px;
  --mdp-gallery-accent: #d5a45c;
  --mdp-gallery-bg: #080808;
  width: 100%; max-width: 100%; min-width: 0; position: relative; color: #fff;
  font-family: inherit; isolation: isolate; overflow: hidden;
}
.mdp-lg *, .mdp-lg *::before, .mdp-lg *::after { box-sizing: border-box; }

/* Neutralise les effets de boutons/overlays imposés par certains thèmes WordPress. */
.mdp-lg__preview, .mdp-lg__thumb, .mdp-lg__dot, .mdp-lg__arrow {
  appearance: none !important; -webkit-appearance: none !important;
  border: 0 !important; padding: 0 !important; margin: 0 !important;
  box-shadow: none !important; text-shadow: none !important;
  filter: none !important; opacity: 1 !important; transform: none;
  background-image: none !important; text-decoration: none !important;
}
.mdp-lg__main::before, .mdp-lg__main::after,
.mdp-lg__preview::before, .mdp-lg__preview::after,
.mdp-lg__thumb::before, .mdp-lg__thumb::after { content: none !important; display: none !important; }

.mdp-lg__stage {
  width: 100%; max-width: 100%; min-width: 0; display: grid;
  grid-template-columns: minmax(0,1fr); align-items: center;
  gap: var(--mdp-gallery-gap); position: relative; overflow: hidden;
}
.mdp-lg--with-sides .mdp-lg__stage {
  grid-template-columns: minmax(80px,var(--mdp-side-width)) minmax(0, 1fr) minmax(80px,var(--mdp-side-width));
}

.mdp-lg__main {
  position: relative !important; display: block !important; width: 100% !important;
  max-width: 100% !important; min-width: 0 !important;
  height: var(--mdp-gallery-height) !important; overflow: hidden !important;
  border-radius: var(--mdp-gallery-radius) !important; background: var(--mdp-gallery-bg) !important;
  cursor: default; z-index: 2; line-height: 0 !important;
}
.mdp-lg__main-image {
  position: relative !important; z-index: 1 !important; display: block !important;
  width: 100% !important; height: 100% !important; max-width: none !important; max-height: none !important;
  object-fit: contain; object-position: center center !important;
  opacity: 1 !important; filter: none !important; -webkit-filter: none !important;
  transform: none !important; mix-blend-mode: normal !important; background: transparent !important;
  image-rendering: auto !important; backface-visibility: visible !important;
}

.mdp-lg__preview {
  display: block !important; width: 100% !important; min-width: 0 !important;
  height: calc(var(--mdp-gallery-height) * .72) !important;
  overflow: hidden !important; border-radius: var(--mdp-gallery-radius) !important;
  background: var(--mdp-gallery-bg) !important; cursor: pointer; opacity: .72 !important;
  transition: opacity .2s ease; line-height: 0 !important;
}
.mdp-lg__preview-image {
  display: block !important; width: 100% !important; height: 100% !important; max-width: none !important;
  object-fit: cover !important; object-position: center center !important;
  opacity: 1 !important; filter: none !important; transform: none !important; mix-blend-mode: normal !important;
}
@media (hover:hover) and (pointer:fine) { .mdp-lg__preview:hover { opacity: 1 !important; } }

.mdp-lg__counter {
  position: absolute; right: 16px; top: 16px; z-index: 5; padding: 7px 11px;
  border: 1px solid rgba(255,255,255,.55); border-radius: 999px;
  background: rgba(0,0,0,.62); color: #fff; font-size: 13px; line-height: 1.1;
  backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
}
.mdp-lg__arrow {
  position: absolute; top: 50%; transform: translateY(-50%) !important; z-index: 5;
  width: 48px; height: 48px; min-width: 48px !important; min-height: 48px !important;
  border-radius: 50% !important; border: 1px solid rgba(255,255,255,.55) !important;
  color: #fff !important; background: rgba(0,0,0,.7) !important; font-size: 34px; line-height: 1;
  display: grid !important; place-items: center; cursor: pointer; padding: 0 !important; margin: 0 !important;
  appearance: none !important; -webkit-appearance: none !important; box-shadow: none !important;
}
.mdp-lg__arrow--prev { left: 18px; }
.mdp-lg__arrow--next { right: 18px; }

.mdp-lg__dots {
  display: flex; justify-content: center; gap: 9px; padding: 15px 10px 8px;
  flex-wrap: wrap; max-width: 100%; overflow: hidden;
}
.mdp-lg__dot {
  width: 9px !important; height: 9px !important; min-width: 9px !important; min-height: 9px !important;
  border-radius: 50% !important; background: #aaa !important; cursor: pointer; flex: 0 0 9px;
}
.mdp-lg__dot.is-active { background: var(--mdp-gallery-accent) !important; transform: scale(1.25) !important; }

.mdp-lg__thumbs {
  display: flex; max-width: 100%; min-width: 0; gap: 10px; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: thin; padding: 8px 0 10px; scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch; overscroll-behavior-inline: contain;
}
.mdp-lg__thumb {
  flex: 0 0 118px; width: 118px !important; height: 76px !important; min-width: 118px !important;
  border-radius: 10px !important; overflow: hidden !important; border: 2px solid transparent !important;
  opacity: .68 !important; background: #191919 !important; cursor: pointer; scroll-snap-align: center;
  transition: opacity .2s ease, border-color .2s ease, transform .2s ease;
}
.mdp-lg__thumb img {
  width: 100% !important; height: 100% !important; max-width: none !important; display: block !important;
  object-fit: cover !important; object-position: center center !important; opacity: 1 !important; filter: none !important;
}
.mdp-lg__thumb.is-active {
  opacity: 1 !important; border-color: var(--mdp-gallery-accent) !important; transform: translateY(-2px) !important;
}

.mdp-lg__preview:focus-visible, .mdp-lg__thumb:focus-visible,
.mdp-lg__dot:focus-visible, .mdp-lg__arrow:focus-visible {
  outline: 3px solid var(--mdp-gallery-accent) !important; outline-offset: 3px;
}
.mdp-lg__empty { padding: 28px; border: 1px dashed #aaa; border-radius: 12px; text-align: center; background: #fafafa; color: #444; }

/* Tablette : une seule grande image. Les aperçus latéraux disparaissent pour ne jamais écraser la page. */
@media (max-width: 1199px) {
  .mdp-lg--with-sides .mdp-lg__stage { grid-template-columns: minmax(0,1fr); }
  .mdp-lg__preview { display: none !important; }
  .mdp-lg__main { height: min(var(--mdp-gallery-height), 54vw) !important; min-height: 320px; }
}

/* Tablette étroite. */
@media (max-width: 900px) {
  .mdp-lg { --mdp-gallery-gap: 8px; }
  .mdp-lg__main { height: min(var(--mdp-gallery-height), 62vw) !important; min-height: 300px; }
  .mdp-lg__counter { right: 10px; top: 10px; }
  .mdp-lg__arrow { width: 44px; height: 44px; min-width: 44px !important; min-height: 44px !important; font-size: 31px; }
  .mdp-lg__arrow--prev { left: 12px; }
  .mdp-lg__arrow--next { right: 12px; }
  .mdp-lg__thumb { flex-basis: 100px; width: 100px !important; min-width: 100px !important; height: 66px !important; }
}

/* Téléphone : compact, aucune largeur fixe qui puisse dépasser l'écran. */
@media (max-width: 767px) {
  .mdp-lg { --mdp-gallery-gap: 6px; --mdp-gallery-radius: 10px; }
  .mdp-lg__stage { gap: 0; }
  .mdp-lg__main {
    height: min(var(--mdp-gallery-height), 72vw) !important;
    min-height: 230px; max-height: 390px;
    border-radius: var(--mdp-gallery-radius) !important;
  }
  .mdp-lg__counter { right: 8px; top: 8px; padding: 6px 9px; font-size: 12px; }
  .mdp-lg__arrow {
    width: 38px; height: 38px; min-width: 38px !important; min-height: 38px !important;
    font-size: 27px; background: rgba(0,0,0,.62) !important;
  }
  .mdp-lg__arrow--prev { left: 8px; }
  .mdp-lg__arrow--next { right: 8px; }
  .mdp-lg__dots { display: none; }
  .mdp-lg__thumbs { gap: 7px; padding: 8px 0 4px; scrollbar-width: none; }
  .mdp-lg__thumbs::-webkit-scrollbar { display: none; }
  .mdp-lg__thumb {
    flex: 0 0 76px; width: 76px !important; min-width: 76px !important; height: 52px !important;
    border-radius: 7px !important;
  }
}

@media (max-width: 420px) {
  .mdp-lg__main { height: min(var(--mdp-gallery-height), 78vw) !important; min-height: 215px; }
  .mdp-lg__arrow { width: 36px; height: 36px; min-width: 36px !important; min-height: 36px !important; font-size: 25px; }
  .mdp-lg__thumb { flex-basis: 70px; width: 70px !important; min-width: 70px !important; height: 48px !important; }
}

@media (prefers-reduced-motion: reduce) {
  .mdp-lg__preview, .mdp-lg__thumb { transition: none; }
}
