/* ==========================================================================
   TESTIMONIALS — layered photo-wall backdrop
   Two layers: a faded wave of client photos spread edge-to-edge behind
   (absolute, low opacity + a soft scrim over it), with the centered
   heading and the three review cards floating on top. Palette and
   reveal behaviour match the neighbouring sections (faq).
   testimonials.js adds .is-in and staggers the photos' transition-delay
   in DOM order so they rise one by one; it also drifts the columns
   slowly upward while the user scrolls through the section.
   ========================================================================== */

.mia-testi {
  position: relative;
  padding: clamp(140px, 18vh, 220px) clamp(16px, 3vw, 40px) clamp(70px, 9vh, 110px);
  background: linear-gradient(180deg, #ffffff 0%, #f2f7fc 55%, #ffffff 100%);
  overflow: hidden;
}

/* soft ambient glows so it blends with the neighbouring sections */
.mia-testi::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(40% 34% at 24% 30%, rgba(125, 184, 232, 0.14), transparent 70%),
    radial-gradient(36% 30% at 80% 66%, rgba(186, 156, 232, 0.09), transparent 70%);
  filter: blur(26px);
  pointer-events: none;
}

/* scrim above the photo layer — fades the photos further behind the
   centered content so the heading and cards stay readable */
.mia-testi::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(
    62% 58% at 50% 46%,
    rgba(242, 247, 252, 0.9) 0%,
    rgba(242, 247, 252, 0.5) 48%,
    rgba(242, 247, 252, 0) 78%
  );
  pointer-events: none;
}

/* ---------------- background photo layer (marquee) ---------------- */

.mia-testi__band {
  position: absolute;
  /* start below the section top so the photos keep a clear gap from
     the section above */
  inset: clamp(72px, 11vh, 140px) 0 0;
  z-index: 0;
  overflow: hidden;
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 1.2s ease;
}

/* backdrop fades in when the section is entered */
.mia-testi:not(.is-in) .mia-testi__band { opacity: 0; }

/* the track holds two identical groups and slides by half its width,
   so the photos glide slowly left to right in a seamless loop */
.mia-testi__track {
  display: flex;
  width: max-content;
  padding: clamp(18px, 3vh, 36px) 0;
  animation: mia-testi-marquee 90s linear infinite;
  will-change: transform;
}

@keyframes mia-testi-marquee {
  from { transform: translate3d(-50%, 0, 0); }
  to   { transform: translate3d(0, 0, 0); }
}

.mia-testi__group {
  display: flex;
  align-items: flex-start;
  gap: clamp(12px, 1.6vw, 20px);
  padding-right: clamp(12px, 1.6vw, 20px);
}

.mia-testi__col {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.4vw, 18px);
  flex: 0 0 auto;
  width: clamp(88px, 9.6vw, 134px);
}

/* wave — each column hangs a different distance from the top */
.mia-testi__col:nth-child(1)  { margin-top: 30px; }
.mia-testi__col:nth-child(2)  { margin-top: 0; }
.mia-testi__col:nth-child(3)  { margin-top: 60px; }
.mia-testi__col:nth-child(4)  { margin-top: 14px; }
.mia-testi__col:nth-child(5)  { margin-top: 80px; }
.mia-testi__col:nth-child(6)  { margin-top: 6px; }
.mia-testi__col:nth-child(7)  { margin-top: 46px; }
.mia-testi__col:nth-child(8)  { margin-top: 20px; }
.mia-testi__col:nth-child(9)  { margin-top: 70px; }
.mia-testi__col:nth-child(10) { margin-top: 10px; }
.mia-testi__col:nth-child(11) { margin-top: 54px; }
.mia-testi__col:nth-child(12) { margin-top: 26px; }
.mia-testi__col:nth-child(13) { margin-top: 66px; }
.mia-testi__col:nth-child(14) { margin-top: 4px; }

/* photo cards */
.mia-testi__card {
  margin: 0;
  border-radius: clamp(12px, 1.2vw, 18px);
  overflow: hidden;
  border: 1px solid rgba(22, 50, 79, 0.08);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 14px 30px -14px rgba(22, 50, 79, 0.3);
}

.mia-testi__card--sm   { aspect-ratio: 1 / 1.08; }
.mia-testi__card--tall { aspect-ratio: 1 / 1.55; }

.mia-testi__card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------------- foreground layer ---------------- */

.mia-testi__fg {
  position: relative;
  z-index: 2;
}

/* ---------------- centered heading ---------------- */

.mia-testi__copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: clamp(12px, 1.8vh, 20px);
  max-width: 620px;
  margin: 0 auto;
}

.mia-testi__eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(74, 144, 194, 0.3);
  background: rgba(125, 184, 232, 0.12);
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 500;
  font-size: clamp(11px, 0.9vw, 13px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #2b5f8f;
}

.mia-testi__title {
  margin: 0;
  font-family: 'Outfit', 'Inter', -apple-system, sans-serif;
  font-weight: 700;
  font-size: clamp(28px, 3.2vw, 46px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: #16324f;
}

.mia-testi__title em {
  font-style: normal;
  color: #4a97d8;
}

/* line — anchor — line rule under the heading */
.mia-testi__title::after {
  content: '';
  display: block;
  width: 190px;
  height: 16px;
  margin: 20px auto 0;
  background-color: #4a97d8;
  -webkit-mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='5' r='3'/%3E%3Cline x1='12' y1='22' x2='12' y2='8'/%3E%3Cpath d='M5 12H2a10 10 0 0 0 20 0h-3'/%3E%3C/svg%3E") center / 15px 15px no-repeat,
    linear-gradient(#000, #000) left center / 70px 1.5px no-repeat,
    linear-gradient(#000, #000) right center / 70px 1.5px no-repeat;
  mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='5' r='3'/%3E%3Cline x1='12' y1='22' x2='12' y2='8'/%3E%3Cpath d='M5 12H2a10 10 0 0 0 20 0h-3'/%3E%3C/svg%3E") center / 15px 15px no-repeat,
    linear-gradient(#000, #000) left center / 70px 1.5px no-repeat,
    linear-gradient(#000, #000) right center / 70px 1.5px no-repeat;
}


.mia-testi__para {
  margin: 0;
  max-width: 560px;
  font-family: 'Outfit', 'Inter', sans-serif;
  font-weight: 300;
  font-size: clamp(14px, 1.3vw, 17px);
  line-height: 1.65;
  color: #45607a;
}

/* copy reveal — heading rises as soon as the section is entered */
.mia-testi__copy > * {
  transition:
    opacity 0.7s ease,
    transform 0.85s cubic-bezier(0.22, 0.8, 0.3, 1);
}

.mia-testi:not(.is-in) .mia-testi__copy > * {
  opacity: 0;
  transform: translateY(30px);
}

.mia-testi.is-in .mia-testi__copy > :nth-child(2) { transition-delay: 0.08s; }
.mia-testi.is-in .mia-testi__copy > :nth-child(3) { transition-delay: 0.16s; }

/* ---------------- single-card quote slider ---------------- */

.mia-testi__slider {
  position: relative;
  max-width: min(680px, 92vw);
  margin: clamp(36px, 6vh, 60px) auto 0;
}

/* slider reveal — rises shortly after the heading */
.mia-testi__slider {
  transition:
    opacity 0.7s ease 0.3s,
    transform 0.85s cubic-bezier(0.22, 0.8, 0.3, 1) 0.3s;
}

.mia-testi:not(.is-in) .mia-testi__slider {
  opacity: 0;
  transform: translateY(40px);
}

.mia-testi__viewport {
  position: relative;
  min-height: 150px;
}

/* big decorative quote marks hugging the card's corners — anchored to
   the viewport (whose height tracks the active card), so they always
   sit right on the card no matter what's below */
.mia-testi__viewport::before,
.mia-testi__viewport::after {
  position: absolute;
  z-index: 3;
  font-family: 'Outfit', Georgia, serif;
  font-weight: 700;
  font-size: clamp(54px, 5.6vw, 80px);
  line-height: 1;
  color: #4a90c2;
  pointer-events: none;
}

.mia-testi__viewport::before {
  content: '\201C';
  top: -0.3em;
  left: -6px;
}

.mia-testi__viewport::after {
  content: '\201D';
  bottom: -0.32em;
  right: -6px;
}

/* each slide IS the card; the active one holds the layout, the rest
   sit stacked on top, hidden to the left, ready to slide in */
.mia-testi__slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: clamp(22px, 2.6vw, 34px) clamp(22px, 3vw, 38px);
  border-radius: 22px;
  border: 1px solid rgba(22, 50, 79, 0.1);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 20px 46px -20px rgba(22, 50, 79, 0.32);
  backdrop-filter: blur(6px);
  opacity: 0;
  transform: translateX(-84px) scale(0.98);
  pointer-events: none;
  transition:
    opacity 0.55s ease,
    transform 0.65s cubic-bezier(0.22, 0.8, 0.3, 1);
}

/* incoming card waits a beat so the outgoing one clearly leaves first */
.mia-testi__slide.is-active {
  position: relative;
  z-index: 2;
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition-delay: 0.18s;
}

/* outgoing card exits to the right immediately */
.mia-testi__slide.is-exit {
  z-index: 1;
  opacity: 0;
  transform: translateX(84px) scale(0.98);
  transition-delay: 0s;
}

.mia-testi__slide-text {
  margin: 0 0 clamp(14px, 2vh, 20px);
  font-family: 'Outfit', 'Inter', sans-serif;
  font-weight: 300;
  font-size: clamp(14px, 1.25vw, 16.5px);
  line-height: 1.7;
  color: #45607a;
}

.mia-testi__slide-name {
  display: block;
  font-family: 'Outfit', 'Inter', sans-serif;
  font-weight: 700;
  font-size: clamp(14px, 1.15vw, 16px);
  color: #16324f;
}

.mia-testi__slide-role {
  display: block;
  margin-top: 2px;
  font-family: 'Outfit', 'Inter', sans-serif;
  font-weight: 300;
  font-size: clamp(12px, 1vw, 13.5px);
  color: #45607a;
}

/* nav — prev/next arrows with dots between */
.mia-testi__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2vw, 22px);
  margin-top: clamp(16px, 2.4vh, 24px);
}

.mia-testi__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(74, 144, 194, 0.3);
  background: rgba(125, 184, 232, 0.14);
  color: #2b5f8f;
  cursor: pointer;
  transition:
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    background 0.3s ease,
    color 0.3s ease,
    border-color 0.3s ease;
}

.mia-testi__arrow:hover {
  transform: translateY(-2px) scale(1.06);
  color: #ffffff;
  background: linear-gradient(180deg, #0d84b5 0%, #006994 100%);
  border-color: transparent;
}

.mia-testi__arrow:active { transform: scale(0.94); }

.mia-testi__arrow:focus-visible {
  outline: 3px solid rgba(0, 105, 148, 0.4);
  outline-offset: 3px;
}

.mia-testi__dots {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mia-testi__dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(22, 50, 79, 0.18);
  cursor: pointer;
  transition:
    width 0.35s cubic-bezier(0.22, 0.9, 0.3, 1),
    background 0.3s ease;
}

.mia-testi__dot.is-on {
  width: 24px;
  background: linear-gradient(90deg, #0d84b5 0%, #4a90c2 100%);
}

.mia-testi__dot:focus-visible {
  outline: 3px solid rgba(0, 105, 148, 0.4);
  outline-offset: 3px;
}

/* ---------------- responsive ---------------- */

@media (max-width: 680px) {
  .mia-testi__col { width: clamp(76px, 17vw, 104px); }

  .mia-testi__band { opacity: 0.3; }
  .mia-testi:not(.is-in) .mia-testi__band { opacity: 0; }

  /* longer wrapped quotes on phones */
  .mia-testi__viewport { min-height: 230px; }
}

@media (prefers-reduced-motion: reduce) {
  .mia-testi__band,
  .mia-testi:not(.is-in) .mia-testi__band,
  .mia-testi__slider,
  .mia-testi:not(.is-in) .mia-testi__slider,
  .mia-testi__copy > *,
  .mia-testi:not(.is-in) .mia-testi__copy > * {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .mia-testi__band { opacity: 0.45; }
  .mia-testi__track { animation: none; }

  /* slides swap instantly instead of gliding */
  .mia-testi__slide { transition: none; }
}

/* ---------------- dark theme ---------------- */

[data-theme="dark"] .mia-testi {
  background: linear-gradient(180deg, #04101d 0%, #071a2e 45%, #04101d 100%);
}

[data-theme="dark"] .mia-testi::before {
  background:
    radial-gradient(42% 30% at 24% 26%, rgba(43, 95, 143, 0.25), transparent 70%),
    radial-gradient(38% 28% at 80% 62%, rgba(74, 42, 120, 0.16), transparent 70%);
}

[data-theme="dark"] .mia-testi::after {
  background: radial-gradient(
    62% 58% at 50% 46%,
    rgba(6, 21, 37, 0.9) 0%,
    rgba(6, 21, 37, 0.5) 48%,
    rgba(6, 21, 37, 0) 78%
  );
}

[data-theme="dark"] .mia-testi__card {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(13, 32, 52, 0.55);
  box-shadow: 0 14px 30px -14px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .mia-testi__eyebrow {
  background: rgba(13, 32, 52, 0.6);
  border-color: rgba(255, 255, 255, 0.12);
  color: #7db8e8;
}

[data-theme="dark"] .mia-testi__title { color: #e6eef7; }
[data-theme="dark"] .mia-testi__title em { color: #7db8e8; }
[data-theme="dark"] .mia-testi__title::after { background-color: #6fb1de; }

[data-theme="dark"] .mia-testi__para { color: #9db4c9; }

[data-theme="dark"] .mia-testi__viewport::before,
[data-theme="dark"] .mia-testi__viewport::after { color: #7db8e8; }

[data-theme="dark"] .mia-testi__slide {
  background: rgba(13, 32, 52, 0.82);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 46px -20px rgba(0, 0, 0, 0.65);
}

[data-theme="dark"] .mia-testi__slide-name { color: #e6eef7; }
[data-theme="dark"] .mia-testi__slide-role,
[data-theme="dark"] .mia-testi__slide-text { color: #9db4c9; }

[data-theme="dark"] .mia-testi__arrow {
  color: #7db8e8;
  background: rgba(43, 95, 143, 0.25);
  border-color: rgba(125, 184, 232, 0.25);
}

[data-theme="dark"] .mia-testi__arrow:hover {
  color: #ffffff;
  background: linear-gradient(180deg, #0d84b5 0%, #006994 100%);
  border-color: transparent;
}

[data-theme="dark"] .mia-testi__dot { background: rgba(230, 238, 247, 0.22); }

[data-theme="dark"] .mia-testi__dot.is-on {
  background: linear-gradient(90deg, #0d84b5 0%, #7db8e8 100%);
}
