/* Karilon Swap & Zoom Gallery — minimal, scoped e non invasivo */
.ks-gallery {
  --ks-gap: 10px;
  --ks-thumb: 64px;
  --ks-radius: 10px;
}

/* AREA PRINCIPALE */
.ks-gallery__main {
  position: relative; /* serve per ancorare l’overlay delle frecce */
  margin: 0 0 var(--ks-gap);
  border-radius: var(--ks-radius);
  overflow: hidden;
}
.ks-gallery__img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}
.ks-gallery.is-fit-cover .ks-gallery__img { object-fit: cover; }

/* THUMBNAILS */
.ks-gallery__thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ks-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}
.ks-gallery__thumb {
  appearance: none;
  background: #fff;
  border: 1px solid #e6e6e6;
  padding: 0;
  margin: 0;
  border-radius: 8px;
  cursor: pointer;
  line-height: 0;
}
.ks-gallery__thumb img {
  display: block;
  width: var(--ks-thumb);
  height: var(--ks-thumb);
  object-fit: cover;
  border-radius: 8px;
}
.ks-gallery__thumb.is-active {
  outline: 2px solid rgba(61,117,185,.6);
  outline-offset: 2px;
}

/* FRECCE OVERLAY — posizionate dentro l'immagine principale */
.ks-gallery__nav {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none; /* l’overlay non blocca i click sull’immagine */
  padding: 0 8px;      /* distanza dai bordi dell’immagine */
}
.ks-gallery__prev,
.ks-gallery__next {
  pointer-events: auto; /* bottoni cliccabili */
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(0,0,0,.45);
  color: #fff;
  font-size: 24px;
  line-height: 44px;
  text-align: center;
  cursor: pointer;
}
.ks-gallery__prev::before { content: '‹'; }
.ks-gallery__next::before { content: '›'; }

/* LIGHTBOX (overlay completamente isolato) */
.ks-gallery__lightbox[hidden] { display: none !important; }
.ks-gallery__lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,.86);
  display: grid;
  place-items: center;
}
.ks-lightbox__inner {
  position: relative;
  max-width: 96vw;
  max-height: 96vh;
}
.ks-lightbox__img {
  display: block;
  max-width: 96vw;
  max-height: 96vh;
  object-fit: contain;
}
.ks-lightbox__close,
.ks-lightbox__prev,
.ks-lightbox__next {
  position: absolute;
  border: 0;
  background: rgba(0,0,0,.5);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 24px;
  line-height: 42px;
  text-align: center;
  cursor: pointer;
}
.ks-lightbox__close { top: -52px; right: 0; }
.ks-lightbox__prev  { left: -52px; top: 50%; transform: translateY(-50%); }
.ks-lightbox__next  { right: -52px; top: 50%; transform: translateY(-50%); }

/* Lente zoom su hover (desktop) */
.ks-zoom-lens{
  position:absolute;
  width:140px;
  height:140px;
  border-radius:50%;
  border:2px solid rgba(255,255,255,.9);
  box-shadow:0 2px 10px rgba(0,0,0,.25);
  background-repeat:no-repeat;
  background-color:rgba(255,255,255,.02);
}

@media (max-width: 600px) {
  .ks-lightbox__close { top: 8px; right: 8px; }
  .ks-lightbox__prev  { left: 8px; }
  .ks-lightbox__next  { right: 8px; }

  /* niente lente su dispositivi touch */
  .ks-zoom-lens{ display:none !important; }

}
