.cew-pvc {
  --cew-pvc-slide-w: min(calc(100% / 3), 300px);
  --cew-pvc-gap: 16px;

  width: 100%;
  max-width: 1300px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  isolation: isolate;
  transform: translateZ(0);
}

/* ── Viewport ────────────────────────────────────────────────── */
.cew-pvc-viewport {
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
}

.cew-pvc-viewport:focus-visible {
  outline: 3px solid #bf6b68;
  outline-offset: 2px;
  border-radius: 8px;
}

/* ── Track ───────────────────────────────────────────────────── */
.cew-pvc-track {
  position: relative;
  width: 100%;
}

.cew-pvc-sizer {
  display: block;
  width: var(--cew-pvc-slide-w);
  aspect-ratio: 9 / 16;
  pointer-events: none;
}

/* ── Slide ───────────────────────────────────────────────────── */
.cew-pvc-slide {
  --cew-pvc-x: 0px;
  --cew-pvc-s: 0.88;
  --cew-pvc-o: 0.72;

  position: absolute;
  top: 0;
  left: 50%;
  width: var(--cew-pvc-slide-w);
  margin-left: calc(var(--cew-pvc-slide-w) / -2);
  transform: translate3d(var(--cew-pvc-x), 0, 0) scale(var(--cew-pvc-s));
  opacity: var(--cew-pvc-o);
  transition:
    transform 460ms cubic-bezier(0.22, 0.61, 0.36, 1),
    opacity 460ms cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: transform, opacity;
}

.cew-pvc-slide.is-active {
  --cew-pvc-s: 1;
  --cew-pvc-o: 1;
}

.cew-pvc-slide.is-far {
  --cew-pvc-o: 0;
  visibility: hidden;
}

.cew-pvc--start .cew-pvc-slide {
  left: 0;
  margin-left: 0;
}

.cew-pvc-slide:not(.is-active) {
  cursor: pointer;
}

.cew-pvc-slide:not(.is-active) .cew-pvc-card,
.cew-pvc-slide:not(.is-active) .cew-pvc-controls {
  pointer-events: none;
}

/* ── Media ───────────────────────────────────────────────────── */
.cew-pvc-media {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 8px;
  background-color: #0f172a;
  /* Softer on the side slides… */
  box-shadow: 0 12px 34px -16px rgba(15, 23, 42, 0.4);
  transition: box-shadow 460ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* …and a pronounced floating shadow on the active card, like the design. */
.cew-pvc-slide.is-active .cew-pvc-media {
  box-shadow:
    0 32px 70px -22px rgba(15, 23, 42, 0.62),
    0 14px 30px -14px rgba(15, 23, 42, 0.4);
}

.cew-pvc-video,
.cew-pvc-poster {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}

/* ── Video controls (top right, stacked) ─────────────────────── */
.cew-pvc-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cew-pvc-ctrl {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent !important;
  color: #ffffff !important;
  cursor: pointer;
  transition: color 200ms ease, transform 200ms ease;
  outline: none;
  appearance: none;
}

.cew-pvc-ctrl::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-color: #000000;
  opacity: 0.30;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: opacity 200ms ease;
}

.cew-pvc-ctrl:hover {
  color: #ffffff;
  transform: scale(1.08);
}

.cew-pvc-ctrl:hover::before {
  opacity: 0.45;
}

/* ── Icons ───────────────────────────────────────────────────── */
.cew-pvc-icon {
  position: relative;
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
}

.cew-pvc-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: currentColor;
}

/* Elementor icon libraries render a font tag instead of an SVG. */
.cew-pvc-icon i {
  font-size: 22px;
  line-height: 1;
}

.cew-pvc-icon--muted,
.cew-pvc-icon--play {
  display: inline-flex;
}

.cew-pvc-slide[data-muted="false"]  .cew-pvc-icon--muted,
.cew-pvc-slide[data-playing="true"] .cew-pvc-icon--play {
  display: none;
}

.cew-pvc-slide[data-muted="false"]  .cew-pvc-icon--unmuted,
.cew-pvc-slide[data-playing="true"] .cew-pvc-icon--pause {
  display: inline-flex;
}

.cew-pvc-card {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  height: 86px;
  padding: 9px;
  display: flex;
  align-items: flex-end;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.70) 100%
  );
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

.cew-pvc-card-row {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 12px;
}

.cew-pvc-slide.is-active .cew-pvc-card {
  animation: cew-pvc-card-in 460ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes cew-pvc-card-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cew-pvc-card-imgwrap {
  flex-shrink: 0;
  width: 56px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background-color: #ffffff;
  overflow: hidden;
}

.cew-pvc-card-img {
  max-width: 100%;
  height: 100% !important;
  max-height: 100% !important;
  object-fit: cover;
  -webkit-user-drag: none;
}

.cew-pvc-card-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.cew-pvc-card-name {
  color: #ffffff;
  font-family: "Manrope";
  font-size: 12px;
  font-weight: 400;
  line-height: 15px;
  font-style: normal;
}

.cew-pvc-card-price {
  color: #ffffff;
  font-family: "Manrope";
  font-size: 11.4px;
  font-weight: 700;
  line-height: 16px;
  font-style: normal;
}

/* WooCommerce currency markup inside the price. */
.cew-pvc-card-price .woocommerce-Price-amount {
  white-space: nowrap;
}

/* On sale: struck original, prominent sale figure. */
.cew-pvc-card-price del {
  margin-right: 6px;
  font-size: 0.72em;
  font-weight: 500;
  opacity: 0.6;
  text-decoration: line-through;
}

.cew-pvc-card-price ins {
  text-decoration: none;
  background: transparent;
  color: inherit;
}

.cew-pvc-card .added_to_cart,
.cew-pvc-card .wc-forward {
  display: none;
}

/* ── Add button ──────────────────────────────────────────────── */
.cew-pvc-add {
  position: relative;
  flex-shrink: 0;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background-color: #f5f5f5 !important;
  color: #000000 !important;
  cursor: pointer;
  transition: background-color 200ms ease, color 200ms ease, transform 160ms cubic-bezier(0.34, 1.56, 0.64, 1);
  -webkit-appearance: none;
  appearance: none;
  background-image: none!important;
}

.cew-pvc-add .cew-pvc-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
}

.cew-pvc-add .cew-pvc-icon i {
  font-size: 20px;
}

.cew-pvc-add:hover {
  background-color: #e6e6e6;
  color: #000000;
}

.cew-pvc-add:active {
  transform: scale(0.94);
}

.cew-pvc-add:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

/* Loading + success + out-of-stock states for the AJAX add-to-cart. */
.cew-pvc-add.is-loading {
  pointer-events: none;
}

.cew-pvc-add.is-loading .cew-pvc-icon {
  opacity: 0;
}

.cew-pvc-add-spinner {
  position: absolute;
  width: 45%;
  height: 45%;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  opacity: 0;
  animation: cew-pvc-spin 700ms linear infinite;
}

.cew-pvc-add.is-loading .cew-pvc-add-spinner {
  opacity: 1;
}

.cew-pvc-add.is-added {
  background-color: #16a34a;
  color: #ffffff;
}

.cew-pvc-add.is-out-of-stock {
  opacity: 0.5;
  cursor: not-allowed;
}

@keyframes cew-pvc-spin {
  to { transform: rotate(360deg); }
}

/* ── Dots ────────────────────────────────────────────────────── */
.cew-pvc-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}

.cew-pvc-dot {
  width: 12px;
  height: 4px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background-color: #A1A1A1 !important;
  cursor: pointer;
  transition: width 0.3s ease, background-color 0.3s ease;
  -webkit-appearance: none;
  appearance: none;
  background-image: none!important;
}

.cew-pvc-dot[aria-selected="true"] {
  width: 24px;
  background-color: #bf6b68 !important;
}

.cew-pvc-dot:focus-visible {
  outline: 2px solid #bf6b68;
  outline-offset: 3px;
}

/* ── Dragging ────────────────────────────────────────────────── */
.cew-pvc.is-dragging .cew-pvc-viewport {
  cursor: grabbing;
}

/* Track the pointer with zero delay — the transition comes back on release. */
.cew-pvc.is-dragging .cew-pvc-slide {
  transition: none;
}

.cew-pvc.is-dragging .cew-pvc-card,
.cew-pvc.is-dragging .cew-pvc-card-name {
  pointer-events: none;
}

/* ── Reduced motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .cew-pvc-slide,
  .cew-pvc-dot,
  .cew-pvc-add,
  .cew-pvc-add .cew-pvc-icon,
  .cew-pvc-ctrl {
    transition: none;
  }

  .cew-pvc-slide.is-active .cew-pvc-card {
    animation: none;
  }

  .cew-pvc-add-spinner {
    animation-duration: 1400ms;
  }
}

/* ── Tablet ──────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .cew-pvc {
    --cew-pvc-slide-w: min(calc(100% / 2.3), 300px);
    max-width: 760px;
  }
}

@media (max-width: 768px) {
  .cew-pvc {
    --cew-pvc-slide-w: min(calc((100vw - 32px) / 1.4), 300px);
    --cew-pvc-gap: 12px;
    max-width: 460px;
  }
}
