/* ============================================================
   cx-testim — Animated rotating testimonials (Emil Kowalski style)
   Vanilla port of @/components/blocks/animated-testimonials
   ============================================================ */

.cx-testim {
  position: relative;
  padding: 88px 0;
  background: var(--cx-bg-soft, #f8fafc);
  overflow: hidden;
  font-family: inherit;
}

.cx-testim__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 64px;
  align-items: center;
}

@media (min-width: 900px) {
  .cx-testim__inner { grid-template-columns: 1fr 1fr; gap: 80px; }
}

/* ---------- LEFT: heading + nav dots ---------- */

.cx-testim__head {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.cx-testim__badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .01em;
  color: #6d28d9;
  background: rgba(167, 139, 250, .12);
  border: 1px solid rgba(167, 139, 250, .25);
  border-radius: 999px;
}

.cx-testim__badge svg {
  width: 13px;
  height: 13px;
  fill: #a78bfa;
}

.cx-testim__title {
  margin: 0;
  font-size: clamp(1.85rem, 3.4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.025em;
  color: var(--cx-ink, #0f172a);
}

.cx-testim__sub {
  margin: 0;
  max-width: 540px;
  font-size: 1.04rem;
  line-height: 1.6;
  color: var(--cx-ink-soft, #475569);
}

.cx-testim__dots {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 12px;
}

.cx-testim__dot {
  height: 9px;
  width: 9px;
  border-radius: 999px;
  background: rgba(100, 116, 139, .35);
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: width .35s cubic-bezier(.4,0,.2,1), background .25s ease;
}

.cx-testim__dot[aria-current="true"] {
  width: 36px;
  background: linear-gradient(90deg, #3b82f6, #a78bfa);
}

.cx-testim__dot:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 3px;
}

/* ---------- RIGHT: stacked cards ---------- */

.cx-testim__stage {
  position: relative;
  min-height: 560px;
}

@media (min-width: 900px) {
  .cx-testim__stage { min-height: 580px; }
}

@media (min-width: 1100px) {
  .cx-testim__stage { min-height: 540px; }
}

.cx-testim__card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 32px 28px 26px;
  background: var(--cx-card, #fff);
  border: 1px solid var(--cx-line, #e2e8f0);
  border-radius: 20px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, .04),
    0 12px 32px -16px rgba(15, 23, 42, .12);
  opacity: 0;
  transform: translateX(80px) scale(.94);
  pointer-events: none;
  transition: opacity .55s cubic-bezier(.4,0,.2,1), transform .55s cubic-bezier(.4,0,.2,1);
  z-index: 0;
}

@media (min-width: 900px) {
  .cx-testim__card { padding: 36px 32px 28px; }
}

.cx-testim__card[data-active="true"] {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
  z-index: 10;
}

.cx-testim__stars {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
}

.cx-testim__star {
  width: 18px;
  height: 18px;
  fill: #f5b302;
}

.cx-testim__quote-wrap {
  position: relative;
  flex: 1;
  margin-bottom: 22px;
}

.cx-testim__quote-icon {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 32px;
  height: 32px;
  color: rgba(59, 130, 246, .18);
  transform: rotate(180deg);
  pointer-events: none;
}

.cx-testim__quote {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0;
  border: 0;
  font-size: .98rem;
  line-height: 1.6;
  color: var(--cx-ink, #0f172a);
  font-style: italic;
  letter-spacing: -.003em;
}

@media (min-width: 900px) {
  .cx-testim__quote { font-size: 1rem; line-height: 1.62; }
}

.cx-testim__quote::before { content: "“"; margin-right: 1px; }
.cx-testim__quote::after  { content: "”"; margin-left: 1px; }

.cx-testim__sep {
  height: 1px;
  background: var(--cx-line, #e2e8f0);
  margin: 0 0 18px;
}

.cx-testim__author {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cx-testim__avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--cx-bg-soft, #f8fafc);
  border: 1px solid var(--cx-line, #e2e8f0);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cx-testim__avatar img {
  width: 88%;
  height: 88%;
  object-fit: contain;
}

.cx-testim__author-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cx-testim__author-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--cx-ink, #0f172a);
  letter-spacing: -.005em;
}

.cx-testim__author-role {
  font-size: 13px;
  color: var(--cx-ink-soft, #64748b);
  line-height: 1.4;
}

/* Decorative blocks */
.cx-testim__deco {
  position: absolute;
  width: 96px;
  height: 96px;
  border-radius: 18px;
  background: rgba(59, 130, 246, .06);
  pointer-events: none;
  z-index: -1;
}

.cx-testim__deco--tl { top: -22px; right: -22px; }
.cx-testim__deco--br { bottom: -22px; left: -22px; background: rgba(167, 139, 250, .07); }

/* ---------- Dark mode ---------- */

html[data-theme="dark"] .cx-testim {
  background: var(--cx-bg, #0d0d10);
}

html[data-theme="dark"] .cx-testim__title { color: var(--cx-ink, #e7e7eb); }
html[data-theme="dark"] .cx-testim__sub { color: var(--cx-mute, #93939c); }

html[data-theme="dark"] .cx-testim__card {
  background: var(--cx-bg-soft, #16161b);
  border-color: var(--cx-line, #2a2a31);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, .4),
    0 12px 32px -16px rgba(0, 0, 0, .6);
}

html[data-theme="dark"] .cx-testim__quote { color: var(--cx-ink, #e7e7eb); }
html[data-theme="dark"] .cx-testim__sep { background: var(--cx-line, #2a2a31); }
html[data-theme="dark"] .cx-testim__author-name { color: var(--cx-ink, #e7e7eb); }
html[data-theme="dark"] .cx-testim__author-role { color: var(--cx-mute, #93939c); }

html[data-theme="dark"] .cx-testim__avatar {
  background: var(--cx-bg-mute, #1d1d23);
  border-color: var(--cx-line, #2a2a31);
}

html[data-theme="dark"] .cx-testim__dot { background: rgba(231, 231, 235, .25); }

html[data-theme="dark"] .cx-testim__badge {
  color: #c4b5fd;
  background: rgba(167, 139, 250, .14);
  border-color: rgba(167, 139, 250, .28);
}

html[data-theme="dark"] .cx-testim__deco--tl { background: rgba(59, 130, 246, .1); }
html[data-theme="dark"] .cx-testim__deco--br { background: rgba(167, 139, 250, .12); }

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .cx-testim__card { transition: opacity .2s ease; transform: none !important; }
}

/* ---------- Mobile ---------- */

@media (max-width: 640px) {
  .cx-testim { padding: 64px 0; }
  .cx-testim__inner { gap: 40px; }
  .cx-testim__card { padding: 28px 22px 24px; }
  .cx-testim__quote { font-size: 1rem; }
  .cx-testim__stage { min-height: 420px; }
  .cx-testim__deco { display: none; }
}
