/**
 * Customer Testimonials Slider
 *
 * 2-row grid layout with CSS Grid equal-height system
 * Based on Figma design specs
 */

/* ========================================
   Container & Viewport
   ======================================== */

.customer-testimonials {
  position: relative;
  padding: clamp(48px, 6vw, 72px) 0; /* Vertical padding only */
}

.testimonials-viewport {
  position: relative;
  width: 100%;
  max-width: none; /* Remove 1280px cap for full width */
  margin: 0; /* Let it span full container width */
  padding-inline: clamp(16px, 4vw, 32px); /* Horizontal padding for gutters */
  overflow: hidden; /* Clip slides for fade gradients - physical clones handle peeks */
}

/* ========================================
   Swiper Setup
   ======================================== */

.testimonials-swiper {
  overflow: visible;
}

/* Hide until positioned (prevents FOUC) */
.testimonials-swiper:not(.slider-ready) {
  opacity: 0;
}

.testimonials-swiper.slider-ready {
  opacity: 1;
  transition: opacity 0.4s ease;
}

.testimonials-swiper .swiper-wrapper {
  align-items: stretch; /* Uniform column heights */
}

/* ========================================
   Slide & Grid Layout
   ======================================== */

/* Each slide contains a 2x2 grid of testimonials */
.testimonials-swiper .swiper-slide {
  width: clamp(720px, 62vw, 940px); /* ~60-65% viewport for centered slide */
}

.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* 2 columns */
  grid-template-rows: repeat(2, 1fr); /* 2 rows - equal heights */
  gap: 24px;
  align-items: stretch;
}

/* ========================================
   V2 Variant: Gap between 2 slides at center + peek
   ======================================== */

/* V2: Each slide width accounts for V1 grid gap so cards match */
/* V1 card width = (V1_slide - gap) / 2 = (940px - 24px) / 2 = 458px */
/* V2 slide should match V1 card width = 458px max */
[id^="testimonials2-"] .testimonials-swiper .swiper-slide {
  width: clamp(348px, 30.4vw, 458px); /* Match V1 card width: (720-24)/2 to (940-24)/2 */
}

/* V2: 2 cards stacked vertically per slide (1 column, not 2x2 grid) */
[id^="testimonials2-"] .testimonials-grid {
  grid-template-columns: 1fr; /* Single column - 2 cards stacked */
  grid-template-rows: auto auto; /* 2 rows for 2 cards */
}

/* ========================================
   Card Base Styles
   ======================================== */

.testimonial-card {
  border-radius: var(--Border-Radius-rounded-xl, 12px);
  border: 1px solid rgba(9, 9, 11, 0.10);
  background: linear-gradient(180deg, rgba(9, 9, 11, 0.04) 0%, rgba(9, 9, 11, 0.02) 100%);
  padding: 24px;

  /* Flexbox for internal spacing */
  display: flex;
  flex-direction: column;
  gap: 12px;

  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.testimonial-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

/* ========================================
   Header Layout
   ======================================== */

.testimonial-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0; /* Fixed height, doesn't grow */
}

.testimonial-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ========================================
   Typography - Exact Figma Specs
   ======================================== */

/* Name */
.testimonial-name {
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 20px; /* Figma Body/XL/SemiBold */
  font-weight: 600;
  line-height: 1.4; /* 28px / 20px = 1.4 */
  color: #000000;
  margin: 0;
}

/* Company Badge */
.testimonial-company-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  /* No background, no padding, no border-radius per Figma */
}

.testimonial-company-badge img {
  width: 16px;
  height: 16px;
  display: block;
  object-fit: contain;
}

.testimonial-company-badge span {
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.43; /* 20px / 14px */
  color: #006D6F; /* Teal 700 */
}

/* Job Title */
body.ds-2025 .testimonial-title {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 12px !important; /* Override body.ds-2025 p */
  font-weight: 400;
  line-height: 1.33 !important; /* 16px / 12px */
  color: #6C737F; /* Gray 500 */
}

/* Quote - Grows to fill available space */
body.ds-2025 .testimonial-quote {
  margin: 0;
  flex: 1; /* Takes remaining space in card */
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px !important; /* Override body.ds-2025 p */
  font-weight: 400;
  line-height: 1.5 !important; /* 24px / 16px */
  color: #384250; /* Gray 700 */

  /* Text truncation */
  display: -webkit-box;
  -webkit-line-clamp: 5; /* Allow up to 5 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========================================
   Fade Gradients
   ======================================== */

.testimonials-fade {
  position: absolute;
  top: 0;
  width: 240px; /* Wide gradient for strong fade effect */
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.testimonials-fade--left {
  left: 0;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 1) 0%,
    rgba(255, 255, 255, 0.8) 60%,
    rgba(255, 255, 255, 0) 100%
  );
}

.testimonials-fade--right {
  right: 0;
  background: linear-gradient(
    to left,
    rgba(255, 255, 255, 1) 0%,
    rgba(255, 255, 255, 0.8) 60%,
    rgba(255, 255, 255, 0) 100%
  );
}

/* ========================================
   Navigation
   ======================================== */

.testimonials-nav {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 40px;
}

.testimonials-nav-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid #E5E7EB;
  background: #FFFFFF;
  color: #006D6F;
  font-size: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.testimonials-nav-btn:hover:not(:disabled) {
  background: #006D6F;
  color: #FFFFFF;
  border-color: #006D6F;
}

.testimonials-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ========================================
   Responsive Breakpoints
   ======================================== */

@media (max-width: 1024px) {
  .testimonials-swiper .swiper-slide {
    width: clamp(580px, 70vw, 800px); /* Adjusted for tablet */
  }

  .testimonials-grid {
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .customer-testimonials {
    padding: 40px 0;
  }

  .testimonial-card {
    padding: 20px;
  }

  .testimonials-swiper .swiper-slide {
    width: clamp(280px, 65vw, 500px); /* Mobile width - 65% for peek effect */
  }

  .testimonials-grid {
    grid-template-columns: 1fr; /* Single column on mobile */
    grid-template-rows: auto; /* Natural heights */
    gap: 16px;
  }

  .testimonials-fade {
    width: 160px; /* Scaled for mobile */
    opacity: 0.6;
  }

  .testimonials-nav {
    margin-top: 32px;
    gap: 12px;
  }

  .testimonials-nav-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
}

@media (max-width: 640px) {
  .testimonial-quote {
    -webkit-line-clamp: 4; /* Shorter on mobile */
  }
}

/* ========================================
   Loop Jump - Disable Transitions
   ======================================== */

.testimonials-swiper.no-transitions,
.testimonials-swiper.no-transitions * {
  transition: none !important;
}

/* ========================================
   Reduced Motion Support
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  .testimonials-swiper,
  .testimonial-card,
  .testimonials-nav-btn {
    transition: none;
  }
}
