/* ───────────────────────────────────────────────────────────────────────────
   OSPREXON — Clients / Editorial testimonials section
   Cinematic envelope scene with paper testimonial cards that emerge on scroll.
   Pinned via GSAP ScrollTrigger; visual-only styles live here.
   ─────────────────────────────────────────────────────────────────────── */

.section-line--studio-clients {
  margin: 0;
  border: 0;
  height: 0;
  border-top: 1px solid rgba(20, 21, 26, 0.12);
  background: transparent;
}

.clients {
  --clients-bg: #faf6ec;
  --clients-text: #1f2328;
  --clients-muted: #6b7079;
  --clients-accent: #e89422;
  --clients-accent-soft: #f8c574;
  --paper: #fffdf7;
  --rule: rgba(31, 35, 40, 0.08);

  position: relative;
  /* ScrollTrigger adds pin spacing below — no extra min-height here. */
  padding: clamp(3rem, 7vw, 5.5rem) clamp(16px, 4vw, 32px)
    clamp(24px, 4vw, 48px);
  overflow: clip;
  isolation: isolate;
  scroll-margin-top: 12px;
  background:
    radial-gradient(
      44% 36% at 50% 12%,
      rgba(255, 209, 142, 0.2) 0%,
      rgba(255, 209, 142, 0) 72%
    ),
    linear-gradient(180deg, #fff 0%, var(--clients-bg) 18%, #fbeed0 100%);
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro",
    "Segoe UI",
    sans-serif;
  color: var(--clients-text);
}

.clients__head {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 880px;
  margin: 0 auto clamp(32px, 5vw, 72px);
  opacity: 0;
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.clients__head.is-visible {
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .clients__head {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

.clients__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding: 6px 14px 6px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: #b87716;
  background: rgba(255, 224, 175, 0.55);
  border: 1px solid rgba(184, 119, 22, 0.18);
  border-radius: 999px;
}
.clients__eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--clients-accent);
  box-shadow: 0 0 0 3px rgba(232, 148, 34, 0.25);
}
.clients__title {
  margin: 0 0 18px;
  font-size: clamp(2.2rem, 5.8vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  font-weight: 800;
}
.clients__title em {
  font-family: "Instrument Serif", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  color: var(--clients-accent);
}
.clients__subtitle {
  margin: 0 auto;
  max-width: 640px;
  font-size: clamp(0.98rem, 1.2vw, 1.08rem);
  color: var(--clients-muted);
  line-height: 1.6;
}
.clients__trust {
  margin: 22px auto 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--clients-muted);
  letter-spacing: 0.04em;
}
.clients__trust-stars {
  display: inline-flex;
  gap: 2px;
  color: var(--clients-accent);
}
.clients__trust-stars svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}
.clients__trust strong {
  color: var(--clients-text);
  font-weight: 700;
}

.clients__pin {
  position: relative;
  z-index: 2;
  width: min(100%, 1220px);
  isolation: isolate;
  height: min(86vh, 760px);
  height: min(86svh, 760px);
  min-height: clamp(560px, 82vh, 700px);
  min-height: clamp(560px, 82svh, 700px);
  margin: 0 auto clamp(24px, 4vw, 56px);
}

/* Paper grain only on the stage — avoids mix-blend over the full section. */
.clients__pin::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  border-radius: inherit;
  background-image:
    radial-gradient(
      circle at 16% 22%,
      rgba(0, 0, 0, 0.05) 0.6px,
      transparent 0.8px
    ),
    radial-gradient(
      circle at 78% 64%,
      rgba(0, 0, 0, 0.04) 0.5px,
      transparent 0.8px
    );
  background-size:
    22px 22px,
    28px 28px;
  opacity: 0.45;
}

/* Lighter glow while scrolling in; full treatment when pin is active. */
.clients:not(.clients--pinned) .clients__scene::before,
.clients:not(.clients--pinned) .clients__envelope-shadow {
  opacity: 0;
  filter: none;
}

/* GPU compositing is handled by GSAP — no persistent will-change needed. */
.clients__pin.is-pin-active {
  isolation: isolate;
}
.clients--pinned .clients__scene::before,
.clients--pinned .clients__envelope-shadow {
  filter: none;
  opacity: 0.85;
}
.clients--pinned .envelope-img--back,
.clients--pinned .envelope-img--front {
  filter: drop-shadow(0 16px 24px rgba(186, 111, 12, 0.2));
}

.clients__scene {
  position: absolute;
  /* Inner inset gives the envelope physical breathing room on every side
     (top reserved for the progress strip, bottom keeps it off the edge). */
  inset: clamp(36px, 5vw, 60px) clamp(24px, 6vw, 80px) clamp(48px, 7vw, 88px);
  display: grid;
  place-items: center;
  perspective: 1400px;
  transform-style: preserve-3d;
}

/* Centered, scroll-driven progress: 01/04 + dots + label. */
.clients__progress {
  position: absolute;
  left: 50%;
  top: clamp(8px, 2vw, 24px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: "JetBrains Mono", "SF Mono", Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--clients-muted);
  z-index: 12;
  user-select: none;
}
.clients__progress-num {
  color: var(--clients-text);
  font-weight: 700;
}
.clients__progress-num em {
  font-style: normal;
  color: var(--clients-accent);
}
.clients__progress-dots {
  display: inline-flex;
  gap: 7px;
}
.clients__progress-dot {
  width: 22px;
  height: 3px;
  border-radius: 2px;
  background: rgba(31, 35, 40, 0.14);
  transition:
    background 0.35s ease,
    transform 0.35s ease;
}
.clients__progress-dot.is-active {
  background: var(--clients-accent);
  transform: scaleX(1.18);
}
.clients__progress-dot.is-past {
  background: rgba(232, 148, 34, 0.4);
}
.clients__progress-label {
  color: var(--clients-muted);
  font-size: 10.5px;
}

.testimonial-prev,
.testimonial-next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  font-family: inherit;
  font-size: 14px;
  line-height: 1;
  color: var(--clients-text);
  cursor: pointer;
  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    opacity 0.25s ease;
}

.testimonial-prev:hover:not(:disabled),
.testimonial-next:hover:not(:disabled) {
  background: #fff;
  border-color: var(--clients-accent);
}

.testimonial-prev:disabled,
.testimonial-next:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ambient glow + soft vignette */
.clients__scene::before {
  content: "";
  position: absolute;
  width: min(70vw, 900px);
  height: min(34vw, 360px);
  bottom: 22%;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 999px;
  background: radial-gradient(
    ellipse at center,
    rgba(247, 191, 98, 0.32) 0%,
    rgba(247, 191, 98, 0.12) 42%,
    rgba(247, 191, 98, 0) 76%
  );
  filter: blur(26px);
  z-index: 0;
}

.clients__envelope-shadow {
  position: absolute;
  left: 50%;
  bottom: clamp(26px, 4vw, 48px);
  width: min(58vw, 640px);
  height: min(8.5vw, 108px);
  transform: translateX(-50%);
  border-radius: 999px;
  background: radial-gradient(
    ellipse at center,
    rgba(125, 68, 6, 0.34) 0%,
    rgba(125, 68, 6, 0.08) 54%,
    rgba(125, 68, 6, 0) 78%
  );
  filter: blur(20px);
  z-index: 1;
}

.envelope-img {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  /* Envelope is the hero of the scene — cards sit smaller above the flap. */
  width: min(68vw, 620px);
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
}
.envelope-img--back {
  z-index: 2;
  bottom: clamp(20px, 3vw, 36px);
  filter: drop-shadow(0 22px 30px rgba(186, 111, 12, 0.24));
}
.envelope-img--front {
  z-index: 30;
  bottom: 0;
  filter: drop-shadow(0 -6px 24px rgba(40, 22, 4, 0.18));
}

.clients__envelope-shadow {
  width: min(56vw, 540px);
  height: min(8vw, 96px);
  bottom: clamp(16px, 2.5vw, 28px);
}

.clients__cards {
  position: absolute;
  left: 50%;
  /* Compact cards emerging from the envelope opening. */
  bottom: clamp(96px, 13vw, 150px);
  width: min(70vw, 500px);
  height: clamp(220px, 22vw, 268px);
  transform: translateX(-50%);
  z-index: 8;
  transform-style: preserve-3d;
  pointer-events: none;
}

.t-card {
  --card-base-rotate: 0deg;
  --card-base-x: 0px;
  --card-base-y: 0px;
  position: absolute;
  inset: 0;
  width: 100%;
  max-width: 100%;
  border-radius: 18px;
  padding: clamp(18px, 2vw, 26px) clamp(20px, 2.2vw, 28px)
    clamp(18px, 2vw, 24px);
  background: linear-gradient(180deg, #ffffff 0%, var(--paper) 100%);
  box-shadow:
    0 30px 60px -22px rgba(20, 24, 29, 0.28),
    0 10px 22px rgba(20, 24, 29, 0.08),
    0 0 0 1px rgba(33, 40, 48, 0.05),
    inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  transform-origin: 50% 100%;
  will-change: transform, opacity;
  cursor: default;
  overflow: hidden;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
}

/* Decorative oversized quote mark */
.t-card::before {
  content: "“";
  position: absolute;
  top: -22px;
  right: 14px;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(100px, 14vw, 140px);
  line-height: 1;
  color: var(--clients-accent);
  opacity: 0.14;
  pointer-events: none;
  user-select: none;
}

/* Folded paper corner */
.t-card::after {
  content: "";
  position: absolute;
  right: 10px;
  bottom: 8px;
  width: 22px;
  height: 22px;
  border-radius: 0 0 10px 0;
  background: linear-gradient(
    140deg,
    transparent 50%,
    rgba(21, 25, 31, 0.07) 50%
  );
  pointer-events: none;
}

.t-card__stars {
  display: flex;
  gap: 3px;
  color: var(--clients-accent);
  margin-bottom: 10px;
}
.t-card__stars svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.t-card__quote {
  margin: 0 0 14px;
  font-size: clamp(0.92rem, 1.05vw, 1.05rem);
  line-height: 1.5;
  color: #2a2e34;
  font-weight: 500;
  letter-spacing: -0.005em;
}

.t-card__divider {
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--rule) 18%,
    var(--rule) 82%,
    transparent 100%
  );
  margin: auto 0 12px;
}

.t-card__foot {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 10px;
}
.t-card__img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.12),
    0 0 0 1px rgba(0, 0, 0, 0.06);
}
.t-card__name {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.t-card__role {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--clients-muted);
  line-height: 1.35;
}
.t-card__brand {
  font-family: "JetBrains Mono", "SF Mono", Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--clients-muted);
  padding: 6px 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
}

@media (max-width: 1024px) {
  .clients__pin {
    height: min(82vh, 700px);
    height: min(82svh, 700px);
    min-height: clamp(540px, 80vh, 660px);
    min-height: clamp(540px, 80svh, 660px);
  }
  .clients__cards {
    width: min(78vw, 460px);
    height: clamp(200px, 24vw, 250px);
    bottom: clamp(88px, 14vw, 140px);
  }
  .envelope-img {
    width: min(72vw, 520px);
  }
  .clients__envelope-shadow {
    width: min(60vw, 480px);
  }
}
@media (max-width: 768px) {
  .clients__head {
    margin-bottom: clamp(28px, 6vw, 56px);
  }
  .clients__pin {
    height: min(80vh, 680px);
    height: min(80svh, 680px);
    min-height: clamp(520px, 80vh, 620px);
    min-height: clamp(520px, 80svh, 620px);
    margin-bottom: clamp(16px, 4vw, 32px);
  }
  .clients__scene {
    inset: clamp(28px, 5vw, 44px) clamp(12px, 3vw, 24px) clamp(32px, 5vw, 48px);
  }
  /* Card ~58% of envelope width — reads as sliding out of the flap. */
  .clients__cards {
    width: min(54vw, 300px);
    bottom: clamp(96px, 20vw, 128px);
    height: clamp(158px, 40vw, 198px);
  }
  .envelope-img {
    width: min(92vw, 420px);
  }
  .envelope-img--back {
    bottom: clamp(14px, 2.5vw, 28px);
  }
  .clients__envelope-shadow {
    width: min(78vw, 380px);
    height: min(7vw, 72px);
  }
}
@media (max-width: 480px) {
  .clients {
    /* Tighter top padding so the head sits closer to the section seam,
       and a small bottom buffer before the pricing band starts. */
    padding-block: clamp(2rem, 8vw, 3rem) clamp(20px, 5vw, 36px);
  }
  .clients__pin {
    height: min(76vh, 600px);
    height: min(76svh, 600px);
    min-height: clamp(460px, 76vh, 560px);
    min-height: clamp(460px, 76svh, 560px);
  }
  .clients__scene {
    inset: 20px 10px 36px;
  }
  .clients__cards {
    width: min(56vw, 268px);
    bottom: clamp(88px, 19vw, 112px);
    height: clamp(142px, 36vw, 172px);
  }
  .envelope-img {
    width: min(94vw, 400px);
  }
  .clients__envelope-shadow {
    width: min(82vw, 360px);
    height: 52px;
    bottom: 14px;
  }
  .t-card {
    border-radius: 16px;
    padding: 16px 16px 14px;
  }
  .t-card::before {
    font-size: 90px;
    top: -18px;
  }
  .t-card__quote {
    font-size: clamp(0.88rem, 3.2vw, 1rem);
    line-height: 1.48;
    margin-bottom: 12px;
  }
  .t-card__foot {
    grid-template-columns: 44px 1fr;
    gap: 12px;
  }
  .t-card__img {
    width: 44px;
    height: 44px;
  }
  .t-card__brand {
    display: none;
  }
  .clients__progress {
    gap: 10px;
  }
  .clients__progress-label {
    display: none;
  }
}
@media (max-width: 390px) {
  .clients__pin {
    min-height: clamp(460px, 82vh, 540px);
    min-height: clamp(460px, 82svh, 540px);
  }
  .clients__cards {
    width: min(58vw, 248px);
    bottom: clamp(82px, 18vw, 104px);
    height: clamp(132px, 34vw, 158px);
  }
  .envelope-img {
    width: min(96vw, 372px);
  }
  .clients__envelope-shadow {
    width: min(84vw, 340px);
  }
}

/* Galaxy S8 class (360px) — tighter than 390px but wider than foldables */
@media (max-width: 360px) {
  .clients__pin {
    height: min(74vh, 560px);
    height: min(74svh, 560px);
    min-height: clamp(440px, 78vh, 520px);
    min-height: clamp(440px, 78svh, 520px);
  }
  .clients__cards {
    width: min(60vw, 236px);
    bottom: clamp(78px, 17vw, 98px);
    height: clamp(125px, 33vw, 150px);
  }
  .envelope-img {
    width: min(97vw, 350px);
  }
  .clients__envelope-shadow {
    width: min(86vw, 320px);
    height: 46px;
  }
  .t-card {
    border-radius: 14px;
    padding: 14px 14px 12px;
  }
  .t-card::before {
    font-size: 80px;
    top: -16px;
  }
  .t-card__quote {
    font-size: clamp(0.82rem, 3vw, 0.92rem);
    line-height: 1.42;
    margin-bottom: 10px;
  }
  .t-card__foot {
    grid-template-columns: 36px 1fr;
    gap: 8px;
  }
  .t-card__img {
    width: 36px;
    height: 36px;
  }
  .t-card__name {
    font-size: 0.82rem;
  }
  .t-card__role {
    font-size: 0.68rem;
  }
}

/* Ultra-narrow: ≤320px (Samsung Galaxy Fold, budget phones) */
@media (max-width: 320px) {
  .clients {
    padding-block: clamp(1.5rem, 6vw, 2.25rem) clamp(16px, 4vw, 28px);
  }
  .clients__head {
    margin-bottom: clamp(16px, 4vw, 28px);
  }
  .clients__title {
    font-size: clamp(1.55rem, 8vw, 2rem);
  }
  .clients__subtitle {
    font-size: clamp(0.88rem, 3.2vw, 0.98rem);
  }
  .clients__pin {
    height: min(72vh, 520px);
    height: min(72svh, 520px);
    min-height: clamp(400px, 74vh, 480px);
    min-height: clamp(400px, 74svh, 480px);
  }
  .clients__scene {
    inset: 16px 6px 28px;
  }
  .clients__cards {
    width: min(62vw, 210px);
    bottom: clamp(70px, 15vw, 90px);
    height: clamp(115px, 30vw, 140px);
  }
  .envelope-img {
    width: min(98vw, 308px);
  }
  .envelope-img--back {
    bottom: clamp(10px, 2vw, 20px);
  }
  .clients__envelope-shadow {
    width: min(88vw, 280px);
    height: 40px;
    bottom: 10px;
  }
  .t-card {
    border-radius: 12px;
    padding: 12px 12px 10px;
  }
  .t-card::before {
    font-size: 68px;
    top: -14px;
    right: 8px;
  }
  .t-card__quote {
    font-size: clamp(0.78rem, 2.8vw, 0.88rem);
    line-height: 1.4;
    margin-bottom: 8px;
  }
  .t-card__stars svg {
    width: 10px;
    height: 10px;
  }
  .t-card__foot {
    grid-template-columns: 32px 1fr;
    gap: 6px;
  }
  .t-card__img {
    width: 32px;
    height: 32px;
  }
  .t-card__name {
    font-size: 0.78rem;
  }
  .t-card__role {
    font-size: 0.64rem;
  }
  .t-card__brand {
    display: none;
  }
  .clients__progress {
    gap: 8px;
    font-size: 10px;
  }
  .clients__progress-dot {
    width: 16px;
  }
  .clients__eyebrow {
    font-size: 0.58rem;
    letter-spacing: 0.24em;
    padding: 4px 8px 4px 6px;
  }
}

/* Landscape phones with notch — very short viewports */
@media (max-height: 440px) and (orientation: landscape) {
  .clients__head .clients__subtitle,
  .clients__trust {
    display: none;
  }
  .clients__head {
    margin-bottom: 12px;
  }
  .clients__title {
    font-size: clamp(1.4rem, 4vw, 1.8rem);
  }
  .clients__pin {
    height: min(94vh, 420px);
    height: min(94svh, 420px);
    min-height: clamp(300px, 90vh, 380px);
    min-height: clamp(300px, 90svh, 380px);
  }
  .clients__cards {
    bottom: clamp(52px, 9vh, 76px);
    height: clamp(140px, 32vh, 180px);
    width: min(42vw, 340px);
  }
  .envelope-img {
    width: min(48vh, 360px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .clients {
    min-height: auto;
  }
  .clients__pin {
    height: auto;
    min-height: auto;
  }
  .clients__scene {
    position: relative;
    inset: auto;
    display: block;
    perspective: none;
  }
  .clients__envelope-shadow,
  .envelope-img {
    display: none;
  }
  .clients__cards {
    position: relative;
    transform: none;
    left: auto;
    bottom: auto;
    height: auto;
    margin: 0 auto;
    display: grid;
    gap: 16px;
    width: min(92vw, 540px);
    padding-bottom: 0;
  }
  .t-card {
    position: relative;
    inset: auto;
    transform: none !important;
    opacity: 1 !important;
  }
  .clients__progress {
    display: none;
  }
}
