/* ===============================
   Great Tales Media – Testimonials Section
   =============================== */

/* Section with off-white background */
.gtm-testimonials {
  position: relative;
  background: linear-gradient(180deg, #f5f3f1 0%, #f9f7f5 100%);
  padding: 80px 0 100px;
  text-align: center;
  color: #333;
  overflow: visible;
  z-index: 1;
}

/* Decorative accent */
.gtm-testimonials::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(
    circle at center,
    rgba(241, 120, 36, 0.04) 0%,
    rgba(241, 120, 36, 0.02) 40%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
}

.gtm-testimonials .container {
  position: relative;
  z-index: 2;
}

/* Headings */
.testi-heading {
  font-family: var(--font-accent);
  font-style: italic;
  font-weight: 400;
  color: var(--color-accent, #f17824);
  font-size: clamp(2.8rem, 4vw, 4.2rem);
  margin-bottom: 0.5rem;
  text-shadow: 0 3px 10px rgba(241, 120, 36, 0.15);
  letter-spacing: -0.01em;
}
.testi-sub {
  font-family: var(--font-primary);
  font-size: clamp(1.1rem, 1.5vw, 1.3rem);
  line-height: 1.5;
  color: #5a4a38;
  opacity: 0.9;
  margin-top: 0;
  margin-bottom: 3.5rem;
  max-width: 700px;
  margin-inline: auto;
  font-weight: 400;
}

/* Carousel viewport */
.testi-viewport {
  position: relative;
  min-height: 340px;
  margin: 10px auto;
  padding: 20px 0;
  max-width: var(--container-max, 1100px);
  overflow-x: hidden;
  overflow-y: visible;
  z-index: 2;
}

/* Edge fade overlays */
.testi-viewport::before,
.testi-viewport::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: clamp(20px, 5vw, 50px);
  pointer-events: none;
  z-index: 10;
}

.testi-viewport::before {
  left: 0;
  background: linear-gradient(to right, #f5f3f1, transparent);
}

.testi-viewport::after {
  right: 0;
  background: linear-gradient(to left, #f5f3f1, transparent);
}

/* Track */
.testi-track {
  display: flex;
  gap: 24px;
  will-change: transform;
  transition: transform 0.1s linear;
  padding: 10px 0;
}

/* Animation will be controlled by JavaScript with pause on hover/focus */
.testi-track.is-playing {
  /* JavaScript will handle transform updates */
}

/* Pause animation on hover or focus */
.testi-viewport:hover .testi-track,
.testi-viewport:focus-within .testi-track {
  /* JavaScript will pause the animation */
}

/* Card */
.testi-card {
  flex: 0 0 calc((1100px - 2 * 24px) / 3);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.85) 100%);
  border: 1px solid rgba(241, 120, 36, 0.1);
  border-radius: 20px;
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.06),
    0 2px 8px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  color: #2a2a2a;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  min-height: 240px;
  transition: transform 0.3s cubic-bezier(0.19, 1, 0.22, 1),
              box-shadow 0.3s cubic-bezier(0.19, 1, 0.22, 1),
              border-color 0.3s ease;
  position: relative;
  z-index: 5;
  transform-origin: center center;
  outline: 2px solid transparent;
  outline-offset: 3px;
}

/* Subtle shine effect */
.testi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, transparent 100%);
  border-radius: 20px 20px 0 0;
  pointer-events: none;
  opacity: 0.6;
}

.testi-card:hover,
.testi-card:focus {
  transform: translateY(-4px) scale(1.01);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.1),
    0 6px 16px rgba(0, 0, 0, 0.06),
    0 0 0 1px rgba(241, 120, 36, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 1);
  border-color: rgba(241, 120, 36, 0.2);
  z-index: 20;
}
.testi-card:focus {
  outline-color: var(--color-accent);
}
.testi-card:focus:not(:focus-visible) {
  outline: none;
}

/* Text */
.testi-text {
  font-family: var(--font-primary);
  font-size: 1.075rem;
  line-height: 1.65;
  margin-bottom: 1.25rem;
  color: #3a3a3a;
  position: relative;
  z-index: 1;
  font-weight: 400;
}

/* Quote marks */
.testi-text::before {
  content: "\201C";
  position: absolute;
  top: -20px;
  left: -10px;
  font-size: 4rem;
  color: rgba(241, 120, 36, 0.12);
  font-family: Georgia, serif;
  line-height: 1;
  z-index: -1;
}

/* Author row */
.testi-author {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 0;
  position: relative;
  z-index: 1;
}
.testi-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(241, 120, 36, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.testi-card:hover .testi-avatar {
  transform: scale(1.05);
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.12),
    0 0 0 1px rgba(241, 120, 36, 0.2);
}
.testi-meta {
  text-align: left;
}
.testi-name {
  font-family: var(--font-primary);
  font-weight: 700;
  color: var(--color-accent, #f17824);
  font-size: 1.1rem;
  margin-bottom: 2px;
  line-height: 1.2;
}
.testi-role {
  font-family: var(--font-primary);
  line-height: 1.3;
  font-size: 0.875rem;
  color: rgba(60, 60, 60, 0.75);
  font-weight: 500;
}

/* Responsive */
@media (max-width: 1024px) {
  .testi-card {
    flex: 0 0 calc((100% - 24px) / 2);
    min-height: 240px;
  }
}

@media (max-width: 760px) {
  .gtm-testimonials {
    padding: 60px 0 80px;
  }

  .testi-viewport {
    min-height: 280px;
  }

  .testi-track { gap: 12px; }
  .testi-card {
    flex: 0 0 65%;
    min-height: 220px;
    padding: 24px 18px;
    border-radius: 16px;
  }

  .testi-text {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1rem;
  }

  .testi-text::before {
    font-size: 3rem;
    top: -16px;
    left: -8px;
  }

  .testi-avatar {
    width: 48px;
    height: 48px;
    border-width: 2px;
  }

  .testi-name {
    font-size: 1rem;
  }

  .testi-role {
    font-size: 0.825rem;
  }

  .testi-heading {
    line-height: 1.1;
    font-size: clamp(2.2rem, 8vw, 2.8rem);
    margin-bottom: 0.75rem;
  }

  .testi-sub {
    font-size: 1.05rem;
    line-height: 1.5;
    margin-bottom: 2.5rem;
    padding: 0 1rem;
  }
}

/* Gradient overlays for fade effect */
.gtm-testimonials::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 40px;
  pointer-events: none;
  z-index: 3;
  opacity: 1;
  background: linear-gradient(to top, #f5f3f1 0%, rgba(245,243,241,0.5) 60%, transparent 100%);
}

/* Reset layout after testimonials */
#testimonials, .gtm-testimonials {
  display: block;
  width: 100%;
}

/* Prevent horizontal overflow from flex */
.testi-track {
  width: 100%;
}

/* ===============================
   Reduced Motion Support
   =============================== */
@media (prefers-reduced-motion: reduce) {
  .testi-track {
    /* JavaScript will disable auto-scroll for users who prefer reduced motion */
  }

  .testi-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease, outline 0.2s ease;
  }
}