/**
 * Felu Touch Swipe — Breakdance ürün kartının hover görseline dokunmatik kaydırma (includes/card-swipe).
 *
 * Kök sınıf .felu-card-swipe PHP'den gelir: hover görseli açık ve Touch Swipe kapatılmamış ürün listesi.
 * Dinlenme durumu Breakdance'in varsayılanıdır (hover görseli opacity 0, transform yok): lazy görsel normal
 * yüklenir, JS yoksa görünüm değişmez. Sarmalayıcı görselin köşesiyle kırpılır (Breakdance köşeyi <img>'ye verir;
 * gösterge çizgisi ve kayan görseller köşeden taşmasın). Öteleme yalnız hareket durumlarında:
 *   .is-felu-dragging  parmak altında; --felu-swipe-x (px) ve --felu-swipe-p (0-1) JS'ten,
 *   .is-felu-second    ikinci görsel,
 *   .is-felu-leaving   ilk görsele dönüş animasyonu (JS süre sonunda kaldırır).
 * .is-felu-touch: kart dokunmayla kullanılıyor → Breakdance'in taklit :hover'ı nötrlenir (fareyle kalkar).
 * Slider düzeninde (.swiper) de çalışır: görsel üstündeki jest kartındır (JS swiper-no-swiping ekler).
 * Konumlar % tabanlı: yeniden boyutlanmada JS gerekmez.
 * Değişkenler: --felu-swipe-dir (RTL'de -1), --felu-swipe-dur, --felu-swipe-bar-color / --felu-swipe-bar-h,
 * --felu-swipe-radius (elementin görsel köşesi; yoksa global ürün görseli köşesi) — elementin kontrollerinden,
 * instance CSS.
 */

.felu-card-swipe {
  --felu-swipe-dir: 1;
  --felu-swipe-dur: .3s;
}

[dir="rtl"] .felu-card-swipe {
  --felu-swipe-dir: -1;
}

@media (prefers-reduced-motion: reduce) {
  .felu-card-swipe {
    --felu-swipe-dur: 0s;
  }
}

/* Yatay hareket JS'e, dikey kaydırma ve yakınlaştırma tarayıcıya kalır. Köşe görselinkiyle aynı; kırpma çizgiyi ve
   kayan görselleri köşe içinde tutar (dinlenmede hiçbir şey ötelenmediği için lazy yükleme etkilenmez). */
.felu-card-swipe .bde-woo-product-image:has(> .bde-woo-product-image__hover-img) {
  border-radius: var(--felu-swipe-radius, var(--bde-woo-product-images__border-radius, 0px));
  overflow: hidden;
  overflow: clip;
  touch-action: pan-y;
  touch-action: pan-y pinch-zoom;
  -webkit-user-select: none;
  user-select: none;
}

/* Taklit :hover dokunuşta ikinci görseli yanıp söndürmesin (JS yüklenmeden önce medya sorgusu, sonra sınıf). */
@media (hover: none) {
  .felu-card-swipe .bde-woo-product-image:has(> .bde-woo-product-image__hover-img) > .bde-woo-product-image__hover-img {
    opacity: 0;
    transition: none;
  }
}

.felu-card-swipe .bde-woo-product-image:has(> .bde-woo-product-image__hover-img).is-felu-touch > .bde-woo-product-image__hover-img {
  opacity: 0;
  transition: none;
}

/* Hareket durumları */

/* Köşe yalnız çerçevede (Felu Gallery'deki gibi): hareket sırasında görsellerin kendi köşesi kalkar, çerçeve kırpar →
   görseller çerçevenin içinde bitişik kayar, köşeler sabit kalır. ul.products li.product: Breakdance'in element CSS'i
   (`… ul.products li.product .bde-woo-product-image > img`, 0,4,3) geçilsin. Dinlenmede köşeler aynı, dokunulmaz. */
.felu-card-swipe ul.products li.product .bde-woo-product-image:has(> .bde-woo-product-image__hover-img).is-felu-dragging > img,
.felu-card-swipe ul.products li.product .bde-woo-product-image:has(> .bde-woo-product-image__hover-img).is-felu-second > img,
.felu-card-swipe ul.products li.product .bde-woo-product-image:has(> .bde-woo-product-image__hover-img).is-felu-leaving > img,
.felu-card-swipe ul.products li.product .bde-woo-product-image:has(> .bde-woo-product-image__hover-img).is-felu-dragging > .bde-woo-product-image__hover-img img,
.felu-card-swipe ul.products li.product .bde-woo-product-image:has(> .bde-woo-product-image__hover-img).is-felu-second > .bde-woo-product-image__hover-img img,
.felu-card-swipe ul.products li.product .bde-woo-product-image:has(> .bde-woo-product-image__hover-img).is-felu-leaving > .bde-woo-product-image__hover-img img {
  border-radius: 0;
}
.felu-card-swipe .bde-woo-product-image:has(> .bde-woo-product-image__hover-img).is-felu-dragging > .onsale,
.felu-card-swipe .bde-woo-product-image:has(> .bde-woo-product-image__hover-img).is-felu-second > .onsale,
.felu-card-swipe .bde-woo-product-image:has(> .bde-woo-product-image__hover-img).is-felu-leaving > .onsale {
  z-index: 2;
}

.felu-card-swipe .bde-woo-product-image:has(> .bde-woo-product-image__hover-img).is-felu-dragging > .bde-woo-product-image__hover-img,
.felu-card-swipe .bde-woo-product-image:has(> .bde-woo-product-image__hover-img).is-felu-second > .bde-woo-product-image__hover-img,
.felu-card-swipe .bde-woo-product-image:has(> .bde-woo-product-image__hover-img).is-felu-leaving > .bde-woo-product-image__hover-img {
  opacity: 1;
  transition: transform var(--felu-swipe-dur, .3s) ease;
}

.felu-card-swipe .bde-woo-product-image:has(> .bde-woo-product-image__hover-img).is-felu-dragging > .bde-woo-product-image__hover-img img,
.felu-card-swipe .bde-woo-product-image:has(> .bde-woo-product-image__hover-img).is-felu-second > .bde-woo-product-image__hover-img img,
.felu-card-swipe .bde-woo-product-image:has(> .bde-woo-product-image__hover-img).is-felu-leaving > .bde-woo-product-image__hover-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.felu-card-swipe .bde-woo-product-image:has(> .bde-woo-product-image__hover-img).is-felu-second > img {
  transform: translateX(calc(-100% * var(--felu-swipe-dir, 1)));
  transition: transform var(--felu-swipe-dur, .3s) ease;
}

.felu-card-swipe .bde-woo-product-image:has(> .bde-woo-product-image__hover-img).is-felu-second > .bde-woo-product-image__hover-img {
  transform: translateX(0);
}

.felu-card-swipe .bde-woo-product-image:has(> .bde-woo-product-image__hover-img).is-felu-leaving > img {
  transform: translateX(0);
  transition: transform var(--felu-swipe-dur, .3s) ease;
}

.felu-card-swipe .bde-woo-product-image:has(> .bde-woo-product-image__hover-img).is-felu-leaving > .bde-woo-product-image__hover-img {
  transform: translateX(calc(100% * var(--felu-swipe-dir, 1)));
}

.felu-card-swipe .bde-woo-product-image:has(> .bde-woo-product-image__hover-img).is-felu-dragging > img {
  transform: translateX(var(--felu-swipe-x, 0px));
  transition: none;
}

.felu-card-swipe .bde-woo-product-image:has(> .bde-woo-product-image__hover-img).is-felu-dragging > .bde-woo-product-image__hover-img {
  transform: translateX(calc(100% * var(--felu-swipe-dir, 1) + var(--felu-swipe-x, 0px)));
  transition: none;
}

/* Gösterge çizgisi: ilk görselde yarım, ikincide tam genişlik. content yalnız görünür kiplerde verilir. */
.felu-card-swipe .bde-woo-product-image:has(> .bde-woo-product-image__hover-img)::after {
  position: absolute;
  inset-inline-start: 0;
  bottom: 0;
  z-index: 3;
  pointer-events: none;
  height: var(--felu-swipe-bar-h, 2px);
  width: calc(50% + 50% * var(--felu-swipe-p, 0));
  background-color: var(--felu-swipe-bar-color, currentColor);
  transition: width var(--felu-swipe-dur, .3s) ease;
}

.felu-card-swipe:not(.felu-card-swipe--bar-touch):not(.felu-card-swipe--bar-none) .bde-woo-product-image:has(> .bde-woo-product-image__hover-img)::after {
  content: '';
}

@media (hover: none) and (pointer: coarse) {
  .felu-card-swipe--bar-touch .bde-woo-product-image:has(> .bde-woo-product-image__hover-img)::after {
    content: '';
  }
}

.felu-card-swipe .bde-woo-product-image:has(> .bde-woo-product-image__hover-img).is-felu-second {
  --felu-swipe-p: 1;
}

.felu-card-swipe .bde-woo-product-image:has(> .bde-woo-product-image__hover-img).is-felu-dragging::after {
  transition: none;
}

@media (hover: hover) {
  .felu-card-swipe .bde-woo-product-image:has(> .bde-woo-product-image__hover-img):hover:not(.is-felu-touch) {
    --felu-swipe-p: 1;
  }
}
