/**
 * Testimonials section — self-contained styles
 *
 * Usage on any page:
 *   1. Include partial: <%- include('partials/testimonials') %>
 *   2. Pass `testimonials` array from the controller
 *   3. In page JS: import { initTestimonials } from "./testimonials.js"
 *      and call initTestimonials() (+ initSectionSliders() for arrows)
 *
 * CSS is loaded globally from partials/head.ejs — no extra link needed.
 */

/* ——— Section shell ——— */
.section-testimonials {
  padding: clamp(2rem, 5vw, 3.5rem) 0;
}

.section-testimonials .section-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.section-testimonials .section-top h2 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 700;
  line-height: 1.2;
  color: #111827;
}

.section-testimonials .section-top h2 span {
  color: var(--primary, #543ae3);
}

.section-testimonials .section-top p {
  margin: 8px 0 0;
  color: var(--text-muted, #64748b);
  font-size: 16px;
  font-weight: 600;
}

.section-testimonials .heading-line {
  width: 72px;
  height: 4px;
  border-radius: 20px;
  margin: 14px 0 0;
  background: linear-gradient(90deg, var(--primary, #543ae3), #14b8a6);
}

/* ——— Slider ——— */
.section-testimonials .section-slider-wrap {
  position: relative;
  margin: 0 -4px;
  padding: 0 4px;
  overflow: hidden;
}

.section-testimonials .section-slider-wrap::before,
.section-testimonials .section-slider-wrap::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 10px;
  width: 72px;
  z-index: 2;
  pointer-events: none;
}

.section-testimonials .section-slider-wrap::before {
  left: 0;
}

.section-testimonials .section-slider-wrap::after {
  right: 0;
}

.section-testimonials .section-slider-nav-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(84, 58, 227, 0.14);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #543ae3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow:
    0 4px 6px rgba(15, 23, 42, 0.04),
    0 14px 32px rgba(84, 58, 227, 0.14);
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.section-testimonials .section-slider-nav-btn[hidden],
.section-testimonials .section-slider-wrap:not(.is-scrollable) .section-slider-nav-btn {
  display: none !important;
}

.section-testimonials .section-slider-nav-btn svg {
  width: 18px;
  height: 18px;
}

.section-testimonials .section-slider-nav-btn--overlay {
  position: absolute;
  top: 50%;
  z-index: 4;
}

.section-testimonials .section-slider-nav-btn--prev {
  left: 10px;
  transform: translateY(-50%);
}

.section-testimonials .section-slider-nav-btn--next {
  right: 10px;
  transform: translateY(-50%);
}

.section-testimonials .section-slider-nav-btn--overlay:hover {
  background: #fff;
  color: #4630c4;
  border-color: rgba(84, 58, 227, 0.28);
  box-shadow:
    0 6px 10px rgba(15, 23, 42, 0.06),
    0 18px 40px rgba(84, 58, 227, 0.2);
}

.section-testimonials .section-slider-nav-btn--prev:hover {
  transform: translateY(-50%) scale(1.04);
}

.section-testimonials .section-slider-nav-btn--next:hover {
  transform: translateY(-50%) scale(1.04);
}

.section-testimonials .section-slider-nav-btn--overlay:active {
  transform: translateY(-50%) scale(0.98);
}

.section-testimonials .testimonials-slider {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding: 8px 4px 22px;
}

.section-testimonials .testimonials-slider::-webkit-scrollbar {
  display: none;
}

/* ——— Cards ——— */
.section-testimonials .testimonial-card {
  flex: 0 0 220px;
  width: 220px;
  aspect-ratio: 9 / 16;
  scroll-snap-align: start;
  border-radius: 18px;
  overflow: hidden;
  border: none;
  background: #0b0b12;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.section-testimonials .testimonial-card:hover,
.section-testimonials .testimonial-card:focus-visible {
  transform: translateY(-4px) scale(1.02);
  outline: none;
}

.section-testimonials .testimonial-media {
  position: relative;
  width: 100%;
  height: 100%;
  background: #111827;
  overflow: hidden;
}

.section-testimonials .testimonial-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.section-testimonials .testimonial-card:hover .testimonial-media img {
  transform: scale(1.06);
}

.section-testimonials .testimonial-shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.08) 0%, transparent 28%),
    linear-gradient(180deg, transparent 42%, rgba(0, 0, 0, 0.88) 100%);
  pointer-events: none;
}

.section-testimonials .testimonial-play {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  transform: translate(-50%, -50%) scale(0.92);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  opacity: 0.92;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
  pointer-events: none;
  padding-left: 3px;
}

.section-testimonials .testimonial-card:hover .testimonial-play,
.section-testimonials .testimonial-card:focus-visible .testimonial-play {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.06);
  background: #fff;
}

.section-testimonials .testimonial-score {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  max-width: calc(100% - 52px);
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  color: #fef3c7;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-testimonials .testimonial-overlay {
  position: absolute;
  left: 0;
  right: 44px;
  bottom: 0;
  z-index: 2;
  padding: 0 12px 14px;
  color: #fff;
  pointer-events: none;
}

.section-testimonials .testimonial-overlay h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.25;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.section-testimonials .testimonial-rank {
  margin: 0 0 4px;
  color: #fde68a;
  font-size: 0.78rem;
  font-weight: 700;
}

.section-testimonials .testimonial-location {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-testimonials .testimonial-location i {
  margin-right: 4px;
  opacity: 0.85;
}

.section-testimonials .testimonial-rail {
  position: absolute;
  right: 8px;
  bottom: 16px;
  z-index: 2;
  display: none;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.section-testimonials .testimonial-rail__btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ——— Modal (vertical Shorts viewer) ——— */
body.testimonial-modal-open {
  overflow: hidden;
}

.testimonial-modal[hidden] {
  display: none !important;
}

.testimonial-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.75rem, 2.5vw, 1.35rem);
  padding: 1rem;
}

.testimonial-modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
}

.testimonial-modal-dialog {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  width: min(380px, calc(100vw - 8rem));
  height: min(84vh, 720px);
  aspect-ratio: 9 / 16;
  max-height: 84vh;
  background: #000;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.55);
}

.testimonial-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  width: 44px;
  height: 44px;
  border: 2px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  background: #fff;
  color: #111827;
  cursor: pointer;
  font-size: 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.28),
    0 10px 28px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.testimonial-modal-close:hover {
  background: #543ae3;
  color: #fff;
  border-color: #fff;
  transform: scale(1.05);
}

.testimonial-nav-btn {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border: 2px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  background: white;
  color: #543ae3;
  cursor: pointer;
  font-size: 1.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.32),
    0 10px 24px rgba(84, 58, 227, 0.35);
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.testimonial-nav-btn:hover:not(:disabled) {
  /* background: #4630c7; */
  /* transform: scale(1.06); */
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.34),
    0 14px 30px rgba(84, 58, 227, 0.42);
}

.testimonial-nav-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: rgba(100, 116, 139, 0.75);
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.testimonial-nav-btn--prev,
.testimonial-nav-btn--next {
  top: auto;
  left: auto;
  right: auto;
}

.testimonial-modal-player {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
}

.testimonial-video {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  object-fit: contain;
}

.testimonial-modal-meta {
  position: absolute;
  left: 0;
  right: 0;
  display: none;
  bottom: 0;
  z-index: 2;
  padding: 2.5rem 1rem 1.15rem;
  color: #fff;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.78));
  pointer-events: none;
}

.testimonial-modal-meta h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.testimonial-modal-meta p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.85rem;
  font-weight: 600;
}

@media (max-width: 768px) {
  .section-testimonials .section-top {
    margin-bottom: 1.25rem;
  }

  .section-testimonials .testimonial-card {
    flex: 0 0 min(62vw, 200px);
    width: min(62vw, 200px);
  }

  .section-testimonials .section-slider-nav-btn {
    width: 42px;
    height: 42px;
  }

  .section-testimonials .section-slider-nav-btn--prev {
    left: 6px;
  }

  .section-testimonials .section-slider-nav-btn--next {
    right: 6px;
  }

  .testimonial-modal {
    padding: 0;
    gap: 0;
  }

  .testimonial-modal-close {
    top: 0.85rem;
    right: 0.85rem;
  }

  .testimonial-modal-dialog {
    width: 100%;
    height: 100%;
    max-height: 100%;
    aspect-ratio: auto;
    border-radius: 0;
  }

  .testimonial-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
  }

  .testimonial-nav-btn:hover:not(:disabled) {
    transform: translateY(-50%) scale(1.06);
  }

  .testimonial-nav-btn--prev {
    left: 0.65rem;
  }

  .testimonial-nav-btn--next {
    right: 0.65rem;
  }
}

@media (max-width: 480px) {
  .section-testimonials .testimonial-rail {
    display: none;
  }

  .section-testimonials .testimonial-overlay {
    right: 0;
  }
}
