.petalya-smart-slider {
  --pss-duration: 700ms;
  --pss-aspect-ratio: 2 / 1;
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #fff;
  isolation: isolate;
  touch-action: pan-y;
  contain: layout paint;
  overscroll-behavior-x: contain;
}

.petalya-smart-slider .pss-stage {
  position: relative;
  width: 100%;
  aspect-ratio: var(--pss-aspect-ratio);
  perspective: 1500px;
  transform-style: preserve-3d;
}

.petalya-smart-slider .pss-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  will-change: opacity, transform;
}

.petalya-smart-slider .pss-slide.is-active {
  z-index: 2;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.petalya-smart-slider .pss-link,
.petalya-smart-slider .pss-image {
  display: block;
  width: 100%;
  height: 100%;
}

.petalya-smart-slider .pss-image {
  object-fit: cover;
  object-position: var(--pss-focus, center center);
  user-select: none;
  -webkit-user-drag: none;
}

.petalya-smart-slider .pss-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: clamp(14px, 3vw, 38px);
  background: linear-gradient(transparent, rgba(0, 0, 0, .58));
  color: #fff;
  font-size: clamp(18px, 2.2vw, 36px);
  line-height: 1.25;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .4);
}

.petalya-smart-slider .pss-arrow,
.petalya-smart-slider .pss-playpause,
.petalya-smart-slider .pss-dot {
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.petalya-smart-slider .pss-arrow {
  position: absolute;
  z-index: 8;
  top: 50%;
  width: 46px;
  height: 64px;
  margin-top: -32px;
  border-radius: 0;
  background: rgba(0, 0, 0, .28);
  color: #fff;
  font-size: 44px;
  line-height: 56px;
  opacity: .75;
  transition: opacity .2s ease, background .2s ease;
}

.petalya-smart-slider .pss-arrow:hover,
.petalya-smart-slider .pss-arrow:focus {
  opacity: 1;
  background: rgba(0, 0, 0, .5);
}

.petalya-smart-slider .pss-prev { left: 0; }
.petalya-smart-slider .pss-next { right: 0; }

.petalya-smart-slider .pss-dots {
  position: absolute;
  z-index: 9;
  left: 50%;
  bottom: 14px;
  display: flex;
  gap: 9px;
  transform: translateX(-50%);
}

.petalya-smart-slider .pss-dot {
  width: 10px;
  height: 10px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 50%;
  background: rgba(0, 0, 0, .35);
  transition: transform .2s ease, background .2s ease;
}

.petalya-smart-slider .pss-dot.is-active {
  transform: scale(1.28);
  background: #fff;
}

.petalya-smart-slider .pss-playpause {
  position: absolute;
  z-index: 9;
  right: 14px;
  bottom: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .42);
  color: #fff;
  font-size: 13px;
}

.petalya-smart-slider .pss-play-icon { display: none; }
.petalya-smart-slider.is-paused .pss-pause-icon { display: none; }
.petalya-smart-slider.is-paused .pss-play-icon { display: inline; }

.petalya-smart-slider .pss-progress {
  position: absolute;
  z-index: 10;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, .22);
  pointer-events: none;
}

.petalya-smart-slider .pss-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: rgba(255, 255, 255, .88);
}

.petalya-smart-slider.is-running .pss-progress span {
  animation: pss-progress var(--pss-delay) linear forwards;
}

@keyframes pss-progress {
  from { width: 0; }
  to { width: 100%; }
}

/* Fade */
.petalya-smart-slider[data-active-effect="fade"] .pss-slide.pss-enter {
  animation: pss-fade-in var(--pss-duration) ease both;
}
.petalya-smart-slider[data-active-effect="fade"] .pss-slide.pss-leave {
  animation: pss-fade-out var(--pss-duration) ease both;
}
@keyframes pss-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pss-fade-out { from { opacity: 1; } to { opacity: 0; } }

/* Slide */
.petalya-smart-slider[data-active-effect="slide"] .pss-slide.pss-enter.pss-forward {
  animation: pss-slide-in-right var(--pss-duration) cubic-bezier(.22,.61,.36,1) both;
}
.petalya-smart-slider[data-active-effect="slide"] .pss-slide.pss-leave.pss-forward {
  animation: pss-slide-out-left var(--pss-duration) cubic-bezier(.22,.61,.36,1) both;
}
.petalya-smart-slider[data-active-effect="slide"] .pss-slide.pss-enter.pss-backward {
  animation: pss-slide-in-left var(--pss-duration) cubic-bezier(.22,.61,.36,1) both;
}
.petalya-smart-slider[data-active-effect="slide"] .pss-slide.pss-leave.pss-backward {
  animation: pss-slide-out-right var(--pss-duration) cubic-bezier(.22,.61,.36,1) both;
}
@keyframes pss-slide-in-right { from { opacity: 1; transform: translate3d(100%,0,0); } to { opacity: 1; transform: translate3d(0,0,0); } }
@keyframes pss-slide-out-left { from { opacity: 1; transform: translate3d(0,0,0); } to { opacity: 1; transform: translate3d(-100%,0,0); } }
@keyframes pss-slide-in-left { from { opacity: 1; transform: translate3d(-100%,0,0); } to { opacity: 1; transform: translate3d(0,0,0); } }
@keyframes pss-slide-out-right { from { opacity: 1; transform: translate3d(0,0,0); } to { opacity: 1; transform: translate3d(100%,0,0); } }

/* Cube */
.petalya-smart-slider[data-active-effect="cube"] .pss-slide.pss-enter.pss-forward {
  transform-origin: left center;
  animation: pss-cube-in-forward var(--pss-duration) cubic-bezier(.35,.01,.25,1) both;
}
.petalya-smart-slider[data-active-effect="cube"] .pss-slide.pss-leave.pss-forward {
  transform-origin: right center;
  animation: pss-cube-out-forward var(--pss-duration) cubic-bezier(.35,.01,.25,1) both;
}
.petalya-smart-slider[data-active-effect="cube"] .pss-slide.pss-enter.pss-backward {
  transform-origin: right center;
  animation: pss-cube-in-back var(--pss-duration) cubic-bezier(.35,.01,.25,1) both;
}
.petalya-smart-slider[data-active-effect="cube"] .pss-slide.pss-leave.pss-backward {
  transform-origin: left center;
  animation: pss-cube-out-back var(--pss-duration) cubic-bezier(.35,.01,.25,1) both;
}
@keyframes pss-cube-in-forward { from { opacity: .65; transform: rotateY(-90deg) translateZ(1px); } to { opacity: 1; transform: rotateY(0); } }
@keyframes pss-cube-out-forward { from { opacity: 1; transform: rotateY(0); } to { opacity: .65; transform: rotateY(90deg) translateZ(1px); } }
@keyframes pss-cube-in-back { from { opacity: .65; transform: rotateY(90deg) translateZ(1px); } to { opacity: 1; transform: rotateY(0); } }
@keyframes pss-cube-out-back { from { opacity: 1; transform: rotateY(0); } to { opacity: .65; transform: rotateY(-90deg) translateZ(1px); } }

/* Flip */
.petalya-smart-slider[data-active-effect="flip"] .pss-slide.pss-enter {
  animation: pss-flip-in var(--pss-duration) ease both;
}
.petalya-smart-slider[data-active-effect="flip"] .pss-slide.pss-leave {
  animation: pss-flip-out var(--pss-duration) ease both;
}
@keyframes pss-flip-in { from { opacity: 0; transform: rotateX(-80deg) scale(.94); } to { opacity: 1; transform: rotateX(0) scale(1); } }
@keyframes pss-flip-out { from { opacity: 1; transform: rotateX(0) scale(1); } to { opacity: 0; transform: rotateX(80deg) scale(.94); } }

/* Zoom */
.petalya-smart-slider[data-active-effect="zoom"] .pss-slide.pss-enter {
  animation: pss-zoom-in var(--pss-duration) ease both;
}
.petalya-smart-slider[data-active-effect="zoom"] .pss-slide.pss-leave {
  animation: pss-zoom-out var(--pss-duration) ease both;
}
@keyframes pss-zoom-in { from { opacity: 0; transform: scale(1.08); } to { opacity: 1; transform: scale(1); } }
@keyframes pss-zoom-out { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(.96); } }

/* Ken Burns */
.petalya-smart-slider[data-active-effect="kenburns"] .pss-slide.pss-enter {
  animation: pss-fade-in var(--pss-duration) ease both;
}
.petalya-smart-slider[data-active-effect="kenburns"] .pss-slide.is-active .pss-image {
  animation: pss-kenburns var(--pss-delay) ease-out both;
}
@keyframes pss-kenburns { from { transform: scale(1); } to { transform: scale(1.08); } }

@media (max-width: 767px) {
  .petalya-smart-slider .pss-arrow {
    width: 36px;
    height: 52px;
    margin-top: -26px;
    font-size: 36px;
    line-height: 46px;
  }
  .petalya-smart-slider .pss-playpause { right: 10px; bottom: 9px; }
  .petalya-smart-slider .pss-dots { bottom: 11px; }
  .petalya-smart-slider .pss-caption { padding: 12px 14px 30px; }
}

@media (prefers-reduced-motion: reduce) {
  .petalya-smart-slider *,
  .petalya-smart-slider *::before,
  .petalya-smart-slider *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

/* V2 mobile 1:1 touch dragging */
.petalya-smart-slider.is-dragging {
  cursor: grabbing;
}
.petalya-smart-slider.is-dragging .pss-slide {
  animation: none !important;
}
.petalya-smart-slider .pss-slide.is-drag-visible {
  display: block;
  pointer-events: none;
  backface-visibility: hidden;
  transform: translate3d(0,0,0);
}
@media (max-width: 767px) {
  .petalya-smart-slider .pss-slide,
  .petalya-smart-slider .pss-image {
    transform: translateZ(0);
    backface-visibility: hidden;
  }
}
.petalya-smart-slider picture { display:block; width:100%; height:100%; }
@media (max-width: 767px) {
  .petalya-smart-slider .pss-stage { aspect-ratio: var(--pss-mobile-aspect-ratio, var(--pss-aspect-ratio)); }
}
