:root {
  --kk-primary-color: #CA1D37;
  --kk-img-bg-color: #2e3b4c0d;
}

.kk-gallery {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 16px;
  width: 50%;
  height: 420px;
  float: left;
}

.kk-gallery-thumbs {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  max-height: 100%;
  padding-left: 4px;
  scrollbar-width: thin;
  scrollbar-color: #CA1D37 transparent;
  direction: rtl;
}
.kk-gallery-thumbs * {
  direction: ltr;  
}

/* scrollbars */
.kk-gallery-thumbs::-webkit-scrollbar{
  width: 6px;
}
.kk-gallery-thumbs::-webkit-scrollbar-track{
  background: transparent;
}
.kk-gallery-thumbs::-webkit-scrollbar-thumb {
  background-color: #CA1D37;
  border-radius: 999px;
}
.kk-gallery-thumbs::-webkit-scrollbar-thumb:hover {
  background-color: #a8182e;
}
.kk-gallery-thumbs::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.kk-thumb {
  background: var(--kk-img-bg-color);
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  transition: all .15s ease;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  flex: 0 0 auto;
  flex-shrink: 0;
}
.kk-thumb:hover, .kk-thumb.is-hover {
    background: none;
    border-color: #2e3b4c;
}
.kk-thumb.is-active {
  background: #ca1d3718;
  border-color: var(--kk-primary-color);
  cursor: default;
}
.kk-thumb img {
  width: 100%;
  display: block;
  transition: scale .15s ease;
}
.kk-thumb:not(.is-active):hover img {
  scale: 1.1;
}

.kk-gallery-main {
  background: var(--kk-img-bg-color);
  display: flex;
  align-items: center;
  justify-content: center;
  height: inherit;
  position: relative;
}
.kk-gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.kk-gallery-nav {
  position: absolute;
  top: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  background: rgb(202, 29, 55, .75);
  opacity: 0;
  transition: all .1s ease;
}
.kk-gallery-nav:active,
.kk-gallery-nav:focus {
  background: rgb(202, 29, 55, .75);
}
.kk-gallery-nav svg {
  width: 16px;
  transition: all .1s ease;
}
.kk-gallery-main:hover .kk-gallery-nav {
  opacity: 1;
}
.kk-gallery-main:hover .kk-gallery-nav:hover {
  background: rgb(202, 29, 55, 1);
}
.kk-gallery-nav:hover svg {
  width: 18px;
}

.kk-gallery-nav.kk-prev {
  left: 16px;
  transform: translateY(-50%);
}
.kk-gallery-nav.kk-next {
  right: 16px;
  transform: translateY(-50%);
}

.kk-gallery-nav:active {
  transform: translateY(-50%) scale(0.95);
}

.kk-gallery-fullscreen {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  background: rgb(255, 255, 255);
  transition: all .1s ease;
}
.kk-gallery-fullscreen:active,
.kk-gallery-fullscreen:focus {
  background: rgb(255, 255, 255);
}
.kk-gallery-fullscreen:active {
  transform: scale(0.95);
}
.kk-gallery-fullscreen:hover {
  background: rgb(230, 230, 230);
}
.kk-gallery-fullscreen svg {
  width: 20px;
  overflow: visible;
  transform-box: fill-box;
  transform-origin: center;
  shape-rendering: geometricPrecision;
  text-rendering: geometricPrecision;
}

.kk-gallery-fullscreen svg .arrow {
  transition: transform .1s cubic-bezier(.4,0,.2,1);
}
/* hover */
.kk-gallery-fullscreen:hover svg .arrow-a {
  transform: translate(-20px, -20px);
}
.kk-gallery-fullscreen:hover svg .arrow-b {
  transform: translate(20px, 20px);
}

.kk-main-image {
  transition: opacity .15s ease;
}

.kk-main-image.is-switching {
  opacity: .5;
}

/* zoom tylko na desktop */
@media (min-width: 768px) {
  .kk-gallery-main {
    overflow: hidden; /* ważne: ukrywa "wyjeżdżanie" powiększonego obrazu poza kadr */
  }

  img.kk-main-image {
    cursor: zoom-in;
    transform-origin: 50% 50%;
    transition: opacity .15s ease, transform .12s ease;
    will-change: transform, transform-origin;
    user-select: none;
    -webkit-user-drag: none;
  }

  img.kk-main-image.is-zoomed {
    cursor: zoom-out;
    transform: scale(2.4); /* zmień jeśli chcesz większy/mniejszy zoom */
  }
}



/* Fullscreen modal (desktop only logic w JS, ale CSS też zabezpiecz) */
.kk-fs { position: fixed; inset: 0; z-index: 999999; display: none; }
.kk-fs.is-open { display: block; }

/* .kk-fs__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); } */

.kk-fs__panel{
  position: absolute;
  inset: 0;
  background: #fff;
  overflow: hidden;
  display:flex;
  flex-direction:column;
}

.kk-fs__close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: 0;
  background: rgba(0, 0, 0, .075);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: black;
  display: flex;
  justify-content: center;
  align-items: center;
  color: black;
  padding: 0;
  transition: all .1s ease;
}
.kk-fs__close:active,
.kk-fs__close:focus {
  background: rgba(0, 0, 0, .075);
  color: black;
}
.kk-fs__close:active {
  transform: scale(0.95);
}
.kk-fs__close:hover {
  background: var(--kk-primary-color);
  color: white;
}


.kk-fs__counter {
  width: 100%;
  padding: 16px;
  font-weight: 600;
  text-align: center;
}

.kk-fs__grid {
  display: grid;
  grid-template-columns: 1fr clamp(180px, 20%, 220px); /* main col | thumbs col */
  flex: 1;
  min-height: 0; 
  padding: 0 0 32px 16px;
}      



.kk-fs__stage {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  background: var(--kk-img-bg-color);
}
.kk-fs__img {
  max-width: 100%; 
  max-height: calc(100vh - 62px - 32px);
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.kk-fs__nav {
  position: absolute;
  top: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  background: rgb(202, 29, 55, .75);
  cursor: pointer;
  transition: all .1s ease;  
  -webkit-tap-highlight-color: transparent;
}
.kk-fs__nav svg {
  width: 20px;
  transition: all .1s ease;
}
.kk-fs__nav:hover svg {
  width: 24px;
}
.kk-fs__nav:active,
.kk-fs__nav:focus {
  background: rgb(202, 29, 55, .75);
}
.kk-fs__nav:hover {
  background: rgb(202, 29, 55, 1);
}
.kk-fs__prev{
  left: 20px;
  transform: translateY(-50%);
}
.kk-fs__next{
  right: 20px;
  transform: translateY(-50%);
}
.kk-fs__nav:active {
  transform: translateY(-50%) scale(0.95);
}



.kk-fs__thumbs{
  padding: 0 16px;
  overflow-y: auto !important;
  border-left: 1px solid rgba(0, 0, 0, .08);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  align-content: start;
  min-height: 0;
  height: inherit;
  grid-auto-rows: max-content;
}

/* eBay-style: co 3ci kafelek jest szeroki */
.kk-fs__thumbs .kk-fs__t:nth-child(3n + 1){
  grid-column: span 2;
}

.kk-fs__t {
  width: 100%;
  overflow: hidden;
  background: var(--kk-img-bg-color);
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  transition: all .15s ease;
}
.kk-fs__t.is-active {
  background: #ca1d3718;
  border-color: var(--kk-primary-color);
  cursor: default;
}
.kk-fs__t img {
  width: 100%;
  height: 100%;
  display: block;
  transition: scale .15s ease;
  object-fit: cover;
}
.kk-fs__t:not(.is-active):hover {
  background: none;
  border-color: #2e3b4c;
}
.kk-fs__t:not(.is-active):hover img {
  scale: 1.1;
}



/* mobile */
@media (max-width: 921px) {
  .kk-gallery {
    width: 100%;
    margin-bottom: 32px;
  }
}
@media (max-width: 767px){
  .kk-gallery {
    grid-template-columns: 1fr;
    height: auto;
  }
  .kk-gallery-main {
    height: 420px;
  }
  .kk-gallery-nav {
    /* display: none; */
    opacity: 1;
  }
  .kk-gallery-nav:hover {
    opacity: 1;
    background: rgb(202, 29, 55, .75) !important;
  }
  .kk-gallery-nav:hover svg {
    width: 16px;
  }
  .kk-gallery-thumbs {
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    height: fit-content;
    flex-direction: row;
    order: 2;
    padding-left: 0;
    padding-bottom: 12px;
    direction: ltr;
  }
  .kk-thumb {
    width: 80px;
  }

  /* .kk-fs, */
  .kk-gallery-fullscreen,
  .kk-fs__thumbs {
    display:none !important;
  }
  .kk-fs__grid {
    grid-template-columns: 1fr;
    padding: 0 16px 128px 16px;
  }
  .kk-fs__nav {
    top: calc(100% + 16px);
    background: rgb(202, 29, 55, 1);
    width: 33%;
  }
  .kk-fs__nav:active {
    transform: translateY(0%) scale(0.95);
  }
  .kk-fs__nav:hover svg {
    width: 20px;
  }
  .kk-fs__prev {
    left: 0;
    transform: translateY(0%);
  }
  .kk-fs__next {
    right: 0;
    transform: translateY(0%);
  }
  
}
@media (max-width: 450px) {
  .kk-gallery-main {
    height: auto;
    aspect-ratio: 1 / 1;
  }
}