/* Testimonials — glassy messy paper stack (homepage) */
.testimonials-section {
  margin-top: 3rem;
  padding: 2.5rem 0.75rem 1.25rem;
  border-top: 1px solid rgba(211, 181, 114, 0.16);
  overflow: visible;
}

.testimonials-actions {
  display: flex;
  justify-content: center;
  margin-top: 1.65rem;
}

.testimonials-submit-btn {
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
}

.testimonials-submit-btn--quiet {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.72);
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.testimonials-submit-btn--quiet:hover,
.testimonials-submit-btn--quiet:focus-visible {
  color: #f0e6c8;
  border-color: rgba(211, 181, 114, 0.5);
  background: rgba(211, 181, 114, 0.1);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.25);
  outline: none;
}

.testimonials-submit-btn--quiet:disabled {
  opacity: 0.55;
  cursor: wait;
}

.testimonials-empty {
  color: rgba(255, 255, 255, 0.65);
  text-align: center;
  padding: 2rem 1rem;
}

/* Desktop-first: wide horizontal stack */
.testimonial-stack-wrap {
  position: relative;
  width: min(900px, 96%);
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 4rem 3.25rem;
  min-height: 400px;
  touch-action: pan-y;
  overflow: visible;
}

.testimonial-stack {
  position: relative;
  height: 300px;
  overflow: visible;
}

.testimonial-card {
  position: absolute;
  top: 0;
  left: 2%;
  right: 2%;
  bottom: auto;
  min-height: 240px;
  height: auto;
  padding: 1.4rem 1.75rem 1.55rem;
  border-radius: 1.4rem;
  background:
    linear-gradient(155deg, rgba(211, 181, 114, 0.11) 0%, transparent 42%),
    rgba(10, 12, 16, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transform-origin: 50% 88%;
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  box-sizing: border-box;
  max-width: 100%;
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
  /* Mobile uses CSS transitions; desktop uses WAAPI (see JS) */
  transition:
    transform 0.68s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.52s ease,
    box-shadow 0.45s ease;
}

.testimonial-card.is-top {
  opacity: 1;
  pointer-events: auto;
  z-index: 5;
  transform: translate3d(0, 0, 0) rotate(-2deg) scale(1);
  background:
    linear-gradient(155deg, rgba(211, 181, 114, 0.14) 0%, transparent 45%),
    rgba(8, 10, 14, 0.58);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  box-shadow:
    0 28px 64px rgba(0, 0, 0, 0.44),
    0 0 0 1px rgba(211, 181, 114, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Desktop: exaggerated peek — corners clearly visible on wide cards */
.testimonial-card.is-second {
  opacity: 0.96;
  z-index: 4;
  transform: translate3d(108px, 38px, 0) rotate(9.5deg) scale(0.935);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.34);
}

.testimonial-card.is-third {
  opacity: 0.76;
  z-index: 3;
  transform: translate3d(-118px, 62px, 0) rotate(-11deg) scale(0.865);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.testimonial-card.is-hidden {
  opacity: 0;
  visibility: hidden;
  transform: translate3d(-80px, 80px, 0) rotate(-14deg) scale(0.82);
  z-index: 0;
  pointer-events: none;
  transition: none;
}

.testimonial-card.is-exiting {
  opacity: 0;
  z-index: 9;
  pointer-events: none;
  visibility: visible;
  transform: translate3d(-115%, -22%, 0) rotate(-22deg) scale(0.9);
  transition:
    transform 0.62s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.5s ease;
  box-shadow: 0 30px 50px rgba(0, 0, 0, 0.35);
}

.testimonial-card__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.14);
}

.testimonial-card__name {
  font-size: 1.14rem;
  color: var(--sahaab-gold, #d3b572);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.testimonial-card__date {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.48);
  white-space: nowrap;
}

.testimonial-card__body {
  margin: 0;
  line-height: 1.95;
  font-size: 1.04rem;
  color: rgba(255, 255, 255, 0.9);
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.testimonial-stack-nav {
  display: flex;
  justify-content: center;
  gap: 0.85rem;
  margin-top: 0.5rem;
  position: relative;
  z-index: 6;
}

.testimonial-nav-btn {
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.32);
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.testimonial-nav-btn:hover {
  background: rgba(211, 181, 114, 0.16);
  border-color: rgba(211, 181, 114, 0.4);
  transform: scale(1.05);
}

/* Modal — glass */
.testimonial-modal[hidden] {
  display: none !important;
}

.testimonial-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-x: hidden;
}

.testimonial-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.testimonial-modal__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 440px);
  max-width: 100%;
  max-height: 90vh;
  overflow-x: hidden;
  overflow-y: auto;
  background:
    linear-gradient(160deg, rgba(211, 181, 114, 0.1) 0%, transparent 45%),
    rgba(12, 14, 18, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 1.25rem;
  padding: 1.25rem 1.35rem 1.5rem;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px) saturate(1.1);
  -webkit-backdrop-filter: blur(20px) saturate(1.1);
  box-sizing: border-box;
}

.testimonial-modal__panel > h3 {
  margin: 0 2rem 1rem 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
}

.testimonial-modal__close {
  position: absolute;
  left: 0.75rem;
  top: 0.5rem;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

.testimonial-form {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-width: 100%;
}

.testimonial-form label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.85);
}

.testimonial-form input,
.testimonial-form textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-top: 0.35rem;
  padding: 0.55rem 0.65rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-family: inherit;
  box-sizing: border-box;
}

.testimonial-form .auth-captcha {
  margin-bottom: 0.75rem;
  max-width: 100%;
}

.testimonial-form .auth-captcha-row,
.testimonial-form .auth-captcha-img {
  max-width: 100%;
}

.testimonial-form .auth-captcha-img {
  height: auto;
  border-radius: 0.5rem;
}

.testimonial-hp {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.testimonial-form-msg {
  font-size: 0.9rem;
  margin: 0.35rem 0 0.65rem;
}

.testimonial-form-msg.is-error {
  color: #f87171;
}

.testimonial-form-msg.is-success {
  color: #86efac;
}

.testimonial-form__submit {
  width: 100%;
  margin-top: 0.25rem;
  text-align: center;
}

.testimonial-toast {
  position: fixed;
  z-index: 10000;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%) translateY(120%);
  max-width: min(92vw, 360px);
  padding: 0.85rem 1.15rem;
  border-radius: 0.85rem;
  background: rgba(18, 20, 26, 0.88);
  border: 1px solid rgba(211, 181, 114, 0.35);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.92rem;
  line-height: 1.7;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: transform 0.35s ease, opacity 0.35s ease;
  pointer-events: none;
}

.testimonial-toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .testimonial-card {
    transition: opacity 0.25s ease !important;
  }
  .testimonial-toast {
    transition: opacity 0.2s ease;
  }
}

/* Mobile — CSS transitions (already works well) */
@media (max-width: 640px) {
  .testimonials-section {
    padding: 1.75rem 0.25rem 0.75rem;
    overflow-x: clip;
  }
  .testimonial-stack-wrap {
    width: 100%;
    max-width: 100%;
    padding: 1.5rem 1.35rem 2rem;
    min-height: 280px;
  }
  .testimonial-stack {
    height: 230px;
  }
  .testimonial-card {
    left: 6%;
    right: 6%;
    min-height: 190px;
    padding: 1rem 1.1rem 1.15rem;
    transition:
      transform 0.68s cubic-bezier(0.22, 1, 0.36, 1),
      opacity 0.52s ease,
      box-shadow 0.45s ease;
  }
  .testimonial-card.is-top {
    transform: translate3d(0, 0, 0) rotate(-2deg) scale(1);
  }
  .testimonial-card.is-second {
    transform: translate3d(22px, 16px, 0) rotate(5deg) scale(0.96);
  }
  .testimonial-card.is-third {
    transform: translate3d(-24px, 28px, 0) rotate(-6deg) scale(0.93);
  }
  .testimonial-card.is-exiting {
    transform: translate3d(-115%, -16%, 0) rotate(-18deg) scale(0.92);
    transition:
      transform 0.62s cubic-bezier(0.4, 0, 0.2, 1),
      opacity 0.5s ease;
  }
  .testimonial-card__name {
    font-size: 1.02rem;
  }
  .testimonial-card__body {
    -webkit-line-clamp: 4;
    font-size: 0.9rem;
    line-height: 1.9;
  }
  .testimonial-stack-nav {
    margin-top: 0.15rem;
  }
}

@media (min-width: 641px) and (max-width: 900px) {
  .testimonial-stack-wrap {
    width: min(760px, 96%);
    padding: 2.6rem 3rem 3rem;
  }
  .testimonial-card.is-second {
    transform: translate3d(88px, 32px, 0) rotate(8deg) scale(0.94);
  }
  .testimonial-card.is-third {
    transform: translate3d(-96px, 54px, 0) rotate(-9.5deg) scale(0.88);
  }
}
