/* ============================================================
   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, #f9fbfc);
  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: #00828c;
  background: rgba(28,164,175, .12);
  border: 1px solid rgba(28,164,175, .25);
  border-radius: 999px;
}

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

.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, #021521);
}

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

.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, #00828c, #54b7c1);
}

.cx-testim__dot:focus-visible {
  outline: 2px solid #00828c;
  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, #e0e5e9);
  border-radius: 20px;
  box-shadow:
    0 1px 2px rgba(2,21,33, .04),
    0 12px 32px -16px rgba(2,21,33, .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(28,164,175, .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, #021521);
  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, #e0e5e9);
  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, #f9fbfc);
  border: 1px solid var(--cx-line, #e0e5e9);
  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, #021521);
  letter-spacing: -.005em;
}

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

/* Decorative blocks */
.cx-testim__deco {
  position: absolute;
  width: 96px;
  height: 96px;
  border-radius: 18px;
  background: rgba(28,164,175, .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(28,164,175, .07); }

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

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

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

html[data-theme="dark"] .cx-testim__card {
  background: var(--cx-bg-soft, #0a1e2a);
  border-color: var(--cx-line, #1c3542);
  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, #f1f4f6); }
html[data-theme="dark"] .cx-testim__sep { background: var(--cx-line, #1c3542); }
html[data-theme="dark"] .cx-testim__author-name { color: var(--cx-ink, #f1f4f6); }
html[data-theme="dark"] .cx-testim__author-role { color: var(--cx-mute, #aab2b8); }

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

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

html[data-theme="dark"] .cx-testim__badge {
  color: #b3dde2;
  background: rgba(28,164,175, .14);
  border-color: rgba(28,164,175, .28);
}

html[data-theme="dark"] .cx-testim__deco--tl { background: rgba(28,164,175, .1); }
html[data-theme="dark"] .cx-testim__deco--br { background: rgba(28,164,175, .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__deco { display: none; }
  /* En móvil las cards FLUYEN con altura automática (en vez de absolute con altura
     fija = stage), para que las citas largas no se salgan. Solo se muestra la activa
     (swap instantáneo, sin fade — el display no transiciona, pero sin desbordes). */
  .cx-testim__stage { min-height: 0; }
  .cx-testim__card {
    position: relative; inset: auto;
    opacity: 1; transform: none; pointer-events: auto;
    display: none;
  }
  .cx-testim__card[data-active="true"] { display: flex; opacity: 1; transform: none; z-index: 1; }
}
