.lmag-gallery {
  --lmag-ratio: 1/1;
  --lmag-nav-size: 28px;
  --lmag-nav-bg: rgba(0, 0, 0, 0.45);
  --lmag-nav-color: #fff;
  position: relative;
  width: 100%;
  display: block;
  box-sizing: border-box;
}

.lmag-gallery *,
.lmag-gallery *::before,
.lmag-gallery *::after {
  box-sizing: border-box;
}

.lmag-gallery__viewport {
  position: relative;
  width: 100%;
  aspect-ratio: var(--lmag-ratio);
  overflow: hidden;
  background: #f2f3f5;
  border-radius: inherit;
  flex-shrink: 0;
}

/* Elementor Loop 內避免被 flex/grid 壓扁或拉高 */
.elementor-widget-shortcode .lmag-gallery,
.elementor-shortcode .lmag-gallery {
  width: 100%;
  max-width: 100%;
}

.lmag-gallery--empty .lmag-gallery__viewport {
  display: flex;
  align-items: center;
  justify-content: center;
}

.lmag-gallery__placeholder-text {
  color: #73788c;
  font-size: 13px;
  line-height: 1.4;
  padding: 12px;
  text-align: center;
}

.lmag-gallery__track {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.lmag-gallery__slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.lmag-gallery__slide.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.lmag-gallery__slide picture {
  display: block;
  width: 100%;
  height: 100%;
}

.lmag-gallery__link {
  display: block;
  width: 100%;
  height: 100%;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.lmag-gallery__link--empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.lmag-gallery__image {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none;
  max-height: none !important;
  object-fit: cover;
  object-position: center;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.lmag-gallery__nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
  width: var(--lmag-nav-size);
  height: var(--lmag-nav-size);
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--lmag-nav-bg);
  color: var(--lmag-nav-color);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease;
}

.lmag-gallery:hover .lmag-gallery__nav,
.lmag-gallery:focus-within .lmag-gallery__nav {
  opacity: 1;
}

.lmag-gallery__nav:hover,
.lmag-gallery__nav:focus-visible {
  background: rgba(0, 0, 0, 0.65);
  outline: none;
}

.lmag-gallery__nav--prev {
  left: 8px;
}

.lmag-gallery__nav--next {
  right: 8px;
}

.lmag-gallery__dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}

.lmag-gallery__dot {
  width: 6px;
  height: 6px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #c5c9d1;
  cursor: pointer;
}

.lmag-gallery__dot.is-active {
  background: #2f3133;
}

/* Loop 卡片被 <a> 包住時，避免整卡可點區域被誤觸，但仍可拖曳／點箭頭 */
.lmag-gallery__nav,
.lmag-gallery__dot {
  pointer-events: auto;
}

@media (hover: none) {
  .lmag-gallery__nav {
    opacity: 0.85;
  }
}

/* Loop 卡片上的 play icon（Elementor 加 class: js-gallery-play） */
.js-gallery-play {
  cursor: pointer;
  pointer-events: auto;
}

.lmag-gallery.is-playing .lmag-gallery__nav {
  opacity: 1;
}
