/* ==========================================================================
   Testimonials — Google reviews / Desk Contabilidade
   --------------------------------------------------------------------------
   Adapts the "Nova" testimonial-v2 layout (three vertical marquee columns)
   to the Desk visual identity:

   - infinite vertical scroll with a different speed for each column;
   - soft mask on the top and bottom edges;
   - pause on hover, focus, off-screen and when the tab is hidden;
   - the static fallback (no JS) shows every review without animation;
   - all colours come from the site design tokens (navy, cream and blue).

   Class prefix: .desk-testimonials / .desk-testimonial
   ========================================================================== */

.desk-testimonials {
  /* Local aliases keep the component easy to retheme. */
  --dt-ink: var(--color-brand-dark, #023344);
  --dt-ink-soft: rgba(2, 51, 68, 0.74);
  --dt-ink-muted: rgba(2, 51, 68, 0.56);
  --dt-line: rgba(2, 51, 68, 0.1);
  --dt-line-hover: rgba(23, 96, 138, 0.32);
  --dt-surface: #ffffff;
  --dt-accent: var(--color-brand-accent-strong, #17608a);
  --dt-accent-soft: var(--color-brand-accent, #8fc8e8);
  --dt-shadow: 0 18px 40px -32px rgba(2, 51, 68, 0.45);
  --dt-shadow-hover: 0 24px 52px -32px rgba(2, 51, 68, 0.55);

  position: relative;
  isolation: isolate;
}

/* Subtle branded glow behind the header, keeping the section airy. */
.desk-testimonials::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  z-index: -1;
  height: 30rem;
  background: radial-gradient(
    circle at 50% 0%,
    rgba(143, 200, 232, 0.18) 0%,
    rgba(143, 200, 232, 0) 70%
  );
  pointer-events: none;
}

/* Hidden symbol sheet used by every star icon (one definition, many uses). */
.desk-testimonials__sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.desk-testimonials__header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  max-width: 48rem;
  margin: 0 auto;
  text-align: center;
}

.desk-testimonials__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

/* Google rating pill — acts as the link to the full review list. */
.desk-testimonials__summary {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.95rem;
  border: 1px solid var(--dt-line);
  border-radius: 9999px;
  background: var(--dt-surface);
  box-shadow: var(--dt-shadow);
  color: var(--dt-ink);
  text-decoration: none;
  transition:
    transform 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

.desk-testimonials__summary:hover {
  border-color: var(--dt-line-hover);
  box-shadow: var(--dt-shadow-hover);
  transform: translateY(-1px);
}

.desk-testimonials__summary:focus-visible {
  outline: 2px solid var(--dt-accent);
  outline-offset: 3px;
}

.desk-testimonials__score {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
}

.desk-testimonials__stars {
  display: inline-flex;
  flex-shrink: 0;
  gap: 0.125rem;
  color: var(--dt-accent);
}

.desk-testimonials__stars svg {
  display: block;
  width: 0.9rem;
  height: 0.9rem;
}

.desk-testimonials__summary-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  line-height: 1.2;
}

.desk-testimonials__summary-text strong {
  font-size: 0.8125rem;
  font-weight: 600;
}

.desk-testimonials__summary-text span {
  margin-top: 0.125rem;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--dt-ink-muted);
}

.desk-testimonials__summary-arrow {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  color: var(--dt-accent);
  transition: transform 0.3s ease;
}

.desk-testimonials__summary:hover .desk-testimonials__summary-arrow {
  transform: translate(1px, -1px);
}

/* Accessible pause/play control for the automatic movement.
   Hidden until JS enables the marquee, so it never appears as a dead control. */
.desk-testimonials__toggle {
  display: none;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.75rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--dt-line);
  border-radius: 9999px;
  background: transparent;
  color: var(--dt-ink-muted);
  font-family: var(--font-sans, Poppins, sans-serif);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition:
    color 0.3s ease,
    background-color 0.3s ease,
    border-color 0.3s ease;
}

.desk-testimonials__toggle:hover {
  border-color: var(--dt-line-hover);
  background: var(--dt-surface);
  color: var(--dt-ink);
}

.desk-testimonials__toggle:focus-visible {
  outline: 2px solid var(--dt-accent);
  outline-offset: 3px;
}

.desk-testimonials.is-enhanced .desk-testimonials__toggle {
  display: inline-flex;
}

.desk-testimonials__toggle-icon {
  width: 0.875rem;
  height: 0.875rem;
}

/* The play icon replaces the pause icon while the animation is paused. */
.desk-testimonials__toggle-icon--play,
.desk-testimonials[data-paused="true"] .desk-testimonials__toggle-icon--pause {
  display: none;
}

.desk-testimonials[data-paused="true"] .desk-testimonials__toggle-icon--play {
  display: block;
}

/* --------------------------------------------------------------------------
   Stage and columns
   -------------------------------------------------------------------------- */

.desk-testimonials__stage {
  margin-top: 2.75rem;
}

/* No-JS fallback: all reviews in a responsive grid. */
.desk-testimonials__source {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  align-items: start;
  gap: 1.25rem;
  max-width: 72rem;
  margin: 0 auto;
}

.desk-testimonials.is-enhanced .desk-testimonials__source {
  display: none;
}

.desk-testimonials__viewport {
  display: flex;
  justify-content: center;
  gap: clamp(0.875rem, 1.5vw, 1.5rem);
  max-width: 72rem;
  margin: 0 auto;
}

.desk-testimonials__viewport[hidden] {
  display: none;
}

/* The height limit + mask only apply after JS builds the seamless loop.
   Without JS the columns stay fully visible. */
.desk-testimonials.is-enhanced .desk-testimonials__viewport {
  max-height: min(720px, 78vh);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    #000 9%,
    #000 91%,
    transparent 100%
  );
  mask-image: linear-gradient(to bottom, transparent 0%, #000 9%, #000 91%, transparent 100%);
}

.desk-testimonials__column {
  width: 100%;
  max-width: 24rem;
  min-width: 0;
}

/* Mobile shows a single column with the full review list. */
.desk-testimonials__column:nth-child(n + 2) {
  display: none;
}

@media (width >= 48rem) {
  .desk-testimonials__column:nth-child(n + 2) {
    display: block;
  }
}

.desk-testimonials__track {
  display: flex;
  flex-direction: column;
  backface-visibility: hidden;
  will-change: transform;
}

/* Animation is enabled only after the group is cloned, so the loop never
   jumps on first paint or when JS is unavailable. */
.desk-testimonials.is-enhanced .desk-testimonials__track.is-ready {
  animation: desk-testimonials-scroll var(--desk-testimonials-duration, 36s) linear infinite;
}

/* Pause on hover/focus and when the section is off-screen or the tab is hidden.
   The .is-enhanced prefix matches the specificity of the animation rule above,
   so this later declaration wins without needing !important. */
.desk-testimonials.is-enhanced[data-paused="true"] .desk-testimonials__track,
.desk-testimonials.is-enhanced.is-offscreen .desk-testimonials__track,
.desk-testimonials.is-enhanced.is-page-hidden .desk-testimonials__track,
.desk-testimonials.is-enhanced .desk-testimonials__column:hover .desk-testimonials__track,
.desk-testimonials.is-enhanced .desk-testimonials__column:focus-within .desk-testimonials__track {
  animation-play-state: paused;
}

/* The group owns the gap at the bottom so two stacked copies form an exact
   -50% loop with no visible seam. */
.desk-testimonials__group {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-bottom: 1.25rem;
}

@keyframes desk-testimonials-scroll {
  from {
    transform: translate3d(0, 0, 0);
  }

  to {
    transform: translate3d(0, -50%, 0);
  }
}

/* --------------------------------------------------------------------------
   Review card
   -------------------------------------------------------------------------- */

.desk-testimonial {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: clamp(1.25rem, 2vw, 1.75rem);
  border: 1px solid var(--dt-line);
  border-radius: 1.25rem;
  background: var(--dt-surface);
  box-shadow: var(--dt-shadow);
  transition:
    transform 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

.desk-testimonial:hover {
  border-color: var(--dt-line-hover);
  box-shadow: var(--dt-shadow-hover);
  transform: translateY(-2px);
}

.desk-testimonial__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.desk-testimonial__stars {
  display: inline-flex;
  gap: 0.125rem;
  color: var(--dt-accent);
}

.desk-testimonial__star {
  display: block;
  width: 0.9rem;
  height: 0.9rem;
}

.desk-testimonial__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--dt-ink-muted);
}

.desk-testimonial__google {
  width: 0.85rem;
  height: 0.85rem;
}

.desk-testimonial__quote {
  margin: 0;
  font-size: clamp(0.9375rem, 0.9rem + 0.15vw, 1rem);
  font-weight: 400;
  line-height: 1.7;
  color: var(--dt-ink-soft);
}

.desk-testimonial__author {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 0.25rem;
}

.desk-testimonial__avatar {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid rgba(23, 96, 138, 0.16);
  border-radius: 9999px;
  background: rgba(143, 200, 232, 0.28);
  color: var(--dt-ink);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.desk-testimonial__identity {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.desk-testimonial__name {
  display: block;
  font-size: 0.9375rem;
  font-style: normal;
  font-weight: 600;
  line-height: 1.25;
  color: var(--dt-ink);
}

.desk-testimonial__meta {
  margin-top: 0.125rem;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--dt-ink-muted);
}

/* --------------------------------------------------------------------------
   Responsive refinements
   -------------------------------------------------------------------------- */

@media (width < 30rem) {
  .desk-testimonials__summary {
    gap: 0.55rem;
    padding: 0.5rem 0.8rem;
  }

  .desk-testimonials__score {
    font-size: 1.35rem;
  }

  .desk-testimonials__summary-text strong {
    font-size: 0.75rem;
  }

  .desk-testimonials__summary-text span {
    font-size: 0.625rem;
  }

  .desk-testimonials__toggle {
    padding-inline: 0.8rem;
    font-size: 0.6875rem;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  .desk-testimonials__track {
    animation: none !important;
  }

  .desk-testimonials__group--clone {
    display: none;
  }

  /* Show the original responsive grid instead of tall, unmoving columns. */
  .desk-testimonials.is-enhanced .desk-testimonials__source {
    display: grid;
  }

  .desk-testimonials.is-enhanced .desk-testimonials__viewport {
    display: none;
    max-height: none;
    overflow: visible;
    -webkit-mask-image: none;
    mask-image: none;
  }

  .desk-testimonials.is-enhanced .desk-testimonials__toggle {
    display: none;
  }

  .desk-testimonial:hover {
    transform: none;
  }
}
