.studio-service-story {
  position: relative;
}

.studio-service-morph {
  display: none;
}

@media (min-width: 56.001rem) and (min-height: 38rem) {
  .studio-service-story.is-service-morph-ready {
    height: calc(100svh + 480svh);
    margin-top: clamp(4rem, 8vw, 7rem);
  }

  .is-service-morph-ready .studio-service-index {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    border: 0 !important;
    white-space: nowrap !important;
  }

  .is-service-morph-ready .studio-service-index__item {
    animation: none !important;
  }

  .is-service-morph-ready .studio-service-morph {
    --service-canvas-opacity: 0;
    --service-progress: 0;
    --service-stage-accent: #542abe;
    --service-stage-cyan: #087e87;
    --service-stage-ghost: rgb(17 19 25 / 7%);
    position: sticky;
    top: var(--header-height);
    display: grid;
    height: calc(100svh - var(--header-height));
    min-height: 38rem;
    overflow: clip;
    contain: layout paint style;
    border-block: 1px solid var(--color-line);
    background:
      linear-gradient(115deg, rgb(84 42 190 / 4%), transparent 31%),
      linear-gradient(290deg, rgb(8 126 135 / 4%), transparent 34%);
    color: var(--color-ink);
    isolation: isolate;
  }

  .is-service-morph-ready .studio-service-morph::before {
    position: absolute;
    z-index: 0;
    inset: 0;
    background:
      linear-gradient(90deg, var(--service-stage-ghost) 1px, transparent 1px) 0 0 / calc(100% / 12) 100%,
      linear-gradient(var(--service-stage-ghost) 1px, transparent 1px) 0 50% / 100% 50%;
    content: "";
    mask-image: linear-gradient(90deg, transparent, #000 11%, #000 89%, transparent);
    pointer-events: none;
  }

  .studio-service-morph__rail {
    position: absolute;
    z-index: 5;
    top: clamp(1rem, 2.4vh, 1.75rem);
    right: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: center;
    color: var(--studio-muted);
    font-family: var(--font-mono);
    font-size: 0.64rem;
    font-weight: 570;
    letter-spacing: 0.075em;
    line-height: 1.35;
    text-transform: uppercase;
    gap: var(--grid-gap);
  }

  .studio-service-morph__rail > span:first-child {
    grid-column: 1;
    color: var(--studio-accent-text);
  }

  .studio-service-morph__rail > span:nth-child(2) {
    grid-column: 2 / span 7;
  }

  .studio-service-morph__rail > span:last-child {
    grid-column: 11 / -1;
    justify-self: end;
  }

  .studio-service-morph__canvas-host,
  .studio-service-morph__canvas,
  .studio-service-morph__canvas--webgpu {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
  }

  .studio-service-morph__canvas-host {
    z-index: 4;
  }

  .studio-service-morph__canvas {
    z-index: 7;
    opacity: var(--service-canvas-opacity);
  }

  .studio-service-morph__canvas--webgpu {
    z-index: 1;
    display: block;
    opacity: 0;
  }

  .studio-service-story[data-service-renderer="webgpu"] .studio-service-morph__canvas--webgpu {
    opacity: 1;
  }

  .studio-service-morph__states,
  .studio-service-morph__state {
    position: absolute;
    z-index: 2;
    inset: 0;
  }

  .studio-service-morph__state {
    --service-state-opacity: 0;
    --service-state-x: 0rem;
    --service-state-y: 1.5rem;
    --service-state-scale: 0.985;
    --service-title-opacity: 1;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: center;
    padding-block: clamp(4rem, 8vh, 6rem);
    opacity: var(--service-state-opacity);
    transform: translate3d(var(--service-state-x), var(--service-state-y), 0) scale(var(--service-state-scale));
    transform-origin: 42% 54%;
    gap: var(--grid-gap);
    pointer-events: none;
  }

  .is-service-morph-active .studio-service-morph__state {
    will-change: opacity, transform;
  }

  .studio-service-morph__number,
  .studio-service-morph__title > span {
    font-family: var(--font-mono);
    font-size: 0.64rem;
    font-weight: 570;
    letter-spacing: 0.075em;
    line-height: 1.4;
    text-transform: uppercase;
  }

  .studio-service-morph__number {
    grid-column: 1;
    align-self: center;
    color: var(--studio-accent-text);
  }

  .studio-service-morph__title {
    grid-column: 2 / span 7;
    align-self: center;
    min-width: 0;
  }

  .studio-service-morph__title > span {
    display: block;
    margin-bottom: clamp(1.75rem, 4vh, 3rem);
    color: var(--studio-muted);
  }

  .studio-service-morph__title h3 {
    max-width: 10ch;
    margin: 0;
    opacity: var(--service-title-opacity);
    font-size: clamp(4rem, 7.8vw, 8.65rem);
    font-stretch: 88%;
    font-variation-settings: "wdth" 88, "wght" 680;
    font-weight: 680;
    letter-spacing: -0.025em;
    line-height: 0.92;
    text-wrap: balance;
  }

  .studio-service-morph__state:nth-child(even) .studio-service-morph__title h3 {
    max-width: 12ch;
    font-stretch: 106%;
    font-variation-settings: "wdth" 106, "wght" 430;
    font-weight: 430;
    letter-spacing: -0.035em;
  }

  .studio-service-morph__state > p {
    grid-column: 9 / -1;
    align-self: end;
    max-width: 30rem;
    margin: 0 0 clamp(2.5rem, 7vh, 5rem);
    color: var(--studio-muted);
    font-size: clamp(1rem, 1.35vw, 1.22rem);
    line-height: 1.5;
  }

  .studio-service-morph__timeline {
    position: absolute;
    z-index: 5;
    right: 0;
    bottom: clamp(1rem, 2.4vh, 1.75rem);
    left: calc((100% + (11 * var(--grid-gap))) / 12 + var(--grid-gap));
    display: block;
    height: 1px;
    background: var(--color-line);
  }

  .studio-service-morph__timeline::before {
    position: absolute;
    top: -1px;
    left: 0;
    width: calc(var(--service-progress) * 100%);
    height: 3px;
    background: linear-gradient(90deg, var(--service-stage-cyan), var(--service-stage-accent));
    content: "";
    transform-origin: 0 50%;
  }

  .studio-service-morph__timeline span {
    position: absolute;
    top: 0;
    left: 0;
    width: 0.48rem;
    height: 0.48rem;
    border: 1px solid var(--studio-accent-text);
    border-radius: 50%;
    background: var(--color-ground);
    opacity: 0.52;
    transform: translate(-50%, -44%);
  }

  .studio-service-morph__timeline span:last-child {
    left: 100%;
    transform: translate(50%, -44%);
  }

  .studio-service-morph__timeline span:nth-child(2) {
    left: 30%;
  }

  .studio-service-morph__timeline span:nth-child(3) {
    left: 76%;
  }

  .studio-service-morph__timeline span.is-past {
    background: var(--studio-accent-text);
    opacity: 1;
  }

  :root[data-theme="dark"] .is-service-morph-ready .studio-service-morph {
    --service-stage-accent: #b9a5ff;
    --service-stage-cyan: #43d8d0;
    --service-stage-ghost: rgb(235 226 246 / 6%);
    background:
      radial-gradient(circle at 72% 44%, rgb(114 83 191 / 11%), transparent 29%),
      linear-gradient(115deg, rgb(67 216 208 / 3%), transparent 31%);
  }
}

@media (prefers-color-scheme: dark) and (min-width: 56.001rem) and (min-height: 38rem) {
  :root:not([data-theme="light"]) .is-service-morph-ready .studio-service-morph {
    --service-stage-accent: #b9a5ff;
    --service-stage-cyan: #43d8d0;
    --service-stage-ghost: rgb(235 226 246 / 6%);
    background:
      radial-gradient(circle at 72% 44%, rgb(114 83 191 / 11%), transparent 29%),
      linear-gradient(115deg, rgb(67 216 208 / 3%), transparent 31%);
  }
}

@media (prefers-reduced-motion: reduce), (max-width: 56rem), (max-height: 37.999rem) {
  .studio-service-morph {
    display: none !important;
  }

  .studio-service-story {
    height: auto !important;
    margin-top: 0 !important;
  }

  .studio-service-index {
    position: static !important;
    width: auto !important;
    height: auto !important;
    margin: clamp(4rem, 8vw, 7rem) 0 0 !important;
    overflow: visible !important;
    clip: auto !important;
    clip-path: none !important;
    white-space: normal !important;
  }
}
