
.ch-testimonials {
  --testimonials-content-width: 70rem;
  --testimonials-header-width: 56rem;
  --testimonials-page-gutter: clamp(28px, 5vw, 88px);
  --testimonials-text: #151515;
  --testimonials-muted: rgba(21, 21, 21, 0.52);
  --testimonials-rule: rgba(21, 21, 21, 0.14);
  --testimonials-section-bg: #ECE9E1;

  position: relative;
  width: 100%;
  padding-block: clamp(76px, 8vw, 112px) clamp(88px, 8.5vw, 124px);
  color: var(--testimonials-text);
  background: var(--testimonials-section-bg);
}

@media (prefers-color-scheme: dark) {
  .ch-testimonials {
    --testimonials-text: #f4f4f2;
    --testimonials-muted: rgba(244, 244, 242, 0.58);
    --testimonials-rule: rgba(255, 255, 255, 0.16);
    --testimonials-section-bg: #151513;
  }
}

.ch-testimonials[data-theme="light"] {
  --testimonials-text: #151515;
  --testimonials-muted: rgba(21, 21, 21, 0.52);
  --testimonials-rule: rgba(21, 21, 21, 0.14);
  --testimonials-section-bg: #ECE9E1;
}

.ch-testimonials[data-theme="dark"] {
  --testimonials-text: #f4f4f2;
  --testimonials-muted: rgba(244, 244, 242, 0.58);
  --testimonials-rule: rgba(255, 255, 255, 0.16);
  --testimonials-section-bg: #151513;
}

.ch-testimonials__inner {
  width: min(
    calc(100% - (var(--testimonials-page-gutter) * 2)),
    var(--testimonials-header-width)
  );
  margin-inline: auto;
}

.ch-testimonials__header {
  display: grid;
  grid-template-columns: minmax(260px, 0.6fr) 1px minmax(360px, 1.08fr);
  align-items: center;
  gap: clamp(24px, 3.4vw, 48px);
}

.ch-testimonials__title {
  margin: 0;
  color: inherit;
  font-size: clamp(42px, 4vw, 58px);
  line-height: 1;
  letter-spacing: -0.058em;
  font-weight: 760;
}

.ch-testimonials__divider {
  width: 1px;
  height: 50px;
  background: var(--testimonials-rule);
}

.ch-testimonials__description {
  max-width: 34rem;
  margin: 0;
  color: var(--testimonials-muted);
  font-size: clamp(14px, 1.04vw, 16px);
  line-height: 1.55;
  text-wrap: pretty;
}

.ch-testimonials__rule {
  width: 100%;
  height: 1px;
  margin-top: clamp(26px, 3vw, 42px);
  background: var(--testimonials-rule);
}

@media (max-width: 760px) {
  .ch-testimonials {
    --testimonials-page-gutter: 18px;
    padding-block: 64px 76px;
  }

  .ch-testimonials__header {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .ch-testimonials__divider {
    display: none;
  }

  .ch-testimonials__title {
    font-size: clamp(40px, 11vw, 54px);
  }
}

.ch-testimonials__carousel {
  --testimonials-page-gutter: clamp(28px, 5vw, 88px);
  --testimonials-content-width: 70rem;
  --testimonials-container-inset:
    max(
      var(--testimonials-page-gutter),
      calc((100vw - var(--testimonials-content-width)) / 2)
    );
  --testimonials-edge-fade: clamp(42px, 5vw, 64px);
  --testimonials-fade-inset: 24px;
  --testimonials-fade-bg: #ECE9E1;
  --testimonials-fade-clear: rgba(236, 233, 225, 0);

  --testimonials-card-bg: #fff;
  --testimonials-card-text: #171717;
  --testimonials-card-muted: #77777f;
  --testimonials-card-border: rgba(45, 45, 47, 0.16);

  --testimonials-control-bg: rgba(255, 255, 255, 0.94);
  --testimonials-control-text: #171717;
  --testimonials-control-border: rgba(20, 20, 20, 0.12);
  --testimonials-control-primary-bg: #111;
  --testimonials-control-primary-text: #fff;

  position: relative;
  width: 100%;
  min-width: 0;
  margin-top: clamp(20px, 2.4vw, 34px);
  color-scheme: light dark;
}

.ch-testimonials__carousel::before,
.ch-testimonials__carousel::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: calc(
    var(--testimonials-container-inset) +
    var(--testimonials-fade-inset) +
    var(--testimonials-edge-fade)
  );
  pointer-events: none;
  z-index: 12;
}

.ch-testimonials__carousel::before {
  left: 0;
  background:
    linear-gradient(
      90deg,
      var(--testimonials-fade-bg) 0,
      var(--testimonials-fade-bg) calc(var(--testimonials-container-inset) + var(--testimonials-fade-inset)),
      var(--testimonials-fade-clear) 100%
    );
}

.ch-testimonials__carousel::after {
  right: 0;
  background:
    linear-gradient(
      270deg,
      var(--testimonials-fade-bg) 0,
      var(--testimonials-fade-bg) calc(var(--testimonials-container-inset) + var(--testimonials-fade-inset)),
      var(--testimonials-fade-clear) 100%
    );
}

@media (prefers-color-scheme: dark) {
  .ch-testimonials__carousel {
    --testimonials-card-bg: #1b1b1e;
    --testimonials-card-text: #f7f7f5;
    --testimonials-card-muted: #a7a7ad;
    --testimonials-card-border: rgba(255, 255, 255, 0.12);

    --testimonials-control-bg: rgba(28, 28, 30, 0.94);
    --testimonials-control-text: #f5f5f3;
    --testimonials-control-border: rgba(255, 255, 255, 0.14);
    --testimonials-control-primary-bg: #f4f4f2;
    --testimonials-control-primary-text: #141414;
    --testimonials-fade-bg: #151513;
    --testimonials-fade-clear: rgba(21, 21, 19, 0);
  }
}

.ch-testimonials__carousel[data-theme="light"] {
  --testimonials-card-bg: #fff;
  --testimonials-card-text: #171717;
  --testimonials-card-muted: #77777f;
  --testimonials-card-border: rgba(45, 45, 47, 0.16);
}

.ch-testimonials__carousel[data-theme="dark"] {
  --testimonials-card-bg: #1b1b1e;
  --testimonials-card-text: #f7f7f5;
  --testimonials-card-muted: #a7a7ad;
  --testimonials-card-border: rgba(255, 255, 255, 0.12);
  --testimonials-fade-bg: #151513;
  --testimonials-fade-clear: rgba(21, 21, 19, 0);
}

.ch-testimonials__viewport {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  padding-block: 32px 70px;
  scrollbar-width: none;
  scroll-snap-type: none;
  overscroll-behavior-x: contain;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

.ch-testimonials__viewport::-webkit-scrollbar {
  display: none;
}

.ch-testimonials__track {
  display: flex;
  align-items: center;
  gap: 16px;
  width: max-content;
  padding-inline: var(--testimonials-container-inset);
}

.ch-testimonials__card {
  --rot: 0deg;
  --lift: 0px;
  --rx: 0deg;
  --ry: 0deg;

  flex: 0 0 clamp(282px, 24vw, 336px);
  min-height: 132px;
  padding: 18px 20px 17px;
  border: 1px solid var(--testimonials-card-border);
  border-radius: 18px;
  color: var(--testimonials-card-text);
  background: var(--testimonials-card-bg);
  box-shadow:
    0 28px 54px rgba(0, 0, 0, 0.11),
    0 5px 14px rgba(0, 0, 0, 0.04);
  transform:
    translateY(var(--lift))
    rotate(var(--rot))
    rotateX(var(--rx))
    rotateY(var(--ry));
  transition:
    transform 320ms cubic-bezier(.22,.61,.36,1),
    box-shadow 320ms ease,
    opacity 240ms ease;
  transform-style: preserve-3d;
}

.ch-testimonials__card--0 { --rot: 1.15deg; --lift: 8px; }
.ch-testimonials__card--1 { --rot: -1.65deg; --lift: 0px; }
.ch-testimonials__card--2 { --rot: 1.3deg; --lift: 10px; }
.ch-testimonials__card--3 { --rot: -1.15deg; --lift: 5px; }

.ch-testimonials__card.is-active {
  z-index: 2;
  box-shadow:
    0 28px 46px rgba(0, 0, 0, 0.13),
    0 7px 16px rgba(0, 0, 0, 0.05);
  transform:
    translateY(calc(var(--lift) - 1px))
    rotate(calc(var(--rot) * .62))
    rotateX(var(--rx))
    rotateY(var(--ry))
    scale(1.004);
}

.ch-testimonials__card:hover {
  z-index: 4;
  box-shadow:
    0 32px 52px rgba(0, 0, 0, 0.15),
    0 9px 19px rgba(0, 0, 0, 0.06);
  transform:
    translateY(calc(var(--lift) - 5px))
    rotate(calc(var(--rot) * .22))
    rotateX(var(--rx))
    rotateY(var(--ry))
    scale(1.014);
}

.ch-testimonials__card.is-active:hover {
  z-index: 6;
  transform:
    translateY(calc(var(--lift) - 8px))
    rotate(0deg)
    rotateX(calc(var(--rx) * 1.08))
    rotateY(calc(var(--ry) * 1.08))
    scale(1.024);
}

@media (prefers-color-scheme: dark) {
  .ch-testimonials__card {
    box-shadow:
      0 34px 58px rgba(0, 0, 0, 0.46),
      0 12px 24px rgba(0, 0, 0, 0.34),
      0 1px 0 rgba(255, 255, 255, 0.08) inset,
      0 0 0 1px rgba(255, 255, 255, 0.045);
  }

  .ch-testimonials__card.is-active {
    box-shadow:
      0 42px 72px rgba(0, 0, 0, 0.58),
      0 16px 30px rgba(0, 0, 0, 0.4),
      0 1px 0 rgba(255, 255, 255, 0.1) inset,
      0 0 0 1px rgba(255, 255, 255, 0.065);
  }
}

.ch-testimonials__quote {
  margin: 0;
  font-size: clamp(14px, 0.86vw, 16.25px);
  line-height: 1.38;
  letter-spacing: -0.016em;
  font-weight: 630;
}

.ch-testimonials__author {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 15px;
}

.ch-testimonials__avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 10px;
}

.ch-testimonials__name,
.ch-testimonials__role {
  display: block;
}

.ch-testimonials__name {
  font-size: 13px;
  line-height: 1.2;
}

.ch-testimonials__role {
  margin-top: 4px;
  color: var(--testimonials-card-muted);
  font-size: 11.5px;
  line-height: 1.3;
}

.ch-testimonials__controls {
  position: absolute;
  right: max(
    var(--testimonials-page-gutter),
    calc((100vw - var(--testimonials-header-width)) / 2)
  );
  bottom: -6px;
  display: flex;
  gap: 8px;
  z-index: 14;
}

.ch-testimonials__control {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--testimonials-control-border);
  border-radius: 999px;
  color: var(--testimonials-control-text);
  background: var(--testimonials-control-bg);
  cursor: pointer;
}

.ch-testimonials__control svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ch-testimonials__control--primary {
  color: var(--testimonials-control-primary-text);
  background: var(--testimonials-control-primary-bg);
  border-color: var(--testimonials-control-primary-bg);
}

@media (max-width: 760px) {
  .ch-testimonials__carousel {
    --testimonials-page-gutter: 18px;
    --testimonials-edge-fade: 36px;
  }

  .ch-testimonials__viewport {
    padding-block: 20px 58px;
  }

  .ch-testimonials__card {
    flex-basis: min(78vw, 306px);
    min-height: 142px;
    padding: 18px 18px 17px;
  }

  .ch-testimonials__controls {
    right: var(--testimonials-page-gutter);
    bottom: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ch-testimonials__card {
    transition: none;
  }
}


/* -------------------------------------------------------------------------
   Shadow-safe geometry and deterministic elevation
   -------------------------------------------------------------------------
   These values are component-owned. They keep rotated/lifted cards and their
   largest hover shadows inside the horizontal scroll box, avoiding clipping
   even when the browser computes overflow-y as auto.
*/
.ch-testimonials__carousel {
  --testimonials-shadow-space-top: 30px;
  --testimonials-shadow-space-bottom: 66px;
  --testimonials-shadow-compensation-bottom: 30px;

  /* Light elevation tokens */
  --testimonial-shadow-rest:
    0 18px 30px -18px rgba(45, 45, 47, 0.22),
    0 8px 18px -14px rgba(45, 45, 47, 0.14),
    0 3px 8px -4px rgba(45, 45, 47, 0.08),
    0 1px 0 rgba(255, 255, 255, 0.9) inset;
  --testimonial-shadow-active:
    0 22px 38px -20px rgba(45, 45, 47, 0.27),
    0 11px 22px -15px rgba(45, 45, 47, 0.18),
    0 4px 10px -5px rgba(45, 45, 47, 0.1),
    0 1px 0 rgba(255, 255, 255, 0.92) inset;
  --testimonial-shadow-hover:
    0 28px 48px -23px rgba(45, 45, 47, 0.31),
    0 14px 27px -17px rgba(45, 45, 47, 0.21),
    0 5px 12px -5px rgba(45, 45, 47, 0.11),
    0 1px 0 rgba(255, 255, 255, 0.94) inset;
  --testimonial-shadow-active-hover:
    0 32px 56px -25px rgba(45, 45, 47, 0.35),
    0 16px 31px -19px rgba(45, 45, 47, 0.24),
    0 6px 14px -6px rgba(45, 45, 47, 0.13),
    0 1px 0 rgba(255, 255, 255, 0.96) inset;

  isolation: isolate;
  overflow: visible;
  margin-bottom: calc(var(--testimonials-shadow-compensation-bottom) * -1);
  padding-bottom: var(--testimonials-shadow-compensation-bottom);
}

.ch-testimonials__viewport {
  /*
   * Horizontal scrolling is owned here.
   * Vertical effects remain safe because the track and viewport reserve
   * enough internal space for every shadow/rotation state.
   */
  overflow-x: auto;
  overflow-y: hidden;
  padding-top: var(--testimonials-shadow-space-top);
  padding-bottom: var(--testimonials-shadow-space-bottom);
}

.ch-testimonials__track {
  position: relative;
  isolation: isolate;
  padding-top: 0;
  padding-bottom: 0;
  will-change: transform;
}

.ch-testimonials__card {
  position: relative;
  z-index: 1;
  isolation: isolate;
  box-shadow: var(--testimonial-shadow-rest);
  will-change: transform, box-shadow;
}

.ch-testimonials__card.is-active {
  z-index: 3;
  box-shadow: var(--testimonial-shadow-active);
}

.ch-testimonials__card:hover {
  z-index: 8;
  box-shadow: var(--testimonial-shadow-hover);
}

.ch-testimonials__card.is-active:hover {
  z-index: 10;
  box-shadow: var(--testimonial-shadow-active-hover);
}

@media (prefers-color-scheme: dark) {
  .ch-testimonials__carousel {
    --testimonial-shadow-rest:
      0 24px 44px rgba(0, 0, 0, 0.42),
      0 9px 20px rgba(0, 0, 0, 0.3),
      0 1px 0 rgba(255, 255, 255, 0.08) inset,
      0 0 0 1px rgba(255, 255, 255, 0.045);
    --testimonial-shadow-active:
      0 30px 56px rgba(0, 0, 0, 0.52),
      0 12px 25px rgba(0, 0, 0, 0.36),
      0 1px 0 rgba(255, 255, 255, 0.1) inset,
      0 0 0 1px rgba(255, 255, 255, 0.065);
    --testimonial-shadow-hover:
      0 36px 66px rgba(0, 0, 0, 0.58),
      0 15px 30px rgba(0, 0, 0, 0.42),
      0 1px 0 rgba(255, 255, 255, 0.11) inset,
      0 0 0 1px rgba(255, 255, 255, 0.075);
    --testimonial-shadow-active-hover:
      0 42px 76px rgba(0, 0, 0, 0.64),
      0 18px 35px rgba(0, 0, 0, 0.46),
      0 1px 0 rgba(255, 255, 255, 0.13) inset,
      0 0 0 1px rgba(255, 255, 255, 0.09);
  }
}

.ch-testimonials__carousel[data-theme="dark"] {
  --testimonial-shadow-rest:
    0 24px 44px rgba(0, 0, 0, 0.42),
    0 9px 20px rgba(0, 0, 0, 0.3),
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 0 0 1px rgba(255, 255, 255, 0.045);
  --testimonial-shadow-active:
    0 30px 56px rgba(0, 0, 0, 0.52),
    0 12px 25px rgba(0, 0, 0, 0.36),
    0 1px 0 rgba(255, 255, 255, 0.1) inset,
    0 0 0 1px rgba(255, 255, 255, 0.065);
  --testimonial-shadow-hover:
    0 36px 66px rgba(0, 0, 0, 0.58),
    0 15px 30px rgba(0, 0, 0, 0.42),
    0 1px 0 rgba(255, 255, 255, 0.11) inset,
    0 0 0 1px rgba(255, 255, 255, 0.075);
  --testimonial-shadow-active-hover:
    0 42px 76px rgba(0, 0, 0, 0.64),
    0 18px 35px rgba(0, 0, 0, 0.46),
    0 1px 0 rgba(255, 255, 255, 0.13) inset,
    0 0 0 1px rgba(255, 255, 255, 0.09);
}

.ch-testimonials__carousel[data-theme="light"] {
  --testimonial-shadow-rest:
    0 18px 30px -18px rgba(45, 45, 47, 0.22),
    0 8px 18px -14px rgba(45, 45, 47, 0.14),
    0 3px 8px -4px rgba(45, 45, 47, 0.08),
    0 1px 0 rgba(255, 255, 255, 0.9) inset;
  --testimonial-shadow-active:
    0 22px 38px -20px rgba(45, 45, 47, 0.27),
    0 11px 22px -15px rgba(45, 45, 47, 0.18),
    0 4px 10px -5px rgba(45, 45, 47, 0.1),
    0 1px 0 rgba(255, 255, 255, 0.92) inset;
  --testimonial-shadow-hover:
    0 28px 48px -23px rgba(45, 45, 47, 0.31),
    0 14px 27px -17px rgba(45, 45, 47, 0.21),
    0 5px 12px -5px rgba(45, 45, 47, 0.11),
    0 1px 0 rgba(255, 255, 255, 0.94) inset;
  --testimonial-shadow-active-hover:
    0 32px 56px -25px rgba(45, 45, 47, 0.35),
    0 16px 31px -19px rgba(45, 45, 47, 0.24),
    0 6px 14px -6px rgba(45, 45, 47, 0.13),
    0 1px 0 rgba(255, 255, 255, 0.96) inset;
}

@media (max-width: 760px) {
  .ch-testimonials__carousel {
    --testimonials-shadow-space-top: 26px;
    --testimonials-shadow-space-bottom: 62px;
    --testimonials-shadow-compensation-bottom: 30px;
  }
}
