/* =============================================================================
   Var Gallery — Spotlight, Before/After, Lightbox
   Theme-neutral: only colours with transparency, so light and dark themes work.
   Override the custom properties below in your theme if needed.
   ============================================================================= */

.VarGallery,
.VarBA {
  --varg-radius: 12px;
  --varg-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --varg-frame-bg: rgba(127, 127, 127, 0.12);
  --varg-btn-bg: rgba(255, 255, 255, 0.72);
  --varg-btn-bg-hover: rgba(255, 255, 255, 0.92);
  --varg-btn-color: #1b1f24;
  --varg-pill-bg: rgba(15, 18, 22, 0.62);
  --varg-pill-color: #fff;
  --varg-focus: #2271b1;

  position: relative;
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin: 1.5em 0;
  padding: 0;
  border-radius: var(--varg-radius);
  overflow: hidden;
  background: var(--varg-frame-bg);
  isolation: isolate;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.VarGallery *,
.VarBA * {
  box-sizing: border-box;
}

.VarGallery:focus-visible,
.VarBA:focus-visible {
  outline: 2px solid var(--varg-focus);
  outline-offset: 2px;
}

.VarGallery figure,
.VarBA figure {
  margin: 0;
}

/* The gallery frame itself always spans its column, never shrink-wraps. */
.VarGallery,
.VarBA,
.VarGallery-grid {
  float: none;
  text-align: left;
}

/* Themes often size and centre every content image (e.g. variatkowo:
   ".single .entry-content img { max-width: 720px; height: auto }"). Inside a
   gallery the frame decides the geometry, so these win with a stronger
   selector and !important on the size properties. */
.VarGallery .VarGallery-track .VarGallery-img,
.VarBA .VarBA-layer .VarBA-img {
  display: block !important;
  float: none !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0;
  border: 0;
  border-radius: 0 !important;
  box-shadow: none;
}

/* ---- Shared round buttons -------------------------------------------------- */
.VarGallery-nav,
.VarGallery-expand,
.VarLightbox-nav,
.VarLightbox-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
  color: var(--varg-btn-color);
  background: var(--varg-btn-bg);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  transition: background 0.2s, opacity 0.2s, transform 0.2s var(--varg-ease, ease);
}

.VarGallery-nav svg,
.VarGallery-expand svg,
.VarLightbox-nav svg,
.VarLightbox-close svg {
  width: 55%;
  height: 55%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.VarGallery-nav:hover,
.VarGallery-expand:hover,
.VarLightbox-nav:hover,
.VarLightbox-close:hover {
  background: var(--varg-btn-bg-hover);
}

.VarGallery-nav:active,
.VarGallery-expand:active,
.VarLightbox-nav:active,
.VarLightbox-close:active {
  transform: scale(0.94);
}

.VarGallery-nav:focus-visible,
.VarGallery-expand:focus-visible,
.VarLightbox-nav:focus-visible,
.VarLightbox-close:focus-visible {
  outline: 2px solid var(--varg-focus, #2271b1);
  outline-offset: 2px;
}

/* =============================================================================
   Spotlight
   ============================================================================= */
.VarGallery-viewport {
  position: relative;
  overflow: hidden;
  aspect-ratio: var(--varg-ratio, 16 / 9);
  touch-action: pan-y pinch-zoom;
  cursor: zoom-in;
}

.VarGallery.is-dragging .VarGallery-viewport {
  cursor: grabbing;
}

.VarGallery-track {
  display: flex;
  height: 100%;
  transition: transform 0.45s var(--varg-ease);
  will-change: transform;
}

.VarGallery-track > * {
  position: relative;
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

.VarGallery .VarGallery-img {
  object-fit: contain;
  -webkit-user-drag: none;
}

.VarGallery--cover .VarGallery-img {
  object-fit: cover;
}

.VarGallery-caption {
  position: absolute;
  left: 50%;
  bottom: 42px;
  transform: translateX(-50%);
  max-width: calc(100% - 120px);
  margin: 0;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--varg-pill-color);
  background: var(--varg-pill-bg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.VarGallery--single .VarGallery-caption {
  bottom: 12px;
}

.VarGallery-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 40px;
  height: 40px;
  margin-top: -20px;
}

.VarGallery-nav--prev {
  left: 12px;
}

.VarGallery-nav--next {
  right: 12px;
}

.VarGallery-expand {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 34px;
  height: 34px;
  opacity: 0;
}

.VarGallery:hover .VarGallery-expand,
.VarGallery-expand:focus-visible {
  opacity: 1;
}

.VarGallery-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 7px;
  pointer-events: none;
}

.VarGallery-dot {
  position: relative;
  width: 11px;
  height: 11px;
  min-width: 0;
  min-height: 0;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.2s, transform 0.2s var(--varg-ease);
}

.VarGallery-dot::before {
  content: '';
  position: absolute;
  inset: -8px -4px;
}

.VarGallery-dot:hover {
  background: rgba(255, 255, 255, 0.85);
}

.VarGallery-dot.is-active {
  background: rgba(90, 90, 90, 0.55);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.95), 0 0 0 1px rgba(0, 0, 0, 0.15);
  transform: scale(1.1);
}

.VarGallery-dot:focus-visible {
  outline: 2px solid var(--varg-focus);
  outline-offset: 2px;
}

.VarGallery-counter {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  color: var(--varg-pill-color);
  background: var(--varg-pill-bg);
}

/* Without JS: images stacked, nothing hidden. */
.VarGallery:not(.is-ready) .VarGallery-viewport {
  aspect-ratio: auto;
}

.VarGallery:not(.is-ready) .VarGallery-track {
  flex-direction: column;
  gap: 4px;
}

.VarGallery:not(.is-ready) .VarGallery-track > *,
.VarGallery:not(.is-ready) .VarGallery-track .VarGallery-img {
  height: auto !important;
}

.VarGallery:not(.is-ready) .VarGallery-caption {
  position: static;
  transform: none;
  max-width: none;
  margin: 4px 8px;
  display: inline-block;
}

.VarGallery--empty {
  display: none;
}

@media (hover: none) {
  .VarGallery-expand {
    opacity: 0.85;
  }
}

@media (max-width: 767px) {
  .VarGallery-nav {
    width: 34px;
    height: 34px;
    margin-top: -17px;
  }

  .VarGallery-nav--prev {
    left: 8px;
  }

  .VarGallery-nav--next {
    right: 8px;
  }

  .VarGallery-dots {
    gap: 5px;
    bottom: 9px;
  }

  .VarGallery-dot {
    width: 9px;
    height: 9px;
  }

  .VarGallery-caption {
    bottom: 34px;
    max-width: calc(100% - 24px);
  }
}

/* =============================================================================
   Before / After
   ============================================================================= */
.VarBA {
  --varba-pos: 50%;
}

.VarBA-stage {
  position: relative;
  width: 100%;
  max-height: 85vh;
  aspect-ratio: var(--varba-ratio, 16 / 9);
  overflow: hidden;
  touch-action: pan-y pinch-zoom;
  cursor: ew-resize;
}

.VarBA--vertical .VarBA-stage {
  touch-action: pan-x pinch-zoom;
  cursor: ns-resize;
}

.VarBA-layer {
  position: absolute;
  inset: 0;
}

.VarBA .VarBA-img {
  object-fit: cover;
  -webkit-user-drag: none;
  pointer-events: none;
}

.VarBA-layer--before {
  z-index: 1;
  -webkit-clip-path: inset(0 calc(100% - var(--varba-pos)) 0 0);
  clip-path: inset(0 calc(100% - var(--varba-pos)) 0 0);
}

.VarBA--vertical .VarBA-layer--before {
  -webkit-clip-path: inset(0 0 calc(100% - var(--varba-pos)) 0);
  clip-path: inset(0 0 calc(100% - var(--varba-pos)) 0);
}

.VarBA-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--varba-pos);
  z-index: 2;
  width: 2px;
  margin-left: -1px;
  background: #fff;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.VarBA--vertical .VarBA-divider {
  top: var(--varba-pos);
  bottom: auto;
  left: 0;
  right: 0;
  width: auto;
  height: 2px;
  margin: -1px 0 0;
}

.VarBA-handle {
  position: absolute;
  top: 50%;
  left: var(--varba-pos);
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border: 2.5px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: rgba(20, 22, 26, 0.35);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  cursor: ew-resize;
  transition: transform 0.2s var(--varg-ease), background 0.2s;
}

.VarBA--vertical .VarBA-handle {
  top: var(--varba-pos);
  left: 50%;
  flex-direction: column;
  cursor: ns-resize;
}

.VarBA-handle svg {
  width: 14px;
  height: 14px;
  margin: 0 -1px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.VarBA--vertical .VarBA-handle svg {
  margin: -1px 0;
}

.VarBA.is-dragging .VarBA-handle,
.VarBA-handle:hover {
  transform: scale(1.08);
  background: rgba(20, 22, 26, 0.5);
}

.VarBA-handle:focus-visible {
  outline: 2px solid var(--varg-focus);
  outline-offset: 3px;
}

.VarBA-label {
  position: absolute;
  top: 12px;
  z-index: 2;
  max-width: calc(50% - 40px);
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.4;
  color: var(--varg-pill-color);
  background: var(--varg-pill-bg);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  transition: opacity 0.2s;
}

.VarBA-label--before {
  left: 12px;
}

.VarBA-label--after {
  right: 12px;
}

.VarBA--vertical .VarBA-label {
  max-width: calc(100% - 24px);
}

.VarBA--vertical .VarBA-label--after {
  top: auto;
  bottom: 12px;
  left: 12px;
  right: auto;
}

.VarBA.is-before-hidden .VarBA-label--before,
.VarBA.is-after-hidden .VarBA-label--after {
  opacity: 0;
}

.VarBA-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
  user-select: text;
  -webkit-user-select: text;
}

.VarBA-title {
  font-size: 1.05em;
}

.VarBA-link {
  align-self: flex-start;
  font-weight: 600;
}

/* Without JS: both images one under the other. */
.VarBA:not(.is-ready) .VarBA-stage {
  aspect-ratio: auto;
  display: flex;
  flex-direction: column-reverse;
  cursor: auto;
}

.VarBA:not(.is-ready) .VarBA-layer {
  position: relative;
  -webkit-clip-path: none;
  clip-path: none;
}

.VarBA:not(.is-ready) .VarBA-layer .VarBA-img {
  height: auto !important;
}

.VarBA--incomplete .VarBA-stage {
  cursor: auto;
}

@media (max-width: 767px) {
  .VarBA-label {
    top: 8px;
    font-size: 11px;
    padding: 3px 9px;
  }

  .VarBA-label--before {
    left: 8px;
  }

  .VarBA-label--after {
    right: 8px;
  }

  .VarBA--vertical .VarBA-label--after {
    top: auto;
    bottom: 8px;
    left: 8px;
  }

  .VarBA-handle {
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
  }
}

/* =============================================================================
   Grid ([var_gallery ids="..." columns="2"])
   ============================================================================= */
.VarGallery-grid {
  display: grid;
  grid-template-columns: repeat(var(--varg-cols, 2), minmax(0, 1fr));
  gap: 16px;
  margin: 1.5em 0;
}

.VarGallery-grid > .VarGallery,
.VarGallery-grid > .VarBA {
  margin: 0;
}

@media (max-width: 767px) {
  .VarGallery-grid {
    grid-template-columns: 1fr;
  }
}

/* =============================================================================
   Lightbox
   ============================================================================= */
.VarLightbox-lock,
.VarLightbox-lock body {
  overflow: hidden;
}

.VarLightbox {
  --varg-btn-bg: rgba(255, 255, 255, 0.14);
  --varg-btn-bg-hover: rgba(255, 255, 255, 0.26);
  --varg-btn-color: #fff;
  --varg-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --varg-focus: #fff;

  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 12, 0.96);
  opacity: 0;
  transition: opacity 0.22s ease;
  user-select: none;
  -webkit-user-select: none;
}

.VarLightbox[hidden] {
  display: none;
}

.VarLightbox.is-open {
  opacity: 1;
}

.VarLightbox:focus {
  outline: none;
}

/* ---- Open / close effects (Var Gallery → settings) ---- */
.VarLightbox--show-none,
.VarLightbox--hide-none {
  transition: none;
}

.VarLightbox--show-zoom.is-open .VarLightbox-stage {
  animation: VarLB-zoom-in 0.3s var(--varg-ease);
}

.VarLightbox--show-flip.is-open .VarLightbox-stage {
  animation: VarLB-flip-in 0.42s var(--varg-ease);
}

.VarLightbox--show-bounce.is-open .VarLightbox-stage {
  animation: VarLB-bounce-in 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.VarLightbox--hide-zoom.is-closing .VarLightbox-stage {
  animation: VarLB-zoom-out 0.28s ease-in forwards;
}

.VarLightbox--hide-flip.is-closing .VarLightbox-stage {
  animation: VarLB-flip-out 0.28s ease-in forwards;
}

.VarLightbox--hide-bounce.is-closing .VarLightbox-stage {
  animation: VarLB-bounce-out 0.28s ease-in forwards;
}

@keyframes VarLB-zoom-in {
  from { opacity: 0; transform: scale(0.85); }
}

@keyframes VarLB-flip-in {
  from { opacity: 0; transform: perspective(900px) rotateX(-70deg); }
}

@keyframes VarLB-bounce-in {
  from { opacity: 0; transform: translate3d(0, -60px, 0); }
}

@keyframes VarLB-zoom-out {
  to { opacity: 0; transform: scale(0.85); }
}

@keyframes VarLB-flip-out {
  to { opacity: 0; transform: perspective(900px) rotateX(70deg); }
}

@keyframes VarLB-bounce-out {
  20% { transform: translate3d(0, -12px, 0); }
  to { opacity: 0; transform: translate3d(0, 80px, 0); }
}

/* Image links in post content handled by the lightbox. */
a[data-varg-lightbox] {
  cursor: zoom-in;
}

.VarLightbox-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(56px, env(safe-area-inset-top)) max(72px, env(safe-area-inset-right)) max(64px, env(safe-area-inset-bottom)) max(72px, env(safe-area-inset-left));
  touch-action: none;
}

.VarLightbox .VarLightbox-img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  margin: 0;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  transition: transform 0.25s var(--varg-ease), opacity 0.25s;
  -webkit-user-drag: none;
}

.VarLightbox.is-loading .VarLightbox-img {
  opacity: 0.55;
}

.VarLightbox-img.is-enter-next {
  animation: VarLightbox-in-next 0.32s var(--varg-ease);
}

.VarLightbox-img.is-enter-prev {
  animation: VarLightbox-in-prev 0.32s var(--varg-ease);
}

@keyframes VarLightbox-in-next {
  from {
    opacity: 0;
    transform: translate3d(40px, 0, 0) scale(0.98);
  }
}

@keyframes VarLightbox-in-prev {
  from {
    opacity: 0;
    transform: translate3d(-40px, 0, 0) scale(0.98);
  }
}

.VarLightbox-nav {
  position: absolute;
  top: 50%;
  width: 48px;
  height: 48px;
  margin-top: -24px;
}

.VarLightbox-nav--prev {
  left: max(14px, env(safe-area-inset-left));
}

.VarLightbox-nav--next {
  right: max(14px, env(safe-area-inset-right));
}

.VarLightbox-nav[hidden],
.VarLightbox-counter[hidden],
.VarLightbox-caption[hidden] {
  display: none;
}

.VarLightbox-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  width: 42px;
  height: 42px;
}

.VarLightbox-counter {
  position: absolute;
  top: max(20px, env(safe-area-inset-top));
  left: max(20px, env(safe-area-inset-left));
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.85);
}

.VarLightbox-caption {
  position: absolute;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: min(90vw, 760px);
  font-size: 14px;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
}

@media (max-width: 767px) {
  .VarLightbox-stage {
    padding: 56px 8px;
  }

  .VarLightbox-nav {
    top: auto;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: 40px;
    height: 40px;
    margin-top: 0;
  }

  .VarLightbox-caption {
    bottom: max(64px, env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .VarGallery-track,
  .VarLightbox,
  .VarLightbox-stage,
  .VarLightbox-img {
    transition: none !important;
    animation: none !important;
  }
}
