/*
 * V3 section package: testimonials
 *
 * CSS isolation: every selector rooted under
 *   .pd-section--testimonials[data-pd-module]
 *
 * Class/attribute selectors only - no element selectors.
 *
 * Canonical tokens used:
 *   --pd-color-text, --pd-color-muted, --pd-color-surface,
 *   --pd-color-surface-alt, --pd-color-primary, --pd-color-accent
 *   --pd-font-heading, --pd-font-body
 *   --pd-radius-md, --pd-radius-lg
 *   --pd-space-2, --pd-space-3, --pd-space-4, --pd-space-5,
 *   --pd-space-6, --pd-space-8
 *
 * Variants:
 *   cards-grid  three-column card grid
 *   spotlight   one centered featured quote, restrained typography
 *   carousel    JS-driven sliding carousel of cards
 */

.pd-section--testimonials[data-pd-module] {
  display: block;
  width: 100%;
  font-family: var(--pd-font-body);
  box-sizing: border-box;
}

/* Background tone contrast.
 * Section bg/root color come from the shared [data-background-tone]
 * primitive in components.css. Quote cards keep their surface-alt
 * background so they remain legible on dark tones; only the section
 * header text needs scoped contrast inversion. */
/* PASS 4BO: __headline / __eyebrow / __intro tone-aware contrast
 * moved to shared [data-background-tone] rules in components.css. */

.pd-section--testimonials[data-pd-module] .pd-testimonials__inner {
  display: flex;
  flex-direction: column;
  gap: var(--pd-space-6);
}

.pd-section--testimonials[data-pd-module] .pd-testimonials__header {
  display: flex;
  flex-direction: column;
  gap: var(--pd-space-3);
  max-width: 48rem;
}

.pd-section--testimonials[data-pd-module][data-pd-variant="spotlight"] .pd-testimonials__header {
  margin-inline: auto;
  text-align: center;
  align-items: center;
}

/* PASS 4BO: testimonials section header typography moved to shared
 * .pd-eyebrow / .pd-section-heading / .pd-section-intro rules in
 * components.css. The placeholder modifier keeps its empty-state cue. */
.pd-section--testimonials[data-pd-module] .pd-testimonials__headline--placeholder {
  font-style: italic;
  opacity: 0.7;
}

.pd-section--testimonials[data-pd-module] .pd-testimonials__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--pd-space-5);
}

.pd-section--testimonials[data-pd-module] .pd-testimonials__item {
  display: block;
}

.pd-section--testimonials[data-pd-module] .pd-testimonials__quote {
  margin: 0;
  padding: var(--pd-space-5);
  background: var(--pd-color-surface-alt);
  border-radius: var(--pd-radius-lg);
  display: flex;
  flex-direction: column;
  gap: var(--pd-space-4);
  height: 100%;
  box-sizing: border-box;
}

.pd-section--testimonials[data-pd-module][data-pd-variant="cards-grid"] .pd-testimonials__quote-body::before,
.pd-section--testimonials[data-pd-module][data-pd-variant="carousel"] .pd-testimonials__quote-body::before {
  content: "\201C";
  display: block;
  font-family: var(--pd-font-heading);
  font-size: 2rem;
  line-height: 1;
  color: var(--pd-color-accent);
  margin-bottom: var(--pd-space-2);
  opacity: 0.55;
}

.pd-section--testimonials[data-pd-module] .pd-testimonials__quote-body {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--pd-color-text);
}

.pd-section--testimonials[data-pd-module] .pd-testimonials__author {
  display: flex;
  align-items: center;
  gap: var(--pd-space-3);
  padding: 0;
  margin: 0;
  font-style: normal;
  margin-top: auto;
}

.pd-section--testimonials[data-pd-module] .pd-testimonials__author-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--pd-color-surface);
}

.pd-section--testimonials[data-pd-module] .pd-testimonials__author-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pd-section--testimonials[data-pd-module] .pd-testimonials__author-avatar--initials {
  background: var(--pd-color-muted-bg);
  color: var(--pd-color-primary);
  font-family: var(--pd-font-heading);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.pd-section--testimonials[data-pd-module] .pd-testimonials__author-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pd-section--testimonials[data-pd-module] .pd-testimonials__author-name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--pd-color-text);
  line-height: 1.3;
}

.pd-section--testimonials[data-pd-module] .pd-testimonials__author-role {
  font-size: 0.875rem;
  color: var(--pd-color-muted);
  line-height: 1.3;
}

.pd-section--testimonials[data-pd-module] .pd-testimonials__empty {
  padding: var(--pd-space-6);
  background: var(--pd-color-surface-alt);
  border-radius: var(--pd-radius-md);
  text-align: center;
}

.pd-section--testimonials[data-pd-module] .pd-testimonials__empty-message {
  margin: 0;
  color: var(--pd-color-muted);
  font-size: 1rem;
  line-height: 1.5;
}

/* Variant: cards-grid */
.pd-section--testimonials[data-pd-module][data-pd-variant="cards-grid"] .pd-testimonials__list {
  grid-template-columns: 1fr;
}

@media (min-width: 40rem) {
  .pd-section--testimonials[data-pd-module][data-pd-variant="cards-grid"] .pd-testimonials__list {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 60rem) {
  .pd-section--testimonials[data-pd-module][data-pd-variant="cards-grid"] .pd-testimonials__list {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Variant: spotlight - one restrained centered quote.
 * Quote font is intentionally NOT enormous; the previous variant was
 * unreadably large. Here it's a touch above the body baseline only. */
.pd-section--testimonials[data-pd-module][data-pd-variant="spotlight"] .pd-testimonials__list {
  grid-template-columns: 1fr;
}

.pd-section--testimonials[data-pd-module][data-pd-variant="spotlight"] .pd-testimonials__quote {
  max-width: 44rem;
  margin-inline: auto;
  padding: var(--pd-space-6) var(--pd-space-6);
  background: var(--pd-color-surface-alt);
  text-align: center;
  align-items: center;
  gap: var(--pd-space-4);
}

.pd-section--testimonials[data-pd-module][data-pd-variant="spotlight"] .pd-testimonials__quote-body {
  font-family: var(--pd-font-body);
  font-size: clamp(1.0625rem, 1.6vw, 1.25rem);
  line-height: 1.55;
  font-weight: 500;
  max-width: 36rem;
}

.pd-section--testimonials[data-pd-module][data-pd-variant="spotlight"] .pd-testimonials__quote-body::before {
  content: "\201C";
  display: block;
  font-family: var(--pd-font-heading);
  font-size: 2.5rem;
  line-height: 1;
  color: var(--pd-color-accent);
  opacity: 0.45;
  margin-bottom: var(--pd-space-2);
}

.pd-section--testimonials[data-pd-module][data-pd-variant="spotlight"] .pd-testimonials__author {
  flex-direction: column;
  gap: var(--pd-space-2);
  align-items: center;
  margin-top: 0;
}

.pd-section--testimonials[data-pd-module][data-pd-variant="spotlight"] .pd-testimonials__author-avatar {
  width: 56px;
  height: 56px;
}

.pd-section--testimonials[data-pd-module][data-pd-variant="spotlight"] .pd-testimonials__author-info {
  align-items: center;
  text-align: center;
}

/* Variant: carousel
 *
 * Module-scoped JS (scripts.js) drives the slide track. Slide widths
 * are written inline by JS based on the responsive items-per-view, so
 * the CSS only owns the chrome (viewport, track wrapper, overflow,
 * arrows, dots) and the visual rhythm. The track transition is also
 * applied inline by JS so reduced-motion users get an instant jump
 * without a CSS-side override fight.
 */
.pd-section--testimonials[data-pd-module][data-pd-variant="carousel"] .pd-testimonials__carousel {
  position: relative;
  display: block;
}

.pd-section--testimonials[data-pd-module][data-pd-variant="carousel"] .pd-testimonials__carousel-viewport {
  overflow: hidden;
  margin-inline: 0;
  padding-block: var(--pd-space-2);
}

.pd-section--testimonials[data-pd-module][data-pd-variant="carousel"] .pd-testimonials__carousel-track {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  will-change: transform;
}

.pd-section--testimonials[data-pd-module][data-pd-variant="carousel"] .pd-testimonials__carousel-slide {
  flex: 0 0 100%;
  max-width: 100%;
  padding-inline: calc(var(--pd-space-3) / 2);
  box-sizing: border-box;
  display: flex;
}

.pd-section--testimonials[data-pd-module][data-pd-variant="carousel"] .pd-testimonials__carousel-slide .pd-testimonials__quote {
  flex: 1 1 auto;
}

/* Arrows: left/right outside the viewport, vertically centered, on top
 * of the slide chrome but always behind the dots. Hidden when the
 * viewport renders fewer slides than the configured items-per-view
 * (server-side-suppressed in the template). */
.pd-section--testimonials[data-pd-module][data-pd-variant="carousel"] .pd-testimonials__carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 999px;
  background: var(--pd-color-surface);
  color: var(--pd-color-text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
  transition: transform 160ms ease, box-shadow 160ms ease;
  z-index: 2;
}

.pd-section--testimonials[data-pd-module][data-pd-variant="carousel"] .pd-testimonials__carousel-arrow:hover {
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.pd-section--testimonials[data-pd-module][data-pd-variant="carousel"] .pd-testimonials__carousel-arrow:focus-visible {
  outline: 2px solid var(--pd-color-accent);
  outline-offset: 2px;
}

.pd-section--testimonials[data-pd-module][data-pd-variant="carousel"] .pd-testimonials__carousel-arrow--prev {
  left: calc(var(--pd-space-3) * -1);
}

.pd-section--testimonials[data-pd-module][data-pd-variant="carousel"] .pd-testimonials__carousel-arrow--next {
  right: calc(var(--pd-space-3) * -1);
}

@media (min-width: 60rem) {
  .pd-section--testimonials[data-pd-module][data-pd-variant="carousel"] .pd-testimonials__carousel-arrow--prev {
    left: calc(var(--pd-space-5) * -1);
  }
  .pd-section--testimonials[data-pd-module][data-pd-variant="carousel"] .pd-testimonials__carousel-arrow--next {
    right: calc(var(--pd-space-5) * -1);
  }
}

.pd-section--testimonials[data-pd-module][data-pd-variant="carousel"] .pd-testimonials__carousel-dots {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  gap: var(--pd-space-2);
  margin-top: var(--pd-space-4);
}

.pd-section--testimonials[data-pd-module][data-pd-variant="carousel"] .pd-testimonials__carousel-dot-item {
  display: inline-flex;
}

.pd-section--testimonials[data-pd-module][data-pd-variant="carousel"] .pd-testimonials__carousel-dot {
  width: 8px;
  height: 8px;
  border: none;
  border-radius: 999px;
  background: var(--pd-color-muted);
  opacity: 0.45;
  cursor: pointer;
  padding: 0;
  transition: opacity 160ms ease, transform 160ms ease, background 160ms ease;
}

.pd-section--testimonials[data-pd-module][data-pd-variant="carousel"] .pd-testimonials__carousel-dot:hover {
  opacity: 0.75;
}

.pd-section--testimonials[data-pd-module][data-pd-variant="carousel"] .pd-testimonials__carousel-dot.is-active {
  opacity: 1;
  background: var(--pd-color-accent);
  transform: scale(1.15);
}

.pd-section--testimonials[data-pd-module][data-pd-variant="carousel"] .pd-testimonials__carousel-dot:focus-visible {
  outline: 2px solid var(--pd-color-accent);
  outline-offset: 2px;
}

/* Reduced-motion: scripts.js already disables autoplay and zeroes the
 * track transition. CSS additionally drops the dot/arrow micro-easing
 * so nothing animates at all for these users. */
@media (prefers-reduced-motion: reduce) {
  .pd-section--testimonials[data-pd-module][data-pd-variant="carousel"] .pd-testimonials__carousel-arrow,
  .pd-section--testimonials[data-pd-module][data-pd-variant="carousel"] .pd-testimonials__carousel-dot {
    transition: none;
  }
  .pd-section--testimonials[data-pd-module][data-pd-variant="carousel"] .pd-testimonials__carousel-arrow:hover {
    transform: translateY(-50%);
  }
  .pd-section--testimonials[data-pd-module][data-pd-variant="carousel"] .pd-testimonials__carousel-dot.is-active {
    transform: none;
  }
}
