.lb-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.lb-grid img { width: 100%; height: auto; display: block; border-radius: 8px; }

/* Gallery popup – stejný jazyk jako mini-cart popup */
.gallery-popup--overlay {
  position: fixed;
  inset: 0;
  display: block;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.4);
  transition: opacity .35s ease, visibility .35s ease;
  z-index: 999999999999;
}

.gallery-popup--overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.gallery-popup {
  position: fixed;
  top: auto;
  bottom: 0;
  left: var(--mobile-edge-gap, 16px);
  right: var(--mobile-edge-gap, 16px);
  width: auto;
  max-width: none;
  height: calc(100% - 10px);
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .15);
  transform: translateY(100%);
  z-index: 9999999;
  border-radius: 32px 32px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  isolation: isolate;
}

.gallery-popup.is-open {
  animation: gallery-popup-slide-in 0.5s ease-out forwards;
  transition: none;
}

.gallery-popup.is-closing {
  pointer-events: none;
  transition: none;
}

@keyframes gallery-popup-slide-in {
  0%   { transform: translateY(100%); }
  55%  { transform: translateY(-12px); }
  75%  { transform: translateY(4px); }
  100% { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-popup.is-open {
    animation: none;
    transform: translateY(0);
  }

  .gallery-popup.is-closing {
    animation: none;
    transform: translateY(100%);
  }
}

.gallery-popup-inner {
  flex: 1;
  min-height: 0;
  position: relative;
  padding: 0;
  box-sizing: border-box;
}

.lb-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  overflow: hidden;
}

.lb-stage img {
  display: block;
  height: 100%;
  width: auto;
  max-width: none;
  max-height: none;
  object-fit: contain;
  object-position: center;
  border-radius: 32px;
  cursor: zoom-in;
}

.lb-stage.is-zoomed {
  overflow: auto;
  align-items: flex-start;
  justify-content: flex-start;
  -webkit-overflow-scrolling: touch;
}

.lb-stage.is-zoomed img {
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  flex: 0 0 auto;
  border-radius: 32px;
  cursor: zoom-out;
}

.lb-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  color: #333;
  text-align: center;
  font: var(--text-base)/var(--text-lh) 'Open Sans', system-ui, sans-serif;
  opacity: .9;
  padding: 12px 0 0;
  pointer-events: none;
}

/* Spodní navigace – uvnitř popupu, stejná pozice jako dříve */
.gallery-popup-nav {
  position: absolute;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  pointer-events: auto;
}

.gallery-popup-nav[hidden] {
  display: none !important;
}

.gallery-popup-nav__btn.eshop-button {
  flex: 0 0 var(--eshop-btn-lg);
  width: var(--eshop-btn-lg);
  height: var(--eshop-btn-lg);
}

.gallery-popup-nav__btn.eshop-button svg,
.gallery-popup-nav__next-icon svg {
  width: var(--eshop-btn-icon);
  height: var(--eshop-btn-icon);
  display: block;
}

.gallery-popup-nav__next-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  transform: scaleX(-1);
}

.gallery-popup-nav__btn.is-animating .gallery-popup-nav__next-icon {
  transform-origin: center bottom;
}

.gallery-popup-nav__dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  height: var(--eshop-btn-lg);
  padding: 0;
  border-radius: calc(var(--eshop-btn-lg) / 2);
  background-color: #fafafa;
  box-sizing: border-box;
  overflow: hidden;
}

.gallery-popup-nav__dot.eshop-button {
  flex: 0 0 var(--eshop-btn-lg);
  width: var(--eshop-btn-lg);
  height: var(--eshop-btn-lg);
  --base-color: transparent;
  --hover-color: color-mix(in srgb, #fafafa 90%, #000 10%);
  --active-color: color-mix(in srgb, #fafafa 80%, #000 20%);
}

.gallery-popup-nav__dot.eshop-button::after {
  content: '';
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: #bebebe;
  flex: 0 0 14px;
}

.gallery-popup-nav__dot.eshop-button.is-active::after {
  background-color: #000;
}

.gallery-popup-nav__dot.eshop-button.is-animating::after {
  transform-origin: center bottom;
  animation: pulse-svg 0.15s ease-in-out;
}

.gallery-popup-close.eshop-button {
  --base-color: #fafafa;
  --hover-color: color-mix(in srgb, var(--base-color) 95%, #000 5%);
  --active-color: color-mix(in srgb, var(--base-color) 90%, #000 10%);
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 20;
  width: var(--eshop-btn-lg);
  height: var(--eshop-btn-lg);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background-color: var(--base-color);
  transition: none;
}

.gallery-popup-close.eshop-button svg {
  width: var(--eshop-btn-icon);
  height: var(--eshop-btn-icon);
}

@media (hover: hover) {
  .gallery-popup-close.eshop-button:hover {
    background-color: var(--hover-color);
  }
}

.gallery-popup-close.eshop-button:active {
  background-color: var(--active-color);
}

.gallery-popup-close.eshop-button.is-animating {
  animation: pulse-width 0.15s ease-in-out;
}

.gallery-popup-close.eshop-button.is-animating svg {
  transform-origin: center bottom;
  animation: pulse-svg 0.15s ease-in-out;
}

@media (max-width: 980px) {
  .gallery-popup--overlay {
    transition: none;
  }

  .gallery-popup {
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: 100%;
  }

  @keyframes gallery-popup-slide-in {
    0%   { transform: translateY(100%); }
    55%  { transform: translateY(0); }
    75%  { transform: translateY(12px); }
    100% { transform: translateY(0); }
  }
}

@media (max-width: 768px) {
  .gallery-popup-inner {
    padding: 0;
  }
}
