/* ═══════════════════════════════════════════════════════════════════════
   TESTIMONIALS ("Working with me")
   Sits between Case Studies and Labs on the homepage.
   One long quote at a time, centred. Slides share a single grid cell so
   the section keeps the height of the longest quote and nothing jumps.
   Each quote arrives line by line, sharpening out of a soft blur, then
   the speaker (portrait, name, role) fades in underneath.
   The active pagination pill doubles as the autoplay progress bar.
   Behaviour lives in assets/js/modules/testimonials.js.
   ═══════════════════════════════════════════════════════════════════════ */

.testimonials {
  --tm-text: #ffffff;
  --tm-muted: rgba(255, 255, 255, 0.6);
  --tm-track: rgba(255, 255, 255, 0.22);
  --tm-fill: rgba(255, 255, 255, 0.85);
  --tm-btn: rgba(255, 255, 255, 0.1);
  --tm-btn-hover: rgba(255, 255, 255, 0.2);
  --tm-autoplay: 10s;

  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 var(--container-pad, 1rem) 128px;
}

.testimonials__title {
  margin: 0 0 28px 0;
  font-family: var(--font-body, 'Switzer', system-ui, sans-serif);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: var(--tm-muted);
  text-align: center;
}

/* ── Slides ───────────────────────────────────────────────────────── */
.testimonials__slides {
  display: grid;
  width: 100%;
  max-width: 40rem;
  touch-action: pan-y;
}

.testimonials__slide {
  grid-area: 1 / 1;
  align-self: center;
  margin: 0;
  text-align: center;
  /* The outgoing quote cuts out at once; only the incoming one fades */
  opacity: 0;
  visibility: hidden;
  transition: none;
}

.testimonials__slide.is-active {
  opacity: 1;
  visibility: visible;
  transition: opacity 1s ease;
}

/* With the line-by-line reveal the words do the fading themselves */
.testimonials.has-reveal .testimonials__slide.is-active {
  transition: none;
}

.testimonials__quote {
  margin: 0;
  padding: 0;
  border: 0;
  quotes: '\201C' '\201D';
}

.testimonials__quote p {
  margin: 0;
  font-family: var(--font-display, 'Switzer', system-ui, sans-serif);
  font-size: 24px;
  font-weight: 400;
  line-height: 32px;
  letter-spacing: -0.01em;
  color: var(--tm-text);
  text-wrap: balance;
}

.testimonials__quote p::before { content: open-quote; }
.testimonials__quote p::after  { content: close-quote; }

/* Once the script has split the quote into words, the quote marks live
   inside the first and last word so they arrive with the text. */
.testimonials__quote p.is-split::before,
.testimonials__quote p.is-split::after {
  content: none;
}

/* ── Line-by-line reveal ──────────────────────────────────────────
   Every word carries its line number (--tm-line, set by the script);
   words on the same line share a delay, so the quote lands a line at a
   time. Runs when a slide becomes active and the section is on screen. */
.tm-word {
  display: inline-block;
  opacity: 0;
  /* The blur and lift exist only inside the animation. Leaving a blur
     (or will-change) on every word of every quote kept some 200 separate
     graphics layers alive, which is the kind of load that makes phone
     browsers reload the page. */
}

.testimonials.is-inview .testimonials__slide.is-active .tm-word {
  animation: tm-word-in 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) both;
  animation-delay: calc(var(--tm-line, 0) * 110ms);
}

@keyframes tm-word-in {
  from { opacity: 0; filter: blur(8px); transform: translateY(6px); }
  to   { opacity: 1; filter: blur(0);   transform: none; }
}

/* ── Speaker: portrait, name, role ────────────────────────────────── */
.testimonials__by {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
  text-align: left;
  font-family: var(--font-body, 'Switzer', system-ui, sans-serif);
}

/* With the reveal on, the speaker follows the last line of the quote */
.testimonials.has-reveal .testimonials__by {
  opacity: 0;
}

.testimonials.has-reveal.is-inview .testimonials__slide.is-active .testimonials__by {
  animation: tm-by-in 0.6s ease both;
  animation-delay: calc(var(--tm-lines, 6) * 110ms + 250ms);
}

@keyframes tm-by-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.testimonials__avatar {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  corner-shape: round;
  object-fit: cover;
  /* placeholder fill until a real photo replaces the span */
  background:
    radial-gradient(120% 80% at 20% 0%, hsl(var(--tm-hue, 220) 55% 78% / 0.9) 0%, transparent 60%),
    linear-gradient(160deg, hsl(calc(var(--tm-hue, 220) - 10) 45% 40%), hsl(calc(var(--tm-hue, 220) + 30) 55% 22%));
}

.testimonials__who {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.testimonials__name {
  font-size: 15px;
  line-height: 1.4;
  color: var(--tm-text);
}

.testimonials__role {
  font-size: 13px;
  line-height: 1.4;
  color: var(--tm-muted);
}

/* ── Controls ─────────────────────────────────────────────────────── */
.testimonials__controls {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 40px;
}

.testimonials__arrow {
  all: unset;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9999px !important;
  corner-shape: round;
  background: var(--tm-btn);
  color: var(--tm-text);
  cursor: pointer;
  transition: background-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.testimonials__arrow:hover {
  background: var(--tm-btn-hover);
}

.testimonials__arrow:focus-visible,
.testimonials__dot:focus-visible {
  outline: 1.5px solid rgba(255, 255, 255, 0.6);
  outline-offset: 2px;
}

.testimonials__arrow svg {
  width: 14px;
  height: 14px;
  display: block;
}

.testimonials__dots {
  display: flex;
  align-items: center;
  gap: 0;
}

/* Each dot is a 24 x 24px tap area around a 4px mark; the padding is
   the tap area, the track inside is what you see. */
.testimonials__dot {
  all: unset;
  box-sizing: content-box;
  display: flex;
  align-items: center;
  width: 4px;
  height: 24px;
  padding: 0 10px;
  border-radius: 9999px !important;
  corner-shape: round;
  cursor: pointer;
  transition: width 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.testimonials__dot.is-active {
  width: 24px;
}

.testimonials__dot-track {
  position: relative;
  display: block;
  width: 100%;
  height: 4px;
  border-radius: 9999px;
  corner-shape: round;
  overflow: hidden;
  background: var(--tm-track);
}

.testimonials__dot-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--tm-fill);
  transform-origin: left center;
  transform: scaleX(0);
}

/* Progress: fills over the autoplay time, and its end triggers the next slide */
.testimonials__dot.is-active .testimonials__dot-fill {
  animation: tm-progress var(--tm-autoplay) linear forwards;
}

.testimonials.is-paused .testimonials__dot.is-active .testimonials__dot-fill {
  animation-play-state: paused;
}

/* No autoplay (reduced motion): the active pill is simply solid */
.testimonials.is-static .testimonials__dot.is-active .testimonials__dot-fill {
  animation: none;
  transform: none;
}

@keyframes tm-progress {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* ── Smaller screens ──────────────────────────────────────────────── */
@media screen and (max-width: 768px) {
  .testimonials {
    padding-bottom: 72px;
  }

  .testimonials__quote p {
    font-size: 20px;
    line-height: 28px;
  }

  .testimonials__controls {
    margin-top: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .testimonials__slide.is-active,
  .testimonials__dot {
    transition: none;
  }
}

/* Touch screens: arrows and dots are at least 44px tall */
@media (pointer: coarse) {
  .testimonials__arrow {
    width: 44px;
    height: 44px;
  }

  .testimonials__dot {
    height: 44px;
  }
}
