/* -------------------------------------------------------
   Testimonial spotlight (homepage "What our clients say" section)
   Behaviour lives in assets/js/testimonial-spot.js.
------------------------------------------------------- */
.testimonial-spot {
  --tm-base: var(--base-color, #dd6531);
  --tm-coral: #ef5f43;
  --tm-peach: #f38c4b;
  --tm-ink: var(--dark-gray, #292d36);
  --tm-muted: var(--medium-gray, #808291);
  --tm-line: rgba(41, 45, 54, 0.08);
  --tm-duration: 6500ms;
  --tm-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --tm-ease-spring: cubic-bezier(0.2, 0.9, 0.25, 1.25);
  position: relative;
  overflow: hidden;
  overflow: clip;
  background-color: #fff;
  background-image: radial-gradient(rgba(41, 45, 54, 0.07) 1px, transparent 1px);
  background-size: 26px 26px;
}

.tm-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  pointer-events: none;
}

.tm-glow-1 {
  width: 460px;
  height: 460px;
  top: 10%;
  right: -140px;
  background: var(--tm-peach);
  opacity: 0.16;
  animation: tm-drift 20s ease-in-out infinite;
}

.tm-glow-2 {
  width: 380px;
  height: 380px;
  bottom: -160px;
  left: -100px;
  background: var(--tm-base);
  opacity: 0.12;
  animation: tm-drift 24s ease-in-out infinite reverse;
}

/* Layout */
.tm-wrap {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 60px;
  align-items: center;
}

/* Heading */
.tm-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--tm-base);
  background: rgba(221, 101, 49, 0.08);
  border: 1px solid rgba(221, 101, 49, 0.25);
}

.tm-eyebrow-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tm-base);
  animation: tm-pulse 1.8s ease-out infinite;
}

.tm-heading {
  margin-bottom: 14px;
  font-weight: 600;
  letter-spacing: -2px;
  color: var(--tm-ink);
}

.tm-gradient-text {
  background: linear-gradient(90deg, var(--tm-base), var(--tm-peach), var(--tm-coral), var(--tm-base));
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: tm-text-flow 7s linear infinite;
}

.tm-sub {
  margin-bottom: 34px;
  font-size: 18px;
  line-height: 1.6;
  color: var(--tm-muted);
}

/* Client switcher */
.tm-people {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tm-person {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 12px 20px 12px 12px;
  text-align: left;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--tm-line);
  cursor: pointer;
  transition: background-color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease, transform 0.5s var(--tm-ease-out);
}

.tm-person:hover {
  transform: translateX(6px);
  border-color: rgba(221, 101, 49, 0.22);
}

.tm-person.is-active {
  background: #fff;
  border-color: rgba(221, 101, 49, 0.3);
  box-shadow: 0 24px 44px -28px rgba(221, 101, 49, 0.55);
}

.tm-person:focus-visible {
  outline: 3px solid rgba(221, 101, 49, 0.35);
  outline-offset: 3px;
}

.tm-avatar {
  position: relative;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

.tm-avatar img {
  position: absolute;
  inset: 5px;
  width: calc(100% - 10px);
  height: calc(100% - 10px);
  border-radius: 50%;
  object-fit: cover;
  filter: grayscale(0.6);
  transition: filter 0.4s ease, transform 0.5s var(--tm-ease-spring);
}

.tm-person:hover .tm-avatar img,
.tm-person.is-active .tm-avatar img {
  filter: none;
}

.tm-person.is-active .tm-avatar img {
  transform: scale(1.06);
}

/* Countdown ring around the active client's photo */
.tm-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.tm-ring circle {
  fill: none;
  stroke: rgba(41, 45, 54, 0.1);
  stroke-width: 2;
}

.tm-person.is-active .tm-ring circle {
  stroke: var(--tm-base);
  stroke-linecap: round;
  stroke-dasharray: 176;
  stroke-dashoffset: 0;
}

.tm-wrap.is-autoplay .tm-person.is-active .tm-ring circle {
  animation: tm-ring-fill var(--tm-duration) linear forwards;
}

.tm-wrap.is-paused .tm-person.is-active .tm-ring circle {
  animation-play-state: paused;
}

.tm-person-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.tm-person-name {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--tm-ink);
}

.tm-person-role {
  font-size: 14px;
  line-height: 1.4;
  color: var(--tm-muted);
}

.tm-person-arrow {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 15px;
  color: var(--tm-ink);
  background: rgba(41, 45, 54, 0.05);
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.3s ease, transform 0.45s var(--tm-ease-spring), background-color 0.3s ease, color 0.3s ease;
}

.tm-person:hover .tm-person-arrow,
.tm-person.is-active .tm-person-arrow {
  opacity: 1;
  transform: none;
}

.tm-person.is-active .tm-person-arrow {
  color: #fff;
  background: var(--tm-base);
}

/* Quote stage */
.tm-stage {
  --mx: 50%;
  --my: 50%;
  position: relative;
  padding: 56px 56px 44px;
  border-radius: 30px;
  color: #fff;
  background:
    radial-gradient(ellipse 80% 60% at 100% 0%, rgba(221, 101, 49, 0.28), transparent 60%),
    var(--tm-ink);
  box-shadow: 0 50px 90px -45px rgba(41, 45, 54, 0.75);
  overflow: hidden;
  isolation: isolate;
}

.tm-spot {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(360px circle at var(--mx) var(--my), rgba(255, 255, 255, 0.08), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.tm-stage:hover .tm-spot {
  opacity: 1;
}

.tm-quote-mark {
  position: absolute;
  top: -40px;
  right: 34px;
  z-index: -1;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 260px;
  line-height: 1;
  background: linear-gradient(180deg, var(--tm-peach), rgba(221, 101, 49, 0));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 0.55;
  animation: tm-float 6s ease-in-out infinite;
  pointer-events: none;
}

.tm-panels {
  display: grid;
}

/* All quotes share one cell so the card keeps the height of the longest */
.tm-panel {
  grid-area: 1 / 1;
  margin: 0;
  visibility: hidden;
}

.tm-panel.is-active {
  visibility: visible;
}

.tm-stars {
  display: flex;
  gap: 4px;
  margin-bottom: 22px;
  font-size: 17px;
  color: #ffb800;
}

.tm-stars i {
  opacity: 0;
  transform: scale(0.4);
}

.tm-panel.is-active .tm-stars i {
  animation: tm-pop 0.5s var(--tm-ease-spring) forwards;
}

.tm-panel.is-active .tm-stars i:nth-child(2) { animation-delay: 0.06s; }
.tm-panel.is-active .tm-stars i:nth-child(3) { animation-delay: 0.12s; }
.tm-panel.is-active .tm-stars i:nth-child(4) { animation-delay: 0.18s; }
.tm-panel.is-active .tm-stars i:nth-child(5) { animation-delay: 0.24s; }

.tm-text {
  margin: 0 0 34px;
  padding: 0;
  border: 0;
  font-size: 27px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: -0.5px;
  color: #fff;
}

/* Each word rises in when its quote becomes active (words wrapped by JS) */
.tm-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(14px);
  filter: blur(6px);
}

.tm-panel.is-active .tm-word {
  animation: tm-word-in 0.6s var(--tm-ease-out) forwards;
  animation-delay: calc(var(--w, 0) * 28ms + 0.15s);
}

.tm-author {
  display: flex;
  align-items: center;
  gap: 14px;
  opacity: 0;
  transform: translateY(12px);
}

.tm-panel.is-active .tm-author {
  animation: tm-word-in 0.7s var(--tm-ease-out) 0.5s forwards;
}

.tm-author img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.tm-author > span {
  display: flex;
  flex-direction: column;
}

.tm-author-name {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
}

.tm-author-role {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
}

.tm-controls {
  position: absolute;
  right: 40px;
  bottom: 40px;
  display: flex;
  gap: 10px;
}

.tm-nav {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  font-size: 18px;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  cursor: pointer;
  transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.4s var(--tm-ease-spring), box-shadow 0.3s ease;
}

.tm-nav:hover,
.tm-nav:focus-visible {
  background: var(--tm-base);
  border-color: transparent;
  box-shadow: 0 14px 30px -12px rgba(221, 101, 49, 0.9);
}

.tm-prev:hover {
  transform: translateX(-3px);
}

.tm-next:hover {
  transform: translateX(3px);
}

.tm-nav:active {
  transform: scale(0.92);
}

.tm-nav:focus-visible {
  outline: 3px solid rgba(221, 101, 49, 0.4);
  outline-offset: 3px;
}

/* Stats strip */
.tm-stats {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr);
  margin-top: 60px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--tm-line);
  box-shadow: 0 20px 50px -36px rgba(41, 45, 54, 0.45);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.tm-stat {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 28px 34px;
}

.tm-stat + .tm-stat {
  border-left: 1px solid var(--tm-line);
}

.tm-faces {
  display: flex;
  flex-shrink: 0;
}

.tm-faces img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #fff;
  box-shadow: 0 6px 14px -6px rgba(41, 45, 54, 0.4);
  transition: transform 0.45s var(--tm-ease-spring), margin 0.45s var(--tm-ease-out);
}

.tm-faces img + img {
  margin-left: -14px;
}

.tm-stat:hover .tm-faces img + img {
  margin-left: -6px;
}

.tm-faces img:hover {
  transform: translateY(-5px) scale(1.08);
}

.tm-stat-num {
  flex-shrink: 0;
  white-space: nowrap;
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -2px;
  font-variant-numeric: tabular-nums;
  color: var(--tm-ink);
}

.tm-stat-text {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--tm-muted);
}

.tm-stat-text strong {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--tm-base);
}

.tm-stat-stars {
  display: flex;
  gap: 3px;
  margin-bottom: 4px;
  font-size: 15px;
  color: #ffb800;
}

/* Scroll reveal (only hidden once JS is running) */
.tm-js .tm-reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s ease, transform 0.8s var(--tm-ease-out);
  transition-delay: calc(var(--tm-i, 0) * 120ms);
}

.tm-js .tm-reveal.is-visible {
  opacity: 1;
  transform: none;
}

.tm-js .tm-stage.tm-reveal {
  transform: translateY(40px) scale(0.96);
}

.tm-js .tm-stage.tm-reveal.is-visible {
  transform: none;
}

/* Faces and stars pop in one by one with the stats strip */
.tm-js .tm-stats .tm-faces img,
.tm-js .tm-stats .tm-stat-stars i {
  opacity: 0;
  transform: scale(0.4);
}

.tm-js .tm-stats.is-visible .tm-faces img {
  animation: tm-pop 0.55s var(--tm-ease-spring) forwards;
  animation-delay: calc(var(--tm-f, 0) * 90ms + 0.3s);
}

.tm-js .tm-stats.is-visible .tm-stat-stars i {
  animation: tm-pop 0.5s var(--tm-ease-spring) forwards;
  animation-delay: calc(var(--tm-s, 0) * 90ms + 0.5s);
}

/* Keyframes */
@keyframes tm-drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-40px, 30px) scale(1.12); }
}

@keyframes tm-pulse {
  0% { box-shadow: 0 0 0 0 rgba(221, 101, 49, 0.6); }
  100% { box-shadow: 0 0 0 10px rgba(221, 101, 49, 0); }
}

@keyframes tm-text-flow {
  to { background-position: 300% 0; }
}

@keyframes tm-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(12px) rotate(-4deg); }
}

@keyframes tm-ring-fill {
  from { stroke-dashoffset: 176; }
  to { stroke-dashoffset: 0; }
}

@keyframes tm-pop {
  to { opacity: 1; transform: none; }
}

@keyframes tm-word-in {
  to { opacity: 1; transform: none; filter: none; }
}

/* Responsive */
@media (max-width: 1199px) {
  .tm-wrap {
    gap: 40px;
  }

  .tm-text {
    font-size: 23px;
  }

  .tm-stat {
    padding: 24px;
  }

  .tm-stat-num {
    font-size: 38px;
  }
}

@media (max-width: 991px) {
  .tm-wrap {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Clients become a swipeable row above the quote */
  .tm-people {
    flex-direction: row;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    margin: 0 -15px;
    padding: 4px 15px 10px;
  }

  .tm-people::-webkit-scrollbar {
    display: none;
  }

  .tm-person {
    flex: 0 0 auto;
    width: auto;
    scroll-snap-align: start;
  }

  .tm-person:hover {
    transform: none;
  }

  .tm-person-arrow {
    display: none;
  }

  .tm-sub {
    margin-bottom: 24px;
  }

  .tm-stats {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .tm-stat:first-child {
    grid-column: 1 / -1;
    border-bottom: 1px solid var(--tm-line);
  }

  .tm-stat:nth-child(2) {
    border-left: 0;
  }
}

@media (max-width: 575px) {
  .tm-heading {
    letter-spacing: -1px;
  }

  .tm-sub {
    font-size: 16px;
  }

  .tm-stage {
    padding: 36px 24px 96px;
    border-radius: 24px;
  }

  .tm-quote-mark {
    font-size: 180px;
    right: 16px;
  }

  .tm-text {
    font-size: 19px;
  }

  .tm-controls {
    left: 24px;
    right: auto;
    bottom: 28px;
  }

  .tm-stats {
    grid-template-columns: minmax(0, 1fr);
    margin-top: 40px;
  }

  .tm-stat {
    padding: 20px 22px;
  }

  .tm-stat + .tm-stat {
    border-left: 0;
    border-top: 1px solid var(--tm-line);
  }

  .tm-stat:first-child {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    border-bottom: 0;
  }

  .tm-stat-num {
    font-size: 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tm-glow,
  .tm-eyebrow-dot,
  .tm-gradient-text,
  .tm-quote-mark {
    animation: none;
  }

  .tm-word,
  .tm-author,
  .tm-stars i,
  .tm-js .tm-stats .tm-faces img,
  .tm-js .tm-stats .tm-stat-stars i {
    opacity: 1;
    transform: none;
    filter: none;
    animation: none !important;
  }

  .tm-js .tm-reveal,
  .tm-person,
  .tm-avatar img {
    transition: none;
  }
}
