.mpg{--gap:16px;--mpg-nav-col:48px;--mpg-nav-btn:44px}
.mpg-view{position:relative;display:grid;grid-template-columns:var(--mpg-nav-col) 1fr var(--mpg-nav-col);align-items:center;gap:var(--gap);margin-bottom:var(--gap)}
.mpg-frame{position:relative;margin:0;border-radius:14px;overflow:hidden;box-shadow:0 4px 14px rgba(0,0,0,.08)}
.mpg-frame::before{content:"";display:block;aspect-ratio:var(--mpg-aspect,16/10);background:#f2f4f7}
.mpg-img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.mpg-cap{position:absolute;left:0;right:0;bottom:0;margin:0;padding:10px 12px;color:#fff;background:linear-gradient(to top, rgba(0,0,0,.65), transparent)}
.mpg-prev,.mpg-next{display:flex;align-items:center;justify-content:center;width:var(--mpg-nav-btn);height:var(--mpg-nav-btn);border-radius:50%;text-decoration:none;background:#f3f5f7;color:#111;line-height:0;box-shadow:0 2px 10px rgba(0,0,0,.06)}
.mpg-prev svg,.mpg-next svg{width:24px;height:24px;display:block}
.mpg-prev:hover,.mpg-next:hover{background:#e9edf2}
.mpg-thumbs{display:flex;flex-wrap:nowrap;gap:var(--gap);justify-content:flex-start;align-items:center;overflow-x:auto;-webkit-overflow-scrolling:touch;padding:0 0 10px;overscroll-behavior-x:contain;scroll-snap-type:x proximity;scroll-padding-left:0;scroll-padding-right:0;scrollbar-gutter:auto}
.mpg-thumb{display:block;flex:0 0 auto;scroll-snap-align:start;border-radius:12px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,.05);width:clamp(140px, 11vw, 200px);height:clamp(140px, 11vw, 200px);position:relative}
.mpg-thumb img{display:block;width:100%;height:100%;object-fit:cover;transition:transform .3s ease}
.mpg-thumb img{opacity:1 !important;visibility:visible !important}
.mpg-thumb:hover img{transform:scale(1.04)}.gv-wrap{max-width:1100px;margin:0 auto;padding:20px}
.gv-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;gap:10px}
.gv-title{font-size:clamp(20px,2.5vw,28px);margin:0}
.gv-meta{color:#666;font-size:14px}
.gv-ad{margin:16px 0;padding:12px;border:1px dashed #cfd6de;border-radius:10px;text-align:center;color:#6b7280;background:#f9fafb}
.gv-related{margin-top:28px}
.gv-related h3{margin:0 0 12px 0;font-size:18px}
.gv-related ul{list-style:none;padding:0;margin:0;display:grid;gap:10px}
.gv-related a{text-decoration:none}
@media (max-width:680px){
  .mpg-view{grid-template-columns:36px 1fr 36px}
  .mpg-thumbs{grid-template-columns:repeat(4,1fr)}
}

/* Desktop: bigger navigation arrows + gradient, and thumbs rail aligned to the main image width */
@media (min-width: 769px){
  .mpg{ --mpg-nav-col: 96px; --mpg-nav-btn: 88px; }
  .mpg-prev,.mpg-next{
    background:linear-gradient(135deg,#2c4bdb,#19b1ef);
    color:#fff;
    font-size:44px;
    box-shadow:0 12px 28px rgba(0,0,0,.16);
  }
  .mpg-prev:hover,.mpg-next:hover{
    background:linear-gradient(135deg,#2c4bdb,#19b1ef);
    filter:brightness(1.06);
  }

  .mpg-thumbs-wrap{
    margin-left:calc(var(--mpg-nav-col) + var(--gap));
    margin-right:calc(var(--mpg-nav-col) + var(--gap));
  }
  .mpg-thumbs{
    padding-left:0;
    padding-right:0;
    scroll-padding-left:0;
    scroll-padding-right:0;
  }
}
@media (max-width: 768px){

  .mpg-thumb{width:clamp(82px, 22vw, 110px);height:clamp(82px, 22vw, 110px)}

  .gv-wrap{max-width:100%;padding-left:0;padding-right:0}
  .mpg-view{grid-template-columns:1fr;gap:12px}
  .mpg-prev,.mpg-next{width:36px;height:36px}
  .mpg-frame::before{aspect-ratio:auto}
  .mpg-img{position:relative;inset:auto;width:100%;height:auto;display:block}
}


@media (max-width: 768px) {
  .mpg-thumb { width: 48px !important; height: 48px !important; }
  .mpg{ --gap: 12px; }
  .mpg-prev, .mpg-next { display: none !important; }
}


/* --- SAFETY: zapobiegaj wpływowi na szerokość wpisu --- */
.mpg{display:block;width:100%;max-width:100%;overflow-x:hidden}
.mpg-view,.mpg-frame{max-width:100%}
.mpg img{max-width:100%;height:auto}
.mpg-thumbs{overflow-x:auto;overflow-y:hidden}
/* --- /SAFETY --- */


@media (max-width: 768px) {
  .mpg-prev, .mpg-next { display: none !important; }
  .mpg-thumb { width: 48px !important; height: 48px !important; }
}

.mpg-frame{touch-action:pan-y pinch-zoom}

@media (max-width: 768px) {
  body.is-regular-article .mpg-thumbs {
    display: flex;
    justify-content: center;
    flex-wrap: nowrap;
    overflow: hidden;
    gap: 4px;
    max-width: 100%;
  }

  body.is-regular-article .mpg-thumb {
    flex: 0 0 auto;
    width: calc(25% - 4px);
  }

  body.is-regular-article .mpg-thumb:nth-child(n+5) {
    display: none !important;
  }
}

/* === Albumy v1.3.5: bez borderów i zaokrągleń === */
.mpg-view img,
.mpg-thumb img {
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
.mpg-view,
.mpg-view figure,
.mpg-view img {
  cursor: pointer;
}

/* === Albumy v1.3.6 === */

/* Max 6 miniaturek na mobile tylko na stronie wpisu */
@media (max-width: 768px) {
  body.is-regular-article .mpg-thumbs {
    display: flex;
    justify-content: center;
    flex-wrap: nowrap;
    overflow: hidden;
    gap: 4px;
    max-width: 100%;
  }

  body.is-regular-article .mpg-thumb {
    flex: 0 0 auto;
    width: calc(16.66% - 4px);
  }

  body.is-regular-article .mpg-thumb:nth-child(n+7) {
    display: none !important;
  }
}

/* Usuń zaokrąglenia i cienie */
.mpg-thumb img,
.mpg-view img {
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
}

/* === Albumy v1.3.7 FINAL === */

/* Border radius = 0 dla .mpg-thumb i .mpg-frame */
.mpg-thumb,
.mpg-thumb img,
.mpg-frame,
.mpg-frame img {
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
}

/* ===== v1.3.6: Bigger thumbnails + visible current state (fix) ===== */
/* Base: bigger thumbs on desktop/tablet */
.mpg-thumbs .mpg-thumb{
  width: clamp(140px, 11vw, 200px);
  height: clamp(140px, 11vw, 200px);
}

/* Current thumb: strong, always-visible highlight (override earlier no-shadow) */
.mpg-thumbs .mpg-thumbs 
/* Mobile GA photo view: make thumbs noticeably bigger (doesn't touch regular article pages) */
@media (max-width: 768px){
  .gv-wrap .mpg-thumbs .mpg-thumb{
    width: 72px !important;
    height: 72px !important;
  }
}

/* Max 6 miniaturek na mobile (tylko na stronie wpisu) */
@media (max-width: 768px) {
  body.is-regular-article .mpg-thumb:nth-child(n+7) {
    display: none !important;
  }

  body.is-regular-article .mpg-thumbs {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    justify-content: center;
    overflow: hidden;
    max-width: 100%;
  }

  body.is-regular-article .mpg-thumb {
    flex: 0 0 auto;
    width: calc(16.66% - 4px);
  }
}


/* ===== v1.3.3 UI refresh (gradient back pill, centered more arrow, animated swipe hint) ===== */

.gv-tools{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.gv-back{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:999px;
  text-decoration:none !important;
  color:#fff;
  background:linear-gradient(135deg,#2c4bdb,#19b1ef);
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
  box-shadow:0 8px 22px rgba(0,0,0,.12);
  transition:transform .15s ease, filter .15s ease;
}

/* "Powrót do artykułu" pill: clickable, but NO hover/tap jump */
.gv-wrap .gv-back{
  cursor:pointer !important;
  pointer-events:auto !important;
  transition:none !important;
}
.gv-wrap .gv-back:active{ transform:none !important; }
.gv-wrap .gv-back:hover{ transform:none !important; filter:none !important; }
.gv-back:hover{ transform:translateY(-1px); filter:brightness(1.05); }
.gv-back-ico{ width:16px; height:16px; flex:0 0 auto; }
.gv-back-txt{ font-size:13px; line-height:1; }

.gv-counter{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height:36px;
  padding:0 12px;
  min-width:54px;
  border-radius:999px;
  color:#fff;
  background:rgba(0,0,0,.45);
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
  box-shadow:0 8px 22px rgba(0,0,0,.14);
  font-size:13px;
  font-variant-numeric:tabular-nums;
}
.gv-counter-sep{ opacity:.75; margin:0 6px; }

/* Caption as label bottom-left */
.mpg-cap{
  position:absolute;
  left:12px;
  bottom:12px;
  right:auto;
  max-width:calc(100% - 24px);
  margin:0;
  padding:8px 10px;
  border-radius:10px;
  font-size:13px;
  line-height:1.2;
  color:#fff;
  background:rgba(0,0,0,.55);
  backdrop-filter:blur(6px);
  -webkit-backdrop-filter:blur(6px);
  box-shadow:0 6px 20px rgba(0,0,0,.25);
  pointer-events:none;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

/* Thumbs wrap + subtle scrollbar */
.mpg-thumbs-wrap{
  position:relative;
  margin-top:12px;
}

.mpg-thumbs{
  scrollbar-width:thin;
  scrollbar-color:rgba(0,0,0,.28) transparent;
}
.mpg-thumbs::-webkit-scrollbar{ height:8px; }
.mpg-thumbs::-webkit-scrollbar-track{ background:transparent; }
.mpg-thumbs::-webkit-scrollbar-thumb{
  background:rgba(0,0,0,.22);
  border-radius:999px;
}
.mpg-thumbs::-webkit-scrollbar-thumb:hover{ background:rgba(0,0,0,.35); }

/* More hint overlay on the right edge when there is more to scroll */
.mpg-thumbs-more,
.mpg-thumbs-less{
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  width:56px;
  height:56px;
  border:0;
  border-radius:999px;
  background:linear-gradient(135deg,#2c4bdb,#19b1ef);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  box-shadow:none;
  opacity:0;
  pointer-events:none;
  transition:opacity .15s ease, filter .15s ease;
  z-index:5;
}

.mpg-thumbs-more:hover,
.mpg-thumbs-less:hover{
  filter:brightness(1.06);
}

.mpg-thumbs-more svg,
.mpg-thumbs-less svg{
  width:30px;
  height:30px;
  display:block;
}

.mpg-thumbs-more{ right:-72px; }
.mpg-thumbs-less{ left:-72px; }

.mpg-thumbs-wrap.has-more .mpg-thumbs-more{ opacity:1; pointer-events:auto; }
.mpg-thumbs-wrap.has-less .mpg-thumbs-less{ opacity:1; pointer-events:auto; }


/* Less hint overlay on the left edge when there is more to scroll back */
.mpg-thumbs-less{
  --mpg-more-pad:10px;
  --mpg-more-circle:34px;
  --mpg-more-icon:22px;
  position:absolute;
  top:0;
  left:0;
  height:100%;
  width:46px;
  border:0;
  background:transparent;
  opacity:0;
  pointer-events:none;
  cursor:pointer;
  transition:opacity .15s ease;
  z-index:3;
}



.mpg-thumbs-wrap.has-less .mpg-thumbs-less{
  opacity:1;
  pointer-events:auto;
}

.mpg-thumbs-less svg{
  width:var(--mpg-more-icon);
  height:var(--mpg-more-icon);
  color:#fff;
  display:block;
  position:absolute;
  left:calc(var(--mpg-more-pad) + (var(--mpg-more-circle) / 2));
  top:50%;
  transform:translate(-50%,-50%);
  z-index:1;
}

/* Mobile swipe hint ("Przesuń zdjęcie palcem") */
.mpg-swipe-note{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  font-size:13px;
  line-height:1;
  margin:0 0 6px 0;
  color:rgba(17,24,39,.78);
  user-select:none;
}
.mpg-swipe-anim{
  width:28px;
  height:18px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  animation:mpg-swipe-nudge 1.25s ease-in-out infinite;
}
.mpg-swipe-anim svg{ width:100%; height:100%; display:block; }
.mpg-swipe-text{ letter-spacing:.1px; }

@keyframes mpg-swipe-nudge{
  0%,100%{ transform:translateX(0); opacity:.75; }
  50%{ transform:translateX(7px); opacity:1; }
}

/* ===== v1.3.11 FIX: thumbs rail starts flush + desktop arrows refined ===== */
/* The thumbs rail should start at the very edge (no artificial padding). */
.mpg-thumbs{padding-left:0 !important;padding-right:0 !important;scroll-padding-left:0 !important;scroll-padding-right:0 !important}

@media (min-width: 769px){
  /* Main prev/next arrows: -20% size vs earlier, gradient background, bigger chevrons, no shadow */
  .mpg{ --mpg-nav-col: 78px; --mpg-nav-btn: 70px; }
  .mpg-prev,.mpg-next{
    background: linear-gradient(135deg,#2c4bdb,#19b1ef) !important;
    color:#fff !important;
    box-shadow: none !important;
    filter: none !important;
  }
  .mpg-prev svg,.mpg-next svg{width:34px;height:34px}
}

/* Remove any theme drop-shadows that can look "square" on the circles */
.mpg-prev, .mpg-next{
  -webkit-filter:none !important;
  filter:none !important;
}

/* Slightly reduce default header spacing on mobile */
@media (max-width: 720px){
  .gv-header{ flex-direction:column; align-items:flex-start; }
  .gv-tools{ width:100%; justify-content:space-between; }
}

/* ===== v1.3.12: fix current thumb white + alternative highlight (no .is-current) ===== */
/* Always paint the thumbnail as a background too (works even if theme hides the <img> in some states). */
.mpg-thumb{
  background-color:#f3f5f7;
  background-repeat:no-repeat;
  background-position:center;
  background-size:cover;
}

/* Current thumb marker: ONLY the gradient dot (no rings, no lift, no overlays). */
.mpg-thumb.is-current,

.mpg-thumb.is-current::after,
.mpg-thumb[data-current="1"]::after{
  content:none !important;
}

.mpg-thumb.is-current::before,
.mpg-thumb[data-current="1"]::before{
  content:"";
  position:absolute;
  right:7px;
  top:7px;
  width:11px;
  height:11px;
  border-radius:50%;
  background:linear-gradient(135deg,#2c4bdb,#19b1ef);
  box-shadow:0 0 0 2px rgba(255,255,255,.92), 0 6px 16px rgba(0,0,0,.18);
  pointer-events:none;
}


.mpg-thumbs-more svg{ transform:translate(52%,-50%); }
.mpg-thumbs-less svg{ transform:translate(-48%,-50%); }

/* ===== v1.3.18: GA thumbs paging (hide via class) + mobile proportions + desktop back arrow ===== */

/* Desktop: no right arrow; show LEFT circular arrow only after the user paged (has-less) */
@media (min-width: 769px){
  .gv-wrap .mpg-thumbs-wrap .mpg-thumbs-more{ display:none !important; }
  .gv-wrap .mpg-thumbs-wrap .mpg-thumbs-less{ display:none !important; }
  .gv-wrap .mpg-thumbs-wrap.has-less .mpg-thumbs-less{
    display:flex !important;
    position:absolute;
    left:0;
    top:50%;
    transform:translate(-55%,-50%);
    width:54px;
    height:54px;
    border-radius:999px;
    background:linear-gradient(135deg,#2c4bdb,#19b1ef);
    color:#fff;
    align-items:center;
    justify-content:center;
    border:0;
    cursor:pointer;
    z-index:8;
    opacity:1;
    pointer-events:auto;
    box-shadow:0 12px 26px rgba(0,0,0,.14);
  }
  .gv-wrap .mpg-thumbs-wrap.has-less .mpg-thumbs-less:hover{ filter:brightness(1.06); }
  .gv-wrap .mpg-thumbs-wrap.has-less .mpg-thumbs-less svg{ width:28px; height:28px; display:block; }
}

/* 2–4) Thumbs: always fill available width, more rectangular, slight rounding */
.gv-wrap .mpg-thumbs-wrap{ margin-left:auto !important; margin-right:auto !important; }

.gv-wrap .mpg-thumbs{
  --thumbs-visible: 6;
  --gap: 6px;
  /* Fallback height for first paint (real mobile can be late to compute via JS) */
  --thumb-h: 80px;
  display:flex !important;
  flex-wrap:nowrap !important;
  gap:var(--gap) !important;
  overflow:hidden !important; /* paging is handled in JS */
  padding:0 0 10px !important;
  justify-content:stretch !important;
  align-items:stretch !important;
}

.gv-wrap .mpg-thumbs .mpg-thumb{
  position:relative !important;
  display:block !important;
  flex:0 0 calc((100% - (var(--gap) * (var(--thumbs-visible) - 1))) / var(--thumbs-visible)) !important;
  width:100% !important;
  height:var(--thumb-h) !important; /* updated via JS for iOS/Safari reliability */
  min-height:var(--thumb-h) !important;
  /* Desktop/tablet: slightly rectangular */
  aspect-ratio:16 / 10 !important;
  border-radius:10px !important;
  overflow:hidden !important;
  background-size:cover !important;
  background-position:center !important;
}

/* Mobile: make thumbs "kwadrato-prostokatne" (closer to square, never flat) */
@media (max-width: 768px){
  .gv-wrap .mpg-thumbs .mpg-thumb{ aspect-ratio: 11 / 10 !important; }
}

/* iOS: reduce tiny flicker while scrolling (layer promotion, no visual change) */
@media (max-width: 768px){
  .gv-wrap .mpg-thumbs-wrap,
  .gv-wrap .mpg-thumbs,
  .gv-wrap .mpg-thumbs .mpg-thumb,
  .gv-wrap .mpg-thumbs .mpg-thumb img{
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }
}

/* JS paging: hide thumbs reliably even if other CSS forces display with !important */
.gv-wrap .mpg-thumbs .mpg-thumb.mpg-hidden{
  display:none !important;
}

.gv-wrap .mpg-thumbs .mpg-thumb img{
  width:100% !important;
  height:100% !important;
  object-fit:cover !important;
  display:block !important;
  border-radius:inherit !important;
}

/* 4) Last visible thumb overlay for "more photos" */
.gv-wrap .mpg-more-overlay{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(0,0,0,.45);
  color:#fff;
  font-weight:800;
  font-size:14px;
  border-radius:inherit;
  cursor:pointer;
  user-select:none;
  -webkit-tap-highlight-color:transparent;
  z-index:3;
}

.gv-wrap .mpg-more-overlay:active{ transform:scale(.99); }

/* Desktop: "back" arrow badge placed on the first visible thumb (left side) */
.gv-wrap .mpg-prev-overlay{
  position:absolute;
  left:8px;
  top:50%;
  transform:translateY(-50%);
  width:34px;
  height:34px;
  border-radius:999px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:linear-gradient(135deg,#2c4bdb,#19b1ef);
  color:#fff;
  box-shadow:0 10px 22px rgba(0,0,0,.18);
  cursor:pointer;
  user-select:none;
  -webkit-tap-highlight-color:transparent;
  z-index:4;
}
.gv-wrap .mpg-prev-overlay svg{ width:20px; height:20px; display:block; }
.gv-wrap .mpg-prev-overlay:active{ transform:translateY(-50%) scale(.98); }

/* Hide legacy arrow buttons; we use the badge on the first thumb + overlay on last thumb instead */
.gv-wrap .mpg-thumbs-less,
.gv-wrap .mpg-thumbs-more{ display:none !important; }

/* Mobile: never show the left "back" icon (per requirements) */
@media (max-width: 768px){
  .gv-wrap .mpg-prev-overlay{ display:none !important; }
}

/* Smooth-ish paging: light fade/slide on newly shown thumbs */
@keyframes mpgThumbIn{
  from{ opacity:0; transform:scale(.985); }
  to{ opacity:1; transform:scale(1); }
}
.gv-wrap .mpg-thumbs .mpg-thumb.mpg-anim-in{ animation: mpgThumbIn .18s ease both; }


/* Current thumb: no highlight effects, ONLY gradient dot */
.mpg-thumb.is-current,
.mpg-thumb[data-current="1"]{
  outline:none !important;
  box-shadow:none !important;
  transform:none !important;
}

.mpg-thumb.is-current::before,
.mpg-thumb[data-current="1"]::before{
  content:"";
  position:absolute;
  right:7px;
  top:7px;
  width:11px;
  height:11px;
  border-radius:50%;
  background:linear-gradient(135deg,#2c4bdb,#19b1ef);
  box-shadow:0 0 0 2px rgba(255,255,255,.92), 0 6px 16px rgba(0,0,0,.18);
  pointer-events:none;
}

/* Make sure theme styles can't hide thumb images */
.mpg-thumb img{ opacity:1 !important; visibility:visible !important; }
