/* =============================================================
   Testimonial stack deck — cards stacked, top swipes to bottom
   ============================================================= */

.testimonials-sec .testimonials {
  width: 100%;
  max-width: none;
}

.testimonial-stack {
  position: relative;
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 8px 0 4px;
}

.testimonial-stack--video {
  max-width: min(480px, 100%);
}

.testimonial-stack__frame {
  display: grid;
  grid-template-columns: 1fr auto auto;
  grid-template-areas:
    ".    prev next"
    "deck deck deck";
  align-items: center;
  column-gap: 10px;
  row-gap: clamp(14px, 2vw, 20px);
  width: 100%;
  max-width: 660px;
  margin: 0 auto;
}

.testimonial-stack__frame .testimonial-stack__deck {
  grid-area: deck;
}

.testimonial-stack__btn--prev {
  grid-area: prev;
}

.testimonial-stack__btn--next {
  grid-area: next;
}

.testimonial-stack__deck {
  position: relative;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  touch-action: pan-x pinch-zoom;
  user-select: none;
  cursor: grab;
  perspective: 1400px;
  transform-style: preserve-3d;
}

/* Soft depth shadow under the whole deck */
.testimonial-stack__deck::after {
  content: '';
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -10px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.14) 0%, transparent 72%);
  pointer-events: none;
  z-index: 0;
}

.testimonial-stack__deck.is-dragging {
  cursor: grabbing;
}

.testimonial-stack__deck.is-instant .testimonial-stack__card {
  transition: none !important;
}

/* Measure natural heights with all cards visible at the same position */
.testimonial-stack__deck.is-measuring .testimonial-stack__card {
  visibility: visible !important;
  opacity: 1 !important;
  transform: none !important;
  pointer-events: none;
}

.testimonial-stack__card {
  --stack-i: 0;
  --stack-x: 0;
  --stack-peek: 18px;
  --stack-scale-step: 0.045;
  --stack-rot: 1.4deg;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  transform:
    translateX(calc(var(--stack-x) * 1px))
    translateY(calc(-1 * var(--stack-i) * var(--stack-peek)))
    rotate(calc(var(--stack-x) * var(--stack-rot) * 1deg))
    scale(calc(1 - var(--stack-i) * var(--stack-scale-step)));
  transform-origin: center top;
  z-index: calc(50 - var(--stack-i));
  opacity: calc(1 - var(--stack-i) * 0.11);
  pointer-events: none;
  transition:
    transform 0.56s cubic-bezier(0.33, 1, 0.54, 1),
    opacity 0.48s ease,
    filter 0.48s ease;
  backface-visibility: hidden;
  filter: brightness(calc(1 - var(--stack-i) * 0.04));
}

/* Cards peeking from behind the front card */
.testimonial-stack__card[data-stack-depth="behind"] .testimonial .info-part,
.testimonial-stack__card[data-stack-depth="behind"] .gift-note {
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.1),
    0 1px 0 rgba(255, 255, 255, 0.65) inset;
}

.testimonial-stack__card[data-stack-depth="behind"] .testimonial .info-part::after,
.testimonial-stack__card[data-stack-depth="behind"] .gift-note::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    rgba(57, 109, 27, 0.35) 0%,
    rgba(57, 109, 27, 0.12) 50%,
    rgba(57, 109, 27, 0.35) 100%
  );
  opacity: 0.85;
  pointer-events: none;
}

.testimonial-stack__card[data-active="true"] {
  pointer-events: auto;
  filter: brightness(1);
  z-index: 55;
}

/* Gentle idle pulse on cards behind the front */
.testimonial-stack__deck:not(.is-dragging):not(.is-instant):not(.is-measuring)[data-animating="0"]
  .testimonial-stack__card[data-stack-depth="behind"] {
  animation: stack-behind-breathe 4.2s ease-in-out infinite;
}

.testimonial-stack__deck:not(.is-dragging):not(.is-instant):not(.is-measuring)[data-animating="0"]
  .testimonial-stack__card[data-stack-depth="behind"]:nth-child(2) {
  animation-delay: 0.35s;
}

.testimonial-stack__deck:not(.is-dragging):not(.is-instant):not(.is-measuring)[data-animating="0"]
  .testimonial-stack__card[data-stack-depth="behind"]:nth-child(3) {
  animation-delay: 0.7s;
}

.testimonial-stack__deck:not(.is-dragging):not(.is-instant):not(.is-measuring)[data-animating="0"]
  .testimonial-stack__card[data-stack-depth="behind"]:nth-child(4) {
  animation-delay: 1.05s;
}

@keyframes stack-behind-breathe {
  0%, 100% {
    opacity: calc(1 - var(--stack-i) * 0.11);
    transform:
      translateX(calc(var(--stack-x) * 1px))
      translateY(calc(-1 * var(--stack-i) * var(--stack-peek)))
      rotate(calc(var(--stack-x) * var(--stack-rot) * 1deg))
      scale(calc(1 - var(--stack-i) * var(--stack-scale-step)));
  }
  50% {
    opacity: calc(1 - var(--stack-i) * 0.11 + 0.05);
    transform:
      translateX(calc(var(--stack-x) * 1px))
      translateY(calc(-1 * var(--stack-i) * var(--stack-peek) + 2px))
      rotate(calc(var(--stack-x) * var(--stack-rot) * 1deg))
      scale(calc(1 - var(--stack-i) * var(--stack-scale-step) + 0.008));
  }
}

/* Top card flies off to the left */
.testimonial-stack__card.is-exiting-next {
  transition:
    transform 0.52s cubic-bezier(0.55, 0.08, 0.38, 1),
    opacity 0.42s ease !important;
  transform: translateX(-115%) rotate(-12deg) scale(1) !important;
  opacity: 0 !important;
  z-index: 60 !important;
  pointer-events: none;
}

/* Bottom card rises to the top */
.testimonial-stack__card.is-entering-back {
  transition: none !important;
  transform:
    translateY(calc(var(--stack-peek) * 2.2))
    scale(0.9) !important;
  opacity: 0.35 !important;
  z-index: 45 !important;
  filter: brightness(0.92);
}

.testimonial-stack__card.is-dragging-card {
  transition: none !important;
  z-index: 70 !important;
  cursor: grabbing;
}

.testimonial-stack__card .testimonial,
.testimonial-stack__card .item {
  display: block;
  width: 100%;
}

.testimonial-stack__card .testimonial .info-part,
.testimonial-stack__card .testimonial .gift-note,
.testimonial-stack__card .gift-note {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-height: clamp(150px, 18vh, 200px);
  padding: clamp(22px, 2.6vw, 30px) clamp(30px, 4vw, 44px) clamp(20px, 2.4vw, 26px);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.3s ease;
}

.testimonial-stack__card .info-text {
  flex: 1 1 auto;
  font-size: clamp(1.05rem, 1.9vw, 1.2rem);
  line-height: 1.72;
}

/* Star rating */
.testimonial-stack__rating {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.info-text + .testimonial-stack__rating {
  margin-top: 12px;
}

.testimonial-stack__stars {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  line-height: 1;
}

.testimonial-stack__stars .bi {
  font-size: 15px;
  color: #e8a317;
}

.testimonial-stack__stars .bi-star {
  color: rgba(0, 0, 0, 0.15);
}

.testimonial-stack__rating-num {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(0, 0, 0, 0.55);
}

.testimonial-stack--video .testimonial-stack__rating {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 4;
  margin: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
}

.testimonial-stack--video .testimonial-stack__stars .bi-star {
  color: rgba(255, 255, 255, 0.35);
}

.testimonial-stack--video .testimonial-stack__rating-num {
  color: rgba(255, 255, 255, 0.92);
}

.testimonial-stack__card .author,
.testimonial-stack__card .name,
.testimonial-stack__card .cloffy-voices__author,
.testimonial-stack__card .dhatri-voices__author {
  flex-shrink: 0;
}

.testimonial-stack--video .testimonial-stack__card .video-testimonial {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* Prevent page hover lifts from fighting stack transforms */
.testimonial-stack__card .testimonial .info-part:hover,
.testimonial-stack__card .testimonial .gift-note:hover,
.testimonial-stack__card .gift-note:hover {
  transform: none !important;
}

.testimonial-stack--video .testimonial-stack__card .video-testimonial,
.testimonial-stack--video .testimonial-stack__card .video-wrapper {
  position: relative;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.testimonial-stack--video .reel-video {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  display: block;
}

.testimonial-stack__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: auto;
  height: auto;
  padding: 4px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--green, #396d1b);
  font-size: clamp(22px, 2.6vw, 28px);
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  transition: color 0.2s ease, opacity 0.2s ease;
  align-self: center;
}

.testimonial-stack__btn:hover {
  background: transparent;
  color: var(--green, #396d1b);
  opacity: 0.72;
  box-shadow: none;
  transform: none;
}

.page-cloffy .testimonial-stack .testimonial .info-part {
  padding: clamp(22px, 2.6vw, 30px) clamp(30px, 4vw, 44px) clamp(20px, 2.4vw, 26px) !important;
}

.page-fitlys .testimonial-stack .testimonial .info-part {
  padding: clamp(22px, 2.6vw, 30px) clamp(30px, 4vw, 44px) clamp(20px, 2.4vw, 26px) !important;
}

.page-dhatri .testimonial-stack .testimonial .info-part {
  padding: clamp(22px, 2.6vw, 30px) clamp(30px, 4vw, 44px) clamp(20px, 2.4vw, 26px) !important;
}

.page-gifting .testimonial-stack .testimonial .info-part {
  padding: clamp(22px, 2.6vw, 30px) clamp(30px, 4vw, 44px) clamp(20px, 2.4vw, 26px) !important;
}

.page-cloffy .testimonial-stack__btn {
  color: var(--cloffy-brown-mid, #6b3f30);
}

.page-cloffy .testimonial-stack__btn:hover {
  background: transparent;
  color: var(--cloffy-brown-mid, #6b3f30);
  opacity: 0.72;
}

.page-dhatri .testimonial-stack__btn {
  color: var(--dhatri-brown-mid, #4a8530);
}

.page-dhatri .testimonial-stack__btn:hover {
  background: transparent;
  color: var(--dhatri-brown-mid, #4a8530);
  opacity: 0.72;
}

.page-gifting .testimonial-stack__btn {
  color: var(--gift-green, #396d1b);
}

.page-gifting .testimonial-stack__btn:hover {
  background: transparent;
  color: var(--gift-green, #396d1b);
  opacity: 0.72;
}

.testimonials .owl-carousel.testimonial-stack-source {
  display: none !important;
}

@media screen and (max-width: 575px) {
  .testimonial-stack {
    max-width: 100%;
    padding-inline: 0;
  }

  .testimonial-stack__frame {
    max-width: 100%;
    column-gap: 8px;
    row-gap: 14px;
  }

  .testimonial-stack--video {
    max-width: 100%;
  }

  .testimonial-stack__btn {
    font-size: 24px;
  }

  .testimonial-stack__card {
    --stack-peek: 12px;
  }

  .testimonial-stack__card .testimonial .info-part,
  .testimonial-stack__card .testimonial .gift-note,
  .testimonial-stack__card .gift-note {
    min-height: 200px;
    padding: 24px 20px 20px;
  }
}

.page-cloffy .testimonial-stack__card[data-stack-depth="behind"] .info-part::after {
  background: linear-gradient(
    90deg,
    rgba(92, 52, 40, 0.4) 0%,
    rgba(92, 52, 40, 0.14) 50%,
    rgba(92, 52, 40, 0.4) 100%
  );
}

.page-dhatri .testimonial-stack__card[data-stack-depth="behind"] .info-part::after {
  background: linear-gradient(
    90deg,
    rgba(57, 109, 27, 0.4) 0%,
    rgba(57, 109, 27, 0.14) 50%,
    rgba(57, 109, 27, 0.4) 100%
  );
}

.page-gifting .testimonial-stack__card[data-stack-depth="behind"] .info-part::after {
  background: linear-gradient(
    90deg,
    rgba(57, 109, 27, 0.4) 0%,
    rgba(57, 109, 27, 0.14) 50%,
    rgba(57, 109, 27, 0.4) 100%
  );
}

.page-cloffy .testimonial-stack__stars .bi-star-fill,
.page-cloffy .testimonial-stack__stars .bi-star-half,
.page-dhatri .testimonial-stack__stars .bi-star-fill,
.page-dhatri .testimonial-stack__stars .bi-star-half,
.page-gifting .testimonial-stack__stars .bi-star-fill,
.page-gifting .testimonial-stack__stars .bi-star-half {
  color: #c4842a;
}

@media (prefers-reduced-motion: reduce) {
  .testimonial-stack__card {
    transition: opacity 0.2s ease;
  }

  .testimonial-stack__card[data-stack-depth="behind"] {
    animation: none !important;
  }

  .testimonial-stack__card.is-exiting-next {
    transform: translateX(-40%) !important;
    opacity: 0 !important;
  }

  .testimonial-stack__btn:hover {
    transform: none;
  }
}
