html, body { overflow-x: hidden !important; }
.rbgm-gallery { position: relative; overflow: hidden !important; width: 100%; max-width: 100vw !important; min-height: var(--rbgm-height, 520px); isolation: isolate; }
.rbgm-mode-fullscreen { min-height: 100vh; }
.rbgm-mode-fullwidth, .rbgm-mode-contained { min-height: var(--rbgm-height, 520px); }
.rbgm-mode-ratio { min-height: 0; aspect-ratio: var(--rbgm-ratio, 16/9); }
.rbgm-mode-contained { max-width: 1200px; margin-left: auto; margin-right: auto; }
.rbgm-bg { position: absolute; inset: 0; z-index: 0; overflow: hidden !important; pointer-events: none; max-width: 100vw !important; }
.rbgm-bg::after { content: ""; position: absolute; inset: 0; z-index: 2; background: var(--rbgm-overlay, #000); opacity: var(--rbgm-opacity, .35); pointer-events: none; }
.rbgm-slide { position: absolute; inset: 0; z-index: 1; width: 100% !important; max-width: 100vw !important; background-size: var(--rbgm-fit, cover); background-position: var(--rbgm-position, center center); background-repeat: no-repeat; opacity: 0; transform: scale(1); animation-duration: var(--rbgm-duration, 24s); animation-timing-function: ease-in-out; animation-iteration-count: infinite; will-change: transform, opacity; }
.rbgm-gallery[data-pause-hover="1"]:hover .rbgm-slide,
.rbgm-gallery.rbgm-lightbox-paused .rbgm-slide { animation-play-state: paused; }
.rbgm-gallery[data-lightbox="1"] .rbgm-bg { pointer-events: auto; cursor: zoom-in; }
@keyframes rbgmKenBurns { 0% { opacity: 1; transform: scale(1); } 33% { opacity: 1; transform: scale(var(--rbgm-zoom, 1.12)); } 41% { opacity: 0; transform: scale(var(--rbgm-zoom, 1.12)); } 100% { opacity: 0; transform: scale(1); } }
.rbgm-slide { animation-name: rbgmKenBurns; }
@media (prefers-reduced-motion: reduce) { .rbgm-gallery[data-reduced-motion="1"] .rbgm-slide { animation: none !important; opacity: 0; transform: none; } .rbgm-gallery[data-reduced-motion="1"] .rbgm-slide:first-child { opacity: 1; } }
/* Divi helper: add class rb-gallery-layered to a section/row when using Divi modules over the shortcode. */
.rb-gallery-layered { position: relative !important; overflow: hidden !important; }
.rb-gallery-layered .rbgm-gallery { position: absolute !important; inset: 0 !important; height: 100% !important; min-height: 100% !important; z-index: 0 !important; }
.rb-gallery-layered .et_pb_row, .rb-gallery-layered .et_pb_module:not(.et_pb_code) { position: relative !important; z-index: 3 !important; }
.rbgm-lightbox { position: fixed; inset: 0; z-index: 999999; display: flex; align-items: center; justify-content: center; padding: 32px; background: rgba(0,0,0,.86); cursor: zoom-out; }
.rbgm-lightbox img { display: block; max-width: 96vw; max-height: 92vh; object-fit: contain; box-shadow: 0 20px 80px rgba(0,0,0,.45); }
.rbgm-lightbox-close { position: fixed; top: 16px; right: 20px; z-index: 1000000; width: 42px; height: 42px; border: 0; border-radius: 999px; background: rgba(255,255,255,.95); color: #111; font-size: 32px; line-height: 36px; cursor: pointer; }

/* Carousel presentation */
.rbgm-carousel { background: var(--rbgm-carousel-bg, transparent); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: var(--rbgm-carousel-padding, 0); }
.rbgm-carousel-stage { position: relative; width: min(100%, 1500px); display: flex; align-items: center; justify-content: center; }
.rbgm-carousel-track { position: relative; width: 100%; height: min(var(--rbgm-height, 520px), 70vh); min-height: 260px; overflow: hidden; }
.rbgm-mode-ratio.rbgm-carousel .rbgm-carousel-track { height: auto; aspect-ratio: var(--rbgm-ratio, 16/9); min-height: 0; }
.rbgm-carousel-slide { position: absolute; top: 50%; left: 50%; width: min(30%, 480px); aspect-ratio: var(--rbgm-ratio, 16/9); padding: 0; border: 2px solid rgba(196,149,32,.65); background: transparent; transform: translate(calc(-50% + 320%),-50%) scale(.72); opacity: 0; transition: transform .55s ease, opacity .55s ease, filter .55s ease; cursor: pointer; box-shadow: 0 18px 50px rgba(0,0,0,.45); overflow: hidden; }
.rbgm-carousel[data-visible="1"] .rbgm-carousel-slide { width: min(86%, 1100px); }
.rbgm-carousel[data-visible="5"] .rbgm-carousel-slide { width: min(22%, 360px); }
.rbgm-carousel-slide img { display: block; width: 100%; height: 100%; object-fit: var(--rbgm-fit, cover); object-position: var(--rbgm-position, center center); }
.rbgm-carousel-slide.is-active { transform: translate(-50%,-50%) scale(var(--rbgm-carousel-center-scale, 1.25)); opacity: 1; filter: none; z-index: 5; }
.rbgm-carousel-slide.is-prev { transform: translate(calc(-50% - 105%),-50%) scale(.84); opacity: .45; filter: brightness(.58); z-index: 3; }
.rbgm-carousel-slide.is-next { transform: translate(calc(-50% + 105%),-50%) scale(.84); opacity: .45; filter: brightness(.58); z-index: 3; }
.rbgm-carousel-slide.is-prev2 { transform: translate(calc(-50% - 205%),-50%) scale(.72); opacity: .24; filter: brightness(.45); z-index: 2; }
.rbgm-carousel-slide.is-next2 { transform: translate(calc(-50% + 205%),-50%) scale(.72); opacity: .24; filter: brightness(.45); z-index: 2; }
.rbgm-carousel-slide.is-hidden-left { transform: translate(calc(-50% - 320%),-50%) scale(.72); opacity: 0; z-index: 1; }
.rbgm-carousel-slide.is-hidden-right { transform: translate(calc(-50% + 320%),-50%) scale(.72); opacity: 0; z-index: 1; }
.rbgm-carousel-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 10; border: 0; background: rgba(0,0,0,.25); color: #fff; width: 48px; height: 72px; font-size: 54px; line-height: 1; cursor: pointer; border-radius: 8px; }
.rbgm-carousel-arrow:hover { background: rgba(255,255,255,.16); }
.rbgm-carousel-prev { left: -8px; }
.rbgm-carousel-next { right: -8px; }
.rbgm-carousel-dots { display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; max-width: min(100%, 900px); }
.rbgm-carousel-dot { width: 13px; height: 13px; border-radius: 999px; border: 0; padding: 0; background: var(--rbgm-dot-color, rgba(0,0,0,.28)); cursor: pointer; }
.rbgm-carousel-dot.is-active { background: var(--rbgm-dot-active-color, #008899); transform: scale(1.1); }
@media (max-width: 767px) {
  .rbgm-carousel { padding: 24px 16px; gap: 18px; }
  .rbgm-carousel-track { height: min(var(--rbgm-height, 420px), 60vh); }
  .rbgm-carousel-slide, .rbgm-carousel[data-visible="3"] .rbgm-carousel-slide, .rbgm-carousel[data-visible="5"] .rbgm-carousel-slide { width: min(78%, 520px); }
  .rbgm-carousel-slide.is-prev, .rbgm-carousel-slide.is-next, .rbgm-carousel-slide.is-prev2, .rbgm-carousel-slide.is-next2 { opacity: 0; }
  .rbgm-carousel-arrow { width: 38px; height: 58px; font-size: 42px; }
}
