.services {
  padding-top: clamp(72px, 12vh, 150px);
}

.stack {
  --p: 1;
  margin-top: clamp(32px, 6vh, 64px);
}

.stack__stage {
  display: grid;
  gap: 24px;
  width: min(100% - 2 * var(--gutter), var(--max));
  margin-inline: auto;
  padding-bottom: clamp(72px, 12vh, 150px);
}

.stack__item {
  --e: 1;
  --u: 0;
  --q: 1;
}

.panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: center;
  gap: clamp(24px, 5vw, 72px);
  height: 100%;
  padding: clamp(24px, 4.4vw, 64px);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: 0 -18px 50px -24px rgb(0 0 0 / 0.75);
  overflow: hidden;
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--abyss);
  opacity: calc(var(--u) * 0.6);
  pointer-events: none;
}

.panel--redesign {
  --bg: linear-gradient(160deg, #11304a, #0b2034 70%);
}

.panel--build {
  --bg: linear-gradient(160deg, #123a4a, #0a2532 70%);
}

.panel--next {
  --bg: linear-gradient(160deg, #1d2550, #111734 70%);
}

.panel h3 {
  font-size: var(--step-3);
}

.panel p {
  max-width: 24ch;
  margin-top: clamp(14px, 2vh, 22px);
  color: var(--ink-soft);
  font-size: var(--step-1);
  line-height: 1.4;
}

.panel .tag {
  display: inline-block;
  margin-top: 22px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgb(99 194 242 / 0.14);
  color: var(--sea-top);
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-weight: 600;
}

.shot {
  position: relative;
  aspect-ratio: 16 / 11;
  max-height: 100%;
  border-radius: 14px;
  background: #0b1726;
  box-shadow: 0 30px 60px -30px rgb(0 0 0 / 0.8);
  overflow: hidden;
}

.shot__bar {
  display: grid;
  place-items: center;
  height: 26px;
  background: #0f1e30;
}

.shot__bar span {
  width: 36%;
  height: 9px;
  border-radius: 9px;
  background: rgb(238 244 247 / 0.1);
}

.shot__screen {
  position: absolute;
  inset: 26px 0 0;
}

.old,
.new {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: start;
  gap: 5%;
  padding: 6%;
}

.old {
  grid-template-columns: 1fr 1fr 1fr;
  background: #e8e2d4;
  font-family: Georgia, "Times New Roman", serif;
}

.old__top {
  grid-column: 1 / -1;
  height: 14px;
  background: #7d725e;
}

.old__banner {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  height: 82px;
  border: 3px outset #c9bea6;
  background: #b7aa8f;
  color: #4b412f;
  font-size: clamp(12px, 1.6vw, 20px);
  font-style: italic;
}

.old__box {
  height: 64px;
  border: 2px outset #d8cfbb;
  background: #cfc5b0;
}

.old__box:nth-of-type(2) {
  margin-top: 12px;
}

.old__text {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}

.old__text span {
  height: 6px;
  background: #a69a82;
}

.old__text span:nth-child(2) {
  width: 84%;
}

.new {
  grid-template-columns: 1.25fr 1fr;
  gap: 6% 7%;
  background: var(--ink-dark);
  clip-path: inset(0 0 0 calc((1 - var(--q)) * 100%));
}

.new__nav {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.new__nav i {
  width: 14px;
  height: 7px;
  border-radius: 7px 7px 0 0;
  background: var(--sun);
}

.new__nav b {
  width: 22px;
  height: 4px;
  border-radius: 4px;
  background: rgb(238 244 247 / 0.25);
}

.new__nav b:first-of-type {
  margin-left: auto;
}

.new__nav em {
  width: 38px;
  height: 12px;
  border-radius: 12px;
  background: var(--sun);
}

.new__copy {
  display: grid;
  align-content: center;
  gap: 9px;
}

.new__copy span {
  height: 12px;
  border-radius: 6px;
  background: var(--ink);
}

.new__copy span:nth-child(2) {
  width: 72%;
}

.new__copy span:nth-child(3) {
  width: 86%;
  height: 6px;
  margin-top: 4px;
  background: rgb(238 244 247 / 0.3);
}

.new__copy em {
  width: 46%;
  height: 16px;
  margin-top: 8px;
  border-radius: 16px;
  background: var(--sun);
}

.new__art {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  background: linear-gradient(180deg, #1d2a52 0 52%, #174264 52%);
  overflow: hidden;
}

.new__art::before {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  top: 22%;
  height: 30%;
  border-radius: 999px 999px 0 0;
  background: var(--sun);
}

.new__tiles {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6%;
}

.new__tiles span {
  height: 34px;
  border-radius: 8px;
  background: rgb(238 244 247 / 0.08);
}

.wipe {
  position: absolute;
  inset: 0;
  border-left: 2px solid var(--ink);
  transform: translateX(calc((1 - var(--q)) * 100%));
  opacity: calc(min(var(--q), 1 - var(--q)) * 12);
  pointer-events: none;
}

.wipe::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -15px;
  width: 28px;
  height: 28px;
  margin-top: -14px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 6px 16px -4px rgb(0 0 0 / 0.5);
}

.build {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  grid-template-rows: auto 1fr auto auto;
  gap: 5%;
  height: 100%;
  padding: 6%;
}

.blk {
  --b: clamp(0, calc(var(--q) * 1.9 - var(--k) * 0.16), 1);
  position: relative;
  min-height: 12px;
  border: 1.5px dashed rgb(99 194 242 / 0.5);
  border-radius: 8px;
  transform: translate(calc(var(--dx) * (1 - var(--b))), calc(var(--dy) * (1 - var(--b)))) rotate(calc(var(--r) * (1 - var(--b))));
}

.blk::before {
  content: "";
  position: absolute;
  inset: -1.5px;
  border-radius: inherit;
  background: var(--fill, rgb(238 244 247 / 0.1));
  opacity: var(--b);
}

.blk--nav {
  grid-column: 1 / -1;
  --fill: rgb(238 244 247 / 0.12);
}

.blk--hero {
  min-height: 90px;
  --fill: linear-gradient(160deg, #1d2a52, #12364f);
}

.blk--art {
  --fill: var(--sun);
}

.blk--row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5%;
  border: 0;
}

.blk--row::before {
  display: none;
}

.blk--tile {
  min-height: 38px;
}

.blk--foot {
  grid-column: 1 / -1;
  --fill: rgb(99 194 242 / 0.25);
}

.flow {
  width: 100%;
  height: 100%;
}

.flow .link {
  fill: none;
  stroke: rgb(99 194 242 / 0.55);
  stroke-width: 2;
  stroke-dasharray: 1;
  stroke-dashoffset: calc(1 - var(--q));
}

.flow .pulse {
  fill: none;
  stroke: var(--sun-top);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 0.05 1;
  stroke-dashoffset: 0.05;
  opacity: var(--q);
}

.flow .node {
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(clamp(0, calc(var(--q) * 2.2 - var(--k) * 0.3), 1));
}

.flow .node rect,
.flow .node circle {
  fill: #1d2a52;
  stroke: rgb(99 194 242 / 0.6);
  stroke-width: 1.5;
}

.flow .node--hub circle {
  fill: url(#flow-sun);
  stroke: none;
}

.flow .node line {
  stroke: rgb(238 244 247 / 0.35);
  stroke-width: 3;
  stroke-linecap: round;
}

.motion .flow .pulse {
  animation: pulse 2.6s var(--ease-in-out) infinite;
  animation-delay: calc(var(--k) * 0.45s);
}

@keyframes pulse {
  to {
    stroke-dashoffset: -1;
  }
}

.motion .services {
  position: relative;
  margin-top: -45svh;
  padding-top: 0;
}

.motion .stack {
  --p: 0;
  height: 400svh;
}

.motion .stack__stage {
  position: sticky;
  top: 0;
  display: block;
  width: auto;
  height: 100svh;
  padding: 0;
  --s: calc(var(--p) * 3);
}

.motion .stack__item {
  --e: clamp(0, calc((var(--s) - var(--i) + 0.45) / 0.45), 1);
  --u: clamp(0, calc((var(--s) - var(--i) - 0.55) / 0.45), 1);
  --q: clamp(0, calc((var(--s) - var(--i)) / 0.5), 1);
  position: absolute;
  inset: calc(var(--header) + 12px) max(var(--gutter), (100% - var(--max)) / 2) clamp(16px, 4vh, 40px);
  transform-origin: 50% 0;
  transform: translateY(calc((1 - var(--e)) * 112%)) scale(calc(1 - var(--u) * 0.06));
}

.motion .stack__item:last-child {
  --u: 0;
}

@media (max-width: 820px) {
  .panel {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    align-content: start;
  }

  .panel__visual {
    order: -1;
    min-height: 0;
    height: 100%;
    display: grid;
    align-items: center;
  }

  .shot {
    width: 100%;
    max-height: 100%;
  }

  .panel p {
    max-width: 30ch;
  }
}

@media (max-width: 820px) and (min-height: 600px) {
  .motion .panel {
    grid-template-rows: minmax(0, 1.1fr) auto;
  }
}
