/*
 * Fotogalerie – GLightbox:
 * - Obrázek: bez ořezu, poměr stran zachován (max-width 800px / 95vw, max-height řízená JS).
 * - Popisek: šířka = reálná šířka fotky (CSS var --_img-w) a vždy hned pod fotkou.
 * - Banner: v toku nad sliderem.
 */

/* ===== NÁHLEDY ===== */
.custom-gallery-scroll { position: relative; width: 100%; overflow: hidden; display: flex; align-items: center; margin-bottom: 50px !important; }
.wp-admin .custom-gallery-scroll { max-width: 650px; margin: 0 auto; }
.custom-gallery-scroll .gallery-track { display: flex; overflow-x: auto; scroll-behavior: smooth; scrollbar-width: none; -ms-overflow-style: none; scroll-snap-type: x mandatory; gap: 10px; padding: 0; }
.custom-gallery-scroll .gallery-track::-webkit-scrollbar { display: none; }
.custom-gallery-scroll .gallery-track a { position: relative; display: block; flex-shrink: 0; scroll-snap-align: start; overflow: hidden; transition: transform .25s ease, box-shadow .25s ease; border-radius: 0 !important; }
.custom-gallery-scroll .gallery-track a:hover { transform: translateY(-4px); box-shadow: 0 8px 18px rgba(0,0,0,.25); }
.custom-gallery-scroll .gallery-track img { width: 100%; height: auto; object-fit: cover; display: block; border-radius: 0 !important; }
@media (min-width:1024px){ .custom-gallery-scroll .gallery-track a { flex:0 0 25%; } }
@media (min-width:600px) and (max-width:1023px){ .custom-gallery-scroll .gallery-track a { flex:0 0 50%; } }
@media (max-width:599px){ .custom-gallery-scroll .gallery-track a { flex:0 0 100%; } }

/* ===== NÁHLEDOVÉ ŠIPKY ===== */
.custom-gallery-scroll .scroll-button { position:absolute; top:50%; z-index:2; background:rgba(0,0,0,.45); color:#fff; border:none; font-size:28px; cursor:pointer; transform:translateY(-50%); height:100%; padding:0 14px; transition:background .2s ease; border-radius:0 !important; }
.custom-gallery-scroll .scroll-button:hover { background:rgba(0,0,0,.65); }
.scroll-button.left{left:0;} .scroll-button.right{right:0;}

/* ===== GLightbox – IKONY (fix pro svg) ===== */
.glightbox-container .gbtn { color:#fff !important; width:48px !important; height:48px !important; display:inline-flex !important; align-items:center !important; justify-content:center !important; line-height:1 !important; }
.glightbox-container .gbtn svg { max-width:none !important; max-height:none !important; width:22px !important; height:22px !important; display:block !important; overflow:visible !important; }
.glightbox-container .gbtn svg, .glightbox-container .gbtn svg * { fill:#fff !important; stroke:#fff !important; stroke-width:2px !important; }

/* ===== GLightbox – LAYOUT (obrázek -> popisek) ===== */
.glightbox-container .gcontainer { display:flex !important; flex-direction:column !important; min-height:100vh !important; }
.glightbox-container .gslider { flex:1 1 auto !important; }

/* Banner v toku */
.glightbox-container .glightbox-top-banner {
  position: relative !important;
  width: min(800px, 95vw);
  height: 150px;
  margin: 16px auto 10px;
  background: #e9ecef;
  border: 1px dashed #bbb;
  display:flex; align-items:center; justify-content:center;
  color:#666; font-size:14px; text-transform:uppercase; letter-spacing:.5px;
  pointer-events:none;
  opacity:0; transition:opacity 220ms ease;
}
.glightbox-container .glightbox-top-banner.visible { opacity:1; }

/* Vnitřek slidu – sloupec: 1) média (výšku hlídá IMG), 2) popisek */
.glightbox-container .gslide .gslide-inner {
  display:flex !important;
  flex-direction:column !important;
  align-items:center !important;
  overflow-y:auto !important;
  -webkit-overflow-scrolling: touch;
  min-height: 0 !important;
}

/* MÉDIA: shrink-to-fit – žádná pevná výška kontejneru */
.glightbox-container .gslide-media {
  order:1 !important;
  height: auto !important;                 /* ← bylo: height: var(--_media-h) */
  width: 100% !important;
  max-width: min(800px, 95vw) !important;
  display:flex !important;
  align-items: center !important;          /* obrázek u dna už nepotřebujeme */
  justify-content: center !important;
  margin: 0 auto !important;
  min-height: 0 !important;
}

/* Obrázek: limit výšky přes CSS proměnnou (JS ji stále nastavuje) */
.glightbox-container .gslide-image img,
.glightbox-container .gslide-image picture img {
  width:auto !important;
  height:auto !important;
  max-width:100% !important;
  max-height: var(--_media-h, 600px) !important;  /* ← bylo: max-height:100% */
  object-fit:contain !important; /* žádný ořez */
  display:block !important;
}

/* Popisek: šířka = šířka fotky (JS zapíše do --_img-w) + FIXNÍ mezera */
.glightbox-container { --_img-w: min(800px, 95vw); } /* fallback */
.glightbox-container .gslide-title { display:none !important; } /* h4 pryč */
.glightbox-container .gdesc,
.glightbox-container .gslide-description {
  order:2 !important;
  position: static !important;
  background: transparent !important;
  color:#fff !important;
  box-shadow:none !important; border:0 !important;

  width: var(--_img-w) !important;
  max-width: min(800px, 95vw) !important;
  margin: 12px auto 0 !important;   /* pevná mezera mezi fotkou a popiskem */
  padding-top: 0 !important;
  align-self: center !important;
  flex: 0 0 auto !important;
}
.glightbox-container .gslide-description { padding: 0 !important; }
.glightbox-container .gslide-description a { color:#fff !important; text-decoration:underline; }

/* zachováno z dřívějška */
.glightbox-clean .gdesc-inner { padding: 0 20px 20px 0 !important; }

/* Šipky na mobilech – pozice; viditelnost řídí JS (auto-hide) */
@media (max-width: 768px) {
  .glightbox-container.glightbox-clean .gprev,
  .glightbox-container.glightbox-clean .gnext {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 30 !important;
  }
  .glightbox-container.glightbox-clean .gprev { left: 10px !important; }
  .glightbox-container.glightbox-clean .gnext { right: 10px !important; }
  .glightbox-container .gbtn { width: 40px !important; height: 40px !important; }
  .glightbox-container .gbtn svg { width: 18px !important; height: 18px !important; }
}

/* Ovladače nad obsahem */
.glightbox-container .gprev, .glightbox-container .gnext, .glightbox-container .gclose { z-index: 40 !important; }

/* Fokus + editor */
.custom-gallery-scroll a:focus { outline: 2px solid #007cba; outline-offset: 2px; }
.editor-styles-wrapper .custom-gallery-scroll a { pointer-events: none !important; cursor: default !important; }
