/**
 * Testimonials / omdömen – kundcitat.
 * Alla fält valfria utom quote. Clean, neutral.
 * Sektionsbakgrund/-text styrs via section settings (inte hårdkodad primary).
 * Depends: design/tokens.css
 */

.testimonials {
  padding: var(--section-padding-y) var(--content-gutter);
}

.testimonials__title {
  /* size/weight + margin följer global Site settings (design/rhythm.css) */
  text-align: center;
}

.testimonials__list {
  max-width: var(--content-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
}

@media (min-width: 600px) {
  .testimonials__list {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .testimonials__list {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Ensamt kort på sista raden centreras (t.ex. 9 st → 3×3; 8 st → sista raden 2; 7 st → sista ensam) */
@media (min-width: 600px) and (max-width: 899px) {
  .testimonials__card:last-child:nth-child(2n+1) {
    grid-column: 1 / -1;
    justify-self: center;
    max-width: calc(50% - var(--space-8) / 2);
  }
}
@media (min-width: 900px) {
  .testimonials__card:last-child:nth-child(3n+1) {
    grid-column: 2;
  }
}

.testimonials__card {
  margin: 0;
  padding: var(--space-6);
  border-radius: var(--radius-card, 8px);
  display: flex;
  flex-direction: column;
  background-color: color-mix(in srgb, currentColor 12%, transparent);
  border: 0.9px solid color-mix(in srgb, currentColor 25%, transparent);
}

.testimonials__quote {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  /* margin följer global rhythm.css (paragraph-after) */
  flex: 1;
}

.testimonials__quote::before {
  content: "\201C";
  font-size: 2em;
  line-height: 1;
  opacity: 0.6;
}

.testimonials__author {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: auto;
}

.testimonials__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.testimonials__name {
  font-size: var(--text-sm);
  font-weight: 600;
  font-style: normal;
}

.testimonials__role {
  font-size: var(--text-sm);
  margin: 0;
  opacity: 0.85;
}

/* Valfria fält – dölj om tomma */
/* Visa bara 3 från början; knapp "Visa alla recensioner" visar resten */
.testimonials__list--collapsed .testimonials__card:nth-child(n+4) {
  display: none;
}

.testimonials__show-all {
  text-align: center;
  margin-top: var(--space-8);
}

.testimonials__show-all .btn {
  min-width: 12rem;
}

/* Default toggle: light fill + dark text (good contrast even if theme primary is light).
 * Custom colors via Buttons drawer → man-btn-custom (same as other sections). */
.testimonials__show-all .btn:not(.man-btn-custom) {
  background-color: var(--color-bg, #fff);
  color: var(--color-heading, #1a1a1a);
  border-color: var(--color-bg, #fff);
}

.testimonials__show-all .btn:not(.man-btn-custom):hover {
  background-color: transparent;
  color: var(--color-bg, #fff);
  border-color: var(--color-bg, #fff);
}

.testimonials__title:empty {
  display: none;
}

.testimonials__author .testimonials__avatar[src=""],
.testimonials__avatar:not([src]),
.testimonials__name:empty,
.testimonials__role:empty {
  display: none;
}
