.client-story {
  --rail-height: clamp(108px, 15svh, 148px);
  position: relative;
  background: #0d071c;
}
.estuary-client {
  position: absolute;
  z-index: 1;
  top: 44%;
  right: max(5%, calc((100% - 1440px) / 2));
  width: min(42%, 690px, 78svh);
  transform: translateY(-50%);
  perspective: 1150px;
}
.estuary-client-camera {
  --slide-travel: clamp(30px, 6vw, 98px);
}
.showcase-hero.has-client-showcase .estuary-scene {
  top: -7%;
  right: -5%;
  width: 43%;
  height: 76%;
}
.estuary-client-viewport {
  position: relative;
  isolation: isolate;
  aspect-ratio: 1.55;
  border-radius: clamp(8px, 1vw, 15px);
  border: 1px solid #f0d9ffee;
  background: #150e24;
  transform: translateY(calc(var(--client-progress, 0) * -13px))
             rotateY(calc(-9deg + var(--client-yaw, 0deg) + var(--client-progress, 0) * 14deg))
             rotateX(calc(4deg + var(--client-pitch, 0deg))) rotateZ(calc(-1.5deg + var(--client-progress, 0) * 3deg));
  transform-origin: 50% 55%;
  box-shadow: 1px 1px 0 #f0d5ff, 2px 2px 0 #b58fff, 3px 3px 0 #7e48db,
              4px 4px 0 #5428bc, 5px 6px 0 #361a77, 10px 20px 35px #0a032da6,
              15px 45px 80px #16064fb3, -6px 4px 40px #7645ff55, 3px -6px 30px #ff3bb52e;
  transition: transform 200ms ease-out;
}
.estuary-client-viewport::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px #ffffff30;
  background: linear-gradient(119deg, #c5caff17, transparent 32%);
}
.estuary-client-panel {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateX(8px) scale(.98);
  transition: opacity 300ms ease, transform 420ms cubic-bezier(.2,.72,.23,1), visibility 0s linear 420ms;
  background: #14121c;
}
.estuary-client-panel[data-visible] {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
  z-index: 1;
}
.estuary-client-panel a {
  position: absolute;
  inset: 0;
  display: grid;
  color: white;
}
@media (prefers-reduced-motion: no-preference) {
  .has-client-showcase .showcase-hero-media {
    transform-origin: 68% 54%;
    transform: translateX(calc(var(--client-progress, 0) * -2%)) scale(calc(1.01 + var(--client-progress, 0) * .11));
    transition: transform 320ms ease-out;
  }
  [data-client-chapter="tongyuye"] .estuary-client-camera { animation: client-rise 850ms both; }
  [data-client-chapter="agent-marketplace"] .estuary-client-camera { animation: client-turn 800ms both; }
  [data-client-chapter="enterprise-api"] .estuary-client-camera { animation: client-zoom 820ms both; }
  [data-client-chapter="feishu-library"] .estuary-client-camera { animation: client-unfold 810ms cubic-bezier(.18,.72,.22,1) both; }
  .estuary-client-panel[data-visible]::after {
    content: "";
    position: absolute;
    z-index: 1;
    inset: -24% auto -24% -30%;
    width: 24%;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, #dacaff1c 50%, #dff2ff52 78%, #ffdfef14 80%, transparent);
    animation: client-reflection 740ms cubic-bezier(.27,.55,.24,1) both;
  }
  [data-client-chapter="enterprise-api"] .estuary-client-panel[data-visible]::after { animation-direction: reverse; }
}
@keyframes client-rise {
  0% { transform: translate3d(0, var(--slide-travel), -130px) rotateX(24deg) rotateZ(calc(-5deg * var(--slide-direction))); }
  65% { transform: translate3d(0, -7px, 8px) rotateX(-3deg); }
  100% { transform: none; }
}
@keyframes client-turn {
  0% { transform: translate3d(calc(var(--slide-travel) * var(--slide-direction)), 12px, -150px) rotateY(calc(38deg * var(--slide-direction))) rotateZ(calc(6deg * var(--slide-direction))); }
  64% { transform: translate3d(calc(-8px * var(--slide-direction)), -3px, 12px) rotateY(calc(-4deg * var(--slide-direction))); }
  100% { transform: none; }
}
@keyframes client-zoom {
  0% { transform: translate3d(calc(-.55 * var(--slide-travel) * var(--slide-direction)), -18px, 125px) rotateX(-14deg) rotateY(calc(-17deg * var(--slide-direction))); }
  66% { transform: translate3d(3px, 3px, -12px) rotateX(2deg); }
  100% { transform: none; }
}
@keyframes client-unfold {
  0% { transform: translate3d(calc(18px * var(--slide-direction)), 16px, -90px) rotateX(15deg) rotateY(calc(-26deg * var(--slide-direction))); }
  72% { transform: translate3d(0, -3px, 4px) rotateX(-1.5deg); }
  100% { transform: none; }
}
@keyframes client-reflection {
  0% { transform: translateX(0) skewX(-18deg); opacity: 0; }
  20%, 70% { opacity: .78; }
  100% { transform: translateX(620%) skewX(-18deg); opacity: 0; }
}
.estuary-client-panel img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
}
.estuary-client-open {
  position: absolute;
  inset: auto 12px 12px auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: white;
  background: #231338e8;
  border: 1px solid #ceb7ffbf;
  border-radius: 50%;
  font: 17px/1 system-ui, sans-serif;
  transition: transform 220ms ease, background 220ms ease;
}
.estuary-client-panel a:is(:hover, :focus-visible) .estuary-client-open {
  transform: translate(1px, -2px);
  background: #6c40cf;
}
.estuary-client-viewport:focus-within { outline: 2px solid #ffa3ee; outline-offset: 5px; }
.estuary-client-rail {
  position: absolute;
  z-index: 2;
  inset: auto 0 0;
  height: var(--rail-height);
  display: grid;
  align-items: center;
  background: linear-gradient(90deg,#130d24fa,#1e1136f5 57%,#190c2bf5);
  border-block: 1px solid #cdb2ff54;
}
.estuary-client-rail::before {
  content: "";
  height: 2px;
  position: absolute;
  inset: -1px 0 auto;
  transform-origin: left;
  transform: scaleX(calc(.08 + var(--client-progress, 0) * .92));
  background: linear-gradient(90deg,#486bff,#aa62ff 55%,#ff5cd6);
  box-shadow: 0 0 13px #c56eff88;
}
.estuary-client-switcher {
  display: flex;
  align-items: stretch;
  gap: clamp(12px, 1.6vw, 28px);
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-behavior: auto;
  width: 100%;
  box-sizing: border-box;
  padding: 5px max(5%, calc((100% - 1440px) / 2));
  scrollbar-width: thin;
  scrollbar-color: #9473c6 #190f29;
}
.estuary-client-switcher button {
  isolation: isolate;
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 69%;
  min-width: 0;
  gap: clamp(16px, 2.3vw, 40px);
  padding: 0 clamp(15px, 2vw, 32px) 0 0;
  overflow: hidden;
  height: calc(var(--rail-height) - 32px);
  border: 1px solid #8068ac8a;
  border-radius: 9px;
  color: #e5d9fb;
  text-align: start;
  cursor: grab;
  user-select: none;
  background: linear-gradient(112deg,#180f31,#281b40 65%,#19112e);
  font: 620 clamp(1.08rem, 2vw, 2.02rem)/1.15 system-ui,sans-serif;
  letter-spacing: -.035em;
}
.estuary-client-thumb {
  width: 24%; height: 100%; flex: none; display: block;
  border-right: 1px solid #dcbdff44; object-fit: cover; object-position: left top;
  pointer-events: none; opacity: .72;
}
.estuary-client-tab-name { flex: 1; min-width: 0; }
.estuary-client-switcher button::after {
  content: "";
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  border: 1px solid #cfb5ff;
}
.estuary-client-switcher button[aria-selected="true"] {
  color: #fff;
  border-color: #c3a3ff;
  background: linear-gradient(107deg,#25154c,#432774 52%,#402167 75%,#41204e);
}
.estuary-client-switcher button[aria-selected="true"] img { opacity: 1; }
.estuary-client-switcher button[aria-selected="true"]::after {
  background: #f2b5ff;
  box-shadow: 0 0 10px #fc65d3;
}
.estuary-client-switcher button:active { cursor: grabbing; }
.estuary-client-switcher button:focus-visible { outline: 2px solid #ffb2ec; outline-offset: 2px; }
@media (min-width: 901px) {
  .client-story .showcase-hero { min-height: max(550px, calc(100svh - var(--showcase-header))); }
  .client-story .showcase-hero-inner {
    padding-top: 68px;
    padding-bottom: calc(var(--rail-height) + clamp(35px, 7svh, 83px));
  }
  .has-client-showcase .showcase-hero-inner h1,
  .has-client-showcase .showcase-hero-inner .showcase-actions { max-width: 51%; }
}
@media (min-width: 901px) and (min-height: 600px) and (prefers-reduced-motion: no-preference) {
  .client-story::after { content: ""; display: block; height: calc(clamp(480px, 85svh, 940px) * var(--chapter-steps, 1)); }
  .client-story > .showcase-hero { position: sticky; top: var(--showcase-header); }
}
@media (max-width: 900px) {
  .client-story { --rail-height: 86px; }
  .showcase-hero.has-client-showcase { min-height: 0; align-items: start; }
  .estuary-client {
    position: relative;
    top: auto;
    right: auto;
    width: min(calc(100% - 54px), 500px);
    margin: clamp(28px, 6vw, 50px) auto 18px;
    transform: none;
  }
  .estuary-client-viewport { transform: perspective(1000px) rotateX(2deg) rotateY(-4deg) rotateZ(-1deg); }
  .estuary-client-open { width: 30px; height: 30px; inset: auto 8px 8px auto; }
  .showcase-hero.has-client-showcase .estuary-scene {
    top: -5%; right: -5%; left: auto; width: min(53%, 415px); height: clamp(160px, 33vw, 295px);
  }
  .estuary-client { order: -1; }
  .estuary-client-rail { position: relative; inset: auto; }
  .estuary-client-switcher {
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 22px;
    padding-inline: 22px;
    scrollbar-width: none;
  }
  .estuary-client-switcher button {
    height: 60px; flex-basis: 87%; gap: 12px; padding-right: 14px; scroll-snap-align: center;
    font-size: clamp(.88rem,3.7vw,1.13rem);
  }
  .showcase-hero.has-client-showcase .showcase-hero-inner { padding-top: clamp(22px, 4.4vw, 40px); }
  .has-client-showcase .showcase-hero-summary { max-width: 36rem; }
}
@media (prefers-reduced-motion: reduce) {
  .estuary-client-viewport { transform: none; }
  .estuary-client *, .estuary-client *::after { transition: none; animation: none; }
  .estuary-client-panel { transform: none; }
}
